dara-components 1.21.25__py3-none-any.whl → 1.22.0__py3-none-any.whl
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.
- dara/components/_assets/__init__.py +30 -0
- dara/components/_assets/auto_js/.gitkeep +0 -0
- dara/components/{umd → _assets/auto_js}/dara.components.umd.js +45719 -40645
- dara/components/_assets/common/bokeh-3.1.1.min.js +690 -0
- dara/components/_assets/common/bokeh-api-3.1.1.min.js +60 -0
- dara/components/_assets/common/bokeh-gl-3.1.1.min.js +67 -0
- dara/components/_assets/common/bokeh-mathjax-3.1.1.min.js +329 -0
- dara/components/_assets/common/bokeh-tables-3.1.1.min.js +132 -0
- dara/components/_assets/common/bokeh-widgets-3.1.1.min.js +129 -0
- dara/components/_assets/common/pixi-filters.min.js +17 -0
- dara/components/_assets/common/pixi.min.js +2214 -0
- dara/components/_assets/common/pixi_viewport.js +1 -0
- dara/components/_assets/common/plotly.min.js +8 -0
- {dara_components-1.21.25.dist-info → dara_components-1.22.0.dist-info}/METADATA +4 -4
- {dara_components-1.21.25.dist-info → dara_components-1.22.0.dist-info}/RECORD +19 -6
- dara_components-1.22.0.dist-info/entry_points.txt +3 -0
- /dara/components/{umd/style.css → _assets/auto_js/dara.components.css} +0 -0
- {dara_components-1.21.25.dist-info → dara_components-1.22.0.dist-info}/LICENSE +0 -0
- {dara_components-1.21.25.dist-info → dara_components-1.22.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,2214 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* PixiJS - v8.5.0
|
|
3
|
+
* Compiled Thu, 10 Oct 2024 13:08:51 UTC
|
|
4
|
+
*
|
|
5
|
+
* PixiJS is licensed under the MIT License.
|
|
6
|
+
* http://www.opensource.org/licenses/mit-license
|
|
7
|
+
*/var PIXI=function(d){"use strict";"use strict";var Ny=Object.defineProperty,Hy=Object.defineProperties,Xy=Object.getOwnPropertyDescriptors,Uu=Object.getOwnPropertySymbols,jy=Object.prototype.hasOwnProperty,zy=Object.prototype.propertyIsEnumerable,ku=(r,t,e)=>t in r?Ny(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,$u=(r,t)=>{for(var e in t||(t={}))jy.call(t,e)&&ku(r,e,t[e]);if(Uu)for(var e of Uu(t))zy.call(t,e)&&ku(r,e,t[e]);return r},Vy=(r,t)=>Hy(r,Xy(t)),x=(r=>(r.Application="application",r.WebGLPipes="webgl-pipes",r.WebGLPipesAdaptor="webgl-pipes-adaptor",r.WebGLSystem="webgl-system",r.WebGPUPipes="webgpu-pipes",r.WebGPUPipesAdaptor="webgpu-pipes-adaptor",r.WebGPUSystem="webgpu-system",r.CanvasSystem="canvas-system",r.CanvasPipesAdaptor="canvas-pipes-adaptor",r.CanvasPipes="canvas-pipes",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r.MaskEffect="mask-effect",r.BlendMode="blend-mode",r.TextureSource="texture-source",r.Environment="environment",r.ShapeBuilder="shape-builder",r.Batcher="batcher",r))(x||{});const on=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){const t=typeof r.extension!="object"?{type:r.extension}:r.extension;r=Vy($u({},t),{ref:r})}if(typeof r=="object")r=$u({},r);else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},cr=(r,t)=>{var e;return(e=on(r).priority)!=null?e:t},D={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(on).forEach(t=>{t.type.forEach(e=>{var i,s;return(s=(i=this._removeHandlers)[e])==null?void 0:s.call(i,t)})}),this},add(...r){return r.map(on).forEach(t=>{t.type.forEach(e=>{var i,s;const n=this._addHandlers,o=this._queue;n[e]?(s=n[e])==null||s.call(n,t):(o[e]=o[e]||[],(i=o[e])==null||i.push(t))})}),this},handle(r,t,e){var i;const s=this._addHandlers,n=this._removeHandlers;s[r]=t,n[r]=e;const o=this._queue;return o[r]&&((i=o[r])==null||i.forEach(a=>t(a)),delete o[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(r,t,e=-1){return this.handle(r,i=>{t.findIndex(s=>s.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((s,n)=>cr(n.value,e)-cr(s.value,e)))},i=>{const s=t.findIndex(n=>n.name===i.name);s!==-1&&t.splice(s,1)})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,n)=>cr(n,e)-cr(s,e)))},i=>{const s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};var RR=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function an(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function MR(r){return r&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function CR(r){return r&&Object.prototype.hasOwnProperty.call(r,"default")&&Object.keys(r).length===1?r.default:r}function OR(r){if(r.__esModule)return r;var t=r.default;if(typeof t=="function"){var e=function i(){return this instanceof i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var s=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return r[i]}})}),e}var ln={exports:{}},GR=ln.exports;(function(r){"use strict";var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function s(l,u,c){this.fn=l,this.context=u,this.once=c||!1}function n(l,u,c,h,p){if(typeof c!="function")throw new TypeError("The listener must be a function");var f=new s(c,h||l,p),m=e?e+u:u;return l._events[m]?l._events[m].fn?l._events[m]=[l._events[m],f]:l._events[m].push(f):(l._events[m]=f,l._eventsCount++),l}function o(l,u){--l._eventsCount===0?l._events=new i:delete l._events[u]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],c,h;if(this._eventsCount===0)return u;for(h in c=this._events)t.call(c,h)&&u.push(e?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},a.prototype.listeners=function(u){var c=e?e+u:u,h=this._events[c];if(!h)return[];if(h.fn)return[h.fn];for(var p=0,f=h.length,m=new Array(f);p<f;p++)m[p]=h[p].fn;return m},a.prototype.listenerCount=function(u){var c=e?e+u:u,h=this._events[c];return h?h.fn?1:h.length:0},a.prototype.emit=function(u,c,h,p,f,m){var _=e?e+u:u;if(!this._events[_])return!1;var g=this._events[_],b=arguments.length,v,y;if(g.fn){switch(g.once&&this.removeListener(u,g.fn,void 0,!0),b){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,c),!0;case 3:return g.fn.call(g.context,c,h),!0;case 4:return g.fn.call(g.context,c,h,p),!0;case 5:return g.fn.call(g.context,c,h,p,f),!0;case 6:return g.fn.call(g.context,c,h,p,f,m),!0}for(y=1,v=new Array(b-1);y<b;y++)v[y-1]=arguments[y];g.fn.apply(g.context,v)}else{var T=g.length,E;for(y=0;y<T;y++)switch(g[y].once&&this.removeListener(u,g[y].fn,void 0,!0),b){case 1:g[y].fn.call(g[y].context);break;case 2:g[y].fn.call(g[y].context,c);break;case 3:g[y].fn.call(g[y].context,c,h);break;case 4:g[y].fn.call(g[y].context,c,h,p);break;default:if(!v)for(E=1,v=new Array(b-1);E<b;E++)v[E-1]=arguments[E];g[y].fn.apply(g[y].context,v)}}return!0},a.prototype.on=function(u,c,h){return n(this,u,c,h,!1)},a.prototype.once=function(u,c,h){return n(this,u,c,h,!0)},a.prototype.removeListener=function(u,c,h,p){var f=e?e+u:u;if(!this._events[f])return this;if(!c)return o(this,f),this;var m=this._events[f];if(m.fn)m.fn===c&&(!p||m.once)&&(!h||m.context===h)&&o(this,f);else{for(var _=0,g=[],b=m.length;_<b;_++)(m[_].fn!==c||p&&!m[_].once||h&&m[_].context!==h)&&g.push(m[_]);g.length?this._events[f]=g.length===1?g[0]:g:o(this,f)}return this},a.prototype.removeAllListeners=function(u){var c;return u?(c=e?e+u:u,this._events[c]&&o(this,c)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=e,a.EventEmitter=a,r.exports=a})(ln);var Wy=ln.exports,mt=an(Wy),Yy={grad:.9,turn:360,rad:360/(2*Math.PI)},Vt=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},ot=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},Ct=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Lu=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Nu=function(r){return{r:Ct(r.r,0,255),g:Ct(r.g,0,255),b:Ct(r.b,0,255),a:Ct(r.a)}},un=function(r){return{r:ot(r.r),g:ot(r.g),b:ot(r.b),a:ot(r.a,3)}},Ky=/^#([0-9a-f]{3,8})$/i,li=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},Hu=function(r){var t=r.r,e=r.g,i=r.b,s=r.a,n=Math.max(t,e,i),o=n-Math.min(t,e,i),a=o?n===t?(e-i)/o:n===e?2+(i-t)/o:4+(t-e)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:s}},Xu=function(r){var t=r.h,e=r.s,i=r.v,s=r.a;t=t/360*6,e/=100,i/=100;var n=Math.floor(t),o=i*(1-e),a=i*(1-(t-n)*e),l=i*(1-(1-t+n)*e),u=n%6;return{r:255*[i,a,o,o,l,i][u],g:255*[l,i,i,a,o,o][u],b:255*[o,o,l,i,i,a][u],a:s}},ju=function(r){return{h:Lu(r.h),s:Ct(r.s,0,100),l:Ct(r.l,0,100),a:Ct(r.a)}},zu=function(r){return{h:ot(r.h),s:ot(r.s),l:ot(r.l),a:ot(r.a,3)}},Vu=function(r){return Xu((e=(t=r).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},hr=function(r){return{h:(t=Hu(r)).h,s:(s=(200-(e=t.s))*(i=t.v)/100)>0&&s<200?e*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,i,s},qy=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Zy=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Qy=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Jy=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,cn={string:[[function(r){var t=Ky.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?ot(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?ot(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=Qy.exec(r)||Jy.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:Nu({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(r){var t=qy.exec(r)||Zy.exec(r);if(!t)return null;var e,i,s=ju({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(Yy[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Vu(s)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,i=r.b,s=r.a,n=s===void 0?1:s;return Vt(t)&&Vt(e)&&Vt(i)?Nu({r:Number(t),g:Number(e),b:Number(i),a:Number(n)}):null},"rgb"],[function(r){var t=r.h,e=r.s,i=r.l,s=r.a,n=s===void 0?1:s;if(!Vt(t)||!Vt(e)||!Vt(i))return null;var o=ju({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return Vu(o)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,n=s===void 0?1:s;if(!Vt(t)||!Vt(e)||!Vt(i))return null;var o=function(a){return{h:Lu(a.h),s:Ct(a.s,0,100),v:Ct(a.v,0,100),a:Ct(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return Xu(o)},"hsv"]]},Wu=function(r,t){for(var e=0;e<t.length;e++){var i=t[e][0](r);if(i)return[i,t[e][1]]}return[null,void 0]},Yu=function(r){return typeof r=="string"?Wu(r.trim(),cn.string):typeof r=="object"&&r!==null?Wu(r,cn.object):[null,void 0]},BR=function(r){return Yu(r)[1]},hn=function(r,t){var e=hr(r);return{h:e.h,s:Ct(e.s+100*t,0,100),l:e.l,a:e.a}},dn=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},Ku=function(r,t){var e=hr(r);return{h:e.h,s:e.s,l:Ct(e.l+100*t,0,100),a:e.a}},ui=function(){function r(t){this.parsed=Yu(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return ot(dn(this.rgba),2)},r.prototype.isDark=function(){return dn(this.rgba)<.5},r.prototype.isLight=function(){return dn(this.rgba)>=.5},r.prototype.toHex=function(){return t=un(this.rgba),e=t.r,i=t.g,s=t.b,o=(n=t.a)<1?li(ot(255*n)):"","#"+li(e)+li(i)+li(s)+o;var t,e,i,s,n,o},r.prototype.toRgb=function(){return un(this.rgba)},r.prototype.toRgbString=function(){return t=un(this.rgba),e=t.r,i=t.g,s=t.b,(n=t.a)<1?"rgba("+e+", "+i+", "+s+", "+n+")":"rgb("+e+", "+i+", "+s+")";var t,e,i,s,n},r.prototype.toHsl=function(){return zu(hr(this.rgba))},r.prototype.toHslString=function(){return t=zu(hr(this.rgba)),e=t.h,i=t.s,s=t.l,(n=t.a)<1?"hsla("+e+", "+i+"%, "+s+"%, "+n+")":"hsl("+e+", "+i+"%, "+s+"%)";var t,e,i,s,n},r.prototype.toHsv=function(){return t=Hu(this.rgba),{h:ot(t.h),s:ot(t.s),v:ot(t.v),a:ot(t.a,3)};var t},r.prototype.invert=function(){return kt({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),kt(hn(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),kt(hn(this.rgba,-t))},r.prototype.grayscale=function(){return kt(hn(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),kt(Ku(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),kt(Ku(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?kt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ot(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=hr(this.rgba);return typeof t=="number"?kt({h:t,s:e.s,l:e.l,a:e.a}):ot(e.h)},r.prototype.isEqual=function(t){return this.toHex()===kt(t).toHex()},r}(),kt=function(r){return r instanceof ui?r:new ui(r)},qu=[],t0=function(r){r.forEach(function(t){qu.indexOf(t)<0&&(t(ui,cn),qu.push(t))})},IR=function(){return new ui({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};function e0(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var s in e)i[e[s]]=s;var n={};r.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,u=i[this.toHex()];if(u)return u;if(o!=null&&o.closest){var c=this.toRgb(),h=1/0,p="black";if(!n.length)for(var f in e)n[f]=new r(e[f]).toRgb();for(var m in e){var _=(a=c,l=n[m],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));_<h&&(h=_,p=m)}return p}},t.string.push([function(o){var a=o.toLowerCase(),l=a==="transparent"?"#0000":e[a];return l?new r(l).toRgb():null},"name"])}var r0=Object.defineProperty,Zu=Object.getOwnPropertySymbols,i0=Object.prototype.hasOwnProperty,s0=Object.prototype.propertyIsEnumerable,Qu=(r,t,e)=>t in r?r0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,n0=(r,t)=>{for(var e in t||(t={}))i0.call(t,e)&&Qu(r,e,t[e]);if(Zu)for(var e of Zu(t))s0.call(t,e)&&Qu(r,e,t[e]);return r};t0([e0]);const Be=class oi{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 oi)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?n0({},t):t}_isSourceEqual(t,e){const i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((s,n)=>s===e[n]);if(t!==null&&e!==null){const s=Object.keys(t),n=Object.keys(e);return s.length!==n.length?!1:s.every(o=>t[o]===e[o])}return t===e}toRgba(){const[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t=t||this._arrayRgb,t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t=t||this._arrayRgba;const[e,i,s,n]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=n,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t=t||this._arrayRgb;const[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){const[t,e,i]=this.toUint8RgbArray();return(i<<16)+(e<<8)+t}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,i,s,n]=oi._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=s,this._components[3]*=n,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,n=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,n=n*t+.5|0),(t*255<<24)+(i<<16)+(s<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,i,s,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const o=t;e=(o>>16&255)/255,i=(o>>8&255)/255,s=(o&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,s,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,s,n=255]=t,e/=255,i/=255,s/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const a=oi.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=kt(t);o.isValid()&&({r:e,g:i,b:s,a:n}=o.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=n,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,n)=>{t[n]=Math.min(Math.max(s,e),i)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof oi||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}};Be.shared=new Be,Be._temp=new Be,Be.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let j=Be;const Ju={cullArea:null,cullable:!1,cullableChildren:!0},tc=Math.PI*2,ec=180/Math.PI,rc=Math.PI/180;class W{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new W(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}static get shared(){return pn.x=0,pn.y=0,pn}}const pn=new W;class G{constructor(t=1,e=0,i=0,s=1,n=0,o=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=o}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,s,n,o){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=o,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new W;const i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new W;const i=this.a,s=this.b,n=this.c,o=this.d,a=this.tx,l=this.ty,u=1/(i*o+n*-s),c=t.x,h=t.y;return e.x=o*u*c+-n*u*h+(l*n-a*o)*u,e.y=i*u*h+-s*u*c+(-l*i+a*s)*u,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){const e=Math.cos(t),i=Math.sin(t),s=this.a,n=this.c,o=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=o*e-this.ty*i,this.ty=o*i+this.ty*e,this}append(t){const e=this.a,i=this.b,s=this.c,n=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this}appendFrom(t,e){const i=t.a,s=t.b,n=t.c,o=t.d,a=t.tx,l=t.ty,u=e.a,c=e.b,h=e.c,p=e.d;return this.a=i*u+s*h,this.b=i*c+s*p,this.c=n*u+o*h,this.d=n*c+o*p,this.tx=a*u+l*h+e.tx,this.ty=a*c+l*p+e.ty,this}setTransform(t,e,i,s,n,o,a,l,u){return this.a=Math.cos(a+u)*n,this.b=Math.sin(a+u)*n,this.c=-Math.sin(a-l)*o,this.d=Math.cos(a-l)*o,this.tx=t-(i*this.a+s*this.c),this.ty=e-(i*this.b+s*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,i=this.b,s=this.c,n=this.d,o=t.pivot,a=-Math.atan2(-s,n),l=Math.atan2(i,e),u=Math.abs(a+l);return u<1e-5||Math.abs(tc-u)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(s*s+n*n),t.position.x=this.tx+(o.x*e+o.y*s),t.position.y=this.ty+(o.x*i+o.y*n),t}invert(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.tx,o=t*s-e*i;return this.a=s/o,this.b=-e/o,this.c=-i/o,this.d=t/o,this.tx=(i*this.ty-s*n)/o,this.ty=-(t*this.ty-e*n)/o,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(){const t=new G;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}static get IDENTITY(){return a0.identity()}static get shared(){return o0.identity()}}const o0=new G,a0=new G;class nt{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new nt(t!=null?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}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))}}const dr={default:-1};function Z(r="default"){return dr[r]===void 0&&(dr[r]=-1),++dr[r]}function l0(){for(const r in dr)delete dr[r]}class ci{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){var e;let i;return this._index>0?i=this._pool[--this._index]:i=new this._classType,(e=i.init)==null||e.call(i,t),i}return(t){var e;(e=t.reset)==null||e.call(t),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}}class ic{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 ci(t)),this._poolsByClass.get(t)}stats(){const t={};return this._poolsByClass.forEach(e=>{const i=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[i]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}}const N=new ic;function fn(r,t,e){const i=r.length;let s;if(t>=i||e===0)return;e=t+e>i?i-t:e;const n=i-e;for(s=t;s<n;++s)r[s]=r[s+e];r.length=n}const sc={allowChildren:!0,removeChildren(r=0,t){const e=t!=null?t:this.children.length,i=e-r,s=[];if(i>0&&i<=e){for(let o=e-1;o>=r;o--){const a=this.children[o];a&&(s.push(a),a.parent=null)}fn(this.children,r,e);const n=this.renderGroup||this.parentRenderGroup;n&&n.removeChildren(s);for(let o=0;o<s.length;++o)this.emit("childRemoved",s[o],this,o),s[o].emit("removed",this);return s}else if(i===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(r){const t=this.getChildAt(r);return this.removeChild(t)},getChildAt(r){if(r<0||r>=this.children.length)throw new Error(`getChildAt: Index (${r}) does not exist.`);return this.children[r]},setChildIndex(r,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(r),this.addChildAt(r,t)},getChildIndex(r){const t=this.children.indexOf(r);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(r,t){const{children:e}=this;if(t<0||t>e.length)throw new Error(`${r}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(r.parent){const s=r.parent.children.indexOf(r);if(r.parent===this&&s===t)return r;s!==-1&&r.parent.children.splice(s,1)}t===e.length?e.push(r):e.splice(t,0,r),r.parent=this,r.didChange=!0,r._updateFlags=15;const i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(r),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",r,this,t),r.emit("added",this),r},swapChildren(r,t){if(r===t)return;const e=this.getChildIndex(r),i=this.getChildIndex(t);this.children[e]=t,this.children[i]=r;const s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){var r;(r=this.parent)==null||r.removeChild(this)},reparentChild(...r){return r.length===1?this.reparentChildAt(r[0],this.children.length):(r.forEach(t=>this.reparentChildAt(t,this.children.length)),r[0])},reparentChildAt(r,t){if(r.parent===this)return this.setChildIndex(r,t),r;const e=r.worldTransform.clone();r.removeFromParent(),this.addChildAt(r,t);const i=this.worldTransform.clone();return i.invert(),e.prepend(i),r.setFromMatrix(e),r}};class pr{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}}class nc{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++){const i=this._tests[e];if(i.test(t))return N.get(i.maskClass,t)}return t}returnMaskEffect(t){N.return(t)}}const hi=new nc;D.handleByList(x.MaskEffect,hi._effectClasses);var u0=Object.defineProperty,oc=Object.getOwnPropertySymbols,c0=Object.prototype.hasOwnProperty,h0=Object.prototype.propertyIsEnumerable,ac=(r,t,e)=>t in r?u0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,lc=(r,t)=>{for(var e in t||(t={}))c0.call(t,e)&&ac(r,e,t[e]);if(oc)for(var e of oc(t))h0.call(t,e)&&ac(r,e,t[e]);return r};const uc={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],addEffect(r){if(this.effects.indexOf(r)!==-1)return;this.effects.push(r),this.effects.sort((e,i)=>e.priority-i.priority);const t=this.renderGroup||this.parentRenderGroup;t&&(t.structureDidChange=!0),this._updateIsSimple()},removeEffect(r){const t=this.effects.indexOf(r);t!==-1&&(this.effects.splice(t,1),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateIsSimple())},set mask(r){const t=this._maskEffect;(t==null?void 0:t.mask)!==r&&(t&&(this.removeEffect(t),hi.returnMaskEffect(t),this._maskEffect=null),r!=null&&(this._maskEffect=hi.getMaskEffect(r),this.addEffect(this._maskEffect)))},setMask(r){this._maskOptions=lc(lc({},this._maskOptions),r),r.mask&&(this.mask=r.mask)},get mask(){var r;return(r=this._maskEffect)==null?void 0:r.mask},set filters(r){var t;!Array.isArray(r)&&r&&(r=[r]);const e=this._filterEffect||(this._filterEffect=new pr);r=r;const i=(r==null?void 0:r.length)>0,s=((t=e.filters)==null?void 0:t.length)>0,n=i!==s;r=Array.isArray(r)?r.slice(0):r,e.filters=Object.freeze(r),n&&(i?this.addEffect(e):(this.removeEffect(e),e.filters=r!=null?r:null))},get filters(){var r;return(r=this._filterEffect)==null?void 0:r.filters},set filterArea(r){this._filterEffect||(this._filterEffect=new pr),this._filterEffect.filterArea=r},get filterArea(){var r;return(r=this._filterEffect)==null?void 0:r.filterArea}},cc={label:null,get name(){return this.label},set name(r){this.label=r},getChildByName(r,t=!1){return this.getChildByLabel(r,t)},getChildByLabel(r,t=!1){const e=this.children;for(let i=0;i<e.length;i++){const s=e[i];if(s.label===r||r instanceof RegExp&&r.test(s.label))return s}if(t)for(let i=0;i<e.length;i++){const s=e[i].getChildByLabel(r,!0);if(s)return s}return null},getChildrenByLabel(r,t=!1,e=[]){const i=this.children;for(let s=0;s<i.length;s++){const n=i[s];(n.label===r||r instanceof RegExp&&r.test(n.label))&&e.push(n)}if(t)for(let s=0;s<i.length;s++)i[s].getChildrenByLabel(r,!0,e);return e}},di=[new W,new W,new W,new W];class V{constructor(t=0,e=0,i=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(s)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new V(0,0,0,0)}clone(){return new V(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,i){const{width:s,height:n}=this;if(s<=0||n<=0)return!1;const o=this.x,a=this.y,l=o-i/2,u=o+s+i/2,c=a-i/2,h=a+n+i/2,p=o+i/2,f=o+s-i/2,m=a+i/2,_=a+n-i/2;return t>=l&&t<=u&&e>=c&&e<=h&&!(t>p&&t<f&&e>m&&e<_)}intersects(t,e){if(!e){const C=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=C)return!1;const S=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>S}const i=this.left,s=this.right,n=this.top,o=this.bottom;if(s<=i||o<=n)return!1;const a=di[0].set(t.left,t.top),l=di[1].set(t.left,t.bottom),u=di[2].set(t.right,t.top),c=di[3].set(t.right,t.bottom);if(u.x<=a.x||l.y<=a.y)return!1;const h=Math.sign(e.a*e.d-e.b*e.c);if(h===0||(e.apply(a,a),e.apply(l,l),e.apply(u,u),e.apply(c,c),Math.max(a.x,l.x,u.x,c.x)<=i||Math.min(a.x,l.x,u.x,c.x)>=s||Math.max(a.y,l.y,u.y,c.y)<=n||Math.min(a.y,l.y,u.y,c.y)>=o))return!1;const p=h*(l.y-a.y),f=h*(a.x-l.x),m=p*i+f*n,_=p*s+f*n,g=p*i+f*o,b=p*s+f*o;if(Math.max(m,_,g,b)<=p*a.x+f*a.y||Math.min(m,_,g,b)>=p*c.x+f*c.y)return!1;const v=h*(a.y-u.y),y=h*(u.x-a.x),T=v*i+y*n,E=v*s+y*n,M=v*i+y*o,w=v*s+y*o;return!(Math.max(T,E,M,w)<=v*a.x+y*a.y||Math.min(T,E,M,w)>=v*c.x+y*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=s,this.height=Math.max(n-s,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=s-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=n-s,this}getBounds(t){return t=t||new V,t.copyFrom(this),t}}const hc=new G;class ut{constructor(t=1/0,e=1/0,i=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=hc,this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new V);const 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=hc,this}set(t,e,i,s){this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}addFrame(t,e,i,s,n){n||(n=this.matrix);const o=n.a,a=n.b,l=n.c,u=n.d,c=n.tx,h=n.ty;let p=this.minX,f=this.minY,m=this.maxX,_=this.maxY,g=o*t+l*e+c,b=a*t+u*e+h;g<p&&(p=g),b<f&&(f=b),g>m&&(m=g),b>_&&(_=b),g=o*i+l*e+c,b=a*i+u*e+h,g<p&&(p=g),b<f&&(f=b),g>m&&(m=g),b>_&&(_=b),g=o*t+l*s+c,b=a*t+u*s+h,g<p&&(p=g),b<f&&(f=b),g>m&&(m=g),b>_&&(_=b),g=o*i+l*s+c,b=a*i+u*s+h,g<p&&(p=g),b<f&&(f=b),g>m&&(m=g),b>_&&(_=b),this.minX=p,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){const e=this.minX,i=this.minY,s=this.maxX,n=this.maxY,{a:o,b:a,c:l,d:u,tx:c,ty:h}=t;let p=o*e+l*i+c,f=a*e+u*i+h;this.minX=p,this.minY=f,this.maxX=p,this.maxY=f,p=o*s+l*i+c,f=a*s+u*i+h,this.minX=p<this.minX?p:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=p>this.maxX?p:this.maxX,this.maxY=f>this.maxY?f:this.maxY,p=o*e+l*n+c,f=a*e+u*n+h,this.minX=p<this.minX?p:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=p>this.maxX?p:this.maxX,this.maxY=f>this.maxY?f:this.maxY,p=o*s+l*n+c,f=a*s+u*n+h,this.minX=p<this.minX?p:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=p>this.maxX?p: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,i,s){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<i&&(this.minY=i),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 ut(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){const e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){const e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,i,s){let n=this.minX,o=this.minY,a=this.maxX,l=this.maxY;s||(s=this.matrix);const u=s.a,c=s.b,h=s.c,p=s.d,f=s.tx,m=s.ty;for(let _=e;_<i;_+=2){const g=t[_],b=t[_+1],v=u*g+h*b+f,y=c*g+p*b+m;n=v<n?v:n,o=y<o?y:o,a=v>a?v:a,l=y>l?y:l}this.minX=n,this.minY=o,this.maxX=a,this.maxY=l}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}}const $t=new ci(G),Lt=new ci(ut);function fr(r,t,e){e.clear();let i,s;return r.parent?t?i=r.parent.worldTransform:(s=$t.get().identity(),i=mr(r,s)):i=G.IDENTITY,mn(r,e,i,t),s&&$t.return(s),e.isValid||e.set(0,0,0,0),e}function mn(r,t,e,i){var s,n;if(!r.visible||!r.measurable)return;let o;i?o=r.worldTransform:(r.updateLocalTransform(),o=$t.get(),o.appendFrom(r.localTransform,e));const a=t,l=!!r.effects.length;if(l&&(t=Lt.get().clear()),r.boundsArea)t.addRect(r.boundsArea,o);else{r.addBounds&&(t.matrix=o,r.addBounds(t));for(let u=0;u<r.children.length;u++)mn(r.children[u],t,o,i)}if(l){for(let u=0;u<r.effects.length;u++)(n=(s=r.effects[u]).addBounds)==null||n.call(s,t);a.addBounds(t,G.IDENTITY),Lt.return(t)}i||$t.return(o)}function mr(r,t){const e=r.parent;return e&&(mr(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}function pi(r,t,e){return t.clear(),e||(e=G.IDENTITY),dc(r,t,e,r,!0),t.isValid||t.set(0,0,0,0),t}function dc(r,t,e,i,s){var n,o;let a;if(s)a=$t.get(),a=e.copyTo(a);else{if(!r.visible||!r.measurable)return;r.updateLocalTransform();const c=r.localTransform;a=$t.get(),a.appendFrom(c,e)}const l=t,u=!!r.effects.length;if(u&&(t=Lt.get().clear()),r.boundsArea)t.addRect(r.boundsArea,a);else{r.renderPipeId&&(t.matrix=a,r.addBounds(t));const c=r.children;for(let h=0;h<c.length;h++)dc(c[h],t,a,i,!1)}if(u){for(let c=0;c<r.effects.length;c++)(o=(n=r.effects[c]).addLocalBounds)==null||o.call(n,t,i);l.addBounds(t,G.IDENTITY),Lt.return(t)}$t.return(a)}function pc(r,t,e){const i=r.parent;i&&i!==t&&(pc(i,t,e),i.updateLocalTransform(),e.append(i.localTransform))}function gn(r,t){const e=r.children;for(let i=0;i<e.length;i++){const s=e[i],n=s.uid,o=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=t.index;(t.data[a]!==n||t.data[a+1]!==o)&&(t.data[t.index]=n,t.data[t.index+1]=o,t.didChange=!0),t.index=a+2,s.children.length&&gn(s,t)}return t.didChange}const d0=new G,fc={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(r,t){const e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=r/t*e:this.scale.x=e},_setHeight(r,t){const e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=r/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new ut});const r=this._localBoundsCacheData;return r.index=1,r.didChange=!1,r.data[0]!==this._didViewChangeTick&&(r.didChange=!0,r.data[0]=this._didViewChangeTick),gn(this,r),r.didChange&&pi(this,r.localBounds,d0),r.localBounds},getBounds(r,t){return fr(this,r,t||new ut)}},mc={_onRender:null,set onRender(r){const t=this.renderGroup||this.parentRenderGroup;if(!r){this._onRender&&(t==null||t.removeOnRender(this)),this._onRender=null;return}this._onRender||t==null||t.addOnRender(this),this._onRender=r},get onRender(){return this._onRender}},gc={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(r){this._zIndex!==r&&(this._zIndex=r,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(p0))}};function p0(r,t){return r._zIndex-t._zIndex}const _c={getGlobalPosition(r=new W,t=!1){return this.parent?this.parent.toGlobal(this._position,r,t):(r.x=this._position.x,r.y=this._position.y),r},toGlobal(r,t,e=!1){if(!e){this.updateLocalTransform();const i=mr(this,new G);return i.append(this.localTransform),i.apply(r,t)}return this.worldTransform.apply(r,t)},toLocal(r,t,e,i){if(t&&(r=t.toGlobal(r,e,i)),!i){this.updateLocalTransform();const s=mr(this,new G);return s.append(this.localTransform),s.applyInverse(r,e)}return this.worldTransform.applyInverse(r,e)}};let f0=0;class _n{constructor(){this.uid=Z("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.tick=0}reset(){this.instructionSize=0,this.tick=f0++}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}class bc{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.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new _n,this._onRenderContainers=[]}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;const e=t.children;for(let i=0;i<e.length;i++)this.addChild(e[i])}reset(){this.renderGroupChildren.length=0;for(const t in this.childrenToUpdate){const 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}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){const 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);const e=t.children;for(let i=0;i<e.length;i++)this.addChild(e[i])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}const e=t.children;for(let i=0;i<e.length;i++)this.removeChild(e[i])}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(){for(let t=0;t<this._onRenderContainers.length;t++)this._onRenderContainers[t]._onRender()}destroy(){this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){const e=this.root.children;for(let i=0;i<e.length;i++)this._getChildren(e[i],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;const i=t.children;for(let s=0;s<i.length;s++)this._getChildren(i[s],e);return e}}function fi(r,t,e={}){for(const i in t)!e[i]&&t[i]!==void 0&&(r[i]=t[i])}const bn=new nt(null),vn=new nt(null),yn=new nt(null,1,1),gr=1,mi=2,Ie=4,m0=8;class Q extends mt{constructor(t={}){var e,i;super(),this.uid=Z("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 nt(this,0,0),this._scale=yn,this._pivot=vn,this._skew=bn,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=[],fi(this,t,{children:!0,parent:!0,effects:!0}),(e=t.children)==null||e.forEach(s=>this.addChild(s)),(i=t.parent)==null||i.addChild(this)}static mixin(t){Object.defineProperties(Q.prototype,Object.getOwnPropertyDescriptors(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(t.length>1){for(let s=0;s<t.length;s++)this.addChild(t[s]);return t[0]}const e=t[0];if(e.parent===this)return this.children.splice(this.children.indexOf(e),1),this.children.push(e),this.parentRenderGroup&&(this.parentRenderGroup.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;const i=this.renderGroup||this.parentRenderGroup;return i&&i.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]}const e=t[0],i=this.children.indexOf(e);return i>-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parent=null,this.emit("childRemoved",e,this,i),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),this.renderGroup=N.get(bc,this),this.groupTransform=G.IDENTITY,t==null||t.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),N.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t==null||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*ec}set angle(t){this.rotation=t*rc}get pivot(){return this._pivot===vn&&(this._pivot=new nt(this,0,0)),this._pivot}set pivot(t){this._pivot===vn&&(this._pivot=new nt(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===bn&&(this._skew=new nt(this,0,0)),this._skew}set skew(t){this._skew===bn&&(this._skew=new nt(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===yn&&(this._scale=new nt(this,1,1)),this._scale}set scale(t){this._scale===yn&&(this._scale=new nt(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){const e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){const e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});const 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){var i;const s=this.getLocalBounds();typeof t=="object"?(e=(i=t.height)!=null?i:t.width,t=t.width):e!=null||(e=t),t!==void 0&&this._setWidth(t,s.width),e!==void 0&&this._setHeight(e,s.height)}_updateSkew(){const 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(){const t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;const e=this.localTransform,i=this._scale,s=this._pivot,n=this._position,o=i._x,a=i._y,l=s._x,u=s._y;e.a=this._cx*o,e.b=this._sx*o,e.c=this._cy*a,e.d=this._sy*a,e.tx=n._x-(l*e.a+u*e.c),e.ty=n._y-(l*e.b+u*e.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=gr,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){const e=j.shared.setValue(t!=null?t:16777215).toBgrNumber();e!==this.localColor&&(this.localColor=e,this._updateFlags|=gr,this._onUpdate())}get tint(){const t=this.localColor;return((t&255)<<16)+(t&65280)+(t>>16&255)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=mi,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){const e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Ie,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(t){const e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Ie,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){const e=t?1:0;(this.localDisplayStatus&1)!==e&&(this._updateFlags|=Ie,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){var e;if(this.destroyed)return;this.destroyed=!0;const i=this.removeChildren(0,this.children.length);if(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==null?void 0:t.children)for(let s=0;s<i.length;++s)i[s].destroy(t);(e=this.renderGroup)==null||e.destroy(),this.renderGroup=null}}Q.mixin(sc),Q.mixin(_c),Q.mixin(mc),Q.mixin(fc),Q.mixin(uc),Q.mixin(cc),Q.mixin(gc),Q.mixin(Ju);class Fe{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Fe.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new W,this.page=new W,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,s,n){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}}var xn=/iPhone/i,vc=/iPod/i,yc=/iPad/i,xc=/\biOS-universal(?:.+)Mac\b/i,Tn=/\bAndroid(?:.+)Mobile\b/i,Tc=/Android/i,De=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,gi=/Silk/i,Wt=/Windows Phone/i,Sc=/\bWindows(?:.+)ARM\b/i,Ec=/BlackBerry/i,Ac=/BB10/i,Pc=/Opera Mini/i,wc=/\b(CriOS|Chrome)(?:.+)Mobile/i,Rc=/Mobile(?:.+)Firefox\b/i,Mc=function(r){return typeof r!="undefined"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream=="undefined"};function g0(r){return function(t){return t.test(r)}}function Cc(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator!="undefined"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,i=e.split("[FBAN");typeof i[1]!="undefined"&&(e=i[0]),i=e.split("Twitter"),typeof i[1]!="undefined"&&(e=i[0]);var s=g0(e),n={apple:{phone:s(xn)&&!s(Wt),ipod:s(vc),tablet:!s(xn)&&(s(yc)||Mc(t))&&!s(Wt),universal:s(xc),device:(s(xn)||s(vc)||s(yc)||s(xc)||Mc(t))&&!s(Wt)},amazon:{phone:s(De),tablet:!s(De)&&s(gi),device:s(De)||s(gi)},android:{phone:!s(Wt)&&s(De)||!s(Wt)&&s(Tn),tablet:!s(Wt)&&!s(De)&&!s(Tn)&&(s(gi)||s(Tc)),device:!s(Wt)&&(s(De)||s(gi)||s(Tn)||s(Tc))||s(/\bokhttp\b/i)},windows:{phone:s(Wt),tablet:s(Sc),device:s(Wt)||s(Sc)},other:{blackberry:s(Ec),blackberry10:s(Ac),opera:s(Pc),firefox:s(Rc),chrome:s(wc),device:s(Ec)||s(Ac)||s(Pc)||s(Rc)||s(wc)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}var Oc;const Gc=((Oc=Cc.default)!=null?Oc:Cc)(globalThis.navigator),_0=9,_i=100,b0=0,v0=0,Bc=2,Ic=1,y0=-1e3,x0=-1e3,T0=2;class Sn{constructor(t,e=Gc){this._mobileInfo=e,this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(e.tablet||e.phone)&&this._createTouchHook();const i=document.createElement("div");i.style.width=`${_i}px`,i.style.height=`${_i}px`,i.style.position="absolute",i.style.top=`${b0}px`,i.style.left=`${v0}px`,i.style.zIndex=Bc.toString(),this._div=i,this._renderer=t,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){const t=document.createElement("button");t.style.width=`${Ic}px`,t.style.height=`${Ic}px`,t.style.position="absolute",t.style.top=`${y0}px`,t.style.left=`${x0}px`,t.style.zIndex=T0.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(){var t;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.add(this),(t=this._renderer.view.canvas.parentNode)==null||t.appendChild(this._div))}_deactivate(){var t;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this),(t=this._div.parentNode)==null||t.removeChild(this._div))}_updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&t.isInteractive()&&(t._accessibleActive||this._addChild(t),t._renderId=this._renderId);const e=t.children;if(e)for(let i=0;i<e.length;i++)this._updateAccessibleObjects(e[i])}init(t){var e;this.debug=(e=t==null?void 0:t.debug)!=null?e:this.debug,this._renderer.runners.postrender.remove(this)}postrender(){const t=performance.now();if(this._mobileInfo.android.device&&t<this._androidUpdateCount||(this._androidUpdateCount=t+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered);const{x:e,y:i,width:s,height:n}=this._renderer.view.canvas.getBoundingClientRect(),{width:o,height:a,resolution:l}=this._renderer,u=s/o*l,c=n/a*l;let h=this._div;h.style.left=`${e}px`,h.style.top=`${i}px`,h.style.width=`${o}px`,h.style.height=`${a}px`;for(let p=0;p<this._children.length;p++){const f=this._children[p];if(f._renderId!==this._renderId)f._accessibleActive=!1,fn(this._children,p,1),this._div.removeChild(f._accessibleDiv),this._pool.push(f._accessibleDiv),f._accessibleDiv=null,p--;else{h=f._accessibleDiv;let m=f.hitArea;const _=f.worldTransform;f.hitArea?(h.style.left=`${(_.tx+m.x*_.a)*u}px`,h.style.top=`${(_.ty+m.y*_.d)*c}px`,h.style.width=`${m.width*_.a*u}px`,h.style.height=`${m.height*_.d*c}px`):(m=f.getBounds().rectangle,this._capHitArea(m),h.style.left=`${m.x*u}px`,h.style.top=`${m.y*c}px`,h.style.width=`${m.width*u}px`,h.style.height=`${m.height*c}px`,h.title!==f.accessibleTitle&&f.accessibleTitle!==null&&(h.title=f.accessibleTitle||""),h.getAttribute("aria-label")!==f.accessibleHint&&f.accessibleHint!==null&&h.setAttribute("aria-label",f.accessibleHint||"")),(f.accessibleTitle!==h.title||f.tabIndex!==h.tabIndex)&&(h.title=f.accessibleTitle||"",h.tabIndex=f.tabIndex,this.debug&&this._updateDebugHTML(h))}}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);const{width:e,height:i}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}_addChild(t){let e=this._pool.pop();e||(e=document.createElement("button"),e.style.width=`${_i}px`,e.style.height=`${_i}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=Bc.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._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){const{container:i}=t.target,s=this._renderer.events.rootBoundary,n=Object.assign(new Fe(s),{target:i});s.rootTarget=this._renderer.lastObjectRendered,e.forEach(o=>s.dispatchEvent(n,o))}_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===_0&&this._activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this._deactivate()}destroy(){this._destroyTouchHook(),this._div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this._pool=null,this._children=null,this._renderer=null}}Sn.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"accessibility"};const Fc={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1};D.add(Sn),Q.mixin(Fc);class En{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:s,clientHeight:n}=this._resizeTo;e=s,i=n}this.renderer.resize(e,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}En.extension=x.Application;var Yt=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(Yt||{});class bi{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=i,this._once=s}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));const 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);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const Dc=class Mt{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 bi(null,null,1/0),this.deltaMS=1/Mt.targetFPMS,this.elapsedMS=1/Mt.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=Yt.NORMAL){return this._addListener(new bi(t,e,i))}addOnce(t,e,i=Yt.NORMAL){return this._addListener(new bi(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=t-n%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Mt.targetFPMS;const i=this._head;let s=i.next;for(;s;)s=s.emit(this);i.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){const e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,Mt.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{const e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!Mt._shared){const t=Mt._shared=new Mt;t.autoStart=!0,t._protected=!0}return Mt._shared}static get system(){if(!Mt._system){const t=Mt._system=new Mt;t.autoStart=!0,t._protected=!0}return Mt._system}};Dc.targetFPMS=.06;let ct=Dc;class An{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,Yt.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?ct.shared:new ct,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}An.extension=x.Application,D.add(En),D.add(An);let S0=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||(ct.system.add(this._tickerUpdate,this,Yt.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(ct.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}const 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())}};const Kt=new S0;class _r extends Fe{constructor(){super(...arguments),this.client=new W,this.movement=new W,this.offset=new W,this.global=new W,this.screen=new W}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,s,n,o,a,l,u,c,h,p,f,m,_){throw new Error("Method not implemented.")}}class Ot extends _r{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!")}}class de extends _r{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}de.DOM_DELTA_PIXEL=0,de.DOM_DELTA_LINE=1,de.DOM_DELTA_PAGE=2;const E0=2048,A0=new W,br=new W;class Uc{constructor(t){this.dispatch=new mt,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((i,s)=>i.priority-s.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const e=this.mappingTable[t.type];if(e)for(let i=0,s=e.length;i<s;i++)e[i].fn(t)}hitTest(t,e){Kt.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",s=this[i](this.rootTarget,this.rootTarget.eventMode,A0.set(t,e),this.hitTestFn,this.hitPruneFn);return s&&s[0]}propagate(t,e){if(!t.target)return;const i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,n=i.length-1;s<n;s++)if(t.currentTarget=i[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=i.length-2;s>=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const s=Array.isArray(e)?e:[e];for(let n=i.length-1;n>=0;n--)s.forEach(o=>{t.currentTarget=i[n],this.notifyTarget(t,o)})}propagationPath(t){const e=[t];for(let i=0;i<E0&&t!==this.rootTarget&&t.parent;i++){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,i,s,n,o=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Kt.pauseUpdate=!1),t.interactiveChildren&&t.children){const c=t.children;for(let h=c.length-1;h>=0;h--){const p=c[h],f=this.hitTestMoveRecursive(p,this._isInteractive(e)?e:p.eventMode,i,s,n,o||n(t,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const m=t.isInteractive();(f.length>0||m)&&(m&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}const l=this._isInteractive(e),u=t.isInteractive();return u&&u&&this._allInteractiveElements.push(t),o||this._hitElements.length>0?null:a?this._hitElements:l&&!n(t,i)&&s(t,i)?u?[t]:[]:null}hitTestRecursive(t,e,i,s,n){if(this._interactivePrune(t)||n(t,i))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Kt.pauseUpdate=!1),t.interactiveChildren&&t.children){const l=t.children,u=i;for(let c=l.length-1;c>=0;c--){const h=l[c],p=this.hitTestRecursive(h,this._isInteractive(e)?e:h.eventMode,u,s,n);if(p){if(p.length>0&&!p[p.length-1].parent)continue;const f=t.isInteractive();return(p.length>0||f)&&p.push(t),p}}}const o=this._isInteractive(e),a=t.isInteractive();return o&&s(t,i)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!t||!t.visible||!t.renderable||!t.includeInBuild||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,br),!t.hitArea.contains(br.x,br.y)))return!0;if(t.effects&&t.effects.length)for(let i=0;i<t.effects.length;i++){const s=t.effects[i];if(s.containsPoint&&!s.containsPoint(e,this.hitTestFn))return!0}return!1}hitTestFn(t,e){return t.hitArea?!0:t!=null&&t.containsPoint?(t.worldTransform.applyInverse(e,br),t.containsPoint(br)):!1}notifyTarget(t,e){var i,s;if(!t.currentTarget.isInteractive())return;e=e!=null?e:t.type;const n=`on${e}`;(s=(i=t.currentTarget)[n])==null||s.call(i,t);const o=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this._notifyListeners(t,o),t.eventPhase===t.AT_TARGET&&this._notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Ot))return;const e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){const s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown")}const i=this.trackingData(t.pointerId);i.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var e,i,s;if(!(t instanceof Ot))return;this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const n=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const o=n.pointerType==="mouse"||n.pointerType==="pen",a=this.trackingData(t.pointerId),l=this.findMountedTarget(a.overTargets);if(((e=a.overTargets)==null?void 0:e.length)>0&&l!==n.target){const h=t.type==="mousemove"?"mouseout":"pointerout",p=this.createPointerEvent(t,h,l);if(this.dispatchEvent(p,"pointerout"),o&&this.dispatchEvent(p,"mouseout"),!n.composedPath().includes(l)){const f=this.createPointerEvent(t,"pointerleave",l);for(f.eventPhase=f.AT_TARGET;f.target&&!n.composedPath().includes(f.target);)f.currentTarget=f.target,this.notifyTarget(f),o&&this.notifyTarget(f,"mouseleave"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(p)}if(l!==n.target){const h=t.type==="mousemove"?"mouseover":"pointerover",p=this.clonePointerEvent(n,h);this.dispatchEvent(p,"pointerover"),o&&this.dispatchEvent(p,"mouseover");let f=l==null?void 0:l.parent;for(;f&&f!==this.rootTarget.parent&&f!==n.target;)f=f.parent;if(!f||f===this.rootTarget.parent){const m=this.clonePointerEvent(n,"pointerenter");for(m.eventPhase=m.AT_TARGET;m.target&&m.target!==l&&m.target!==this.rootTarget.parent;)m.currentTarget=m.target,this.notifyTarget(m),o&&this.notifyTarget(m,"mouseenter"),m.target=m.target.parent;this.freeEvent(m)}this.freeEvent(p)}const u=[],c=(i=this.enableGlobalMoveEvents)!=null?i:!0;this.moveOnAll?u.push("pointermove"):this.dispatchEvent(n,"pointermove"),c&&u.push("globalpointermove"),n.pointerType==="touch"&&(this.moveOnAll?u.splice(1,0,"touchmove"):this.dispatchEvent(n,"touchmove"),c&&u.push("globaltouchmove")),o&&(this.moveOnAll?u.splice(1,0,"mousemove"):this.dispatchEvent(n,"mousemove"),c&&u.push("globalmousemove"),this.cursor=(s=n.target)==null?void 0:s.cursor),u.length>0&&this.all(n,u),this._allInteractiveElements.length=0,this._hitElements.length=0,a.overTargets=n.composedPath(),this.freeEvent(n)}mapPointerOver(t){var e;if(!(t instanceof Ot))return;const i=this.trackingData(t.pointerId),s=this.createPointerEvent(t),n=s.pointerType==="mouse"||s.pointerType==="pen";this.dispatchEvent(s,"pointerover"),n&&this.dispatchEvent(s,"mouseover"),s.pointerType==="mouse"&&(this.cursor=(e=s.target)==null?void 0:e.cursor);const o=this.clonePointerEvent(s,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),n&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;i.overTargets=s.composedPath(),this.freeEvent(s),this.freeEvent(o)}mapPointerOut(t){if(!(t instanceof Ot))return;const e=this.trackingData(t.pointerId);if(e.overTargets){const i=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(n),i&&this.dispatchEvent(n,"mouseout");const o=this.createPointerEvent(t,"pointerleave",s);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),i&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(o)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Ot))return;const e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),n=this.findMountedTarget(s.pressTargetsByButton[t.button]);let o=n;if(n&&!i.composedPath().includes(n)){let a=n;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const l=i.button===2;this.notifyTarget(i,l?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],o=a}if(o){const a=this.clonePointerEvent(i,"click");a.target=o,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});const l=s.clicksByButton[t.button];if(l.target===a.target&&e-l.timeStamp<200?++l.clickCount:l.clickCount=1,l.target=a.target,l.timeStamp=e,a.detail=l.clickCount,a.pointerType==="mouse"){const u=a.button===2;this.dispatchEvent(a,u?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof Ot))return;const e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(i){let n=i;for(;n;)s.currentTarget=n,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"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof de))return;const e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){var s;const n=this.allocateEvent(Ot);return this.copyPointerData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.nativeEvent=t.nativeEvent,n.originalEvent=t,n.target=(s=i!=null?i:this.hitTest(n.global.x,n.global.y))!=null?s:this._hitElements[0],typeof e=="string"&&(n.type=e),n}createWheelEvent(t){const e=this.allocateEvent(de);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){const i=this.allocateEvent(Ot);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=e!=null?e:i.type,i}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 _r&&e instanceof _r&&(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,[]);const 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!");const e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}_notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeListener(e,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let s=0,n=i.length;s<n&&!t.propagationImmediatelyStopped;s++)i[s].once&&t.currentTarget.removeListener(e,i[s].fn,void 0,!0),i[s].fn.call(i[s].context,t)}}var P0=Object.defineProperty,kc=Object.getOwnPropertySymbols,w0=Object.prototype.hasOwnProperty,R0=Object.prototype.propertyIsEnumerable,$c=(r,t,e)=>t in r?P0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,M0=(r,t)=>{for(var e in t||(t={}))w0.call(t,e)&&$c(r,e,t[e]);if(kc)for(var e of kc(t))R0.call(t,e)&&$c(r,e,t[e]);return r};const C0=1,O0={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Pn=class Ru{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Uc(null),Kt.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Ot(null),this._rootWheelEvent=new de(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy(M0({},Ru.defaultEventFeatures),{set:(e,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[i]=s,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){var e,i;const{canvas:s,resolution:n}=this.renderer;this.setTargetElement(s),this.resolution=n,Ru._defaultEventMode=(e=t.eventMode)!=null?e:"passive",Object.assign(this.features,(i=t.eventFeatures)!=null?i:{}),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;const i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this._rootPointerEvent}_onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this._normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let i=0,s=e.length;i<s;i++){const n=e[i],o=this._bootstrapEvent(this._rootPointerEvent,n);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Kt.pointerMoved();const e=this._normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){const n=this._bootstrapEvent(this._rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}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]);const i=e!==this.domElement?"outside":"",s=this._normalizeToPointerData(t);for(let n=0,o=s.length;n<o;n++){const a=this._bootstrapEvent(this._rootPointerEvent,s[n]);a.type+=i,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this._normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){const n=this._bootstrapEvent(this._rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;const e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this._removeEvents(),this.domElement=t,Kt.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;Kt.addTickerListener();const 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;Kt.removeTickerListener();const 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,i){const s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},n=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*n,t.y=(i-s.top)*(this.domElement.height/s.height)*n}_normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let i=0,s=t.changedTouches.length;i<s;i++){const n=t.changedTouches[i];typeof n.button=="undefined"&&(n.button=0),typeof n.buttons=="undefined"&&(n.buttons=1),typeof n.isPrimary=="undefined"&&(n.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof n.width=="undefined"&&(n.width=n.radiusX||1),typeof n.height=="undefined"&&(n.height=n.radiusY||1),typeof n.tiltX=="undefined"&&(n.tiltX=0),typeof n.tiltY=="undefined"&&(n.tiltY=0),typeof n.pointerType=="undefined"&&(n.pointerType="touch"),typeof n.pointerId=="undefined"&&(n.pointerId=n.identifier||0),typeof n.pressure=="undefined"&&(n.pressure=n.force||.5),typeof n.twist=="undefined"&&(n.twist=0),typeof n.tangentialPressure=="undefined"&&(n.tangentialPressure=0),typeof n.layerX=="undefined"&&(n.layerX=n.offsetX=n.clientX),typeof n.layerY=="undefined"&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=t.type,e.push(n)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){const i=t;typeof i.isPrimary=="undefined"&&(i.isPrimary=!0),typeof i.width=="undefined"&&(i.width=1),typeof i.height=="undefined"&&(i.height=1),typeof i.tiltX=="undefined"&&(i.tiltX=0),typeof i.tiltY=="undefined"&&(i.tiltY=0),typeof i.pointerType=="undefined"&&(i.pointerType="mouse"),typeof i.pointerId=="undefined"&&(i.pointerId=C0),typeof i.pressure=="undefined"&&(i.pressure=.5),typeof i.twist=="undefined"&&(i.twist=0),typeof i.tangentialPressure=="undefined"&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}else e.push(t);return e}normalizeWheelEvent(t){const 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=O0[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}};Pn.extension={name:"events",type:[x.WebGLSystem,x.CanvasSystem,x.WebGPUSystem],priority:-1},Pn.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let wn=Pn;const Lc={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(r){this.eventMode=r?"static":"passive"},_internalEventMode:void 0,get eventMode(){var r;return(r=this._internalEventMode)!=null?r:wn.defaultEventMode},set eventMode(r){this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof e=="object"?e.signal:void 0,n=typeof e=="object"?e.once===!0:!1,o=typeof t=="function"?void 0:t;r=i?`${r}capture`:r;const a=typeof t=="function"?t:t.handleEvent,l=this;s&&s.addEventListener("abort",()=>{l.off(r,a,o)}),n?l.once(r,a,o):l.on(r,a,o)},removeEventListener(r,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.off(r,t,s)},dispatchEvent(r){if(!(r instanceof Fe))throw new Error("Container cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}};D.add(wn),Q.mixin(Lc);var St=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(St||{});const Nc={createCanvas:(r,t)=>{const e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>{var r;return(r=document.baseURI)!=null?r:window.location.href},getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};let Hc=Nc;const L={get(){return Hc},set(r){Hc=r}};function It(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function vr(r){return r.split("?")[0].split("#")[0]}function G0(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function B0(r,t,e){return r.replace(new RegExp(G0(t),"g"),e)}function I0(r,t){let e="",i=0,s=-1,n=0,o=-1;for(let a=0;a<=r.length;++a){if(a<r.length)o=r.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(s===a-1||n===1))if(s!==a-1&&n===2){if(e.length<2||i!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const l=e.lastIndexOf("/");if(l!==e.length-1){l===-1?(e="",i=0):(e=e.slice(0,l),i=e.length-1-e.lastIndexOf("/")),s=a,n=0;continue}}else if(e.length===2||e.length===1){e="",i=0,s=a,n=0;continue}}t&&(e.length>0?e+="/..":e="..",i=2)}else e.length>0?e+=`/${r.slice(s+1,a)}`:e=r.slice(s+1,a),i=a-s-1;s=a,n=0}else o===46&&n!==-1?++n:n=-1}return e}const gt={toPosix(r){return B0(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){It(r),r=this.toPosix(r);const t=/^file:\/\/\//.exec(r);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if(It(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const i=vr(this.toPosix(t!=null?t:L.get().getBaseUrl())),s=vr(this.toPosix(e!=null?e:this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?gt.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(It(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="";const e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));const i=r.endsWith("/");return r=I0(r,!1),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return It(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){var t;if(r.length===0)return".";let e;for(let i=0;i<r.length;++i){const s=r[i];if(It(s),s.length>0)if(e===void 0)e=s;else{const n=(t=r[i-1])!=null?t:"";this.joinExtensions.includes(this.extname(n).toLowerCase())?e+=`/../${s}`:e+=`/${s}`}}return e===void 0?".":this.normalize(e)},dirname(r){if(It(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0);const e=t===47;let i=-1,s=!0;const n=this.getProtocol(r),o=r;r=r.slice(n.length);for(let a=r.length-1;a>=1;--a)if(t=r.charCodeAt(a),t===47){if(!s){i=a;break}}else s=!1;return i===-1?e?"/":this.isUrl(o)?n+r:n:e&&i===1?"//":n+r.slice(0,i)},rootname(r){It(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){const e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){It(r),t&&It(t),r=vr(this.toPosix(r));let e=0,i=-1,s=!0,n;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let o=t.length-1,a=-1;for(n=r.length-1;n>=0;--n){const l=r.charCodeAt(n);if(l===47){if(!s){e=n+1;break}}else a===-1&&(s=!1,a=n+1),o>=0&&(l===t.charCodeAt(o)?--o===-1&&(i=n):(o=-1,i=a))}return e===i?i=a:i===-1&&(i=r.length),r.slice(e,i)}for(n=r.length-1;n>=0;--n)if(r.charCodeAt(n)===47){if(!s){e=n+1;break}}else i===-1&&(s=!1,i=n+1);return i===-1?"":r.slice(e,i)},extname(r){It(r),r=vr(this.toPosix(r));let t=-1,e=0,i=-1,s=!0,n=0;for(let o=r.length-1;o>=0;--o){const a=r.charCodeAt(o);if(a===47){if(!s){e=o+1;break}continue}i===-1&&(s=!1,i=o+1),a===46?t===-1?t=o:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||i===-1||n===0||n===1&&t===i-1&&t===e+1?"":r.slice(t,i)},parse(r){It(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=vr(this.toPosix(r));let e=r.charCodeAt(0);const i=this.isAbsolute(r);let s;const n="";t.root=this.rootname(r),i||this.hasProtocol(r)?s=1:s=0;let o=-1,a=0,l=-1,u=!0,c=r.length-1,h=0;for(;c>=s;--c){if(e=r.charCodeAt(c),e===47){if(!u){a=c+1;break}continue}l===-1&&(u=!1,l=c+1),e===46?o===-1?o=c:h!==1&&(h=1):o!==-1&&(h=-1)}return o===-1||l===-1||h===0||h===1&&o===l-1&&o===a+1?l!==-1&&(a===0&&i?t.base=t.name=r.slice(1,l):t.base=t.name=r.slice(a,l)):(a===0&&i?(t.name=r.slice(1,o),t.base=r.slice(1,l)):(t.name=r.slice(a,o),t.base=r.slice(a,l)),t.ext=r.slice(o,l)),t.dir=this.dirname(r),n&&(t.dir=n+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]},Gt=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r);function Xc(r,t,e,i,s){const n=t[e];for(let o=0;o<n.length;o++){const a=n[o];e<t.length-1?Xc(r.replace(i[e],a),t,e+1,i,s):s.push(r.replace(i[e],a))}}function jc(r){const t=/\{(.*?)\}/g,e=r.match(t),i=[];if(e){const s=[];e.forEach(n=>{const o=n.substring(1,n.length-1).split(",");s.push(o)}),Xc(r,s,0,e,i)}else i.push(r);return i}const yr=r=>!Array.isArray(r);var F0=Object.defineProperty,D0=Object.defineProperties,U0=Object.getOwnPropertyDescriptors,zc=Object.getOwnPropertySymbols,k0=Object.prototype.hasOwnProperty,$0=Object.prototype.propertyIsEnumerable,Vc=(r,t,e)=>t in r?F0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ue=(r,t)=>{for(var e in t||(t={}))k0.call(t,e)&&Vc(r,e,t[e]);if(zc)for(var e of zc(t))$0.call(t,e)&&Vc(r,e,t[e]);return r},L0=(r,t)=>D0(r,U0(t));class ee{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){var e,i,s;if(this._bundleIdConnector=(e=t.connector)!=null?e:this._bundleIdConnector,this._createBundleAssetId=(i=t.createBundleAssetId)!=null?i:this._createBundleAssetId,this._extractAssetIdFromBundle=(s=t.extractAssetIdFromBundle)!=null?s: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{const e=t;this._defaultSearchParams=Object.keys(e).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){const{alias:e,src:i}=t;return Gt(e||i,s=>typeof s=="string"?s:Array.isArray(s)?s.map(n=>{var o;return(o=n==null?void 0:n.src)!=null?o:n}):s!=null&&s.src?s.src:s,!0)}addManifest(t){this._manifest,this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const i=[];let s=e;Array.isArray(e)||(s=Object.entries(e).map(([n,o])=>typeof o=="string"||Array.isArray(o)?{alias:n,src:o}:Ue({alias:n},o))),s.forEach(n=>{const o=n.src,a=n.alias;let l;if(typeof a=="string"){const u=this._createBundleAssetId(t,a);i.push(u),l=[a,u]}else{const u=a.map(c=>this._createBundleAssetId(t,c));i.push(...u),l=[...a,...u]}this.add(L0(Ue({},n),{alias:l,src:o}))}),this._bundles[t]=i}add(t){const e=[];Array.isArray(t)?e.push(...t):e.push(t);let i;Gt(e).forEach(s=>{const{src:n}=s;let{data:o,format:a,loadParser:l}=s;const u=Gt(n).map(p=>typeof p=="string"?jc(p):Array.isArray(p)?p:[p]),c=this.getAlias(s),h=[];u.forEach(p=>{p.forEach(f=>{var m,_,g;let b={};if(typeof f!="object"){b.src=f;for(let v=0;v<this._parsers.length;v++){const y=this._parsers[v];if(y.test(f)){b=y.parse(f);break}}}else o=(m=f.data)!=null?m:o,a=(_=f.format)!=null?_:a,l=(g=f.loadParser)!=null?g:l,b=Ue(Ue({},b),f);if(!c)throw new Error(`[Resolver] alias is undefined for this asset: ${b.src}`);b=this._buildResolvedAsset(b,{aliases:c,data:o,format:a,loadParser:l}),h.push(b)})}),c.forEach(p=>{this._assetMap[p]=h})})}resolveBundle(t){const e=yr(t);t=Gt(t);const i={};return t.forEach(s=>{const n=this._bundles[s];if(n){const o=this.resolve(n),a={};for(const l in o){const u=o[l];a[this._extractAssetIdFromBundle(s,l)]=u}i[s]=a}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const s in e)i[s]=e[s].src;return i}return e.src}resolve(t){const e=yr(t);t=Gt(t);const i={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let n=this._assetMap[s];const o=this._getPreferredOrder(n);o==null||o.priority.forEach(a=>{o.params[a].forEach(l=>{const u=n.filter(c=>c[a]?c[a]===l:!1);u.length&&(n=u)})}),this._resolverHash[s]=n[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const i=t[0],s=this._preferredOrder.find(n=>n.params.format.includes(i.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){var i,s;const{aliases:n,data:o,loadParser:a,format:l}=e;return(this._basePath||this._rootPath)&&(t.src=gt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=(i=n!=null?n:t.alias)!=null?i:[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data=Ue(Ue({},o||{}),t.data),t.loadParser=a!=null?a:t.loadParser,t.format=(s=l!=null?l:t.format)!=null?s:Wc(t.src),t}}ee.RETINA_PREFIX=/@([0-9\.]+)x/;function Wc(r){return r.split(".").pop().split("?").shift().split("#").shift()}const vi=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r},pe=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],fe=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],me=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ge=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Rn=[],Yc=[],yi=Math.sign;function N0(){for(let r=0;r<16;r++){const t=[];Rn.push(t);for(let e=0;e<16;e++){const i=yi(pe[r]*pe[e]+me[r]*fe[e]),s=yi(fe[r]*pe[e]+ge[r]*fe[e]),n=yi(pe[r]*me[e]+me[r]*ge[e]),o=yi(fe[r]*me[e]+ge[r]*ge[e]);for(let a=0;a<16;a++)if(pe[a]===i&&fe[a]===s&&me[a]===n&&ge[a]===o){t.push(a);break}}}for(let r=0;r<16;r++){const t=new G;t.set(pe[r],fe[r],me[r],ge[r],0,0),Yc.push(t)}}N0();const k={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>pe[r],uY:r=>fe[r],vX:r=>me[r],vY:r=>ge[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>Rn[r][t],sub:(r,t)=>Rn[r][k.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?k.S:k.N:Math.abs(t)*2<=Math.abs(r)?r>0?k.E:k.W:t>0?r>0?k.SE:k.SW:r>0?k.NE:k.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{const s=Yc[k.inv(t)];s.tx=e,s.ty=i,r.append(s)}},Mn=()=>{};function _e(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function Cn(r){return!(r&r-1)&&!!r}function H0(r){let t=(r>65535?1:0)<<4;r>>>=t;let e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function Nt(r){const t={};for(const e in r)r[e]!==void 0&&(t[e]=r[e]);return t}var X0=Object.defineProperty,Kc=Object.getOwnPropertySymbols,j0=Object.prototype.hasOwnProperty,z0=Object.prototype.propertyIsEnumerable,qc=(r,t,e)=>t in r?X0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Zc=(r,t)=>{for(var e in t||(t={}))j0.call(t,e)&&qc(r,e,t[e]);if(Kc)for(var e of Kc(t))z0.call(t,e)&&qc(r,e,t[e]);return r};const Qc=Object.create(null);function V0(r){const t=Qc[r];return t===void 0&&(Qc[r]=Z("resource")),t}const Jc=class py extends mt{constructor(t={}){var e,i,s,n,o,a,l;super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t=Zc(Zc({},py.defaultOptions),t),this.addressMode=t.addressMode,this.addressModeU=(e=t.addressModeU)!=null?e:this.addressModeU,this.addressModeV=(i=t.addressModeV)!=null?i:this.addressModeV,this.addressModeW=(s=t.addressModeW)!=null?s:this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=(n=t.magFilter)!=null?n:this.magFilter,this.minFilter=(o=t.minFilter)!=null?o:this.minFilter,this.mipmapFilter=(a=t.mipmapFilter)!=null?a:this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=(l=t.maxAnisotropy)!=null?l:1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){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(){const 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()}};Jc.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let On=Jc;var W0=Object.defineProperty,th=Object.getOwnPropertySymbols,Y0=Object.prototype.hasOwnProperty,K0=Object.prototype.propertyIsEnumerable,eh=(r,t,e)=>t in r?W0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,rh=(r,t)=>{for(var e in t||(t={}))Y0.call(t,e)&&eh(r,e,t[e]);if(th)for(var e of th(t))K0.call(t,e)&&eh(r,e,t[e]);return r};const ih=class fy extends mt{constructor(t={}){var e,i,s;super(),this.options=t,this.uid=Z("textureSource"),this._resourceType="textureSource",this._resourceId=Z("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=rh(rh({},fy.defaultOptions),t),this.label=(e=t.label)!=null?e:"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource&&(i=this.resourceWidth)!=null?i:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource&&(s=this.resourceHeight)!=null?s: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 On(Nt(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){var e,i;this.style!==t&&((e=this._style)==null||e.off("change",this._onStyleChange,this),this._style=t,(i=this._style)==null||i.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){const 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=Z("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){const{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){const{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,i){i=i||this._resolution,t=t||this.width,e=e||this.height;const s=Math.round(t*i),n=Math.round(e*i);return this.width=s/i,this.height=n/i,this._resolution=i,this.pixelWidth===s&&this.pixelHeight===n?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=n,this.emit("resize",this),this._resourceId=Z("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=Cn(this.pixelWidth)&&Cn(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};ih.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let tt=ih;var q0=Object.defineProperty,Z0=Object.defineProperties,Q0=Object.getOwnPropertyDescriptors,sh=Object.getOwnPropertySymbols,J0=Object.prototype.hasOwnProperty,tx=Object.prototype.propertyIsEnumerable,nh=(r,t,e)=>t in r?q0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ex=(r,t)=>{for(var e in t||(t={}))J0.call(t,e)&&nh(r,e,t[e]);if(sh)for(var e of sh(t))tx.call(t,e)&&nh(r,e,t[e]);return r},rx=(r,t)=>Z0(r,Q0(t));class xi extends tt{constructor(t){const e=t.resource||new Float32Array(t.width*t.height*4);let i=t.format;i||(e instanceof Float32Array?i="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?i="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?i="rgba16uint":(e instanceof Int8Array,i="bgra8unorm")),super(rx(ex({},t),{resource:e,format:i})),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}xi.extension=x.TextureSource;const oh=new G;class Gn{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=="undefined"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){var e;this.texture!==t&&((e=this._texture)==null||e.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);const i=this.mapCoord;for(let s=0;s<t.length;s+=2){const n=t[s],o=t[s+1];e[s]=n*i.a+o*i.c+i.tx,e[s+1]=n*i.b+o*i.d+i.ty}return e}update(){const t=this._texture;this._updateID++;const 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);const i=t.orig,s=t.trim;s&&(oh.set(i.width/s.width,0,0,i.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(oh));const n=t.source,o=this.uClampFrame,a=this.clampMargin/n._resolution,l=this.clampOffset/n._resolution;return o[0]=(t.frame.x+a+l)/n.width,o[1]=(t.frame.y+a+l)/n.height,o[2]=(t.frame.x+t.frame.width-a+l)/n.width,o[3]=(t.frame.y+t.frame.height-a+l)/n.height,this.uClampOffset[0]=this.clampOffset/n.pixelWidth,this.uClampOffset[1]=this.clampOffset/n.pixelHeight,this.isSimple=t.frame.width===n.width&&t.frame.height===n.height&&t.rotate===0,!0}}class P extends mt{constructor({source:t,label:e,frame:i,orig:s,trim:n,defaultAnchor:o,defaultBorders:a,rotate:l,dynamic:u}={}){var c;if(super(),this.uid=Z("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=(c=t==null?void 0:t.source)!=null?c:new tt,this.noFrame=!i,i)this.frame.copyFrom(i);else{const{width:h,height:p}=this._source;this.frame.width=h,this.frame.height=p}this.orig=s||this.frame,this.trim=n,this.rotate=l!=null?l:0,this.defaultAnchor=o,this.defaultBorders=a,this.destroyed=!1,this.dynamic=u||!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 Gn(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:t,frame:e}=this,{width:i,height:s}=this._source,n=e.x/i,o=e.y/s,a=e.width/i,l=e.height/s;let u=this.rotate;if(u){const c=a/2,h=l/2,p=n+c,f=o+h;u=k.add(u,k.NW),t.x0=p+c*k.uX(u),t.y0=f+h*k.uY(u),u=k.add(u,2),t.x1=p+c*k.uX(u),t.y1=f+h*k.uY(u),u=k.add(u,2),t.x2=p+c*k.uX(u),t.y2=f+h*k.uY(u),u=k.add(u,2),t.x3=p+c*k.uX(u),t.y3=f+h*k.uY(u)}else t.x0=n,t.y0=o,t.x1=n+a,t.y1=o,t.x2=n+a,t.y2=o+l,t.x3=n,t.y3=o+l}destroy(t=!1){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return this._source}}P.EMPTY=new P({label:"EMPTY",source:new tt({label:"EMPTY"})}),P.EMPTY.destroy=Mn,P.WHITE=new P({source:new xi({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"}),P.WHITE.destroy=Mn;const ah=class ai{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof P?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;const i=parseFloat(e.meta.scale);i?(this.resolution=i,t.source.resolution=this.resolution):this.resolution=t.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=ai.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=ai.BATCH_SIZE;for(;e-t<i&&e<this._frameKeys.length;){const s=this._frameKeys[e],n=this._frames[s],o=n.frame;if(o){let a=null,l=null;const u=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,c=new V(0,0,Math.floor(u.w)/this.resolution,Math.floor(u.h)/this.resolution);n.rotated?a=new V(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):a=new V(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(l=new V(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[s]=new P({source:this.textureSource,frame:a,orig:c,trim:l,rotate:n.rotated?2:0,defaultAnchor:n.anchor,defaultBorders:n.borders,label:s.toString()})}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let i=0;i<t[e].length;i++){const s=t[e][i];this.animations[e].push(this.textures[s])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*ai.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*ai.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const i in this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&((e=this._texture)==null||e.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};ah.BATCH_SIZE=1e3;let Bn=ah;const ix=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function lh(r,t,e){const i={};if(r.forEach(s=>{i[s]=t}),Object.keys(t.textures).forEach(s=>{i[s]=t.textures[s]}),!e){const s=gt.dirname(r[0]);t.linkedSheets.forEach((n,o)=>{const a=lh([`${s}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(i,a)})}return i}const uh={extension:x.Asset,cache:{test:r=>r instanceof Bn,getCacheableAssets:(r,t)=>lh(r,t,!1)},resolver:{extension:{type:x.ResolveParser,name:"resolveSpritesheet"},test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),i=t.pop();return e==="json"&&ix.includes(i)},parse:r=>{var t,e;const i=r.split(".");return{resolution:parseFloat((e=(t=ee.RETINA_PREFIX.exec(r))==null?void 0:t[1])!=null?e:"1"),format:i[i.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:x.LoadParser,priority:St.Normal,name:"spritesheetLoader"},async testParse(r,t){return gt.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var i,s,n;const{texture:o,imageFilename:a}=(i=t==null?void 0:t.data)!=null?i:{};let l=gt.dirname(t.src);l&&l.lastIndexOf("/")!==l.length-1&&(l+="/");let u;if(o instanceof P)u=o;else{const p=vi(l+(a!=null?a:r.meta.image),t.src);u=(await e.load([p]))[p]}const c=new Bn(u.source,r);await c.parse();const h=(s=r==null?void 0:r.meta)==null?void 0:s.related_multi_packs;if(Array.isArray(h)){const p=[];for(const m of h){if(typeof m!="string")continue;let _=l+m;(n=t.data)!=null&&n.ignoreMultiPack||(_=vi(_,t.src),p.push(e.load({src:_,data:{ignoreMultiPack:!0}})))}const f=await Promise.all(p);c.linkedSheets=f,f.forEach(m=>{m.linkedSheets=[c].concat(c.linkedSheets.filter(_=>_!==m))})}return c},async unload(r,t,e){await e.unload(r.textureSource._sourceOrigin),r.destroy(!1)}}};D.add(uh);function xr(r,t,e,i){const{width:s,height:n}=e.orig,o=e.trim;if(o){const a=o.width,l=o.height;r.minX=o.x-t._x*s-i,r.maxX=r.minX+a,r.minY=o.y-t._y*n-i,r.maxY=r.minY+l}else r.minX=-t._x*s-i,r.maxX=r.minX+s,r.minY=-t._y*n-i,r.maxY=r.minY+n}class re extends Q{constructor(){super(...arguments),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=0,this._lastInstructionTick=-1,this._bounds=new ut(0,1,0,0),this._boundsDirty=!0}_updateBounds(){}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){const e=this.bounds,{x:i,y:s}=t;return i>=e.minX&&i<=e.maxX&&s>=e.minY&&s<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){super.destroy(t),this._bounds=null}}var sx=Object.defineProperty,Ti=Object.getOwnPropertySymbols,ch=Object.prototype.hasOwnProperty,hh=Object.prototype.propertyIsEnumerable,dh=(r,t,e)=>t in r?sx(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,nx=(r,t)=>{for(var e in t||(t={}))ch.call(t,e)&&dh(r,e,t[e]);if(Ti)for(var e of Ti(t))hh.call(t,e)&&dh(r,e,t[e]);return r},ox=(r,t)=>{var e={};for(var i in r)ch.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Ti)for(var i of Ti(r))t.indexOf(i)<0&&hh.call(r,i)&&(e[i]=r[i]);return e};class Ft extends re{constructor(t=P.EMPTY){t instanceof P&&(t={texture:t});const e=t,{texture:i=P.EMPTY,anchor:s,roundPixels:n,width:o,height:a}=e,l=ox(e,["texture","anchor","roundPixels","width","height"]);super(nx({label:"Sprite"},l)),this.renderPipeId="sprite",this.batched=!0,this._sourceBounds={minX:0,maxX:1,minY:0,maxY:0},this._sourceBoundsDirty=!0,this._anchor=new nt({_onUpdate:()=>{this.onViewUpdate()}}),s?this.anchor=s:i.defaultAnchor&&(this.anchor=i.defaultAnchor),this.texture=i,this.allowChildren=!1,this.roundPixels=n!=null?n:!1,o!==void 0&&(this.width=o),a!==void 0&&(this.height=a)}static from(t,e=!1){return t instanceof P?new Ft(t):new Ft(P.from(t,e))}set texture(t){t||(t=P.EMPTY);const 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 bounds(){return this._boundsDirty&&(this._updateBounds(),this._boundsDirty=!1),this._bounds}get sourceBounds(){return this._sourceBoundsDirty&&(this._updateSourceBounds(),this._sourceBoundsDirty=!1),this._sourceBounds}containsPoint(t){const e=this.sourceBounds;return t.x>=e.maxX&&t.x<=e.minX&&t.y>=e.maxY&&t.y<=e.minY}addBounds(t){const e=this._texture.trim?this.sourceBounds:this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}onViewUpdate(){this._sourceBoundsDirty=this._boundsDirty=!0,super.onViewUpdate()}_updateBounds(){xr(this._bounds,this._anchor,this._texture,0)}_updateSourceBounds(){const t=this._anchor,e=this._texture,i=this._sourceBounds,{width:s,height:n}=e.orig;i.maxX=-t._x*s,i.minX=i.maxX+s,i.maxY=-t._y*n,i.minY=i.maxY+n}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(e)}this._texture=null,this._bounds=null,this._sourceBounds=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){var i;typeof t=="object"?(e=(i=t.height)!=null?i:t.width,t=t.width):e!=null||(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}const ax=new ut;function Si(r,t,e){const i=ax;r.measurable=!0,fr(r,e,i),t.addBoundsMask(i),r.measurable=!1}function Ei(r,t,e){const i=Lt.get();r.measurable=!0;const s=$t.get().identity(),n=In(r,e,s);pi(r,i,n),r.measurable=!1,t.addBoundsMask(i),$t.return(s),Lt.return(i)}function In(r,t,e){return r&&r!==t&&(In(r.parent,t,e),r.updateLocalTransform(),e.append(r.localTransform)),e}class Fn{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof Ft),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||Si(this.mask,t,e)}addLocalBounds(t,e){Ei(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof Ft}}Fn.extension=x.MaskEffect;class Dn{constructor(t){this.priority=0,this.pipe="colorMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}}Dn.extension=x.MaskEffect;class Un{constructor(t){this.priority=0,this.pipe="stencilMask",t!=null&&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){Si(this.mask,t,e)}addLocalBounds(t,e){Ei(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof Q}}Un.extension=x.MaskEffect;class ie extends tt{constructor(t){t.resource||(t.resource=L.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;const e=t.resource;(this.pixelWidth!==e.width||this.pixelWidth!==e.height)&&this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,i=this._resolution){const s=super.resize(t,e,i);return s&&this.resizeCanvas(),s}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}ie.extension=x.TextureSource;class be extends tt{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){const e=L.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}super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}}be.extension=x.TextureSource;let kn;async function $n(){return kn!=null||(kn=(async()=>{var r;const t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";const e=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(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";const i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);const s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(s),t.deleteTexture(i),(r=t.getExtension("WEBGL_lose_context"))==null||r.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),kn}var lx=Object.defineProperty,ux=Object.defineProperties,cx=Object.getOwnPropertyDescriptors,ph=Object.getOwnPropertySymbols,hx=Object.prototype.hasOwnProperty,dx=Object.prototype.propertyIsEnumerable,fh=(r,t,e)=>t in r?lx(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ln=(r,t)=>{for(var e in t||(t={}))hx.call(t,e)&&fh(r,e,t[e]);if(ph)for(var e of ph(t))dx.call(t,e)&&fh(r,e,t[e]);return r},px=(r,t)=>ux(r,cx(t));const Ai=class my extends tt{constructor(t){var e;super(t),this.isReady=!1,this.uploadMethodId="video",t=Ln(Ln({},my.defaultOptions),t),this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=(e=t.alphaMode)!=null?e:"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){const t=ct.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;const 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 $n(),this._load=new Promise((i,s)=>{this.isValid?i(this):(this._resolve=i,this._reject=s,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const 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(){const 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();const 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&&(ct.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||(ct.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ct.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};Ai.extension=x.TextureSource,Ai.defaultOptions=px(Ln({},tt.defaultOptions),{autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1}),Ai.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Tr=Ai,fx=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){return this._cache.get(t)}set(t,e){const i=Gt(t);let s;for(let l=0;l<this.parsers.length;l++){const u=this.parsers[l];if(u.test(e)){s=u.getCacheableAssets(i,e);break}}const n=new Map(Object.entries(s||{}));s||i.forEach(l=>{n.set(l,e)});const o=[...n.keys()],a={cacheKeys:o,keys:i};i.forEach(l=>{this._cacheMap.set(l,a)}),o.forEach(l=>{const u=s?s[l]:e;this._cache.has(l)&&this._cache.get(l),this._cache.set(l,n.get(l))})}remove(t){if(!this._cacheMap.has(t))return;const e=this._cacheMap.get(t);e.cacheKeys.forEach(i=>{this._cache.delete(i)}),e.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}};const Y=new fx,Nn=[];D.handleByList(x.TextureSource,Nn);function mx(r={}){return Hn(r)}function Hn(r={}){const t=r&&r.resource,e=t?r.resource:r,i=t?r:{resource:r};for(let s=0;s<Nn.length;s++){const n=Nn[s];if(n.test(e))return new n(i)}throw new Error(`Could not find a source type for resource: ${i.resource}`)}function mh(r={},t=!1){const e=r&&r.resource,i=e?r.resource:r,s=e?r:{resource:r};if(!t&&Y.has(i))return Y.get(i);const n=new P({source:Hn(s)});return n.on("destroy",()=>{Y.has(i)&&Y.remove(i)}),t||Y.set(i,n),n}function gh(r,t=!1){return typeof r=="string"?Y.get(r):r instanceof tt?new P({source:r}):mh(r,t)}P.from=gh,tt.from=Hn,D.add(Fn,Dn,Un,Tr,be,ie,xi);class Ht{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(const i in t){const s=t[i];this.setResource(s,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const t=[];let e=0;for(const i in this.resources)t[e++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,e){var i,s;const n=this.resources[e];t!==n&&(n&&((i=t.off)==null||i.call(t,"change",this.onResourceChange,this)),(s=t.on)==null||s.call(t,"change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){const e=this.resources;for(const i in e)e[i]._touched=t}destroy(){var t;const e=this.resources;for(const i in e){const s=e[i];(t=s.off)==null||t.call(s,"change",this.onResourceChange,this)}this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){const e=this.resources;for(const i in e)e[i]===t&&(e[i]=null)}else this._updateKey()}}let Sr;function Xn(){return(!Sr||Sr!=null&&Sr.isContextLost())&&(Sr=L.get().createCanvas().getContext("webgl",{})),Sr}const gx=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
8
|
+
`);function _x(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
|
|
9
|
+
else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function _h(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){const i=gx.replace(/%forloop%/gi,_x(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}}finally{t.deleteShader(e)}return r}let ke=null;function ve(){var r;if(ke)return ke;const t=Xn();return ke=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),ke=_h(ke,t),(r=t.getExtension("WEBGL_lose_context"))==null||r.loseContext(),ke}const bh={};function Pi(r,t){let e=2166136261;for(let i=0;i<t;i++)e^=r[i].uid,e=Math.imul(e,16777619),e>>>=0;return bh[e]||bx(r,t,e)}let jn=0;function bx(r,t,e){const i={};let s=0;jn||(jn=ve());for(let o=0;o<jn;o++){const a=o<t?r[o]:P.EMPTY.source;i[s++]=a.source,i[s++]=a.style}const n=new Ht(i);return bh[e]=n,n}class ye{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 wi(r,t){const e=r.byteLength/8|0,i=new Float64Array(r,0,e);new Float64Array(t,0,e).set(i);const s=r.byteLength-e*8;if(s>0){const n=new Uint8Array(r,e*8,s);new Uint8Array(t,e*8,s).set(n)}}const vh={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var et=(r=>(r[r.DISABLED=0]="DISABLED",r[r.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",r[r.MASK_ACTIVE=2]="MASK_ACTIVE",r[r.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",r[r.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",r[r.NONE=5]="NONE",r))(et||{});function $e(r,t){return t.alphaMode==="no-premultiply-alpha"&&vh[r]||r}class yh{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){const e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}var vx=Object.defineProperty,xh=Object.getOwnPropertySymbols,yx=Object.prototype.hasOwnProperty,xx=Object.prototype.propertyIsEnumerable,Th=(r,t,e)=>t in r?vx(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Sh=(r,t)=>{for(var e in t||(t={}))yx.call(t,e)&&Th(r,e,t[e]);if(xh)for(var e of xh(t))xx.call(t,e)&&Th(r,e,t[e]);return r};class Eh{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new yh,this.blendMode="normal",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}}const Ah=[];let zn=0;function Ph(){return zn>0?Ah[--zn]:new Eh}function wh(r){Ah[zn++]=r}let Er=0;const Rh=class sn{constructor(t={}){this.uid=Z("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[];var e;sn.defaultOptions.maxTextures=(e=sn.defaultOptions.maxTextures)!=null?e:ve(),t=Sh(Sh({},sn.defaultOptions),t);const{maxTextures:i,attributesInitialSize:s,indicesInitialSize:n}=t;this.attributeBuffer=new ye(s*4),this.indexBuffer=new Uint16Array(n),this.maxTextures=i}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)wh(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){const i=t._batch.textures.ids[e._source.uid];return!i&&i!==0?!1:(t._textureId=i,t.texture=e,!0)}updateElement(t){this.dirty=!0;const 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){const e=this._elements;if(!e[this.elementStart])return;let i=Ph(),s=i.textures;s.clear();const n=e[this.elementStart];let o=$e(n.blendMode,n.texture._source);this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);const a=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,u=this.indexBuffer;let c=this._batchIndexSize,h=this._batchIndexStart,p="startBatch";const f=this.maxTextures;for(let m=this.elementStart;m<this.elementSize;++m){const _=e[m];e[m]=null;const g=_.texture._source,b=$e(_.blendMode,g),v=o!==b;if(g._batchTick===Er&&!v){_._textureId=g._textureBindLocation,c+=_.indexSize,_.packAsQuad?(this.packQuadAttributes(_,a,l,_._attributeStart,_._textureId),this.packQuadIndex(u,_._indexStart,_._attributeStart/this.vertexSize)):(this.packAttributes(_,a,l,_._attributeStart,_._textureId),this.packIndex(_,u,_._indexStart,_._attributeStart/this.vertexSize)),_._batch=i;continue}g._batchTick=Er,(s.count>=f||v)&&(this._finishBatch(i,h,c-h,s,o,t,p),p="renderBatch",h=c,o=b,i=Ph(),s=i.textures,s.clear(),++Er),_._textureId=g._textureBindLocation=s.count,s.ids[g.uid]=s.count,s.textures[s.count++]=g,_._batch=i,c+=_.indexSize,_.packAsQuad?(this.packQuadAttributes(_,a,l,_._attributeStart,_._textureId),this.packQuadIndex(u,_._indexStart,_._attributeStart/this.vertexSize)):(this.packAttributes(_,a,l,_._attributeStart,_._textureId),this.packIndex(_,u,_._indexStart,_._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(i,h,c-h,s,o,t,p),h=c,++Er),this.elementStart=this.elementSize,this._batchIndexStart=h,this._batchIndexSize=c}_finishBatch(t,e,i,s,n,o,a){t.gpuBindGroup=null,t.bindGroup=null,t.action=a,t.batcher=this,t.textures=s,t.blendMode=n,t.start=e,t.size=i,++Er,this.batches[this.batchIndex++]=t,o.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){const e=Math.max(t,this.attributeBuffer.size*2),i=new ye(e);wi(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(t){const e=this.indexBuffer;let i=Math.max(t,e.length*1.5);i+=i%2;const s=i>65535?new Uint32Array(i):new Uint16Array(i);if(s.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let n=0;n<e.length;n++)s[n]=e[n];else wi(e.buffer,s.buffer);this.indexBuffer=s}packQuadIndex(t,e,i){t[e]=i+0,t[e+1]=i+1,t[e+2]=i+2,t[e+3]=i+0,t[e+4]=i+2,t[e+5]=i+3}packIndex(t,e,i,s){const n=t.indices,o=t.indexSize,a=t.indexOffset,l=t.attributeOffset;for(let u=0;u<o;u++)e[i++]=s+n[u+a]-l}destroy(){for(let t=0;t<this.batches.length;t++)wh(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}};Rh.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let Mh=Rh;var $=(r=>(r[r.MAP_READ=1]="MAP_READ",r[r.MAP_WRITE=2]="MAP_WRITE",r[r.COPY_SRC=4]="COPY_SRC",r[r.COPY_DST=8]="COPY_DST",r[r.INDEX=16]="INDEX",r[r.VERTEX=32]="VERTEX",r[r.UNIFORM=64]="UNIFORM",r[r.STORAGE=128]="STORAGE",r[r.INDIRECT=256]="INDIRECT",r[r.QUERY_RESOLVE=512]="QUERY_RESOLVE",r[r.STATIC=1024]="STATIC",r))($||{});class dt extends mt{constructor(t){let{data:e,size:i}=t;const{usage:s,label:n,shrinkToFit:o}=t;super(),this.uid=Z("buffer"),this._resourceType="buffer",this._resourceId=Z("resource"),this._touched=0,this._updateID=1,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,i=i!=null?i:e==null?void 0:e.byteLength;const a=!!e;this.descriptor={size:i,usage:s,mappedAtCreation:a,label:n},this.shrinkToFit=o!=null?o:!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get static(){return!!(this.descriptor.usage&$.STATIC)}set static(t){t?this.descriptor.usage|=$.STATIC:this.descriptor.usage&=~$.STATIC}setDataWithSize(t,e,i){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){i&&this.emit("update",this);return}const s=this._data;if(this._data=t,s.length!==t.length){!this.shrinkToFit&&t.byteLength<s.byteLength?i&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=Z("resource"),this.emit("change",this));return}i&&this.emit("update",this)}update(t){this._updateSize=t!=null?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 Vn(r,t){if(!(r instanceof dt)){let e=t?$.INDEX:$.VERTEX;r instanceof Array&&(t?(r=new Uint32Array(r),e=$.INDEX|$.COPY_DST):(r=new Float32Array(r),e=$.VERTEX|$.COPY_DST)),r=new dt({data:r,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return r}function Ch(r,t,e){const i=r.getAttribute(t);if(!i)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;const s=i.buffer.data;let n=1/0,o=1/0,a=-1/0,l=-1/0;const u=s.BYTES_PER_ELEMENT,c=(i.offset||0)/u,h=(i.stride||2*4)/u;for(let p=c;p<s.length;p+=h){const f=s[p],m=s[p+1];f>a&&(a=f),m>l&&(l=m),f<n&&(n=f),m<o&&(o=m)}return e.minX=n,e.minY=o,e.maxX=a,e.maxY=l,e}function Tx(r){return(r instanceof dt||Array.isArray(r)||r.BYTES_PER_ELEMENT)&&(r={buffer:r}),r.buffer=Vn(r.buffer,!1),r}class xe extends mt{constructor(t={}){super(),this.uid=Z("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new ut,this._boundsDirty=!0;const{attributes:e,indexBuffer:i,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(const n in e)this.addAttribute(n,e[n]);this.instanceCount=t.instanceCount||1,i&&this.addIndex(i),this.topology=s||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(const t in this.attributes){const e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){const i=Tx(e);this.buffers.indexOf(i.buffer)===-1&&(this.buffers.push(i.buffer),i.buffer.on("update",this.onBufferUpdate,this),i.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=i}addIndex(t){this.indexBuffer=Vn(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,Ch(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}}const Sx=new Float32Array(1),Ex=new Uint32Array(1);class Oh extends xe{constructor(){const t=new dt({data:Sx,label:"attribute-batch-buffer",usage:$.VERTEX|$.COPY_DST,shrinkToFit:!1}),e=new dt({data:Ex,label:"index-batch-buffer",usage:$.INDEX|$.COPY_DST,shrinkToFit:!1}),i=6*4;super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:i,offset:0},aUV:{buffer:t,format:"float32x2",stride:i,offset:8},aColor:{buffer:t,format:"unorm8x4",stride:i,offset:16},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:i,offset:20}},indexBuffer:e})}}const Wn=Object.create(null),Gh=Object.create(null);function Le(r,t){let e=Gh[r];return e===void 0&&(Wn[t]===void 0&&(Wn[t]=1),Gh[r]=e=Wn[t]++),e}let Ri;function Bh(){if(!Ri){Ri="mediump";const r=Xn();r&&r.getShaderPrecisionFormat&&(Ri=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision?"highp":"mediump")}return Ri}function Ih(r,t,e){return t?r:e?(r=r.replace("out vec4 finalColor;",""),`
|
|
10
|
+
|
|
11
|
+
#ifdef GL_ES // This checks if it is WebGL1
|
|
12
|
+
#define in varying
|
|
13
|
+
#define finalColor gl_FragColor
|
|
14
|
+
#define texture texture2D
|
|
15
|
+
#endif
|
|
16
|
+
${r}
|
|
17
|
+
`):`
|
|
18
|
+
|
|
19
|
+
#ifdef GL_ES // This checks if it is WebGL1
|
|
20
|
+
#define in attribute
|
|
21
|
+
#define out varying
|
|
22
|
+
#endif
|
|
23
|
+
${r}
|
|
24
|
+
`}function Fh(r,t,e){const i=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(r.substring(0,9)!=="precision"){let s=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return s==="highp"&&i!=="highp"&&(s="mediump"),`precision ${s} float;
|
|
25
|
+
${r}`}else if(i!=="highp"&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}function Dh(r,t){return t?`#version 300 es
|
|
26
|
+
${r}`:r}const Ax={},Px={};function Uh(r,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";const i=e?Ax:Px;return i[t]?(i[t]++,t+=`-${i[t]}`):i[t]=1,r.indexOf("#define SHADER_NAME")!==-1?r:`${`#define SHADER_NAME ${t}`}
|
|
27
|
+
${r}`}function kh(r,t){return t?r.replace("#version 300 es",""):r}var wx=Object.defineProperty,$h=Object.getOwnPropertySymbols,Rx=Object.prototype.hasOwnProperty,Mx=Object.prototype.propertyIsEnumerable,Lh=(r,t,e)=>t in r?wx(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Nh=(r,t)=>{for(var e in t||(t={}))Rx.call(t,e)&&Lh(r,e,t[e]);if($h)for(var e of $h(t))Mx.call(t,e)&&Lh(r,e,t[e]);return r};const Yn={stripVersion:kh,ensurePrecision:Fh,addProgramDefines:Ih,setProgramName:Uh,insertVersion:Dh},Kn=Object.create(null),Hh=class Mu{constructor(t){t=Nh(Nh({},Mu.defaultOptions),t);const e=t.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Bh()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e};let s=t.fragment,n=t.vertex;Object.keys(Yn).forEach(o=>{const a=i[o];s=Yn[o](s,a,!0),n=Yn[o](n,a,!1)}),this.fragment=s,this.vertex=n,this._key=Le(`${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){const e=`${t.vertex}:${t.fragment}`;return Kn[e]||(Kn[e]=new Mu(t)),Kn[e]}};Hh.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let Et=Hh;const Xh={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 qt(r){var t;return(t=Xh[r])!=null?t:Xh.float32}const Cx={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 jh({source:r,entryPoint:t}){var e;const i={},s=r.indexOf(`fn ${t}`);if(s!==-1){const n=r.indexOf("->",s);if(n!==-1){const o=r.substring(s,n),a=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g;let l;for(;(l=a.exec(o))!==null;){const u=(e=Cx[l[3]])!=null?e:"float32";i[l[2]]={location:parseInt(l[1],10),format:u,stride:qt(u).stride,offset:0,instance:!1,start:0}}}}return i}function Mi(r){var t,e,i;const s=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,n=/@group\((\d+)\)/,o=/@binding\((\d+)\)/,a=/var(<[^>]+>)? (\w+)/,l=/:\s*(\w+)/,u=/struct\s+(\w+)\s*{([^}]+)}/g,c=/(\w+)\s*:\s*([\w\<\>]+)/g,h=/struct\s+(\w+)/,p=(t=r.match(s))==null?void 0:t.map(m=>({group:parseInt(m.match(n)[1],10),binding:parseInt(m.match(o)[1],10),name:m.match(a)[2],isUniform:m.match(a)[1]==="<uniform>",type:m.match(l)[1]}));if(!p)return{groups:[],structs:[]};const f=(i=(e=r.match(u))==null?void 0:e.map(m=>{const _=m.match(h)[1],g=m.match(c).reduce((b,v)=>{const[y,T]=v.split(":");return b[y.trim()]=T.trim(),b},{});return g?{name:_,members:g}:null}).filter(({name:m})=>p.some(_=>_.type===m)))!=null?i:[];return{groups:p,structs:f}}var Ne=(r=>(r[r.VERTEX=1]="VERTEX",r[r.FRAGMENT=2]="FRAGMENT",r[r.COMPUTE=4]="COMPUTE",r))(Ne||{});function zh({groups:r}){const t=[];for(let e=0;e<r.length;e++){const i=r[e];t[i.group]||(t[i.group]=[]),i.isUniform?t[i.group].push({binding:i.binding,visibility:Ne.VERTEX|Ne.FRAGMENT,buffer:{type:"uniform"}}):i.type==="sampler"?t[i.group].push({binding:i.binding,visibility:Ne.FRAGMENT,sampler:{type:"filtering"}}):i.type==="texture_2d"&&t[i.group].push({binding:i.binding,visibility:Ne.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}})}return t}function Vh({groups:r}){const t=[];for(let e=0;e<r.length;e++){const i=r[e];t[i.group]||(t[i.group]={}),t[i.group][i.name]=i.binding}return t}function Wh(r,t){const e=new Set,i=new Set,s=[...r.structs,...t.structs].filter(o=>e.has(o.name)?!1:(e.add(o.name),!0)),n=[...r.groups,...t.groups].filter(o=>{const a=`${o.name}-${o.binding}`;return i.has(a)?!1:(i.add(a),!0)});return{structs:s,groups:n}}const qn=Object.create(null);class _t{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;var e,i;const{fragment:s,vertex:n,layout:o,gpuLayout:a,name:l}=t;if(this.name=l,this.fragment=s,this.vertex=n,s.source===n.source){const u=Mi(s.source);this.structsAndGroups=u}else{const u=Mi(n.source),c=Mi(s.source);this.structsAndGroups=Wh(u,c)}this.layout=o!=null?o:Vh(this.structsAndGroups),this.gpuLayout=a!=null?a:zh(this.structsAndGroups),this.autoAssignGlobalUniforms=((e=this.layout[0])==null?void 0:e.globalUniforms)!==void 0,this.autoAssignLocalUniforms=((i=this.layout[1])==null?void 0:i.localUniforms)!==void 0,this._generateProgramKey()}_generateProgramKey(){const{vertex:t,fragment:e}=this,i=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=Le(i,"program")}get attributeData(){var t;return(t=this._attributeData)!=null||(this._attributeData=jh(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null}static from(t){const e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return qn[e]||(qn[e]=new _t(t)),qn[e]}}function Zn(r,t,e){if(r)for(const i in r){const s=i.toLocaleLowerCase(),n=t[s];if(n){let o=r[i];i==="header"&&(o=o.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&n.push(`//----${e}----//`),n.push(o)}}}const Yh=/\{\{(.*?)\}\}/g;function Qn(r){var t,e;const i={};return((e=(t=r.match(Yh))==null?void 0:t.map(s=>s.replace(/[{()}]/g,"")))!=null?e:[]).forEach(s=>{i[s]=[]}),i}function Kh(r,t){let e;const i=/@in\s+([^;]+);/g;for(;(e=i.exec(r))!==null;)t.push(e[1])}function Jn(r,t,e=!1){const i=[];Kh(t,i),r.forEach(a=>{a.header&&Kh(a.header,i)});const s=i;e&&s.sort();const n=s.map((a,l)=>` @location(${l}) ${a},`).join(`
|
|
28
|
+
`);let o=t.replace(/@in\s+[^;]+;\s*/g,"");return o=o.replace("{{in}}",`
|
|
29
|
+
${n}
|
|
30
|
+
`),o}function qh(r,t){let e;const i=/@out\s+([^;]+);/g;for(;(e=i.exec(r))!==null;)t.push(e[1])}function Ox(r){const t=/\b(\w+)\s*:/g.exec(r);return t?t[1]:""}function Gx(r){const t=/@.*?\s+/g;return r.replace(t,"")}function Zh(r,t){const e=[];qh(t,e),r.forEach(l=>{l.header&&qh(l.header,e)});let i=0;const s=e.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${i++}) ${l}`).join(`,
|
|
31
|
+
`),n=e.sort().map(l=>` var ${Gx(l)};`).join(`
|
|
32
|
+
`),o=`return VSOutput(
|
|
33
|
+
${e.sort().map(l=>` ${Ox(l)}`).join(`,
|
|
34
|
+
`)});`;let a=t.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`
|
|
35
|
+
${s}
|
|
36
|
+
`),a=a.replace("{{start}}",`
|
|
37
|
+
${n}
|
|
38
|
+
`),a=a.replace("{{return}}",`
|
|
39
|
+
${o}
|
|
40
|
+
`),a}function to(r,t){let e=r;for(const i in t){const s=t[i];s.join(`
|
|
41
|
+
`).length?e=e.replace(`{{${i}}}`,`//-----${i} START-----//
|
|
42
|
+
${s.join(`
|
|
43
|
+
`)}
|
|
44
|
+
//----${i} FINISH----//`):e=e.replace(`{{${i}}}`,"")}return e}const Te=Object.create(null),eo=new Map;let Bx=0;function Qh({template:r,bits:t}){const e=td(r,t);if(Te[e])return Te[e];const{vertex:i,fragment:s}=Ix(r,t);return Te[e]=ed(i,s,t),Te[e]}function Jh({template:r,bits:t}){const e=td(r,t);return Te[e]||(Te[e]=ed(r.vertex,r.fragment,t)),Te[e]}function Ix(r,t){const e=t.map(o=>o.vertex).filter(o=>!!o),i=t.map(o=>o.fragment).filter(o=>!!o);let s=Jn(e,r.vertex,!0);s=Zh(e,s);const n=Jn(i,r.fragment,!0);return{vertex:s,fragment:n}}function td(r,t){return t.map(e=>(eo.has(e)||eo.set(e,Bx++),eo.get(e))).sort((e,i)=>e-i).join("-")+r.vertex+r.fragment}function ed(r,t,e){const i=Qn(r),s=Qn(t);return e.forEach(n=>{Zn(n.vertex,i,n.name),Zn(n.fragment,s,n.name)}),{vertex:to(r,i),fragment:to(t,s)}}const rd=`
|
|
45
|
+
@in aPosition: vec2<f32>;
|
|
46
|
+
@in aUV: vec2<f32>;
|
|
47
|
+
|
|
48
|
+
@out @builtin(position) vPosition: vec4<f32>;
|
|
49
|
+
@out vUV : vec2<f32>;
|
|
50
|
+
@out vColor : vec4<f32>;
|
|
51
|
+
|
|
52
|
+
{{header}}
|
|
53
|
+
|
|
54
|
+
struct VSOutput {
|
|
55
|
+
{{struct}}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
@vertex
|
|
59
|
+
fn main( {{in}} ) -> VSOutput {
|
|
60
|
+
|
|
61
|
+
var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;
|
|
62
|
+
var modelMatrix = mat3x3<f32>(
|
|
63
|
+
1.0, 0.0, 0.0,
|
|
64
|
+
0.0, 1.0, 0.0,
|
|
65
|
+
0.0, 0.0, 1.0
|
|
66
|
+
);
|
|
67
|
+
var position = aPosition;
|
|
68
|
+
var uv = aUV;
|
|
69
|
+
|
|
70
|
+
{{start}}
|
|
71
|
+
|
|
72
|
+
vColor = vec4<f32>(1., 1., 1., 1.);
|
|
73
|
+
|
|
74
|
+
{{main}}
|
|
75
|
+
|
|
76
|
+
vUV = uv;
|
|
77
|
+
|
|
78
|
+
var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;
|
|
79
|
+
|
|
80
|
+
vPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0);
|
|
81
|
+
|
|
82
|
+
vColor *= globalUniforms.uWorldColorAlpha;
|
|
83
|
+
|
|
84
|
+
{{end}}
|
|
85
|
+
|
|
86
|
+
{{return}}
|
|
87
|
+
};
|
|
88
|
+
`,id=`
|
|
89
|
+
@in vUV : vec2<f32>;
|
|
90
|
+
@in vColor : vec4<f32>;
|
|
91
|
+
|
|
92
|
+
{{header}}
|
|
93
|
+
|
|
94
|
+
@fragment
|
|
95
|
+
fn main(
|
|
96
|
+
{{in}}
|
|
97
|
+
) -> @location(0) vec4<f32> {
|
|
98
|
+
|
|
99
|
+
{{start}}
|
|
100
|
+
|
|
101
|
+
var outColor:vec4<f32>;
|
|
102
|
+
|
|
103
|
+
{{main}}
|
|
104
|
+
|
|
105
|
+
var finalColor:vec4<f32> = outColor * vColor;
|
|
106
|
+
|
|
107
|
+
{{end}}
|
|
108
|
+
|
|
109
|
+
return finalColor;
|
|
110
|
+
};
|
|
111
|
+
`,sd=`
|
|
112
|
+
in vec2 aPosition;
|
|
113
|
+
in vec2 aUV;
|
|
114
|
+
|
|
115
|
+
out vec4 vColor;
|
|
116
|
+
out vec2 vUV;
|
|
117
|
+
|
|
118
|
+
{{header}}
|
|
119
|
+
|
|
120
|
+
void main(void){
|
|
121
|
+
|
|
122
|
+
mat3 worldTransformMatrix = uWorldTransformMatrix;
|
|
123
|
+
mat3 modelMatrix = mat3(
|
|
124
|
+
1.0, 0.0, 0.0,
|
|
125
|
+
0.0, 1.0, 0.0,
|
|
126
|
+
0.0, 0.0, 1.0
|
|
127
|
+
);
|
|
128
|
+
vec2 position = aPosition;
|
|
129
|
+
vec2 uv = aUV;
|
|
130
|
+
|
|
131
|
+
{{start}}
|
|
132
|
+
|
|
133
|
+
vColor = vec4(1.);
|
|
134
|
+
|
|
135
|
+
{{main}}
|
|
136
|
+
|
|
137
|
+
vUV = uv;
|
|
138
|
+
|
|
139
|
+
mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;
|
|
140
|
+
|
|
141
|
+
gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
142
|
+
|
|
143
|
+
vColor *= uWorldColorAlpha;
|
|
144
|
+
|
|
145
|
+
{{end}}
|
|
146
|
+
}
|
|
147
|
+
`,nd=`
|
|
148
|
+
|
|
149
|
+
in vec4 vColor;
|
|
150
|
+
in vec2 vUV;
|
|
151
|
+
|
|
152
|
+
out vec4 finalColor;
|
|
153
|
+
|
|
154
|
+
{{header}}
|
|
155
|
+
|
|
156
|
+
void main(void) {
|
|
157
|
+
|
|
158
|
+
{{start}}
|
|
159
|
+
|
|
160
|
+
vec4 outColor;
|
|
161
|
+
|
|
162
|
+
{{main}}
|
|
163
|
+
|
|
164
|
+
finalColor = outColor * vColor;
|
|
165
|
+
|
|
166
|
+
{{end}}
|
|
167
|
+
}
|
|
168
|
+
`,od={name:"global-uniforms-bit",vertex:{header:`
|
|
169
|
+
struct GlobalUniforms {
|
|
170
|
+
uProjectionMatrix:mat3x3<f32>,
|
|
171
|
+
uWorldTransformMatrix:mat3x3<f32>,
|
|
172
|
+
uWorldColorAlpha: vec4<f32>,
|
|
173
|
+
uResolution: vec2<f32>,
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
@group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
|
|
177
|
+
`}},Fx={name:"global-uniforms-ubo-bit",vertex:{header:`
|
|
178
|
+
uniform globalUniforms {
|
|
179
|
+
mat3 uProjectionMatrix;
|
|
180
|
+
mat3 uWorldTransformMatrix;
|
|
181
|
+
vec4 uWorldColorAlpha;
|
|
182
|
+
vec2 uResolution;
|
|
183
|
+
};
|
|
184
|
+
`}},ad={name:"global-uniforms-bit",vertex:{header:`
|
|
185
|
+
uniform mat3 uProjectionMatrix;
|
|
186
|
+
uniform mat3 uWorldTransformMatrix;
|
|
187
|
+
uniform vec4 uWorldColorAlpha;
|
|
188
|
+
uniform vec2 uResolution;
|
|
189
|
+
`}};var Dx=Object.defineProperty,ld=Object.getOwnPropertySymbols,Ux=Object.prototype.hasOwnProperty,kx=Object.prototype.propertyIsEnumerable,ud=(r,t,e)=>t in r?Dx(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,$x=(r,t)=>{for(var e in t||(t={}))Ux.call(t,e)&&ud(r,e,t[e]);if(ld)for(var e of ld(t))kx.call(t,e)&&ud(r,e,t[e]);return r};function He({bits:r,name:t}){const e=Qh({template:{fragment:id,vertex:rd},bits:[od,...r]});return _t.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Xe({bits:r,name:t}){return new Et($x({name:t},Jh({template:{vertex:sd,fragment:nd},bits:[ad,...r]})))}const Ci={name:"color-bit",vertex:{header:`
|
|
190
|
+
@in aColor: vec4<f32>;
|
|
191
|
+
`,main:`
|
|
192
|
+
vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
|
|
193
|
+
`}},Oi={name:"color-bit",vertex:{header:`
|
|
194
|
+
in vec4 aColor;
|
|
195
|
+
`,main:`
|
|
196
|
+
vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
|
|
197
|
+
`}},ro={};function Lx(r){const t=[];if(r===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 i=0;i<r;i++)t.push(`@group(1) @binding(${e++}) var textureSource${i+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${e++}) var textureSampler${i+1}: sampler;`)}return t.join(`
|
|
198
|
+
`)}function Nx(r){const t=[];if(r===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let e=0;e<r;e++)e===r-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(`
|
|
199
|
+
`)}function Gi(r){return ro[r]||(ro[r]={name:"texture-batch-bit",vertex:{header:`
|
|
200
|
+
@in aTextureIdAndRound: vec2<u32>;
|
|
201
|
+
@out @interpolate(flat) vTextureId : u32;
|
|
202
|
+
`,main:`
|
|
203
|
+
vTextureId = aTextureIdAndRound.y;
|
|
204
|
+
`,end:`
|
|
205
|
+
if(aTextureIdAndRound.x == 1)
|
|
206
|
+
{
|
|
207
|
+
vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
208
|
+
}
|
|
209
|
+
`},fragment:{header:`
|
|
210
|
+
@in @interpolate(flat) vTextureId: u32;
|
|
211
|
+
|
|
212
|
+
${Lx(r)}
|
|
213
|
+
`,main:`
|
|
214
|
+
var uvDx = dpdx(vUV);
|
|
215
|
+
var uvDy = dpdy(vUV);
|
|
216
|
+
|
|
217
|
+
${Nx(r)}
|
|
218
|
+
`}}),ro[r]}const io={};function Hx(r){const t=[];for(let e=0;e<r;e++)e>0&&t.push("else"),e<r-1&&t.push(`if(vTextureId < ${e}.5)`),t.push("{"),t.push(` outColor = texture(uTextures[${e}], vUV);`),t.push("}");return t.join(`
|
|
219
|
+
`)}function Bi(r){return io[r]||(io[r]={name:"texture-batch-bit",vertex:{header:`
|
|
220
|
+
in vec2 aTextureIdAndRound;
|
|
221
|
+
out float vTextureId;
|
|
222
|
+
|
|
223
|
+
`,main:`
|
|
224
|
+
vTextureId = aTextureIdAndRound.y;
|
|
225
|
+
`,end:`
|
|
226
|
+
if(aTextureIdAndRound.x == 1.)
|
|
227
|
+
{
|
|
228
|
+
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
229
|
+
}
|
|
230
|
+
`},fragment:{header:`
|
|
231
|
+
in float vTextureId;
|
|
232
|
+
|
|
233
|
+
uniform sampler2D uTextures[${r}];
|
|
234
|
+
|
|
235
|
+
`,main:`
|
|
236
|
+
|
|
237
|
+
${Hx(r)}
|
|
238
|
+
`}}),io[r]}const je={name:"round-pixels-bit",vertex:{header:`
|
|
239
|
+
fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
|
|
240
|
+
{
|
|
241
|
+
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
242
|
+
}
|
|
243
|
+
`}},ze={name:"round-pixels-bit",vertex:{header:`
|
|
244
|
+
vec2 roundPixels(vec2 position, vec2 targetSize)
|
|
245
|
+
{
|
|
246
|
+
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
247
|
+
}
|
|
248
|
+
`}},so=["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>"],cd=so.reduce((r,t)=>(r[t]=!0,r),{});function hd(r,t){switch(r){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 Xx=Object.defineProperty,dd=Object.getOwnPropertySymbols,jx=Object.prototype.hasOwnProperty,zx=Object.prototype.propertyIsEnumerable,pd=(r,t,e)=>t in r?Xx(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,fd=(r,t)=>{for(var e in t||(t={}))jx.call(t,e)&&pd(r,e,t[e]);if(dd)for(var e of dd(t))zx.call(t,e)&&pd(r,e,t[e]);return r};const md=class gy{constructor(t,e){this._touched=0,this.uid=Z("uniform"),this._resourceType="uniformGroup",this._resourceId=Z("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1;var i,s;e=fd(fd({},gy.defaultOptions),e),this.uniformStructures=t;const n={};for(const o in t){const a=t[o];if(a.name=o,a.size=(i=a.size)!=null?i:1,!cd[a.type])throw new Error(`Uniform type ${a.type} is not supported. Supported uniform types are: ${so.join(", ")}`);(s=a.value)!=null||(a.value=hd(a.type,a.size)),n[o]=a.value}this.uniforms=n,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Le(Object.keys(n).map(o=>`${o}-${t[o].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};md.defaultOptions={ubo:!1,isStatic:!1};let st=md;const gd={};function Ii(r){let t=gd[r];if(t)return t;const e=new Int32Array(r);for(let i=0;i<r;i++)e[i]=i;return t=gd[r]=new st({uTextures:{value:e,type:"i32",size:r}},{isStatic:!0}),t}var bt=(r=>(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.BOTH=3]="BOTH",r))(bt||{}),Vx=Object.defineProperty,Fi=Object.getOwnPropertySymbols,_d=Object.prototype.hasOwnProperty,bd=Object.prototype.propertyIsEnumerable,vd=(r,t,e)=>t in r?Vx(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Wx=(r,t)=>{for(var e in t||(t={}))_d.call(t,e)&&vd(r,e,t[e]);if(Fi)for(var e of Fi(t))bd.call(t,e)&&vd(r,e,t[e]);return r},Yx=(r,t)=>{var e={};for(var i in r)_d.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Fi)for(var i of Fi(r))t.indexOf(i)<0&&bd.call(r,i)&&(e[i]=r[i]);return e};class At extends mt{constructor(t){super(),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:i,groups:s,resources:n,compatibleRenderers:o,groupMap:a}=t;this.gpuProgram=e,this.glProgram=i,o===void 0&&(o=0,e&&(o|=bt.WEBGPU),i&&(o|=bt.WEBGL)),this.compatibleRenderers=o;const l={};if(!n&&!s&&(n={}),n&&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(const u in a)for(const c in a[u]){const h=a[u][c];l[h]={group:u,binding:c,name:h}}else if(e&&s&&!a){const u=e.structsAndGroups.groups;a={},u.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,l[c.name]=c})}else if(n){s={},a={},e&&e.structsAndGroups.groups.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,l[c.name]=c});let u=0;for(const c in n)l[c]||(s[99]||(s[99]=new Ht,this._ownedBindGroups.push(s[99])),l[c]={group:99,binding:u,name:c},a[99]=a[99]||{},a[99][u]=c,u++);for(const c in n){const h=c;let p=n[c];!p.source&&!p._resourceType&&(p=new st(p));const f=l[h];f&&(s[f.group]||(s[f.group]=new Ht,this._ownedBindGroups.push(s[f.group])),s[f.group].setResource(p,f.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,l)}addResource(t,e,i){var s,n;(s=this._uniformBindMap)[e]||(s[e]={}),(n=this._uniformBindMap[e])[i]||(n[i]=t),this.groups[e]||(this.groups[e]=new Ht,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){const i={};for(const s in e){const n=e[s];Object.defineProperty(i,n.name,{get(){return t[n.group].getResource(n.binding)},set(o){t[n.group].setResource(o,n.binding)}})}return i}destroy(t=!1){var e,i;this.emit("destroy",this),t&&((e=this.gpuProgram)==null||e.destroy(),(i=this.glProgram)==null||i.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(s=>{s.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){const e=t,{gpu:i,gl:s}=e,n=Yx(e,["gpu","gl"]);let o,a;return i&&(o=_t.from(i)),s&&(a=Et.from(s)),new At(Wx({gpuProgram:o,glProgram:a},n))}}class yd extends At{constructor(t){const e=Xe({name:"batch",bits:[Oi,Bi(t),ze]}),i=He({name:"batch",bits:[Ci,Gi(t),je]});super({glProgram:e,gpuProgram:i,resources:{batchSamplers:Ii(t)}})}}let xd=null;const Td=class _y extends Mh{constructor(){super(...arguments),this.geometry=new Oh,this.shader=xd||(xd=new yd(this.maxTextures)),this.name=_y.extension.name,this.vertexSize=6}packAttributes(t,e,i,s,n){const o=n<<16|t.roundPixels&65535,a=t.transform,l=a.a,u=a.b,c=a.c,h=a.d,p=a.tx,f=a.ty,{positions:m,uvs:_}=t,g=t.color,b=t.attributeOffset,v=b+t.attributeSize;for(let y=b;y<v;y++){const T=y*2,E=m[T],M=m[T+1];e[s++]=l*E+c*M+p,e[s++]=h*M+u*E+f,e[s++]=_[T],e[s++]=_[T+1],i[s++]=g,i[s++]=o}}packQuadAttributes(t,e,i,s,n){const o=t.texture,a=t.transform,l=a.a,u=a.b,c=a.c,h=a.d,p=a.tx,f=a.ty,m=t.bounds,_=m.maxX,g=m.minX,b=m.maxY,v=m.minY,y=o.uvs,T=t.color,E=n<<16|t.roundPixels&65535;e[s+0]=l*g+c*v+p,e[s+1]=h*v+u*g+f,e[s+2]=y.x0,e[s+3]=y.y0,i[s+4]=T,i[s+5]=E,e[s+6]=l*_+c*v+p,e[s+7]=h*v+u*_+f,e[s+8]=y.x1,e[s+9]=y.y1,i[s+10]=T,i[s+11]=E,e[s+12]=l*_+c*b+p,e[s+13]=h*b+u*_+f,e[s+14]=y.x2,e[s+15]=y.y2,i[s+16]=T,i[s+17]=E,e[s+18]=l*g+c*b+p,e[s+19]=h*b+u*g+f,e[s+20]=y.x3,e[s+21]=y.y3,i[s+22]=T,i[s+23]=E}};Td.extension={type:[x.Batcher],name:"default"};let Di=Td;const Sd={},Kx="8.0.0",Ed="8.3.4";function no(r,t,e=3){if(Sd[t])return;let i=new Error().stack;typeof i=="undefined"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
249
|
+
Deprecated since v${r}`):(i=i.split(`
|
|
250
|
+
`).splice(e).join(`
|
|
251
|
+
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
|
|
252
|
+
Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
253
|
+
Deprecated since v${r}`),console.warn(i))),Sd[t]=!0}function oo(r,t,e,i,s,n,o,a=null){let l=0;e*=t,s*=n;const u=a.a,c=a.b,h=a.c,p=a.d,f=a.tx,m=a.ty;for(;l<o;){const _=r[e],g=r[e+1];i[s]=u*_+h*g+f,i[s+1]=c*_+p*g+m,s+=n,e+=t,l++}}function ao(r,t,e,i){let s=0;for(t*=e;s<i;)r[t]=0,r[t+1]=0,t+=e,s++}function Ui(r,t,e,i,s){const n=t.a,o=t.b,a=t.c,l=t.d,u=t.tx,c=t.ty;e=e||0,i=i||2,s=s||r.length/i-e;let h=e*i;for(let p=0;p<s;p++){const f=r[h],m=r[h+1];r[h]=n*f+a*m+u,r[h+1]=o*f+l*m+c,h+=i}}function Ad(r,t){if(r===16777215||!t)return t;if(t===16777215||!r)return r;const e=r>>16&255,i=r>>8&255,s=r&255,n=t>>16&255,o=t>>8&255,a=t&255,l=e*n/255,u=i*o/255,c=s*a/255;return(l<<16)+(u<<8)+c}const qx=new G;class ki{constructor(){this.packAsQuad=!1,this.batcherName="default",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(){const t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,i=this.renderable;return i?Ad(e,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){var t;return((t=this.renderable)==null?void 0:t.groupTransform)||qx}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}reset(){this.applyTransform=!0,this.renderable=null}}var Zx=Object.defineProperty,Qx=Object.defineProperties,Jx=Object.getOwnPropertyDescriptors,Pd=Object.getOwnPropertySymbols,t1=Object.prototype.hasOwnProperty,e1=Object.prototype.propertyIsEnumerable,wd=(r,t,e)=>t in r?Zx(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,$i=(r,t)=>{for(var e in t||(t={}))t1.call(t,e)&&wd(r,e,t[e]);if(Pd)for(var e of Pd(t))e1.call(t,e)&&wd(r,e,t[e]);return r},Li=(r,t)=>Qx(r,Jx(t));const Zt={extension:{type:x.ShapeBuilder,name:"circle"},build(r,t){let e,i,s,n,o,a;if(r.type==="circle"){const T=r;e=T.x,i=T.y,o=a=T.radius,s=n=0}else if(r.type==="ellipse"){const T=r;e=T.x,i=T.y,o=T.halfWidth,a=T.halfHeight,s=n=0}else{const T=r,E=T.width/2,M=T.height/2;e=T.x+E,i=T.y+M,o=a=Math.max(0,Math.min(T.radius,Math.min(E,M))),s=E-o,n=M-a}if(!(o>=0&&a>=0&&s>=0&&n>=0))return t;const l=Math.ceil(2.3*Math.sqrt(o+a)),u=l*8+(s?4:0)+(n?4:0);if(u===0)return t;if(l===0)return t[0]=t[6]=e+s,t[1]=t[3]=i+n,t[2]=t[4]=e-s,t[5]=t[7]=i-n,t;let c=0,h=l*4+(s?2:0)+2,p=h,f=u,m=s+o,_=n,g=e+m,b=e-m,v=i+_;if(t[c++]=g,t[c++]=v,t[--h]=v,t[--h]=b,n){const T=i-_;t[p++]=b,t[p++]=T,t[--f]=T,t[--f]=g}for(let T=1;T<l;T++){const E=Math.PI/2*(T/l),M=s+Math.cos(E)*o,w=n+Math.sin(E)*a,C=e+M,S=e-M,A=i+w,H=i-w;t[c++]=C,t[c++]=A,t[--h]=A,t[--h]=S,t[p++]=S,t[p++]=H,t[--f]=H,t[--f]=C}m=s,_=n+a,g=e+m,b=e-m,v=i+_;const y=i-_;return t[c++]=g,t[c++]=v,t[--f]=y,t[--f]=g,s&&(t[c++]=b,t[c++]=v,t[--f]=y,t[--f]=b),t},triangulate(r,t,e,i,s,n){if(r.length===0)return;let o=0,a=0;for(let c=0;c<r.length;c+=2)o+=r[c],a+=r[c+1];o/=r.length/2,a/=r.length/2;let l=i;t[l*e]=o,t[l*e+1]=a;const u=l++;for(let c=0;c<r.length;c+=2)t[l*e]=r[c],t[l*e+1]=r[c+1],c>0&&(s[n++]=l,s[n++]=u,s[n++]=l-1),l++;s[n++]=u+1,s[n++]=u,s[n++]=l-1}},Rd=Li($i({},Zt),{extension:Li($i({},Zt.extension),{name:"ellipse"})}),Md=Li($i({},Zt),{extension:Li($i({},Zt.extension),{name:"roundedRectangle"})}),Cd=1e-4,lo=1e-4;function Od(r){const t=r.length;if(t<6)return 1;let e=0;for(let i=0,s=r[t-2],n=r[t-1];i<t;i+=2){const o=r[i],a=r[i+1];e+=(o-s)*(a+n),s=o,n=a}return e<0?-1:1}function Gd(r,t,e,i,s,n,o,a){const l=r-e*s,u=t-i*s,c=r+e*n,h=t+i*n;let p,f;o?(p=i,f=-e):(p=-i,f=e);const m=l+p,_=u+f,g=c+p,b=h+f;return a.push(m,_),a.push(g,b),2}function Se(r,t,e,i,s,n,o,a){const l=e-r,u=i-t;let c=Math.atan2(l,u),h=Math.atan2(s-r,n-t);a&&c<h?c+=Math.PI*2:!a&&c>h&&(h+=Math.PI*2);let p=c;const f=h-c,m=Math.abs(f),_=Math.sqrt(l*l+u*u),g=(15*m*Math.sqrt(_)/Math.PI>>0)+1,b=f/g;if(p+=b,a){o.push(r,t),o.push(e,i);for(let v=1,y=p;v<g;v++,y+=b)o.push(r,t),o.push(r+Math.sin(y)*_,t+Math.cos(y)*_);o.push(r,t),o.push(s,n)}else{o.push(e,i),o.push(r,t);for(let v=1,y=p;v<g;v++,y+=b)o.push(r+Math.sin(y)*_,t+Math.cos(y)*_),o.push(r,t);o.push(s,n),o.push(r,t)}return g*2}function Bd(r,t,e,i,s,n,o,a,l){const u=Cd;if(r.length===0)return;const c=t;let h=c.alignment;if(t.alignment!==.5){let K=Od(r);e&&(K*=-1),h=(h-.5)*K+.5}const p=new W(r[0],r[1]),f=new W(r[r.length-2],r[r.length-1]),m=i,_=Math.abs(p.x-f.x)<u&&Math.abs(p.y-f.y)<u;if(m){r=r.slice(),_&&(r.pop(),r.pop(),f.set(r[r.length-2],r[r.length-1]));const K=(p.x+f.x)*.5,he=(f.y+p.y)*.5;r.unshift(K,he),r.push(K,he)}const g=s,b=r.length/2;let v=r.length;const y=g.length/2,T=c.width/2,E=T*T,M=c.miterLimit*c.miterLimit;let w=r[0],C=r[1],S=r[2],A=r[3],H=0,X=0,R=-(C-A),B=w-S,q=0,it=0,Tt=Math.sqrt(R*R+B*B);R/=Tt,B/=Tt,R*=T,B*=T;const ly=h,F=(1-ly)*2,U=ly*2;m||(c.cap==="round"?v+=Se(w-R*(F-U)*.5,C-B*(F-U)*.5,w-R*F,C-B*F,w+R*U,C+B*U,g,!0)+2:c.cap==="square"&&(v+=Gd(w,C,R,B,F,U,!0,g))),g.push(w-R*F,C-B*F),g.push(w+R*U,C+B*U);for(let K=1;K<b-1;++K){w=r[(K-1)*2],C=r[(K-1)*2+1],S=r[K*2],A=r[K*2+1],H=r[(K+1)*2],X=r[(K+1)*2+1],R=-(C-A),B=w-S,Tt=Math.sqrt(R*R+B*B),R/=Tt,B/=Tt,R*=T,B*=T,q=-(A-X),it=S-H,Tt=Math.sqrt(q*q+it*it),q/=Tt,it/=Tt,q*=T,it*=T;const he=S-w,ri=C-A,ii=S-H,si=X-A,uy=he*ii+ri*si,tn=ri*ii-si*he,ni=tn<0;if(Math.abs(tn)<.001*Math.abs(uy)){g.push(S-R*F,A-B*F),g.push(S+R*U,A+B*U),uy>=0&&(c.join==="round"?v+=Se(S,A,S-R*F,A-B*F,S-q*F,A-it*F,g,!1)+4:v+=2,g.push(S-q*U,A-it*U),g.push(S+q*F,A+it*F));continue}const cy=(-R+w)*(-B+A)-(-R+S)*(-B+C),hy=(-q+H)*(-it+A)-(-q+S)*(-it+X),en=(he*hy-ii*cy)/tn,rn=(si*cy-ri*hy)/tn,wu=(en-S)*(en-S)+(rn-A)*(rn-A),Me=S+(en-S)*F,Ce=A+(rn-A)*F,Oe=S-(en-S)*U,Ge=A-(rn-A)*U,PR=Math.min(he*he+ri*ri,ii*ii+si*si),dy=ni?F:U,wR=PR+dy*dy*E;wu<=wR?c.join==="bevel"||wu/E>M?(ni?(g.push(Me,Ce),g.push(S+R*U,A+B*U),g.push(Me,Ce),g.push(S+q*U,A+it*U)):(g.push(S-R*F,A-B*F),g.push(Oe,Ge),g.push(S-q*F,A-it*F),g.push(Oe,Ge)),v+=2):c.join==="round"?ni?(g.push(Me,Ce),g.push(S+R*U,A+B*U),v+=Se(S,A,S+R*U,A+B*U,S+q*U,A+it*U,g,!0)+4,g.push(Me,Ce),g.push(S+q*U,A+it*U)):(g.push(S-R*F,A-B*F),g.push(Oe,Ge),v+=Se(S,A,S-R*F,A-B*F,S-q*F,A-it*F,g,!1)+4,g.push(S-q*F,A-it*F),g.push(Oe,Ge)):(g.push(Me,Ce),g.push(Oe,Ge)):(g.push(S-R*F,A-B*F),g.push(S+R*U,A+B*U),c.join==="round"?ni?v+=Se(S,A,S+R*U,A+B*U,S+q*U,A+it*U,g,!0)+2:v+=Se(S,A,S-R*F,A-B*F,S-q*F,A-it*F,g,!1)+2:c.join==="miter"&&wu/E<=M&&(ni?(g.push(Oe,Ge),g.push(Oe,Ge)):(g.push(Me,Ce),g.push(Me,Ce)),v+=2),g.push(S-q*F,A-it*F),g.push(S+q*U,A+it*U),v+=2)}w=r[(b-2)*2],C=r[(b-2)*2+1],S=r[(b-1)*2],A=r[(b-1)*2+1],R=-(C-A),B=w-S,Tt=Math.sqrt(R*R+B*B),R/=Tt,B/=Tt,R*=T,B*=T,g.push(S-R*F,A-B*F),g.push(S+R*U,A+B*U),m||(c.cap==="round"?v+=Se(S-R*(F-U)*.5,A-B*(F-U)*.5,S-R*F,A-B*F,S+R*U,A+B*U,g,!1)+2:c.cap==="square"&&(v+=Gd(S,A,R,B,F,U,!1,g)));const AR=lo*lo;for(let K=y;K<v+y-2;++K)w=g[K*2],C=g[K*2+1],S=g[(K+1)*2],A=g[(K+1)*2+1],H=g[(K+2)*2],X=g[(K+2)*2+1],!(Math.abs(w*(A-X)+S*(X-C)+H*(C-A))<AR)&&a.push(K,K+1,K+2)}var Ni={exports:{}},DR=Ni.exports;Ni.exports=Hi;var UR=Ni.exports.default=Hi;function Hi(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,n=Id(r,0,s,e,!0),o=[];if(!n||n.next===n.prev)return o;var a,l,u,c,h,p,f;if(i&&(n=o1(r,t,n,e)),r.length>80*e){a=u=r[0],l=c=r[1];for(var m=e;m<s;m+=e)h=r[m],p=r[m+1],h<a&&(a=h),p<l&&(l=p),h>u&&(u=h),p>c&&(c=p);f=Math.max(u-a,c-l),f=f!==0?32767/f:0}return Ar(n,o,e,a,l,f,0),o}function Id(r,t,e,i,s){var n,o;if(s===ho(r,t,e,i)>0)for(n=t;n<e;n+=i)o=Ud(n,r[n],r[n+1],o);else for(n=e-i;n>=t;n-=i)o=Ud(n,r[n],r[n+1],o);return o&&Xi(o,o.next)&&(wr(o),o=o.next),o}function Ee(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(Xi(e,e.next)||J(e.prev,e,e.next)===0)){if(wr(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Ar(r,t,e,i,s,n,o){if(r){!o&&n&&h1(r,i,s,n);for(var a=r,l,u;r.prev!==r.next;){if(l=r.prev,u=r.next,n?i1(r,i,s,n):r1(r)){t.push(l.i/e|0),t.push(r.i/e|0),t.push(u.i/e|0),wr(r),r=u.next,a=u.next;continue}if(r=u,r===a){o?o===1?(r=s1(Ee(r),t,e),Ar(r,t,e,i,s,n,2)):o===2&&n1(r,t,e,i,s,n):Ar(Ee(r),t,e,i,s,n,1);break}}}}function r1(r){var t=r.prev,e=r,i=r.next;if(J(t,e,i)>=0)return!1;for(var s=t.x,n=e.x,o=i.x,a=t.y,l=e.y,u=i.y,c=s<n?s<o?s:o:n<o?n:o,h=a<l?a<u?a:u:l<u?l:u,p=s>n?s>o?s:o:n>o?n:o,f=a>l?a>u?a:u:l>u?l:u,m=i.next;m!==t;){if(m.x>=c&&m.x<=p&&m.y>=h&&m.y<=f&&Ve(s,a,n,l,o,u,m.x,m.y)&&J(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function i1(r,t,e,i){var s=r.prev,n=r,o=r.next;if(J(s,n,o)>=0)return!1;for(var a=s.x,l=n.x,u=o.x,c=s.y,h=n.y,p=o.y,f=a<l?a<u?a:u:l<u?l:u,m=c<h?c<p?c:p:h<p?h:p,_=a>l?a>u?a:u:l>u?l:u,g=c>h?c>p?c:p:h>p?h:p,b=uo(f,m,t,e,i),v=uo(_,g,t,e,i),y=r.prevZ,T=r.nextZ;y&&y.z>=b&&T&&T.z<=v;){if(y.x>=f&&y.x<=_&&y.y>=m&&y.y<=g&&y!==s&&y!==o&&Ve(a,c,l,h,u,p,y.x,y.y)&&J(y.prev,y,y.next)>=0||(y=y.prevZ,T.x>=f&&T.x<=_&&T.y>=m&&T.y<=g&&T!==s&&T!==o&&Ve(a,c,l,h,u,p,T.x,T.y)&&J(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;y&&y.z>=b;){if(y.x>=f&&y.x<=_&&y.y>=m&&y.y<=g&&y!==s&&y!==o&&Ve(a,c,l,h,u,p,y.x,y.y)&&J(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;T&&T.z<=v;){if(T.x>=f&&T.x<=_&&T.y>=m&&T.y<=g&&T!==s&&T!==o&&Ve(a,c,l,h,u,p,T.x,T.y)&&J(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function s1(r,t,e){var i=r;do{var s=i.prev,n=i.next.next;!Xi(s,n)&&Fd(s,i,i.next,n)&&Pr(s,n)&&Pr(n,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),wr(i),wr(i.next),i=r=n),i=i.next}while(i!==r);return Ee(i)}function n1(r,t,e,i,s,n){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&f1(o,a)){var l=Dd(o,a);o=Ee(o,o.next),l=Ee(l,l.next),Ar(o,t,e,i,s,n,0),Ar(l,t,e,i,s,n,0);return}a=a.next}o=o.next}while(o!==r)}function o1(r,t,e,i){var s=[],n,o,a,l,u;for(n=0,o=t.length;n<o;n++)a=t[n]*i,l=n<o-1?t[n+1]*i:r.length,u=Id(r,a,l,i,!1),u===u.next&&(u.steiner=!0),s.push(p1(u));for(s.sort(a1),n=0;n<s.length;n++)e=l1(s[n],e);return e}function a1(r,t){return r.x-t.x}function l1(r,t){var e=u1(r,t);if(!e)return t;var i=Dd(e,r);return Ee(i,i.next),Ee(e,e.next)}function u1(r,t){var e=t,i=r.x,s=r.y,n=-1/0,o;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<=i&&a>n&&(n=a,o=e.x<e.next.x?e:e.next,a===i))return o}e=e.next}while(e!==t);if(!o)return null;var l=o,u=o.x,c=o.y,h=1/0,p;e=o;do i>=e.x&&e.x>=u&&i!==e.x&&Ve(s<c?i:n,s,u,c,s<c?n:i,s,e.x,e.y)&&(p=Math.abs(s-e.y)/(i-e.x),Pr(e,r)&&(p<h||p===h&&(e.x>o.x||e.x===o.x&&c1(o,e)))&&(o=e,h=p)),e=e.next;while(e!==l);return o}function c1(r,t){return J(r.prev,r,t.prev)<0&&J(t.next,r,r.next)<0}function h1(r,t,e,i){var s=r;do s.z===0&&(s.z=uo(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,d1(s)}function d1(r){var t,e,i,s,n,o,a,l,u=1;do{for(e=r,r=null,n=null,o=0;e;){for(o++,i=e,a=0,t=0;t<u&&(a++,i=i.nextZ,!!i);t++);for(l=u;a>0||l>0&&i;)a!==0&&(l===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,a--):(s=i,i=i.nextZ,l--),n?n.nextZ=s:r=s,s.prevZ=n,n=s;e=i}n.nextZ=null,u*=2}while(o>1);return r}function uo(r,t,e,i,s){return r=(r-e)*s|0,t=(t-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function p1(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function Ve(r,t,e,i,s,n,o,a){return(s-o)*(t-a)>=(r-o)*(n-a)&&(r-o)*(i-a)>=(e-o)*(t-a)&&(e-o)*(n-a)>=(s-o)*(i-a)}function f1(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!m1(r,t)&&(Pr(r,t)&&Pr(t,r)&&g1(r,t)&&(J(r.prev,r,t.prev)||J(r,t.prev,t))||Xi(r,t)&&J(r.prev,r,r.next)>0&&J(t.prev,t,t.next)>0)}function J(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Xi(r,t){return r.x===t.x&&r.y===t.y}function Fd(r,t,e,i){var s=zi(J(r,t,e)),n=zi(J(r,t,i)),o=zi(J(e,i,r)),a=zi(J(e,i,t));return!!(s!==n&&o!==a||s===0&&ji(r,e,t)||n===0&&ji(r,i,t)||o===0&&ji(e,r,i)||a===0&&ji(e,t,i))}function ji(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function zi(r){return r>0?1:r<0?-1:0}function m1(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Fd(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Pr(r,t){return J(r.prev,r,r.next)<0?J(r,t,r.next)>=0&&J(r,r.prev,t)>=0:J(r,t,r.prev)<0||J(r,r.next,t)<0}function g1(r,t){var e=r,i=!1,s=(r.x+t.x)/2,n=(r.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&s<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==r);return i}function Dd(r,t){var e=new co(r.i,r.x,r.y),i=new co(t.i,t.x,t.y),s=r.next,n=t.prev;return r.next=t,t.prev=r,e.next=s,s.prev=e,i.next=e,e.prev=i,n.next=i,i.prev=n,i}function Ud(r,t,e,i){var s=new co(r,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function wr(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function co(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Hi.deviation=function(r,t,e,i){var s=t&&t.length,n=s?t[0]*e:r.length,o=Math.abs(ho(r,0,n,e));if(s)for(var a=0,l=t.length;a<l;a++){var u=t[a]*e,c=a<l-1?t[a+1]*e:r.length;o-=Math.abs(ho(r,u,c,e))}var h=0;for(a=0;a<i.length;a+=3){var p=i[a]*e,f=i[a+1]*e,m=i[a+2]*e;h+=Math.abs((r[p]-r[m])*(r[f+1]-r[p+1])-(r[p]-r[f])*(r[m+1]-r[p+1]))}return o===0&&h===0?0:Math.abs((h-o)/o)};function ho(r,t,e,i){for(var s=0,n=t,o=e-i;n<e;n+=i)s+=(r[o]-r[n])*(r[n+1]+r[o+1]),o=n;return s}Hi.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,s=0;s<r.length;s++){for(var n=0;n<r[s].length;n++)for(var o=0;o<t;o++)e.vertices.push(r[s][n][o]);s>0&&(i+=r[s-1].length,e.holes.push(i))}return e};var _1=Ni.exports,kd=an(_1);function po(r,t,e,i,s,n,o){const a=kd(r,t,2);if(!a)return;for(let u=0;u<a.length;u+=3)n[o++]=a[u]+s,n[o++]=a[u+1]+s,n[o++]=a[u+2]+s;let l=s*i;for(let u=0;u<r.length;u+=2)e[l]=r[u],e[l+1]=r[u+1],l+=i}const b1=[],fo={extension:{type:x.ShapeBuilder,name:"polygon"},build(r,t){for(let e=0;e<r.points.length;e++)t[e]=r.points[e];return t},triangulate(r,t,e,i,s,n){po(r,b1,t,e,i,s,n)}},mo={extension:{type:x.ShapeBuilder,name:"rectangle"},build(r,t){const e=r,i=e.x,s=e.y,n=e.width,o=e.height;return n>=0&&o>=0&&(t[0]=i,t[1]=s,t[2]=i+n,t[3]=s,t[4]=i+n,t[5]=s+o,t[6]=i,t[7]=s+o),t},triangulate(r,t,e,i,s,n){let o=0;i*=e,t[i+o]=r[0],t[i+o+1]=r[1],o+=e,t[i+o]=r[2],t[i+o+1]=r[3],o+=e,t[i+o]=r[6],t[i+o+1]=r[7],o+=e,t[i+o]=r[4],t[i+o+1]=r[5],o+=e;const a=i/e;s[n++]=a,s[n++]=a+1,s[n++]=a+2,s[n++]=a+1,s[n++]=a+3,s[n++]=a+2}},go={extension:{type:x.ShapeBuilder,name:"triangle"},build(r,t){return t[0]=r.x,t[1]=r.y,t[2]=r.x2,t[3]=r.y2,t[4]=r.x3,t[5]=r.y3,t},triangulate(r,t,e,i,s,n){let o=0;i*=e,t[i+o]=r[0],t[i+o+1]=r[1],o+=e,t[i+o]=r[2],t[i+o+1]=r[3],o+=e,t[i+o]=r[4],t[i+o+1]=r[5];const a=i/e;s[n++]=a,s[n++]=a+1,s[n++]=a+2}},Rr={};D.handleByMap(x.ShapeBuilder,Rr),D.add(mo,fo,go,Zt,Rd,Md);const v1=new V;function $d(r,t){const{geometryData:e,batches:i}=t;i.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<r.instructions.length;s++){const n=r.instructions[s];if(n.action==="texture")y1(n.data,i,e);else if(n.action==="fill"||n.action==="stroke"){const o=n.action==="stroke",a=n.data.path.shapePath,l=n.data.style,u=n.data.hole;o&&u&&Ld(u.shapePath,l,null,!0,i,e),Ld(a,l,u,o,i,e)}}}function y1(r,t,e){const{vertices:i,uvs:s,indices:n}=e,o=n.length,a=i.length/2,l=[],u=Rr.rectangle,c=v1,h=r.image;c.x=r.dx,c.y=r.dy,c.width=r.dw,c.height=r.dh;const p=r.transform;u.build(c,l),p&&Ui(l,p),u.triangulate(l,i,2,a,n,o);const f=h.uvs;s.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);const m=N.get(ki);m.indexOffset=o,m.indexSize=n.length-o,m.attributeOffset=a,m.attributeSize=i.length/2-a,m.baseColor=r.style,m.alpha=r.alpha,m.texture=h,m.geometryData=e,t.push(m)}function Ld(r,t,e,i,s,n){const{vertices:o,uvs:a,indices:l}=n,u=r.shapePrimitives.length-1;r.shapePrimitives.forEach(({shape:c,transform:h},p)=>{var f;const m=l.length,_=o.length/2,g=[],b=Rr[c.type];if(b.build(c,g),h&&Ui(g,h),i){const E=(f=c.closePath)!=null?f:!0;Bd(g,t,!1,E,o,2,_,l,m)}else if(e&&u===p){u!==0&&console.warn("[Pixi Graphics] only the last shape have be cut out");const E=[],M=g.slice();x1(e.shapePath).forEach(w=>{E.push(M.length/2),M.push(...w)}),po(M,E,o,2,_,l,m)}else b.triangulate(g,o,2,_,l,m);const v=a.length/2,y=t.texture;if(y!==P.WHITE){const E=t.matrix;E&&(h&&E.append(h.clone().invert()),oo(o,2,_,a,v,2,o.length/2-_,E))}else ao(a,v,2,o.length/2-_);const T=N.get(ki);T.indexOffset=m,T.indexSize=l.length-m,T.attributeOffset=_,T.attributeSize=o.length/2-_,T.baseColor=t.color,T.alpha=t.alpha,T.texture=y,T.geometryData=n,s.push(T)})}function x1(r){if(!r)return[];const t=r.shapePrimitives,e=[];for(let i=0;i<t.length;i++){const s=t[i].shape,n=[];Rr[s.type].build(s,n),e.push(n)}return e}class Nd{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}}class Hd{constructor(){this.batcher=new Di,this.instructions=new _n}init(){this.instructions.reset()}get geometry(){return no(Ed,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}}const _o=class Cu{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){var e;Cu.defaultOptions.bezierSmoothness=(e=t==null?void 0:t.bezierSmoothness)!=null?e:Cu.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),$d(t,e);const i=t.batchMode;t.customShader||i==="no-batch"?e.isBatchable=!1:i==="auto"&&(e.isBatchable=e.geometryData.vertices.length<400),t.dirty=!1}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){const e=N.get(Hd),{batches:i,geometryData:s}=this._gpuContextHash[t.uid],n=s.vertices.length,o=s.indices.length;for(let c=0;c<i.length;c++)i[c].applyTransform=!1;const a=e.batcher;a.ensureAttributeBuffer(n),a.ensureIndexBuffer(o),a.begin();for(let c=0;c<i.length;c++){const h=i[c];a.add(h)}a.finish(e.instructions);const l=a.geometry;l.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),l.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);const u=a.batches;for(let c=0;c<u.length;c++){const h=u[c];h.bindGroup=Pi(h.textures.textures,h.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){const e=new Nd;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){const e=this._gpuContextHash[t.uid];e.isBatchable||this._graphicsDataContextHash[t.uid]&&(N.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(i=>{N.return(i)})}destroy(){for(const t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};_o.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"graphicsContext"},_o.defaultOptions={bezierSmoothness:.5};let Vi=_o;const T1={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},bo=0,vo=1,yo=2,xo=3,To=4,So=5,Eo=class by{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<bo)}set blend(t){!!(this.data&1<<bo)!==t&&(this.data^=1<<bo)}get offsets(){return!!(this.data&1<<vo)}set offsets(t){!!(this.data&1<<vo)!==t&&(this.data^=1<<vo)}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<<yo)}set culling(t){!!(this.data&1<<yo)!==t&&(this.data^=1<<yo)}get depthTest(){return!!(this.data&1<<xo)}set depthTest(t){!!(this.data&1<<xo)!==t&&(this.data^=1<<xo)}get depthMask(){return!!(this.data&1<<So)}set depthMask(t){!!(this.data&1<<So)!==t&&(this.data^=1<<So)}get clockwiseFrontFace(){return!!(this.data&1<<To)}set clockwiseFrontFace(t){!!(this.data&1<<To)!==t&&(this.data^=1<<To)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=T1[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new by;return t.depthTest=!1,t.blend=!0,t}};Eo.default2d=Eo.for2d();let Pt=Eo;function S1(r,t,e,i){e[i++]=(r>>16&255)/255,e[i++]=(r>>8&255)/255,e[i++]=(r&255)/255,e[i++]=t}function We(r,t,e){const i=(r>>24&255)/255;t[e++]=(r&255)/255*i,t[e++]=(r>>8&255)/255*i,t[e++]=(r>>16&255)/255*i,t[e++]=i}class Ao{constructor(t,e){this.state=Pt.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){const e=t.context,i=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return!!(s.isBatchable||i!==s.isBatchable)}addRenderable(t,e){const i=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),i.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){const e=this._graphicsBatchesHash[t.uid];if(e)for(let i=0;i<e.length;i++){const s=e[i];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;const e=this.renderer,i=t.context;if(!e.graphicsContext.getGpuContext(i).batches.length)return;const s=i.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;const n=s.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,We(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){const e=!!this._graphicsBatchesHash[t.uid],i=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),i.isBatchable&&this._initBatchesForRenderable(t),t.batched=i.isBatchable}_addToBatcher(t,e){const i=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let n=0;n<s.length;n++){const o=s[n];i.addToBatch(o,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){const e=t.context,i=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,n=i.batches.map(o=>{const a=N.get(ki);return o.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]=n,n}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach(e=>{N.return(e)}),this._graphicsBatchesHash[t]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(const t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null}}Ao.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"graphics"},D.add(Ao),D.add(Vi);class Wi{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}get uvs(){const t=this.geometry.getBuffer("aUV"),e=t.data;let i=e;const s=this.texture.textureMatrix;return s.isSimple||(i=this._transformedUvs,(this._textureMatrixUpdateId!==s._updateID||this._uvUpdateId!==t._updateID)&&((!i||i.length<e.length)&&(i=this._transformedUvs=new Float32Array(e.length)),this._textureMatrixUpdateId=s._updateID,this._uvUpdateId=t._updateID,s.multiplyUvs(e,i))),i}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}}class Po{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 Ht({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){const e=this._getMeshData(t),i=e.batched,s=t.batched;if(e.batched=s,i!==s)return!0;if(s){const n=t._geometry;if(n.indices.length!==e.indexSize||n.positions.length!==e.vertexSize)return e.indexSize=n.indices.length,e.vertexSize=n.positions.length,!0;const o=this._getBatchableMesh(t),a=t.texture;if(o.texture._source!==a._source&&o.texture._source!==a._source)return!o._batcher.checkAndUpdateTexture(o,a)}return!1}addRenderable(t,e){const i=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){const n=this._getBatchableMesh(t);n.texture=t._texture,n.geometry=t._geometry,i.addToBatch(n,e)}else i.break(e),e.add(t)}updateRenderable(t){if(t.batched){const e=this._gpuBatchableMeshHash[t.uid];e.texture=t._texture,e.geometry=t._geometry,e._batcher.updateElement(e)}}destroyRenderable(t){this._meshDataHash[t.uid]=null;const e=this._gpuBatchableMeshHash[t.uid];e&&(N.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=$e(t.groupBlendMode,t.texture._source);const e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),We(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){var e,i;return this._meshDataHash[t.uid]={batched:t.batched,indexSize:(e=t._geometry.indices)==null?void 0:e.length,vertexSize:(i=t._geometry.positions)==null?void 0:i.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){const e=N.get(Wi);return e.renderable=t,e.texture=t._texture,e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e,e}destroy(){for(const t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&N.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}}Po.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"mesh"},D.add(Po);class Xd{execute(t,e){const i=t.state,s=t.renderer,n=e.shader||t.defaultShader;n.resources.uTexture=e.texture._source,n.resources.uniforms=t.localUniforms;const o=s.gl,a=t.getBuffers(e);s.shader.bind(n),s.state.set(i),s.geometry.bind(a.geometry,n.glProgram);const l=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;o.drawElements(o.TRIANGLES,e.particleChildren.length*6,l,0)}}function wo(r,t=null){const e=r*6;if(e>65535?t=t||new Uint32Array(e):t=t||new Uint16Array(e),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let i=0,s=0;i<e;i+=6,s+=4)t[i+0]=s+0,t[i+1]=s+1,t[i+2]=s+2,t[i+3]=s+0,t[i+4]=s+2,t[i+5]=s+3;return t}function jd(r){return{dynamicUpdate:zd(r,!0),staticUpdate:zd(r,!1)}}function zd(r,t){const e=[];e.push(`
|
|
254
|
+
|
|
255
|
+
var index = 0;
|
|
256
|
+
|
|
257
|
+
for (let i = 0; i < ps.length; ++i)
|
|
258
|
+
{
|
|
259
|
+
const p = ps[i];
|
|
260
|
+
|
|
261
|
+
`);let i=0;for(const n in r){const o=r[n];if(t!==o.dynamic)continue;e.push(`offset = index + ${i}`),e.push(o.code);const a=qt(o.format);i+=a.stride/4}e.push(`
|
|
262
|
+
index += stride * 4;
|
|
263
|
+
}
|
|
264
|
+
`),e.unshift(`
|
|
265
|
+
var stride = ${i};
|
|
266
|
+
`);const s=e.join(`
|
|
267
|
+
`);return new Function("ps","f32v","u32v",s)}class Vd{constructor(t){this._size=0,this._generateParticleUpdateCache={};var e;const i=this._size=(e=t.size)!=null?e:1e3,s=t.properties;let n=0,o=0;for(const h in s){const p=s[h],f=qt(p.format);p.dynamic?o+=f.stride:n+=f.stride}this._dynamicStride=o/4,this._staticStride=n/4,this.staticAttributeBuffer=new ye(i*4*n),this.dynamicAttributeBuffer=new ye(i*4*o),this.indexBuffer=wo(i);const a=new xe;let l=0,u=0;this._staticBuffer=new dt({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:$.VERTEX|$.COPY_DST}),this._dynamicBuffer=new dt({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:$.VERTEX|$.COPY_DST});for(const h in s){const p=s[h],f=qt(p.format);p.dynamic?(a.addAttribute(p.attributeName,{buffer:this._dynamicBuffer,stride:this._dynamicStride*4,offset:l*4,format:p.format}),l+=f.size):(a.addAttribute(p.attributeName,{buffer:this._staticBuffer,stride:this._staticStride*4,offset:u*4,format:p.format}),u+=f.size)}a.addIndex(this.indexBuffer);const c=this.getParticleUpdate(s);this._dynamicUpload=c.dynamicUpdate,this._staticUpload=c.staticUpdate,this.geometry=a}getParticleUpdate(t){const e=E1(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return jd(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new ye(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new ye(this._size*this._dynamicStride*4*4),this.indexBuffer=wo(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));const i=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,i.float32View,i.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,t.length*this._dynamicStride*4,!0),e){const 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()}}function E1(r){const t=[];for(const e in r){const i=r[e];t.push(e,i.code,i.dynamic?"d":"s")}return t.join("_")}var Wd=`varying vec2 vUV;
|
|
268
|
+
varying vec4 vColor;
|
|
269
|
+
|
|
270
|
+
uniform sampler2D uTexture;
|
|
271
|
+
|
|
272
|
+
void main(void){
|
|
273
|
+
vec4 color = texture2D(uTexture, vUV) * vColor;
|
|
274
|
+
gl_FragColor = color;
|
|
275
|
+
}`,Yd=`attribute vec2 aVertex;
|
|
276
|
+
attribute vec2 aUV;
|
|
277
|
+
attribute vec4 aColor;
|
|
278
|
+
|
|
279
|
+
attribute vec2 aPosition;
|
|
280
|
+
attribute float aRotation;
|
|
281
|
+
|
|
282
|
+
uniform mat3 uTranslationMatrix;
|
|
283
|
+
uniform float uRound;
|
|
284
|
+
uniform vec2 uResolution;
|
|
285
|
+
uniform vec4 uColor;
|
|
286
|
+
|
|
287
|
+
varying vec2 vUV;
|
|
288
|
+
varying vec4 vColor;
|
|
289
|
+
|
|
290
|
+
vec2 roundPixels(vec2 position, vec2 targetSize)
|
|
291
|
+
{
|
|
292
|
+
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
void main(void){
|
|
296
|
+
float cosRotation = cos(aRotation);
|
|
297
|
+
float sinRotation = sin(aRotation);
|
|
298
|
+
float x = aVertex.x * cosRotation - aVertex.y * sinRotation;
|
|
299
|
+
float y = aVertex.x * sinRotation + aVertex.y * cosRotation;
|
|
300
|
+
|
|
301
|
+
vec2 v = vec2(x, y);
|
|
302
|
+
v = v + aPosition;
|
|
303
|
+
|
|
304
|
+
gl_Position = vec4((uTranslationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
|
|
305
|
+
|
|
306
|
+
if(uRound == 1.0)
|
|
307
|
+
{
|
|
308
|
+
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
vUV = aUV;
|
|
312
|
+
vColor = aColor * uColor;
|
|
313
|
+
}
|
|
314
|
+
`,Ro=`
|
|
315
|
+
struct ParticleUniforms {
|
|
316
|
+
uProjectionMatrix:mat3x3<f32>,
|
|
317
|
+
uResolution:vec2<f32>,
|
|
318
|
+
uRoundPixels:f32,
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
@group(0) @binding(0) var<uniform> uniforms: ParticleUniforms;
|
|
322
|
+
|
|
323
|
+
@group(1) @binding(0) var uTexture: texture_2d<f32>;
|
|
324
|
+
@group(1) @binding(1) var uSampler : sampler;
|
|
325
|
+
|
|
326
|
+
struct VSOutput {
|
|
327
|
+
@builtin(position) position: vec4<f32>,
|
|
328
|
+
@location(0) uv : vec2<f32>,
|
|
329
|
+
@location(1) color : vec4<f32>,
|
|
330
|
+
};
|
|
331
|
+
@vertex
|
|
332
|
+
fn mainVertex(
|
|
333
|
+
@location(0) aVertex: vec2<f32>,
|
|
334
|
+
@location(1) aPosition: vec2<f32>,
|
|
335
|
+
@location(2) aUV: vec2<f32>,
|
|
336
|
+
@location(3) aColor: vec4<f32>,
|
|
337
|
+
@location(4) aRotation: f32,
|
|
338
|
+
) -> VSOutput {
|
|
339
|
+
|
|
340
|
+
let v = vec2(
|
|
341
|
+
aVertex.x * cos(aRotation) - aVertex.y * sin(aRotation),
|
|
342
|
+
aVertex.x * sin(aRotation) + aVertex.y * cos(aRotation)
|
|
343
|
+
) + aPosition;
|
|
344
|
+
|
|
345
|
+
let position = vec4((uniforms.uProjectionMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
|
|
346
|
+
|
|
347
|
+
return VSOutput(
|
|
348
|
+
position,
|
|
349
|
+
aUV,
|
|
350
|
+
aColor,
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
@fragment
|
|
355
|
+
fn mainFragment(
|
|
356
|
+
@location(0) uv: vec2<f32>,
|
|
357
|
+
@location(1) color: vec4<f32>,
|
|
358
|
+
@builtin(position) position: vec4<f32>,
|
|
359
|
+
) -> @location(0) vec4<f32> {
|
|
360
|
+
|
|
361
|
+
var sample = textureSample(uTexture, uSampler, uv) * color;
|
|
362
|
+
|
|
363
|
+
return sample;
|
|
364
|
+
}`;class Kd extends At{constructor(){const t=Et.from({vertex:Yd,fragment:Wd}),e=_t.from({fragment:{source:Ro,entryPoint:"mainFragment"},vertex:{source:Ro,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:P.WHITE.source,uSampler:new On({}),uniforms:{uTranslationMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new j(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}class Mo{constructor(t,e){this.state=Pt.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 Kd,this.state=Pt.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 Vd({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){const e=t.particleChildren;if(e.length===0)return;const i=this.renderer,s=this.getBuffers(t);t.texture||(t.texture=e[0].texture);const n=this.state;s.update(e,t._childrenDirty),t._childrenDirty=!1,n.blendMode=$e(t.blendMode,t.texture._source);const o=this.localUniforms.uniforms,a=o.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(i.globalUniforms.globalUniformData.projectionMatrix),o.uResolution=i.globalUniforms.globalUniformData.resolution,o.uRound=i._roundPixels|t._roundPixels,We(t.groupColorAlpha,o.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}class Co extends Mo{constructor(t){super(t,new Xd)}}Co.extension={type:[x.WebGLPipes],name:"particle"};class qd{execute(t,e){const i=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=i.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),s.groups[1]=i.texture.getTextureBindGroup(e.texture);const n=t.state,o=t.getBuffers(e);i.encoder.draw({geometry:o.geometry,shader:e.shader||t.defaultShader,state:n,size:e.particleChildren.length*6})}}class Oo extends Mo{constructor(t){super(t,new qd)}}Oo.extension={type:[x.WebGPUPipes],name:"particle"},D.add(Co),D.add(Oo);class Yi{constructor(){this.batcherName="default",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}}class Go{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(const t in this._gpuText){const e=this._gpuText[t];if(!e)continue;const i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){const e=this._getGpuText(t),i=t._getKey();return e.currentKey!==i}addRenderable(t,e){const i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){const e=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),e._batcher.updateElement(e)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){const e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),N.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){const e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1;const n=t._style.padding;xr(s.bounds,t._anchor,s.texture,n)}_updateGpuText(t){const e=this._getGpuText(t),i=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=i.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),i.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){const e={texture:null,currentKey:"--",batchableSprite:N.get(Yi)};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(const t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}}Go.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"text"};class Zd{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){const i=L.get().createCanvas();i.width=t,i.height=e;const s=i.getContext("2d");return{canvas:i,context:s}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),t=_e(t),e=_e(e);const s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let n=this._canvasPool[s].pop();return n||(n=this._createCanvasAndContext(t,e)),n}returnCanvasAndContext(t){const e=t.canvas,{width:i,height:s}=e,n=(i<<17)+(s<<1);t.context.clearRect(0,0,i,s),this._canvasPool[n].push(t)}clear(){this._canvasPool={}}}const Xt=new Zd;var A1=Object.defineProperty,P1=Object.defineProperties,w1=Object.getOwnPropertyDescriptors,Qd=Object.getOwnPropertySymbols,R1=Object.prototype.hasOwnProperty,M1=Object.prototype.propertyIsEnumerable,Jd=(r,t,e)=>t in r?A1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,C1=(r,t)=>{for(var e in t||(t={}))R1.call(t,e)&&Jd(r,e,t[e]);if(Qd)for(var e of Qd(t))M1.call(t,e)&&Jd(r,e,t[e]);return r},O1=(r,t)=>P1(r,w1(t));let G1=0;class tp{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,i){const s=new tt(O1(C1({},this.textureOptions),{width:t,height:e,resolution:1,antialias:i,autoGarbageCollect:!0}));return new P({source:s,label:`texturePool_${G1++}`})}getOptimalTexture(t,e,i=1,s){let n=Math.ceil(t*i-1e-6),o=Math.ceil(e*i-1e-6);n=_e(n),o=_e(o);const a=(n<<17)+(o<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let l=this._texturePool[a].pop();return l||(l=this.createTexture(n,o,s)),l.source._resolution=i,l.source.width=n/i,l.source.height=o/i,l.source.pixelWidth=n,l.source.pixelHeight=o,l.frame.x=0,l.frame.y=0,l.frame.width=t,l.frame.height=e,l.updateUvs(),this._poolKeyHash[l.uid]=a,l}getSameSizeTexture(t,e=!1){const i=t.source;return this.getOptimalTexture(t.width,t.height,i._resolution,e)}returnTexture(t){const e=this._poolKeyHash[t.uid];this._texturePool[e].push(t)}clear(t){if(t=t!==!1,t)for(const e in this._texturePool){const i=this._texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this._texturePool={}}}const ht=new tp;function ep(r,t,e){for(let i=0,s=4*e*t;i<t;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function rp(r,t,e,i,s){const n=4*t;for(let o=i,a=i*n+4*e;o<=s;++o,a+=n)if(r[a+3]!==0)return!1;return!0}function ip(r,t=1){const{width:e,height:i}=r,s=r.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");const n=s.getImageData(0,0,e,i).data;let o=0,a=0,l=e-1,u=i-1;for(;a<i&&ep(n,e,a);)++a;if(a===i)return V.EMPTY;for(;ep(n,e,u);)--u;for(;rp(n,e,o,a,u);)++o;for(;rp(n,e,l,a,u);)--l;return++l,++u,new V(o/t,a/t,(l-o)/t,(u-a)/t)}const sp=class Ou{constructor(t,e,i,s){this.uid=Z("fillGradient"),this.type="linear",this.gradientStops=[],this._styleKey=null,this.x0=t,this.y0=e,this.x1=i,this.y1=s}addColorStop(t,e){return this.gradientStops.push({offset:t,color:j.shared.setValue(e).toHexa()}),this._styleKey=null,this}buildLinearGradient(){const t=Ou.defaultTextureSize,{gradientStops:e}=this,i=L.get().createCanvas();i.width=t,i.height=t;const s=i.getContext("2d"),n=s.createLinearGradient(0,0,Ou.defaultTextureSize,1);for(let _=0;_<e.length;_++){const g=e[_];n.addColorStop(g.offset,g.color)}s.fillStyle=n,s.fillRect(0,0,t,t),this.texture=new P({source:new be({resource:i,addressModeU:"clamp-to-edge",addressModeV:"repeat"})});const{x0:o,y0:a,x1:l,y1:u}=this,c=new G,h=l-o,p=u-a,f=Math.sqrt(h*h+p*p),m=Math.atan2(p,h);c.translate(-o,-a),c.scale(1/t,1/t),c.rotate(-m),c.scale(256/f,1),this.transform=c,this._styleKey=null}get styleKey(){if(this._styleKey)return this._styleKey;const t=this.gradientStops.map(s=>`${s.offset}-${s.color}`).join("-"),e=this.texture.uid,i=this.transform.toArray().join("-");return`fill-gradient-${this.uid}-${t}-${e}-${i}-${this.x0}-${this.y0}-${this.x1}-${this.y1}`}};sp.defaultTextureSize=256;let Ye=sp;const np={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"}};class Mr{constructor(t,e){this.uid=Z("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=np[e].addressModeU,t.source.style.addressModeV=np[e].addressModeV)}setTransform(t){const 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 B1=F1,Bo={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},I1=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function F1(r){var t=[];return r.replace(I1,function(e,i,s){var n=i.toLowerCase();for(s=U1(s),n=="m"&&s.length>2&&(t.push([i].concat(s.splice(0,2))),n="l",i=i=="m"?"l":"L");;){if(s.length==Bo[n])return s.unshift(i),t.push(s);if(s.length<Bo[n])throw new Error("malformed path data");t.push([i].concat(s.splice(0,Bo[n])))}}),t}var D1=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function U1(r){var t=r.match(D1);return t?t.map(Number):[]}var k1=an(B1);function op(r,t){const e=k1(r),i=[];let s=null,n=0,o=0;for(let a=0;a<e.length;a++){const l=e[a],u=l[0],c=l;switch(u){case"M":n=c[1],o=c[2],t.moveTo(n,o);break;case"m":n+=c[1],o+=c[2],t.moveTo(n,o);break;case"H":n=c[1],t.lineTo(n,o);break;case"h":n+=c[1],t.lineTo(n,o);break;case"V":o=c[1],t.lineTo(n,o);break;case"v":o+=c[1],t.lineTo(n,o);break;case"L":n=c[1],o=c[2],t.lineTo(n,o);break;case"l":n+=c[1],o+=c[2],t.lineTo(n,o);break;case"C":n=c[5],o=c[6],t.bezierCurveTo(c[1],c[2],c[3],c[4],n,o);break;case"c":t.bezierCurveTo(n+c[1],o+c[2],n+c[3],o+c[4],n+c[5],o+c[6]),n+=c[5],o+=c[6];break;case"S":n=c[3],o=c[4],t.bezierCurveToShort(c[1],c[2],n,o);break;case"s":t.bezierCurveToShort(n+c[1],o+c[2],n+c[3],o+c[4]),n+=c[3],o+=c[4];break;case"Q":n=c[3],o=c[4],t.quadraticCurveTo(c[1],c[2],n,o);break;case"q":t.quadraticCurveTo(n+c[1],o+c[2],n+c[3],o+c[4]),n+=c[3],o+=c[4];break;case"T":n=c[1],o=c[2],t.quadraticCurveToShort(n,o);break;case"t":n+=c[1],o+=c[2],t.quadraticCurveToShort(n,o);break;case"A":n=c[6],o=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],n,o);break;case"a":n+=c[6],o+=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],n,o);break;case"Z":case"z":t.closePath(),i.length>0&&(s=i.pop(),s?(n=s.startX,o=s.startY):(n=0,o=0)),s=null;break;default:}u!=="Z"&&u!=="z"&&s===null&&(s={startX:n,startY:o},i.push(s))}return t}class Ki{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new Ki(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let s=this.x-t,n=this.y-e;return s*=s,n*=n,s+n<=i}strokeContains(t,e,i){if(this.radius===0)return!1;const s=this.x-t,n=this.y-e,o=this.radius,a=i/2,l=Math.sqrt(s*s+n*n);return l<o+a&&l>o-a}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}}class qi{constructor(t=0,e=0,i=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=s}clone(){return new qi(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return i*=i,s*=s,i+s<=1}strokeContains(t,e,i){const{halfWidth:s,halfHeight:n}=this;if(s<=0||n<=0)return!1;const o=i/2,a=s-o,l=n-o,u=s+o,c=n+o,h=t-this.x,p=e-this.y,f=h*h/(a*a)+p*p/(l*l),m=h*h/(u*u)+p*p/(c*c);return f>1&&m<=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}}function Cr(r,t,e,i,s,n){const o=r-e,a=t-i,l=s-e,u=n-i,c=o*l+a*u,h=l*l+u*u;let p=-1;h!==0&&(p=c/h);let f,m;p<0?(f=e,m=i):p>1?(f=s,m=n):(f=e+p*l,m=i+p*u);const _=r-f,g=t-m;return _*_+g*g}class Ke{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const i=[];for(let s=0,n=e.length;s<n;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.closePath=!0}clone(){const t=this.points.slice(),e=new Ke(t);return e.closePath=this.closePath,e}contains(t,e){let i=!1;const s=this.points.length/2;for(let n=0,o=s-1;n<s;o=n++){const a=this.points[n*2],l=this.points[n*2+1],u=this.points[o*2],c=this.points[o*2+1];l>e!=c>e&&t<(u-a)*((e-l)/(c-l))+a&&(i=!i)}return i}strokeContains(t,e,i){const s=i/2,n=s*s,{points:o}=this,a=o.length-(this.closePath?0:2);for(let l=0;l<a;l+=2){const u=o[l],c=o[l+1],h=o[(l+2)%o.length],p=o[(l+3)%o.length];if(Cr(t,e,u,c,h,p)<=n)return!0}return!1}getBounds(t){t=t||new V;const e=this.points;let i=1/0,s=-1/0,n=1/0,o=-1/0;for(let a=0,l=e.length;a<l;a+=2){const u=e[a],c=e[a+1];i=u<i?u:i,s=u>s?u:s,n=c<n?c:n,o=c>o?c:o}return t.x=i,t.width=s-i,t.y=n,t.height=o-n,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}const Zi=(r,t,e,i,s,n)=>{const o=r-e,a=t-i,l=Math.sqrt(o*o+a*a);return l>=s-n&&l<=s+n};class Qi{constructor(t=0,e=0,i=0,s=0,n=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=s,this.radius=n}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 Qi(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){const i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),n=e-(this.y+i);const o=i*i;if(s*s+n*n<=o||(s=t-(this.x+this.width-i),s*s+n*n<=o)||(n=e-(this.y+this.height-i),s*s+n*n<=o)||(s=t-(this.x+i),s*s+n*n<=o))return!0}return!1}strokeContains(t,e,i){const{x:s,y:n,width:o,height:a,radius:l}=this,u=i/2,c=s+l,h=n+l,p=o-l*2,f=a-l*2,m=s+o,_=n+a;return(t>=s-u&&t<=s+u||t>=m-u&&t<=m+u)&&e>=h&&e<=h+f||(e>=n-u&&e<=n+u||e>=_-u&&e<=_+u)&&t>=c&&t<=c+p?!0:t<c&&e<h&&Zi(t,e,c,h,l,u)||t>m-l&&e<h&&Zi(t,e,m-l,h,l,u)||t>m-l&&e>_-l&&Zi(t,e,m-l,_-l,l,u)||t<c&&e>_-l&&Zi(t,e,c,_-l,l,u)}}const $1=8,Ji=11920929e-14,L1=1,Io=.01,qe=0,Ae=0;function Fo(r,t,e,i,s,n,o,a,l,u){const c=Math.min(.99,Math.max(0,u!=null?u:Vi.defaultOptions.bezierSmoothness));let h=(L1-c)/1;return h*=h,N1(t,e,i,s,n,o,a,l,r,h),r}function N1(r,t,e,i,s,n,o,a,l,u){Do(r,t,e,i,s,n,o,a,l,u,0),l.push(o,a)}function Do(r,t,e,i,s,n,o,a,l,u,c){if(c>$1)return;const h=Math.PI,p=(r+e)/2,f=(t+i)/2,m=(e+s)/2,_=(i+n)/2,g=(s+o)/2,b=(n+a)/2,v=(p+m)/2,y=(f+_)/2,T=(m+g)/2,E=(_+b)/2,M=(v+T)/2,w=(y+E)/2;if(c>0){let C=o-r,S=a-t;const A=Math.abs((e-o)*S-(i-a)*C),H=Math.abs((s-o)*S-(n-a)*C);let X,R;if(A>Ji&&H>Ji){if((A+H)*(A+H)<=u*(C*C+S*S)){if(qe<Io){l.push(M,w);return}const B=Math.atan2(n-i,s-e);if(X=Math.abs(B-Math.atan2(i-t,e-r)),R=Math.abs(Math.atan2(a-n,o-s)-B),X>=h&&(X=2*h-X),R>=h&&(R=2*h-R),X+R<qe){l.push(M,w);return}if(Ae!==0){if(X>Ae){l.push(e,i);return}if(R>Ae){l.push(s,n);return}}}}else if(A>Ji){if(A*A<=u*(C*C+S*S)){if(qe<Io){l.push(M,w);return}if(X=Math.abs(Math.atan2(n-i,s-e)-Math.atan2(i-t,e-r)),X>=h&&(X=2*h-X),X<qe){l.push(e,i),l.push(s,n);return}if(Ae!==0&&X>Ae){l.push(e,i);return}}}else if(H>Ji){if(H*H<=u*(C*C+S*S)){if(qe<Io){l.push(M,w);return}if(X=Math.abs(Math.atan2(a-n,o-s)-Math.atan2(n-i,s-e)),X>=h&&(X=2*h-X),X<qe){l.push(e,i),l.push(s,n);return}if(Ae!==0&&X>Ae){l.push(s,n);return}}}else if(C=M-(r+o)/2,S=w-(t+a)/2,C*C+S*S<=u){l.push(M,w);return}}Do(r,t,p,f,v,y,M,w,l,u,c+1),Do(M,w,T,E,g,b,o,a,l,u,c+1)}const H1=8,X1=11920929e-14,j1=1,z1=.01,ap=0;function lp(r,t,e,i,s,n,o,a){const l=Math.min(.99,Math.max(0,a!=null?a:Vi.defaultOptions.bezierSmoothness));let u=(j1-l)/1;return u*=u,V1(t,e,i,s,n,o,r,u),r}function V1(r,t,e,i,s,n,o,a){Uo(o,r,t,e,i,s,n,a,0),o.push(s,n)}function Uo(r,t,e,i,s,n,o,a,l){if(l>H1)return;const u=Math.PI,c=(t+i)/2,h=(e+s)/2,p=(i+n)/2,f=(s+o)/2,m=(c+p)/2,_=(h+f)/2;let g=n-t,b=o-e;const v=Math.abs((i-n)*b-(s-o)*g);if(v>X1){if(v*v<=a*(g*g+b*b)){if(ap<z1){r.push(m,_);return}let y=Math.abs(Math.atan2(o-s,n-i)-Math.atan2(s-e,i-t));if(y>=u&&(y=2*u-y),y<ap){r.push(m,_);return}}}else if(g=m-(t+n)/2,b=_-(e+o)/2,g*g+b*b<=a){r.push(m,_);return}Uo(r,t,e,c,h,m,_,a,l+1),Uo(r,m,_,p,f,n,o,a,l+1)}function ko(r,t,e,i,s,n,o,a){let l=Math.abs(s-n);(!o&&s>n||o&&n>s)&&(l=2*Math.PI-l),a=a||Math.max(6,Math.floor(6*Math.pow(i,.3333333333333333)*(l/Math.PI))),a=Math.max(a,3);let u=l/a,c=s;u*=o?-1:1;for(let h=0;h<a+1;h++){const p=Math.cos(c),f=Math.sin(c),m=t+p*i,_=e+f*i;r.push(m,_),c+=u}}function up(r,t,e,i,s,n){const o=r[r.length-2],a=r[r.length-1]-e,l=o-t,u=s-e,c=i-t,h=Math.abs(a*c-l*u);if(h<1e-8||n===0){(r[r.length-2]!==t||r[r.length-1]!==e)&&r.push(t,e);return}const p=a*a+l*l,f=u*u+c*c,m=a*u+l*c,_=n*Math.sqrt(p)/h,g=n*Math.sqrt(f)/h,b=_*m/p,v=g*m/f,y=_*c+g*l,T=_*u+g*a,E=l*(g+b),M=a*(g+b),w=c*(_+v),C=u*(_+v),S=Math.atan2(M-T,E-y),A=Math.atan2(C-T,w-y);ko(r,y+t,T+e,n,S,A,l*u>c*a)}const Or=Math.PI*2,$o={centerX:0,centerY:0,ang1:0,ang2:0},Lo=({x:r,y:t},e,i,s,n,o,a,l)=>{r*=e,t*=i;const u=s*r-n*t,c=n*r+s*t;return l.x=u+o,l.y=c+a,l};function W1(r,t){const e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),i=t===1.5707963267948966?.551915024494:e,s=Math.cos(r),n=Math.sin(r),o=Math.cos(r+t),a=Math.sin(r+t);return[{x:s-n*i,y:n+s*i},{x:o+a*i,y:a-o*i},{x:o,y:a}]}const cp=(r,t,e,i)=>{const s=r*i-t*e<0?-1:1;let n=r*e+t*i;return n>1&&(n=1),n<-1&&(n=-1),s*Math.acos(n)},Y1=(r,t,e,i,s,n,o,a,l,u,c,h,p)=>{const f=Math.pow(s,2),m=Math.pow(n,2),_=Math.pow(c,2),g=Math.pow(h,2);let b=f*m-f*g-m*_;b<0&&(b=0),b/=f*g+m*_,b=Math.sqrt(b)*(o===a?-1:1);const v=b*s/n*h,y=b*-n/s*c,T=u*v-l*y+(r+e)/2,E=l*v+u*y+(t+i)/2,M=(c-v)/s,w=(h-y)/n,C=(-c-v)/s,S=(-h-y)/n,A=cp(1,0,M,w);let H=cp(M,w,C,S);a===0&&H>0&&(H-=Or),a===1&&H<0&&(H+=Or),p.centerX=T,p.centerY=E,p.ang1=A,p.ang2=H};function hp(r,t,e,i,s,n,o,a=0,l=0,u=0){if(n===0||o===0)return;const c=Math.sin(a*Or/360),h=Math.cos(a*Or/360),p=h*(t-i)/2+c*(e-s)/2,f=-c*(t-i)/2+h*(e-s)/2;if(p===0&&f===0)return;n=Math.abs(n),o=Math.abs(o);const m=Math.pow(p,2)/Math.pow(n,2)+Math.pow(f,2)/Math.pow(o,2);m>1&&(n*=Math.sqrt(m),o*=Math.sqrt(m)),Y1(t,e,i,s,n,o,l,u,c,h,p,f,$o);let{ang1:_,ang2:g}=$o;const{centerX:b,centerY:v}=$o;let y=Math.abs(g)/(Or/4);Math.abs(1-y)<1e-7&&(y=1);const T=Math.max(Math.ceil(y),1);g/=T;let E=r[r.length-2],M=r[r.length-1];const w={x:0,y:0};for(let C=0;C<T;C++){const S=W1(_,g),{x:A,y:H}=Lo(S[0],n,o,h,c,b,v,w),{x:X,y:R}=Lo(S[1],n,o,h,c,b,v,w),{x:B,y:q}=Lo(S[2],n,o,h,c,b,v,w);Fo(r,E,M,A,H,X,R,B,q),E=B,M=q,_+=g}}function dp(r,t,e){var i;const s=(a,l)=>{const u=l.x-a.x,c=l.y-a.y,h=Math.sqrt(u*u+c*c),p=u/h,f=c/h;return{len:h,nx:p,ny:f}},n=(a,l)=>{a===0?r.moveTo(l.x,l.y):r.lineTo(l.x,l.y)};let o=t[t.length-1];for(let a=0;a<t.length;a++){const l=t[a%t.length],u=(i=l.radius)!=null?i:e;if(u<=0){n(a,l),o=l;continue}const c=t[(a+1)%t.length],h=s(l,o),p=s(l,c);if(h.len<1e-4||p.len<1e-4){n(a,l),o=l;continue}let f=Math.asin(h.nx*p.ny-h.ny*p.nx),m=1,_=!1;h.nx*p.nx-h.ny*-p.ny<0?f<0?f=Math.PI+f:(f=Math.PI-f,m=-1,_=!0):f>0&&(m=-1,_=!0);const g=f/2;let b,v=Math.abs(Math.cos(g)*u/Math.sin(g));v>Math.min(h.len/2,p.len/2)?(v=Math.min(h.len/2,p.len/2),b=Math.abs(v*Math.sin(g)/Math.cos(g))):b=u;const y=l.x+p.nx*v+-p.ny*b*m,T=l.y+p.ny*v+p.nx*b*m,E=Math.atan2(h.ny,h.nx)+Math.PI/2*m,M=Math.atan2(p.ny,p.nx)-Math.PI/2*m;a===0&&r.moveTo(y+Math.cos(E)*b,T+Math.sin(E)*b),r.arc(y,T,b,E,M,_),o=l}}function pp(r,t,e,i){var s;const n=(l,u)=>Math.sqrt((l.x-u.x)**2+(l.y-u.y)**2),o=(l,u,c)=>({x:l.x+(u.x-l.x)*c,y:l.y+(u.y-l.y)*c}),a=t.length;for(let l=0;l<a;l++){const u=t[(l+1)%a],c=(s=u.radius)!=null?s:e;if(c<=0){l===0?r.moveTo(u.x,u.y):r.lineTo(u.x,u.y);continue}const h=t[l],p=t[(l+2)%a],f=n(h,u);let m;if(f<1e-4)m=u;else{const b=Math.min(f/2,c);m=o(u,h,b/f)}const _=n(p,u);let g;if(_<1e-4)g=u;else{const b=Math.min(_/2,c);g=o(u,p,b/_)}l===0?r.moveTo(m.x,m.y):r.lineTo(m.x,m.y),r.quadraticCurveTo(u.x,u.y,g.x,g.y,i)}}const K1=new V;class fp{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new ut,this._graphicsPath2D=t}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();const i=this._currentPoly.points,s=i[i.length-2],n=i[i.length-1];return(s!==t||n!==e)&&i.push(t,e),this}arc(t,e,i,s,n,o){this._ensurePoly(!1);const a=this._currentPoly.points;return ko(a,t,e,i,s,n,o),this}arcTo(t,e,i,s,n){this._ensurePoly();const o=this._currentPoly.points;return up(o,t,e,i,s,n),this}arcToSvg(t,e,i,s,n,o,a){const l=this._currentPoly.points;return hp(l,this._currentPoly.lastX,this._currentPoly.lastY,o,a,t,e,i,s,n),this}bezierCurveTo(t,e,i,s,n,o,a){this._ensurePoly();const l=this._currentPoly;return Fo(this._currentPoly.points,l.lastX,l.lastY,t,e,i,s,n,o,a),this}quadraticCurveTo(t,e,i,s,n){this._ensurePoly();const o=this._currentPoly;return lp(this._currentPoly.points,o.lastX,o.lastY,t,e,i,s,n),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));for(let i=0;i<t.instructions.length;i++){const s=t.instructions[i];this[s.action](...s.data)}return this}finish(t=!1){this.endPoly(t)}rect(t,e,i,s,n){return this.drawShape(new V(t,e,i,s),n),this}circle(t,e,i,s){return this.drawShape(new Ki(t,e,i),s),this}poly(t,e,i){const s=new Ke(t);return s.closePath=e,this.drawShape(s,i),this}regularPoly(t,e,i,s,n=0,o){s=Math.max(s|0,3);const a=-1*Math.PI/2+n,l=Math.PI*2/s,u=[];for(let c=0;c<s;c++){const h=c*l+a;u.push(t+i*Math.cos(h),e+i*Math.sin(h))}return this.poly(u,!0,o),this}roundPoly(t,e,i,s,n,o=0,a){if(s=Math.max(s|0,3),n<=0)return this.regularPoly(t,e,i,s,o);const l=i*Math.sin(Math.PI/s)-.001;n=Math.min(n,l);const u=-1*Math.PI/2+o,c=Math.PI*2/s,h=(s-2)*Math.PI/s/2;for(let p=0;p<s;p++){const f=p*c+u,m=t+i*Math.cos(f),_=e+i*Math.sin(f),g=f+Math.PI+h,b=f-Math.PI-h,v=m+n*Math.cos(g),y=_+n*Math.sin(g),T=m+n*Math.cos(b),E=_+n*Math.sin(b);p===0?this.moveTo(v,y):this.lineTo(v,y),this.quadraticCurveTo(m,_,T,E,a)}return this.closePath()}roundShape(t,e,i=!1,s){return t.length<3?this:(i?pp(this,t,e,s):dp(this,t,e),this.closePath())}filletRect(t,e,i,s,n){if(n===0)return this.rect(t,e,i,s);const o=Math.min(i,s)/2,a=Math.min(o,Math.max(-o,n)),l=t+i,u=e+s,c=a<0?-a:0,h=Math.abs(a);return this.moveTo(t,e+h).arcTo(t+c,e+c,t+h,e,h).lineTo(l-h,e).arcTo(l-c,e+c,l,e+h,h).lineTo(l,u-h).arcTo(l-c,u-c,t+i-h,u,h).lineTo(t+h,u).arcTo(t+c,u-c,t,u-h,h).closePath()}chamferRect(t,e,i,s,n,o){if(n<=0)return this.rect(t,e,i,s);const a=Math.min(n,Math.min(i,s)/2),l=t+i,u=e+s,c=[t+a,e,l-a,e,l,e+a,l,u-a,l-a,u,t+a,u,t,u-a,t,e+a];for(let h=c.length-1;h>=2;h-=2)c[h]===c[h-2]&&c[h-1]===c[h-3]&&c.splice(h-1,2);return this.poly(c,!0,o)}ellipse(t,e,i,s,n){return this.drawShape(new qi(t,e,i,s),n),this}roundRect(t,e,i,s,n,o){return this.drawShape(new Qi(t,e,i,s,n),o),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new Ke,i.points.push(t,e),this._currentPoly=i,this}endPoly(t=!1){const 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 Ke,t)){const e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){const n=e.transform,o=i;i=n.a*i+n.c*s+n.tx,s=n.b*o+n.d*s+n.ty}this._currentPoly.points.push(i,s)}else this._currentPoly.points.push(0,0)}}buildPath(){const t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){const i=t.instructions[e];this[i.action](...i.data)}this.finish()}get bounds(){const t=this._bounds;t.clear();const e=this.shapePrimitives;for(let i=0;i<e.length;i++){const s=e[i],n=s.shape.getBounds(K1);s.transform?t.addRect(n,s.transform):t.addRect(n)}return t}}class se{constructor(t){this.instructions=[],this.uid=Z("graphicsPath"),this._dirty=!0;var e;typeof t=="string"?op(t,this):this.instructions=(e=t==null?void 0:t.slice())!=null?e:[]}get shapePath(){return this._shapePath||(this._shapePath=new fp(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,i,s,n){const o=this.instructions[this.instructions.length-1],a=this.getLastPoint(W.shared);let l=0,u=0;if(!o||o.action!=="bezierCurveTo")l=a.x,u=a.y;else{l=o.data[2],u=o.data[3];const c=a.x,h=a.y;l=c+(c-l),u=h+(h-u)}return this.instructions.push({action:"bezierCurveTo",data:[l,u,t,e,i,s,n]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,i){const s=this.instructions[this.instructions.length-1],n=this.getLastPoint(W.shared);let o=0,a=0;if(!s||s.action!=="quadraticCurveTo")o=n.x,a=n.y;else{o=s.data[0],a=s.data[1];const l=n.x,u=n.y;o=l+(l-o),a=u+(u-a)}return this.instructions.push({action:"quadraticCurveTo",data:[o,a,t,e,i]}),this._dirty=!0,this}rect(t,e,i,s,n){return this.instructions.push({action:"rect",data:[t,e,i,s,n]}),this._dirty=!0,this}circle(t,e,i,s){return this.instructions.push({action:"circle",data:[t,e,i,s]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,i,s,n,o,a){n=n||s/2;const l=-1*Math.PI/2+o,u=i*2,c=Math.PI*2/u,h=[];for(let p=0;p<u;p++){const f=p%2?n:s,m=p*c+l;h.push(t+f*Math.cos(m),e+f*Math.sin(m))}return this.poly(h,!0,a),this}clone(t=!1){const e=new se;if(!t)e.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){const s=this.instructions[i];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;const e=t.a,i=t.b,s=t.c,n=t.d,o=t.tx,a=t.ty;let l=0,u=0,c=0,h=0,p=0,f=0,m=0,_=0;for(let g=0;g<this.instructions.length;g++){const b=this.instructions[g],v=b.data;switch(b.action){case"moveTo":case"lineTo":l=v[0],u=v[1],v[0]=e*l+s*u+o,v[1]=i*l+n*u+a;break;case"bezierCurveTo":c=v[0],h=v[1],p=v[2],f=v[3],l=v[4],u=v[5],v[0]=e*c+s*h+o,v[1]=i*c+n*h+a,v[2]=e*p+s*f+o,v[3]=i*p+n*f+a,v[4]=e*l+s*u+o,v[5]=i*l+n*u+a;break;case"quadraticCurveTo":c=v[0],h=v[1],l=v[2],u=v[3],v[0]=e*c+s*h+o,v[1]=i*c+n*h+a,v[2]=e*l+s*u+o,v[3]=i*l+n*u+a;break;case"arcToSvg":l=v[5],u=v[6],m=v[0],_=v[1],v[0]=e*m+s*_,v[1]=i*m+n*_,v[5]=e*l+s*u+o,v[6]=i*l+n*u+a;break;case"circle":v[4]=Gr(v[3],t);break;case"rect":v[4]=Gr(v[4],t);break;case"ellipse":v[8]=Gr(v[8],t);break;case"roundRect":v[5]=Gr(v[5],t);break;case"addPath":v[0].transform(t);break;case"poly":v[2]=Gr(v[2],t);break;default:break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,i=this.instructions[e];if(!i)return t.x=0,t.y=0,t;for(;i.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;i=this.instructions[e]}switch(i.action){case"moveTo":case"lineTo":t.x=i.data[0],t.y=i.data[1];break;case"quadraticCurveTo":t.x=i.data[2],t.y=i.data[3];break;case"bezierCurveTo":t.x=i.data[4],t.y=i.data[5];break;case"arc":case"arcToSvg":t.x=i.data[5],t.y=i.data[6];break;case"addPath":i.data[0].getLastPoint(t);break}return t}}function Gr(r,t){return r?r.prepend(t):t.clone()}var q1=Object.defineProperty,mp=Object.getOwnPropertySymbols,Z1=Object.prototype.hasOwnProperty,Q1=Object.prototype.propertyIsEnumerable,gp=(r,t,e)=>t in r?q1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ts=(r,t)=>{for(var e in t||(t={}))Z1.call(t,e)&&gp(r,e,t[e]);if(mp)for(var e of mp(t))Q1.call(t,e)&&gp(r,e,t[e]);return r};function _p(r,t){if(typeof r=="string"){const i=document.createElement("div");i.innerHTML=r.trim(),r=i.querySelector("svg")}const e={context:t,path:new se};return bp(r,e,null,null),t}function bp(r,t,e,i){const s=r.children,{fillStyle:n,strokeStyle:o}=J1(r);n&&e?e=ts(ts({},e),n):n&&(e=n),o&&i?i=ts(ts({},i),o):o&&(i=o),t.context.fillStyle=e,t.context.strokeStyle=i;let a,l,u,c,h,p,f,m,_,g,b,v,y,T,E,M,w;switch(r.nodeName.toLowerCase()){case"path":T=r.getAttribute("d"),E=new se(T),t.context.path(E),e&&t.context.fill(),i&&t.context.stroke();break;case"circle":f=at(r,"cx",0),m=at(r,"cy",0),_=at(r,"r",0),t.context.ellipse(f,m,_,_),e&&t.context.fill(),i&&t.context.stroke();break;case"rect":a=at(r,"x",0),l=at(r,"y",0),M=at(r,"width",0),w=at(r,"height",0),g=at(r,"rx",0),b=at(r,"ry",0),g||b?t.context.roundRect(a,l,M,w,g||b):t.context.rect(a,l,M,w),e&&t.context.fill(),i&&t.context.stroke();break;case"ellipse":f=at(r,"cx",0),m=at(r,"cy",0),g=at(r,"rx",0),b=at(r,"ry",0),t.context.beginPath(),t.context.ellipse(f,m,g,b),e&&t.context.fill(),i&&t.context.stroke();break;case"line":u=at(r,"x1",0),c=at(r,"y1",0),h=at(r,"x2",0),p=at(r,"y2",0),t.context.beginPath(),t.context.moveTo(u,c),t.context.lineTo(h,p),i&&t.context.stroke();break;case"polygon":y=r.getAttribute("points"),v=y.match(/\d+/g).map(C=>parseInt(C,10)),t.context.poly(v,!0),e&&t.context.fill(),i&&t.context.stroke();break;case"polyline":y=r.getAttribute("points"),v=y.match(/\d+/g).map(C=>parseInt(C,10)),t.context.poly(v,!1),i&&t.context.stroke();break;case"g":case"svg":break;default:{console.info(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}for(let C=0;C<s.length;C++)bp(s[C],t,e,i)}function at(r,t,e){const i=r.getAttribute(t);return i?Number(i):e}function J1(r){const t=r.getAttribute("style"),e={},i={};let s=!1,n=!1;if(t){const o=t.split(";");for(let a=0;a<o.length;a++){const l=o[a],[u,c]=l.split(":");switch(u){case"stroke":c!=="none"&&(e.color=j.shared.setValue(c).toNumber(),n=!0);break;case"stroke-width":e.width=Number(c);break;case"fill":c!=="none"&&(s=!0,i.color=j.shared.setValue(c).toNumber());break;case"fill-opacity":i.alpha=Number(c);break;case"stroke-opacity":e.alpha=Number(c);break;case"opacity":i.alpha=Number(c),e.alpha=Number(c);break}}}else{const o=r.getAttribute("stroke");o&&o!=="none"&&(n=!0,e.color=j.shared.setValue(o).toNumber(),e.width=at(r,"stroke-width",1));const a=r.getAttribute("fill");a&&a!=="none"&&(s=!0,i.color=j.shared.setValue(a).toNumber())}return{strokeStyle:n?e:null,fillStyle:s?i:null}}var tT=Object.defineProperty,es=Object.getOwnPropertySymbols,vp=Object.prototype.hasOwnProperty,yp=Object.prototype.propertyIsEnumerable,xp=(r,t,e)=>t in r?tT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Qt=(r,t)=>{for(var e in t||(t={}))vp.call(t,e)&&xp(r,e,t[e]);if(es)for(var e of es(t))yp.call(t,e)&&xp(r,e,t[e]);return r},eT=(r,t)=>{var e={};for(var i in r)vp.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&es)for(var i of es(r))t.indexOf(i)<0&&yp.call(r,i)&&(e[i]=r[i]);return e};function rT(r){return j.isColorLike(r)}function Tp(r){return r instanceof Mr}function Sp(r){return r instanceof Ye}function iT(r,t,e){const i=j.shared.setValue(t!=null?t:0);return r.color=i.toNumber(),r.alpha=i.alpha===1?e.alpha:i.alpha,r.texture=P.WHITE,Qt(Qt({},e),r)}function Ep(r,t,e){return r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,Qt(Qt({},e),r)}function Ap(r,t,e){return t.buildLinearGradient(),r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,Qt(Qt({},e),r)}function sT(r,t){var e;const i=Qt(Qt({},t),r);if(i.texture){if(i.texture!==P.WHITE){const o=((e=i.matrix)==null?void 0:e.invert())||new G;o.translate(i.texture.frame.x,i.texture.frame.y),o.scale(1/i.texture.source.width,1/i.texture.source.height),i.matrix=o}const n=i.texture.source.style;n.addressMode==="clamp-to-edge"&&(n.addressMode="repeat",n.update())}const s=j.shared.setValue(i.color);return i.alpha*=s.alpha,i.color=s.toNumber(),i.matrix=i.matrix?i.matrix.clone():null,i}function ne(r,t){if(r==null)return null;const e={},i=r;return rT(r)?iT(e,r,t):Tp(r)?Ep(e,r,t):Sp(r)?Ap(e,r,t):i.fill&&Tp(i.fill)?Ep(i,i.fill,t):i.fill&&Sp(i.fill)?Ap(i,i.fill,t):sT(i,t)}function Br(r,t){const e=t,{width:i,alignment:s,miterLimit:n,cap:o,join:a}=e,l=eT(e,["width","alignment","miterLimit","cap","join"]),u=ne(r,l);return u?Qt({width:i,alignment:s,miterLimit:n,cap:o,join:a},u):null}var nT=Object.defineProperty,Pp=Object.getOwnPropertySymbols,oT=Object.prototype.hasOwnProperty,aT=Object.prototype.propertyIsEnumerable,wp=(r,t,e)=>t in r?nT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ze=(r,t)=>{for(var e in t||(t={}))oT.call(t,e)&&wp(r,e,t[e]);if(Pp)for(var e of Pp(t))aT.call(t,e)&&wp(r,e,t[e]);return r};const lT=new W,Rp=new G,No=class zt extends mt{constructor(){super(...arguments),this.uid=Z("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new se,this._transform=new G,this._fillStyle=Ze({},zt.defaultFillStyle),this._strokeStyle=Ze({},zt.defaultStrokeStyle),this._stateStack=[],this._tick=0,this._bounds=new ut,this._boundsDirty=!0}clone(){const t=new zt;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle=Ze({},this._fillStyle),t._strokeStyle=Ze({},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,zt.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=Br(t,zt.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=ne(t,zt.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=ne(t,zt.defaultStrokeStyle),this}texture(t,e,i,s,n,o){return this.instructions.push({action:"texture",data:{image:t,dx:i||0,dy:s||0,dw:n||t.frame.width,dh:o||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?j.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new se,this}fill(t,e){let i;const s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?i=s.data.path:i=this._activePath.clone(),i?(t!=null&&(e!==void 0&&typeof t=="number"&&(t={color:t,alpha:e}),this._fillStyle=ne(t,zt.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:t,y:e}=this._activePath.getLastPoint(W.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e;const i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="fill"?e=i.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=Br(t,zt.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++){const e=this.instructions[this.instructions.length-1-t],i=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(i);else{e.data.hole=i;break}}return this._initNextPathLocation(),this}arc(t,e,i,s,n,o){this._tick++;const a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,i,s,n,o),this}arcTo(t,e,i,s,n){this._tick++;const o=this._transform;return this._activePath.arcTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*i+o.c*s+o.tx,o.b*i+o.d*s+o.ty,n),this}arcToSvg(t,e,i,s,n,o,a){this._tick++;const l=this._transform;return this._activePath.arcToSvg(t,e,i,s,n,l.a*o+l.c*a+l.tx,l.b*o+l.d*a+l.ty),this}bezierCurveTo(t,e,i,s,n,o,a){this._tick++;const l=this._transform;return this._activePath.bezierCurveTo(l.a*t+l.c*e+l.tx,l.b*t+l.d*e+l.ty,l.a*i+l.c*s+l.tx,l.b*i+l.d*s+l.ty,l.a*n+l.c*o+l.tx,l.b*n+l.d*o+l.ty,a),this}closePath(){var t;return this._tick++,(t=this._activePath)==null||t.closePath(),this}ellipse(t,e,i,s){return this._tick++,this._activePath.ellipse(t,e,i,s,this._transform.clone()),this}circle(t,e,i){return this._tick++,this._activePath.circle(t,e,i,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;const i=this._transform;return this._activePath.lineTo(i.a*t+i.c*e+i.tx,i.b*t+i.d*e+i.ty),this}moveTo(t,e){this._tick++;const i=this._transform,s=this._activePath.instructions,n=i.a*t+i.c*e+i.tx,o=i.b*t+i.d*e+i.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=n,s[0].data[1]=o,this):(this._activePath.moveTo(n,o),this)}quadraticCurveTo(t,e,i,s,n){this._tick++;const o=this._transform;return this._activePath.quadraticCurveTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*i+o.c*s+o.tx,o.b*i+o.d*s+o.ty,n),this}rect(t,e,i,s){return this._tick++,this._activePath.rect(t,e,i,s,this._transform.clone()),this}roundRect(t,e,i,s,n){return this._tick++,this._activePath.roundRect(t,e,i,s,n,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,i,s,n=0,o){return this._tick++,this._activePath.regularPoly(t,e,i,s,n,o),this}roundPoly(t,e,i,s,n,o){return this._tick++,this._activePath.roundPoly(t,e,i,s,n,o),this}roundShape(t,e,i,s){return this._tick++,this._activePath.roundShape(t,e,i,s),this}filletRect(t,e,i,s,n){return this._tick++,this._activePath.filletRect(t,e,i,s,n),this}chamferRect(t,e,i,s,n,o){return this._tick++,this._activePath.chamferRect(t,e,i,s,n,o),this}star(t,e,i,s,n=0,o=0){return this._tick++,this._activePath.star(t,e,i,s,n,o,this._transform.clone()),this}svg(t){return this._tick++,_p(t,this),this}restore(){const 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:Ze({},this._fillStyle),strokeStyle:Ze({},this._strokeStyle)}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,i,s,n,o){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,i,s,n,o),this)}transform(t,e,i,s,n,o){return t instanceof G?(this._transform.append(t),this):(Rp.set(t,e,i,s,n,o),this._transform.append(Rp),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;const t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){const i=this.instructions[e],s=i.action;if(s==="fill"){const n=i.data;t.addBounds(n.path.bounds)}else if(s==="texture"){const n=i.data;t.addFrame(n.dx,n.dy,n.dx+n.dw,n.dy+n.dh,n.transform)}if(s==="stroke"){const n=i.data,o=n.style.width/2,a=n.path.bounds;t.addFrame(a.minX-o,a.minY-o,a.maxX+o,a.maxY+o)}}return t}containsPoint(t){var e;if(!this.bounds.containsPoint(t.x,t.y))return!1;const i=this.instructions;let s=!1;for(let n=0;n<i.length;n++){const o=i[n],a=o.data,l=a.path;if(!o.action||!l)continue;const u=a.style,c=l.shapePath.shapePrimitives;for(let h=0;h<c.length;h++){const p=c[h].shape;if(!u||!p)continue;const f=c[h].transform,m=f?f.applyInverse(t,lT):t;o.action==="fill"?s=p.contains(m.x,m.y):s=p.strokeContains(m.x,m.y,u.width);const _=a.hole;if(_){const g=(e=_.shapePath)==null?void 0:e.shapePrimitives;if(g)for(let b=0;b<g.length;b++)g[b].shape.contains(m.x,m.y)&&(s=!1)}if(s)return!0}}return s}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(e),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(e)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};No.defaultFillStyle={color:16777215,alpha:1,texture:P.WHITE,matrix:null,fill:null},No.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:P.WHITE,matrix:null,fill:null};let pt=No;const Mp=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"];function Ho(r){const t=[];let e=0;for(let i=0;i<Mp.length;i++){const s=`_${Mp[i]}`;t[e++]=r[s]}return e=Cp(r._fill,t,e),e=uT(r._stroke,t,e),e=cT(r.dropShadow,t,e),t.join("-")}function Cp(r,t,e){var i;return r&&(t[e++]=r.color,t[e++]=r.alpha,t[e++]=(i=r.fill)==null?void 0:i.styleKey),e}function uT(r,t,e){return r&&(e=Cp(r,t,e),t[e++]=r.width,t[e++]=r.alignment,t[e++]=r.cap,t[e++]=r.join,t[e++]=r.miterLimit),e}function cT(r,t,e){return r&&(t[e++]=r.alpha,t[e++]=r.angle,t[e++]=r.blur,t[e++]=r.distance,t[e++]=j.shared.setValue(r.color).toNumber()),e}var hT=Object.defineProperty,dT=Object.defineProperties,pT=Object.getOwnPropertyDescriptors,Op=Object.getOwnPropertySymbols,fT=Object.prototype.hasOwnProperty,mT=Object.prototype.propertyIsEnumerable,Gp=(r,t,e)=>t in r?hT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,wt=(r,t)=>{for(var e in t||(t={}))fT.call(t,e)&&Gp(r,e,t[e]);if(Op)for(var e of Op(t))mT.call(t,e)&&Gp(r,e,t[e]);return r},gT=(r,t)=>dT(r,pT(t));const Xo=class ur extends mt{constructor(t={}){super(),_T(t);const e=wt(wt({},ur.defaultTextStyle),t);for(const i in e){const s=i;this[s]=e[i]}this.update()}get align(){return this._align}set align(t){this._align=t,this.update()}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy(wt(wt({},ur.defaultDropShadow),t)):this._dropShadow=t?this._createProxy(wt({},ur.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(wt({},pt.defaultFillStyle),t),()=>{this._fill=ne(wt({},this._originalFill),pt.defaultFillStyle)})),this._fill=ne(t===0?"black":t,pt.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(wt({},pt.defaultStrokeStyle),t),()=>{this._stroke=Br(wt({},this._originalStroke),pt.defaultStrokeStyle)})),this._stroke=Br(t,pt.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Ho(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){const t=ur.defaultTextStyle;for(const e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new ur({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?wt({},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){var e,i,s,n;if(this.removeAllListeners(),typeof t=="boolean"?t:t==null?void 0:t.texture){const o=typeof t=="boolean"?t:t==null?void 0:t.textureSource;(e=this._fill)!=null&&e.texture&&this._fill.texture.destroy(o),(i=this._originalFill)!=null&&i.texture&&this._originalFill.texture.destroy(o),(s=this._stroke)!=null&&s.texture&&this._stroke.texture.destroy(o),(n=this._originalStroke)!=null&&n.texture&&this._originalStroke.texture.destroy(o)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(i,s,n)=>(i[s]=n,e==null||e(s,n),this.update(),!0)})}_isFillStyle(t){return(t!=null?t:null)!==null&&!(j.isColorLike(t)||t instanceof Ye||t instanceof Mr)}};Xo.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},Xo.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};let Rt=Xo;function _T(r){var t,e,i,s,n;const o=r;if(typeof o.dropShadow=="boolean"&&o.dropShadow){const a=Rt.defaultDropShadow;r.dropShadow={alpha:(t=o.dropShadowAlpha)!=null?t:a.alpha,angle:(e=o.dropShadowAngle)!=null?e:a.angle,blur:(i=o.dropShadowBlur)!=null?i:a.blur,color:(s=o.dropShadowColor)!=null?s:a.color,distance:(n=o.dropShadowDistance)!=null?n:a.distance}}if(o.strokeThickness!==void 0){const a=o.stroke;let l={};if(j.isColorLike(a))l.color=a;else if(a instanceof Ye||a instanceof Mr)l.fill=a;else if(Object.hasOwnProperty.call(a,"color")||Object.hasOwnProperty.call(a,"fill"))l=a;else throw new Error("Invalid stroke value.");r.stroke=gT(wt({},l),{width:o.strokeThickness})}if(Array.isArray(o.fillGradientStops)){let a;r.fontSize==null?r.fontSize=Rt.defaultTextStyle.fontSize:typeof r.fontSize=="string"?a=parseInt(r.fontSize,10):a=r.fontSize;const l=new Ye(0,0,0,a*1.7),u=o.fillGradientStops.map(c=>j.shared.setValue(c).toNumber());u.forEach((c,h)=>{const p=h/(u.length-1);l.addColorStop(p,c)}),r.fill={fill:l}}}const bT=new ut;function jo(r,t,e,i){const s=bT;s.minX=0,s.minY=0,s.maxX=r.width/i|0,s.maxY=r.height/i|0;const n=ht.getOptimalTexture(s.width,s.height,i,!1);return n.source.uploadMethodId="image",n.source.resource=r,n.source.alphaMode="premultiply-alpha-on-upload",n.frame.width=t/i,n.frame.height=e/i,n.source.emit("update",n.source),n.updateUvs(),n}const vT=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function Ir(r){const t=typeof r.fontSize=="number"?`${r.fontSize}px`:r.fontSize;let e=r.fontFamily;Array.isArray(r.fontFamily)||(e=r.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let s=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!vT.includes(s)&&(s=`"${s}"`),e[i]=s}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${t} ${e.join(",")}`}const zo={willReadFrequently:!0},Dt=class O{static get experimentalLetterSpacingSupported(){let t=O._experimentalLetterSpacingSupported;if(t!==void 0){const e=L.get().getCanvasRenderingContext2D().prototype;t=O._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,s,n,o,a,l,u){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=n,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=u}static measureText(t=" ",e,i=O._canvas,s=e.wordWrap){var n;const o=`${t}:${e.styleKey}`;if(O._measurementCache[o])return O._measurementCache[o];const a=Ir(e),l=O.measureFont(a);l.fontSize===0&&(l.fontSize=e.fontSize,l.ascent=e.fontSize);const u=O.__context;u.font=a;const c=(s?O._wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),h=new Array(c.length);let p=0;for(let b=0;b<c.length;b++){const v=O._measureText(c[b],e.letterSpacing,u);h[b]=v,p=Math.max(p,v)}const f=((n=e._stroke)==null?void 0:n.width)||0;let m=p+f;e.dropShadow&&(m+=e.dropShadow.distance);const _=e.lineHeight||l.fontSize;let g=Math.max(_,l.fontSize+f)+(c.length-1)*(_+e.leading);return e.dropShadow&&(g+=e.dropShadow.distance),new O(t,e,m,g,c,h,_+e.leading,p,l)}static _measureText(t,e,i){let s=!1;O.experimentalLetterSpacingSupported&&(O.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));const n=i.measureText(t);let o=n.width;const a=-n.actualBoundingBoxLeft;let l=n.actualBoundingBoxRight-a;if(o>0)if(s)o-=e,l-=e;else{const u=(O.graphemeSegmenter(t).length-1)*e;o+=u,l+=u}return Math.max(o,l)}static _wordWrap(t,e,i=O._canvas){const s=i.getContext("2d",zo);let n=0,o="",a="";const l=Object.create(null),{letterSpacing:u,whiteSpace:c}=e,h=O._collapseSpaces(c),p=O._collapseNewlines(c);let f=!h;const m=e.wordWrapWidth+u,_=O._tokenize(t);for(let g=0;g<_.length;g++){let b=_[g];if(O._isNewline(b)){if(!p){a+=O._addLine(o),f=!h,o="",n=0;continue}b=" "}if(h){const y=O.isBreakingSpace(b),T=O.isBreakingSpace(o[o.length-1]);if(y&&T)continue}const v=O._getFromCache(b,u,l,s);if(v>m)if(o!==""&&(a+=O._addLine(o),o="",n=0),O.canBreakWords(b,e.breakWords)){const y=O.wordWrapSplit(b);for(let T=0;T<y.length;T++){let E=y[T],M=E,w=1;for(;y[T+w];){const S=y[T+w];if(!O.canBreakChars(M,S,b,T,e.breakWords))E+=S;else break;M=S,w++}T+=w-1;const C=O._getFromCache(E,u,l,s);C+n>m&&(a+=O._addLine(o),f=!1,o="",n=0),o+=E,n+=C}}else{o.length>0&&(a+=O._addLine(o),o="",n=0);const y=g===_.length-1;a+=O._addLine(b,!y),f=!1,o="",n=0}else v+n>m&&(f=!1,a+=O._addLine(o),o="",n=0),(o.length>0||!O.isBreakingSpace(b)||f)&&(o+=b,n+=v)}return a+=O._addLine(o,!1),a}static _addLine(t,e=!0){return t=O._trimRight(t),t=e?`${t}
|
|
365
|
+
`:t,t}static _getFromCache(t,e,i,s){let n=i[t];return typeof n!="number"&&(n=O._measureText(t,e,s)+e,i[t]=n),n}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--){const i=t[e];if(!O.isBreakingSpace(i))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){const e=[];let i="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){const n=t[s],o=t[s+1];if(O.isBreakingSpace(n,o)||O._isNewline(n)){i!==""&&(e.push(i),i=""),e.push(n);continue}i+=n}return i!==""&&e.push(i),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,s,n){return!0}static wordWrapSplit(t){return O.graphemeSegmenter(t)}static measureFont(t){if(O._fonts[t])return O._fonts[t];const e=O._context;e.font=t;const i=e.measureText(O.METRICS_STRING+O.BASELINE_SYMBOL),s={ascent:i.actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent,fontSize:i.actualBoundingBoxAscent+i.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{const e=new OffscreenCanvas(0,0),i=e.getContext("2d",zo);if(i!=null&&i.measureText)return O.__canvas=e,e;t=L.get().createCanvas()}catch(e){t=L.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",zo)),O.__context}};Dt.METRICS_STRING="|\xC9q\xC5",Dt.BASELINE_SYMBOL="M",Dt.BASELINE_MULTIPLIER=1.4,Dt.HEIGHT_MULTIPLIER=2,Dt.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})(),Dt.experimentalLetterSpacing=!1,Dt._fonts={},Dt._newlines=[10,13],Dt._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],Dt._measurementCache={};let Ut=Dt;function Fr(r,t){var e;if(r.texture===P.WHITE&&!r.fill)return j.shared.setValue(r.color).setAlpha((e=r.alpha)!=null?e:1).toHexa();if(r.fill){if(r.fill instanceof Mr){const i=r.fill,s=t.createPattern(i.texture.source.resource,"repeat"),n=i.transform.copyTo(G.shared);return n.scale(i.texture.frame.width,i.texture.frame.height),s.setTransform(n),s}else if(r.fill instanceof Ye){const i=r.fill;if(i.type==="linear"){const s=t.createLinearGradient(i.x0,i.y0,i.x1,i.y1);return i.gradientStops.forEach(n=>{s.addColorStop(n.offset,j.shared.setValue(n.color).toHex())}),s}}}else{const i=t.createPattern(r.texture.source.resource,"repeat"),s=r.matrix.copyTo(G.shared);return s.scale(r.texture.frame.width,r.texture.frame.height),i.setTransform(s),i}return"red"}class Vo{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,i){const s=Ut.measureText(t||" ",i);let n=Math.ceil(Math.ceil(Math.max(1,s.width)+i.padding*2)*e),o=Math.ceil(Math.ceil(Math.max(1,s.height)+i.padding*2)*e);return n=Math.ceil(n-1e-6),o=Math.ceil(o-1e-6),n=_e(n),o=_e(o),{width:n,height:o}}getTexture(t,e,i,s){typeof t=="string"&&(no("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:i,resolution:e}),t.style instanceof Rt||(t.style=new Rt(t.style));const{texture:n,canvasAndContext:o}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(n._source),Xt.returnCanvasAndContext(o),n}createTextureAndCanvas(t){var e;const{text:i,style:s}=t,n=(e=t.resolution)!=null?e:this._renderer.resolution,o=Ut.measureText(i||" ",s),a=Math.ceil(Math.ceil(Math.max(1,o.width)+s.padding*2)*n),l=Math.ceil(Math.ceil(Math.max(1,o.height)+s.padding*2)*n),u=Xt.getOptimalCanvasAndContext(a,l),{canvas:c}=u;this.renderTextToCanvas(i,s,n,u);const h=jo(c,a,l,n);if(s.trim){const p=ip(c,n);h.frame.copyFrom(p),h.updateUvs()}return{texture:h,canvasAndContext:u}}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;const e=t._getKey();if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;const{texture:i,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:i,usageCount:1},i}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){const e=this._activeTextures[t];if(e.usageCount--,e.usageCount===0){Xt.returnCanvasAndContext(e.canvasAndContext),ht.returnTexture(e.texture);const i=e.texture.source;i.resource=null,i.uploadMethodId="unknown",i.alphaMode="no-premultiply-alpha",this._activeTextures[t]=null}}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,i,s){var n,o,a,l,u;const{canvas:c,context:h}=s,p=Ir(e),f=Ut.measureText(t||" ",e),m=f.lines,_=f.lineHeight,g=f.lineWidths,b=f.maxLineWidth,v=f.fontProperties,y=c.height;if(h.resetTransform(),h.scale(i,i),h.textBaseline=e.textBaseline,(n=e._stroke)!=null&&n.width){const w=e._stroke;h.lineWidth=w.width,h.miterLimit=w.miterLimit,h.lineJoin=w.join,h.lineCap=w.cap}h.font=p;let T,E;const M=e.dropShadow?2:1;for(let w=0;w<M;++w){const C=e.dropShadow&&w===0,S=C?Math.ceil(Math.max(1,y)+e.padding*2):0,A=S*i;if(C){h.fillStyle="black",h.strokeStyle="black";const R=e.dropShadow,B=R.color,q=R.alpha;h.shadowColor=j.shared.setValue(B).setAlpha(q).toRgbaString();const it=R.blur*i,Tt=R.distance*i;h.shadowBlur=it,h.shadowOffsetX=Math.cos(R.angle)*Tt,h.shadowOffsetY=Math.sin(R.angle)*Tt+A}else h.fillStyle=e._fill?Fr(e._fill,h):null,(o=e._stroke)!=null&&o.width&&(h.strokeStyle=Fr(e._stroke,h)),h.shadowColor="black";let H=(_-v.fontSize)/2;_-v.fontSize<0&&(H=0);const X=(l=(a=e._stroke)==null?void 0:a.width)!=null?l:0;for(let R=0;R<m.length;R++)T=X/2,E=X/2+R*_+v.ascent+H,e.align==="right"?T+=b-g[R]:e.align==="center"&&(T+=(b-g[R])/2),(u=e._stroke)!=null&&u.width&&this._drawLetterSpacing(m[R],e,s,T+e.padding,E+e.padding-S,!0),e._fill!==void 0&&this._drawLetterSpacing(m[R],e,s,T+e.padding,E+e.padding-S)}}_drawLetterSpacing(t,e,i,s,n,o=!1){const{context:a}=i,l=e.letterSpacing;let u=!1;if(Ut.experimentalLetterSpacingSupported&&(Ut.experimentalLetterSpacing?(a.letterSpacing=`${l}px`,a.textLetterSpacing=`${l}px`,u=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),l===0||u){o?a.strokeText(t,s,n):a.fillText(t,s,n);return}let c=s;const h=Ut.graphemeSegmenter(t);let p=a.measureText(t).width,f=0;for(let m=0;m<h.length;++m){const _=h[m];o?a.strokeText(_,c,n):a.fillText(_,c,n);let g="";for(let b=m+1;b<h.length;++b)g+=h[b];f=a.measureText(g).width,c+=p-f+l,p=f}}destroy(){this._activeTextures=null}}Vo.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"canvasText"},D.add(Vo),D.add(Go);var yT=Object.defineProperty,rs=Object.getOwnPropertySymbols,Bp=Object.prototype.hasOwnProperty,Ip=Object.prototype.propertyIsEnumerable,Fp=(r,t,e)=>t in r?yT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,xT=(r,t)=>{for(var e in t||(t={}))Bp.call(t,e)&&Fp(r,e,t[e]);if(rs)for(var e of rs(t))Ip.call(t,e)&&Fp(r,e,t[e]);return r},TT=(r,t)=>{var e={};for(var i in r)Bp.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&rs)for(var i of rs(r))t.indexOf(i)<0&&Ip.call(r,i)&&(e[i]=r[i]);return e};class Qe extends re{constructor(t){t instanceof pt&&(t={context:t});const e=t||{},{context:i,roundPixels:s}=e,n=TT(e,["context","roundPixels"]);super(xT({label:"Graphics"},n)),this.renderPipeId="graphics",i?this._context=i:this._context=this._ownedContext=new pt,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=s!=null?s:!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}addBounds(t){t.addBounds(this._context.bounds)}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||(t==null?void 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 Qe(this._context.clone()):(this._ownedContext=null,new Qe(this._context))}lineStyle(t,e,i){const s={};return t&&(s.width=t),e&&(s.color=e),i&&(s.alpha=i),this.context.strokeStyle=s,this}beginFill(t,e){const i={};return t&&(i.color=t),e&&(i.alpha=e),this.context.fillStyle=i,this}endFill(){this.context.fill();const t=this.context.strokeStyle;return(t.width!==pt.defaultStrokeStyle.width||t.color!==pt.defaultStrokeStyle.color||t.alpha!==pt.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return this._callContextMethod("circle",t)}drawEllipse(...t){return this._callContextMethod("ellipse",t)}drawPolygon(...t){return this._callContextMethod("poly",t)}drawRect(...t){return this._callContextMethod("rect",t)}drawRoundedRect(...t){return this._callContextMethod("roundRect",t)}drawStar(...t){return this._callContextMethod("star",t)}}const Dp={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
366
|
+
struct LocalUniforms {
|
|
367
|
+
uColor:vec4<f32>,
|
|
368
|
+
uTransformMatrix:mat3x3<f32>,
|
|
369
|
+
uDistance: f32,
|
|
370
|
+
uRound:f32,
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
@group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
|
|
374
|
+
`,main:`
|
|
375
|
+
vColor *= localUniforms.uColor;
|
|
376
|
+
modelMatrix *= localUniforms.uTransformMatrix;
|
|
377
|
+
`,end:`
|
|
378
|
+
if(localUniforms.uRound == 1)
|
|
379
|
+
{
|
|
380
|
+
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
381
|
+
}
|
|
382
|
+
`},fragment:{header:`
|
|
383
|
+
struct LocalUniforms {
|
|
384
|
+
uColor:vec4<f32>,
|
|
385
|
+
uTransformMatrix:mat3x3<f32>,
|
|
386
|
+
uDistance: f32
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
@group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
|
|
390
|
+
`,main:`
|
|
391
|
+
outColor = vec4<f32>(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance));
|
|
392
|
+
`}},Up={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
393
|
+
uniform mat3 uTransformMatrix;
|
|
394
|
+
uniform vec4 uColor;
|
|
395
|
+
uniform float uRound;
|
|
396
|
+
`,main:`
|
|
397
|
+
vColor *= uColor;
|
|
398
|
+
modelMatrix *= uTransformMatrix;
|
|
399
|
+
`,end:`
|
|
400
|
+
if(uRound == 1.)
|
|
401
|
+
{
|
|
402
|
+
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
403
|
+
}
|
|
404
|
+
`},fragment:{header:`
|
|
405
|
+
uniform float uDistance;
|
|
406
|
+
`,main:`
|
|
407
|
+
outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance));
|
|
408
|
+
`}},kp={name:"msdf-bit",fragment:{header:`
|
|
409
|
+
fn calculateMSDFAlpha(msdfColor:vec4<f32>, shapeColor:vec4<f32>, distance:f32) -> f32 {
|
|
410
|
+
|
|
411
|
+
// MSDF
|
|
412
|
+
var median = msdfColor.r + msdfColor.g + msdfColor.b -
|
|
413
|
+
min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -
|
|
414
|
+
max(msdfColor.r, max(msdfColor.g, msdfColor.b));
|
|
415
|
+
|
|
416
|
+
// SDF
|
|
417
|
+
median = min(median, msdfColor.a);
|
|
418
|
+
|
|
419
|
+
var screenPxDistance = distance * (median - 0.5);
|
|
420
|
+
var alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);
|
|
421
|
+
if (median < 0.01) {
|
|
422
|
+
alpha = 0.0;
|
|
423
|
+
} else if (median > 0.99) {
|
|
424
|
+
alpha = 1.0;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
// Gamma correction for coverage-like alpha
|
|
428
|
+
var luma: f32 = dot(shapeColor.rgb, vec3<f32>(0.299, 0.587, 0.114));
|
|
429
|
+
var gamma: f32 = mix(1.0, 1.0 / 2.2, luma);
|
|
430
|
+
var coverage: f32 = pow(shapeColor.a * alpha, gamma);
|
|
431
|
+
|
|
432
|
+
return coverage;
|
|
433
|
+
|
|
434
|
+
}
|
|
435
|
+
`}},$p={name:"msdf-bit",fragment:{header:`
|
|
436
|
+
float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) {
|
|
437
|
+
|
|
438
|
+
// MSDF
|
|
439
|
+
float median = msdfColor.r + msdfColor.g + msdfColor.b -
|
|
440
|
+
min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -
|
|
441
|
+
max(msdfColor.r, max(msdfColor.g, msdfColor.b));
|
|
442
|
+
|
|
443
|
+
// SDF
|
|
444
|
+
median = min(median, msdfColor.a);
|
|
445
|
+
|
|
446
|
+
float screenPxDistance = distance * (median - 0.5);
|
|
447
|
+
float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);
|
|
448
|
+
|
|
449
|
+
if (median < 0.01) {
|
|
450
|
+
alpha = 0.0;
|
|
451
|
+
} else if (median > 0.99) {
|
|
452
|
+
alpha = 1.0;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// Gamma correction for coverage-like alpha
|
|
456
|
+
float luma = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114));
|
|
457
|
+
float gamma = mix(1.0, 1.0 / 2.2, luma);
|
|
458
|
+
float coverage = pow(shapeColor.a * alpha, gamma);
|
|
459
|
+
|
|
460
|
+
return coverage;
|
|
461
|
+
}
|
|
462
|
+
`}};let Wo,Yo;class Lp extends At{constructor(){const 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=ve();Wo!=null||(Wo=He({name:"sdf-shader",bits:[Ci,Gi(e),Dp,kp,je]})),Yo!=null||(Yo=Xe({name:"sdf-shader",bits:[Oi,Bi(e),Up,$p,ze]})),super({glProgram:Yo,gpuProgram:Wo,resources:{localUniforms:t,batchSamplers:Ii(e)}})}}let Ko=0;const Np=500;function jt(...r){Ko!==Np&&(Ko++,Ko===Np?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...r))}class qo extends mt{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 this.fontFamily}get pageTextures(){return this.pages}get size(){return this.fontMetrics.fontSize}get distanceFieldRange(){return this.distanceField.range}get distanceFieldType(){return this.distanceField.type}destroy(t=!1){var e;this.emit("destroy",this),this.removeAllListeners();for(const i in this.chars)(e=this.chars[i].texture)==null||e.destroy();this.chars=null,t&&(this.pages.forEach(i=>i.texture.destroy(!0)),this.pages=null)}}function Zo(r){if(r==="")return[];typeof r=="string"&&(r=[r]);const t=[];for(let e=0,i=r.length;e<i;e++){const s=r[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.");const n=s[0].charCodeAt(0),o=s[1].charCodeAt(0);if(o<n)throw new Error("[BitmapFont]: Invalid character range.");for(let a=n,l=o;a<=l;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 ST=Object.defineProperty,Hp=Object.getOwnPropertySymbols,ET=Object.prototype.hasOwnProperty,AT=Object.prototype.propertyIsEnumerable,Xp=(r,t,e)=>t in r?ST(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,jp=(r,t)=>{for(var e in t||(t={}))ET.call(t,e)&&Xp(r,e,t[e]);if(Hp)for(var e of Hp(t))AT.call(t,e)&&Xp(r,e,t[e]);return r};const zp=class vy extends qo{constructor(t){var e,i,s;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;const n=jp(jp({},vy.defaultOptions),t);this._textureSize=n.textureSize,this._mipmap=n.mipmap;const o=n.style.clone();n.overrideFill&&(o._fill.color=16777215,o._fill.alpha=1,o._fill.texture=P.WHITE,o._fill.fill=null),this.applyFillAsTint=n.overrideFill;const a=o.fontSize;o.fontSize=this.baseMeasurementFontSize;const l=Ir(o);n.overrideSize?o._stroke&&(o._stroke.width*=this.baseRenderedFontSize/a):o.fontSize=this.baseRenderedFontSize=a,this._style=o,this._skipKerning=(e=n.skipKerning)!=null?e:!1,this.resolution=(i=n.resolution)!=null?i:1,this._padding=(s=n.padding)!=null?s:4,this.fontMetrics=Ut.measureFont(l),this.lineHeight=o.lineHeight||this.fontMetrics.fontSize||o.fontSize}ensureCharacters(t){var e,i,s,n;const o=Zo(t).filter(v=>!this._currentChars.includes(v)).filter((v,y,T)=>T.indexOf(v)===y);if(!o.length)return;this._currentChars=[...this._currentChars,...o];let a;this._currentPageIndex===-1?a=this._nextPage():a=this.pages[this._currentPageIndex];let{canvas:l,context:u}=a.canvasAndContext,c=a.texture.source;const h=this._style;let p=this._currentX,f=this._currentY;const m=this.baseRenderedFontSize/this.baseMeasurementFontSize,_=this._padding*m;let g=0,b=!1;for(let v=0;v<o.length;v++){const y=o[v],T=Ut.measureText(y,h,l,!1),E=Math.ceil((h.fontStyle==="italic"?2:1)*T.width);T.lineHeight=T.height;const M=T.width*m,w=T.height*m,C=E+_*2,S=w+_*2;if(b=!1,y!==`
|
|
463
|
+
`&&y!=="\r"&&y!==" "&&y!==" "&&(b=!0,g=Math.ceil(Math.max(S,g))),p+C>this._textureSize&&(f+=g,g=S,p=0,f+g>this._textureSize)){c.update();const H=this._nextPage();l=H.canvasAndContext.canvas,u=H.canvasAndContext.context,c=H.texture.source,f=0}const A=M/m-((i=(e=h.dropShadow)==null?void 0:e.distance)!=null?i:0)-((n=(s=h._stroke)==null?void 0:s.width)!=null?n:0);if(this.chars[y]={id:y.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:A,kerning:{}},b){this._drawGlyph(u,T,p+_,f+_,m,h);const H=c.width*m,X=c.height*m,R=new V(p/H*c.width,f/X*c.height,C/H*c.width,S/X*c.height);this.chars[y].texture=new P({source:c,frame:R}),p+=Math.ceil(C)}}c.update(),this._currentX=p,this._currentY=f,this._skipKerning&&this._applyKerning(o,u)}get pageTextures(){return this.pages}_applyKerning(t,e){const i=this._measureCache;for(let s=0;s<t.length;s++){const n=t[s];for(let o=0;o<this._currentChars.length;o++){const a=this._currentChars[o];let l=i[n];l||(l=i[n]=e.measureText(n).width);let u=i[a];u||(u=i[a]=e.measureText(a).width);let c=e.measureText(n+a).width,h=c-(l+u);h&&(this.chars[n].kerning[a]=h),c=e.measureText(n+a).width,h=c-(l+u),h&&(this.chars[a].kerning[n]=h)}}}_nextPage(){this._currentPageIndex++;const t=this.resolution,e=Xt.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);const i=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new P({source:new be({resource:e.canvas,resolution:i,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})}),n={canvasAndContext:e,texture:s};return this.pages[this._currentPageIndex]=n,n}_setupContext(t,e,i){var s;e.fontSize=this.baseRenderedFontSize,t.scale(i,i),t.font=Ir(e),e.fontSize=this.baseMeasurementFontSize,t.textBaseline=e.textBaseline;const n=e._stroke,o=(s=n==null?void 0:n.width)!=null?s:0;if(n&&(t.lineWidth=o,t.lineJoin=n.join,t.miterLimit=n.miterLimit,t.strokeStyle=Fr(n,t)),e._fill&&(t.fillStyle=Fr(e._fill,t)),e.dropShadow){const a=e.dropShadow,l=j.shared.setValue(a.color).toArray(),u=a.blur*i,c=a.distance*i;t.shadowColor=`rgba(${l[0]*255},${l[1]*255},${l[2]*255},${a.alpha})`,t.shadowBlur=u,t.shadowOffsetX=Math.cos(a.angle)*c,t.shadowOffsetY=Math.sin(a.angle)*c}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0}_drawGlyph(t,e,i,s,n,o){var a;const l=e.text,u=e.fontProperties,c=o._stroke,h=((a=c==null?void 0:c.width)!=null?a:0)*n,p=i+h/2,f=s-h/2,m=u.descent*n,_=e.lineHeight*n;o.stroke&&h&&t.strokeText(l,p,f+_-m),o._fill&&t.fillText(l,p,f+_-m)}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){const{canvasAndContext:e,texture:i}=this.pages[t];Xt.returnCanvasAndContext(e),i.destroy(!0)}this.pages=null}};zp.defaultOptions={textureSize:512,style:new Rt,mipmap:!0};let Qo=zp;function Jo(r,t,e,i){const 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 n=s.lines[0],o=null,a=!0;const l={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},u=m=>{const _=n.width;for(let g=0;g<l.index;g++){const b=m.positions[g];n.chars.push(m.chars[g]),n.charPositions.push(b+_)}n.width+=m.width,a=!1,l.width=0,l.index=0,l.chars.length=0},c=()=>{let m=n.chars.length-1;if(i){let _=n.chars[m];for(;_===" ";)n.width-=e.chars[_].xAdvance,_=n.chars[--m]}s.width=Math.max(s.width,n.width),n={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,s.lines.push(n),s.height+=e.lineHeight},h=e.baseMeasurementFontSize/t.fontSize,p=t.letterSpacing*h,f=t.wordWrapWidth*h;for(let m=0;m<r.length+1;m++){let _;const g=m===r.length;g||(_=r[m]);const b=e.chars[_]||e.chars[" "];if(/(?:\s)/.test(_)||_==="\r"||_===`
|
|
464
|
+
`||g){if(!a&&t.wordWrap&&n.width+l.width-p>f?(c(),u(l),g||n.charPositions.push(0)):(l.start=n.width,u(l),g||n.charPositions.push(0)),_==="\r"||_===`
|
|
465
|
+
`)n.width!==0&&c();else if(!g){const v=b.xAdvance+(b.kerning[o]||0)+p;n.width+=v,n.spaceWidth=v,n.spacesIndex.push(n.charPositions.length),n.chars.push(_)}}else{const v=b.kerning[o]||0,y=b.xAdvance+v+p;l.positions[l.index++]=l.width+v,l.chars.push(_),l.width+=y}o=_}return c(),t.align==="center"?PT(s):t.align==="right"?wT(s):t.align==="justify"&&RT(s),s}function PT(r){for(let t=0;t<r.lines.length;t++){const e=r.lines[t],i=r.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=i}}function wT(r){for(let t=0;t<r.lines.length;t++){const e=r.lines[t],i=r.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=i}}function RT(r){const t=r.width;for(let e=0;e<r.lines.length;e++){const i=r.lines[e];let s=0,n=i.spacesIndex[s++],o=0;const a=i.spacesIndex.length,l=(t-i.width)/a;for(let u=0;u<i.charPositions.length;u++)u===n&&(n=i.spacesIndex[s++],o+=l),i.charPositions[u]+=o}}var MT=Object.defineProperty,Vp=Object.getOwnPropertySymbols,CT=Object.prototype.hasOwnProperty,OT=Object.prototype.propertyIsEnumerable,Wp=(r,t,e)=>t in r?MT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ta=(r,t)=>{for(var e in t||(t={}))CT.call(t,e)&&Wp(r,e,t[e]);if(Vp)for(var e of Vp(t))OT.call(t,e)&&Wp(r,e,t[e]);return r};let is=0,GT=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){var i;let s=`${e.fontFamily}-bitmap`,n=!0;if(e._fill.fill&&!e._stroke)s+=e._fill.fill.styleKey,n=!1;else if(e._stroke||e.dropShadow){let a=e.styleKey;a=a.substring(0,a.lastIndexOf("-")),s=`${a}-bitmap`,n=!1}if(!Y.has(s)){const a=new Qo(ta({style:e,overrideFill:n,overrideSize:!0},this.defaultOptions));is++,is>50&&jt("BitmapText",`You have dynamically created ${is} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),a.once("destroy",()=>{is--,Y.remove(s)}),Y.set(s,a)}const o=Y.get(s);return(i=o.ensureCharacters)==null||i.call(o,t),o}getLayout(t,e,i=!0){const s=this.getFont(t,e);return Jo([...t],e,s,i)}measureText(t,e,i=!0){return this.getLayout(t,e,i)}install(...t){var e,i,s,n;let o=t[0];typeof o=="string"&&(o={name:o,style:t[1],chars:(e=t[2])==null?void 0:e.chars,resolution:(i=t[2])==null?void 0:i.resolution,padding:(s=t[2])==null?void 0:s.padding,skipKerning:(n=t[2])==null?void 0:n.skipKerning});const a=o==null?void 0:o.name;if(!a)throw new Error("[BitmapFontManager] Property `name` is required.");o=ta(ta({},this.defaultOptions),o);const l=o.style,u=l instanceof Rt?l:new Rt(l),c=u._fill.fill!==null&&u._fill.fill!==void 0,h=new Qo({style:u,overrideFill:c,skipKerning:o.skipKerning,padding:o.padding,resolution:o.resolution,overrideSize:!1}),p=Zo(o.chars);return h.ensureCharacters(p.join("")),Y.set(`${a}-bitmap`,h),h.once("destroy",()=>Y.remove(`${a}-bitmap`)),h}uninstall(t){const e=`${t}-bitmap`,i=Y.get(e);i&&i.destroy()}};const Dr=new GT;class ea{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(t){const e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){const i=this._getGpuBitmapText(t);Yp(t,i),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,i)),this._renderer.renderPipes.graphics.addRenderable(i,e),i.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){const e=this._gpuBitmapText[t].context;e.customShader&&(N.return(e.customShader),e.customShader=null),N.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){const e=this._getGpuBitmapText(t);Yp(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){const{context:i}=e,s=Dr.getFont(t.text,t._style);i.clear(),s.distanceField.type!=="none"&&(i.customShader||(i.customShader=N.get(Lp)));const n=Array.from(t.text),o=t._style;let a=s.baseLineOffset;const l=Jo(n,o,s,!0);let u=0;const c=o.padding,h=l.scale;let p=l.width,f=l.height+l.offsetY;o._stroke&&(p+=o._stroke.width/h,f+=o._stroke.width/h),i.translate(-t._anchor._x*p-c,-t._anchor._y*f-c).scale(h,h);const m=s.applyFillAsTint?o._fill.color:16777215;for(let _=0;_<l.lines.length;_++){const g=l.lines[_];for(let b=0;b<g.charPositions.length;b++){const v=n[u++],y=s.chars[v];y!=null&&y.texture&&i.texture(y.texture,m||"black",Math.round(g.charPositions[b]+y.xOffset),Math.round(a+y.yOffset))}a+=s.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){const e=N.get(Qe);return this._gpuBitmapText[t.uid]=e,this._updateContext(t,e),t.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[t.uid]}_updateDistanceField(t){const e=this._getGpuBitmapText(t).context,i=t._style.fontFamily,s=Y.get(`${i}-bitmap`),{a:n,b:o,c:a,d:l}=t.groupTransform,u=Math.sqrt(n*n+o*o),c=Math.sqrt(a*a+l*l),h=(Math.abs(u)+Math.abs(c))/2,p=s.baseRenderedFontSize/t._style.fontSize,f=h*s.distanceField.range*(1/p);e.customShader.resources.localUniforms.uniforms.uDistance=f}destroy(){for(const t in this._gpuBitmapText)this._destroyRenderableByUid(t);this._gpuBitmapText=null,this._renderer=null}}ea.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"bitmapText"};function Yp(r,t){t.groupTransform=r.groupTransform,t.groupColorAlpha=r.groupColorAlpha,t.groupColor=r.groupColor,t.groupBlendMode=r.groupBlendMode,t.globalDisplayStatus=r.globalDisplayStatus,t.groupTransform=r.groupTransform,t.localDisplayStatus=r.localDisplayStatus,t.groupAlpha=r.groupAlpha,t._roundPixels=r._roundPixels}D.add(ea);class ra{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(const t in this._gpuText){const e=this._gpuText[t];if(!e)continue;const i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){const e=this._getGpuText(t),i=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==i}addRenderable(t,e){const i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){const e=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),e._batcher.updateElement(e)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){const e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),N.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){const e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o)}),t._didTextUpdate=!1;const n=t._style.padding;xr(s.bounds,t._anchor,s.texture,n)}async _updateGpuText(t){var e;t._didTextUpdate=!1;const i=this._getGpuText(t);if(i.generatingTexture)return;const s=t._getKey();this._renderer.htmlText.decreaseReferenceCount(i.currentKey),i.generatingTexture=!0,i.currentKey=s;const n=(e=t.resolution)!=null?e:this._renderer.resolution,o=await this._renderer.htmlText.getManagedTexture(t.text,n,t._style,t._getKey()),a=i.batchableSprite;a.texture=i.texture=o,i.generatingTexture=!1,i.textureNeedsUploading=!0,t.onViewUpdate();const l=t._style.padding;xr(a.bounds,t._anchor,a.texture,l)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){const e={texture:P.EMPTY,currentKey:"--",batchableSprite:N.get(Yi),textureNeedsUploading:!1,generatingTexture:!1},i=e.batchableSprite;return i.renderable=t,i.transform=t.groupTransform,i.texture=P.EMPTY,i.bounds={minX:0,maxX:1,minY:0,maxY:0},i.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}}ra.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"htmlText"};function Kp(){const{userAgent:r}=L.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(r)}const ia="http://www.w3.org/2000/svg",sa="http://www.w3.org/1999/xhtml";class na{constructor(){this.svgRoot=document.createElementNS(ia,"svg"),this.foreignObject=document.createElementNS(ia,"foreignObject"),this.domElement=document.createElementNS(sa,"div"),this.styleElement=document.createElementNS(sa,"style"),this.image=new Image;const{foreignObject:t,svgRoot:e,styleElement:i,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(i),t.appendChild(s)}}function qp(r){const t=r._stroke,e=r._fill,i=[`div { ${[`color: ${j.shared.setValue(e.color).toHex()}`,`font-size: ${r.fontSize}px`,`font-family: ${r.fontFamily}`,`font-weight: ${r.fontWeight}`,`font-style: ${r.fontStyle}`,`font-variant: ${r.fontVariant}`,`letter-spacing: ${r.letterSpacing}px`,`text-align: ${r.align}`,`padding: ${r.padding}px`,`white-space: ${r.whiteSpace==="pre"&&r.wordWrap?"pre-wrap":r.whiteSpace}`,...r.lineHeight?[`line-height: ${r.lineHeight}px`]:[],...r.wordWrap?[`word-wrap: ${r.breakWords?"break-all":"break-word"}`,`max-width: ${r.wordWrapWidth}px`]:[],...t?[Qp(t)]:[],...r.dropShadow?[Zp(r.dropShadow)]:[],...r.cssOverrides].join(";")} }`];return BT(r.tagStyles,i),i.join(" ")}function Zp(r){const t=j.shared.setValue(r.color).setAlpha(r.alpha).toHexa(),e=Math.round(Math.cos(r.angle)*r.distance),i=Math.round(Math.sin(r.angle)*r.distance),s=`${e}px ${i}px`;return r.blur>0?`text-shadow: ${s} ${r.blur}px ${t}`:`text-shadow: ${s} ${t}`}function Qp(r){return[`-webkit-text-stroke-width: ${r.width}px`,`-webkit-text-stroke-color: ${j.shared.setValue(r.color).toHex()}`,`text-stroke-width: ${r.width}px`,`text-stroke-color: ${j.shared.setValue(r.color).toHex()}`,"paint-order: stroke"].join(";")}const Jp={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"},tf={fill:r=>`color: ${j.shared.setValue(r).toHex()}`,breakWords:r=>`word-wrap: ${r?"break-all":"break-word"}`,stroke:Qp,dropShadow:Zp};function BT(r,t){for(const e in r){const i=r[e],s=[];for(const n in i)tf[n]?s.push(tf[n](i[n])):Jp[n]&&s.push(Jp[n].replace("{{VALUE}}",i[n]));t.push(`${e} { ${s.join(";")} }`)}}var IT=Object.defineProperty,ef=Object.getOwnPropertySymbols,FT=Object.prototype.hasOwnProperty,DT=Object.prototype.propertyIsEnumerable,rf=(r,t,e)=>t in r?IT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,UT=(r,t)=>{for(var e in t||(t={}))FT.call(t,e)&&rf(r,e,t[e]);if(ef)for(var e of ef(t))DT.call(t,e)&&rf(r,e,t[e]);return r};class Pe extends Rt{constructor(t={}){var e,i;super(t),this._cssOverrides=[],(e=this.cssOverrides)!=null||(this.cssOverrides=t.cssOverrides),this.tagStyles=(i=t.tagStyles)!=null?i:{}}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=Ho(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new Pe({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?UT({},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=qp(this)),this._cssStyle}addOverride(...t){const e=t.filter(i=>!this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){const e=t.filter(i=>this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(i=>!e.includes(i)),this.update())}set fill(t){super.fill=t}set stroke(t){super.stroke=t}}function sf(r,t){const e=t.fontFamily,i=[],s={},n=/font-family:([^;"\s]+)/g,o=r.match(n);function a(l){s[l]||(i.push(l),s[l]=!0)}if(Array.isArray(e))for(let l=0;l<e.length;l++)a(e[l]);else a(e);o&&o.forEach(l=>{const u=l.split(":")[1].trim();a(u)});for(const l in t.tagStyles){const u=t.tagStyles[l].fontFamily;a(u)}return i}async function nf(r){const t=await(await L.get().fetch(r)).blob(),e=new FileReader;return await new Promise((i,s)=>{e.onloadend=()=>i(e.result),e.onerror=s,e.readAsDataURL(t)})}async function oa(r,t){const e=await nf(t);return`@font-face {
|
|
466
|
+
font-family: "${r.fontFamily}";
|
|
467
|
+
src: url('${e}');
|
|
468
|
+
font-weight: ${r.fontWeight};
|
|
469
|
+
font-style: ${r.fontStyle};
|
|
470
|
+
}`}const Ur=new Map;async function of(r,t,e){const i=r.filter(s=>Y.has(`${s}-and-url`)).map((s,n)=>{if(!Ur.has(s)){const{url:o}=Y.get(`${s}-and-url`);n===0?Ur.set(s,oa({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},o)):Ur.set(s,oa({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},o))}return Ur.get(s)});return(await Promise.all(i)).join(`
|
|
471
|
+
`)}function af(r,t,e,i,s){const{domElement:n,styleElement:o,svgRoot:a}=s;n.innerHTML=`<style>${t.cssStyle}</style><div style='padding:0;'>${r}</div>`,n.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),o.textContent=i;const{width:l,height:u}=s.image;return a.setAttribute("width",l.toString()),a.setAttribute("height",u.toString()),new XMLSerializer().serializeToString(a)}function lf(r,t){const e=Xt.getOptimalCanvasAndContext(r.width,r.height,t),{context:i}=e;return i.clearRect(0,0,r.width,r.height),i.drawImage(r,0,0),e}function uf(r,t,e){return new Promise(async i=>{e&&await new Promise(s=>setTimeout(s,100)),r.onload=()=>{i()},r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,r.crossOrigin="anonymous"})}let cf;function aa(r,t,e,i){i=i||cf||(cf=new na);const{domElement:s,styleElement:n,svgRoot:o}=i;s.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${r}</div>`,s.setAttribute("style","transform-origin: top left; display: inline-block"),e&&(n.textContent=e),document.body.appendChild(o);const a=s.getBoundingClientRect();o.remove();const l=Ut.measureFont(t.fontStyle).descent,u=t.padding*2;return{width:a.width-u,height:a.height+l-u}}class ss{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===bt.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,i,s){if(this._activeTextures[s])return this._increaseReferenceCount(s),this._activeTextures[s].promise;const n=this._buildTexturePromise(t,e,i).then(o=>(this._activeTextures[s].texture=o,o));return this._activeTextures[s]={texture:null,promise:n,usageCount:1},n}async _buildTexturePromise(t,e,i){const s=N.get(na),n=sf(t,i),o=await of(n,i,Pe.defaultTextStyle),a=aa(t,i,o,s),l=Math.ceil(Math.ceil(Math.max(1,a.width)+i.padding*2)*e),u=Math.ceil(Math.ceil(Math.max(1,a.height)+i.padding*2)*e),c=s.image,h=2;c.width=(l|0)+h,c.height=(u|0)+h;const p=af(t,i,e,o,s);await uf(c,p,Kp()&&n.length>0);const f=c;let m;this._createCanvas&&(m=lf(c,e));const _=jo(m?m.canvas:f,c.width-h,c.height-h,e);return this._createCanvas&&(this._renderer.texture.initSource(_.source),Xt.returnCanvasAndContext(m)),N.return(s),_}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){const e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(e.texture?this._cleanUp(e):e.promise.then(i=>{e.texture=i,this._cleanUp(e)}).catch(()=>{}),this._activeTextures[t]=null))}_cleanUp(t){ht.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown"}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null}}ss.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"htmlText"},ss.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"},D.add(ss),D.add(ra);var kT=Object.defineProperty,hf=Object.getOwnPropertySymbols,$T=Object.prototype.hasOwnProperty,LT=Object.prototype.propertyIsEnumerable,df=(r,t,e)=>t in r?kT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,pf=(r,t)=>{for(var e in t||(t={}))$T.call(t,e)&&df(r,e,t[e]);if(hf)for(var e of hf(t))LT.call(t,e)&&df(r,e,t[e]);return r};const ff=class yy extends xe{constructor(...t){var e;let i=(e=t[0])!=null?e:{};i instanceof Float32Array&&(i={positions:i,uvs:t[1],indices:t[2]}),i=pf(pf({},yy.defaultOptions),i);const s=i.positions||new Float32Array([0,0,1,0,1,1,0,1]),n=i.uvs||new Float32Array([0,0,1,0,1,1,0,1]),o=i.indices||new Uint32Array([0,1,2,0,2,3]),a=i.shrinkBuffersToFit,l=new dt({data:s,label:"attribute-mesh-positions",shrinkToFit:a,usage:$.VERTEX|$.COPY_DST}),u=new dt({data:n,label:"attribute-mesh-uvs",shrinkToFit:a,usage:$.VERTEX|$.COPY_DST}),c=new dt({data:o,label:"index-mesh-buffer",shrinkToFit:a,usage:$.INDEX|$.COPY_DST});super({attributes:{aPosition:{buffer:l,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:u,format:"float32x2",stride:2*4,offset:0}},indexBuffer:c,topology:i.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}};ff.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};let oe=ff;var NT=Object.defineProperty,HT=Object.defineProperties,XT=Object.getOwnPropertyDescriptors,mf=Object.getOwnPropertySymbols,jT=Object.prototype.hasOwnProperty,zT=Object.prototype.propertyIsEnumerable,gf=(r,t,e)=>t in r?NT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,_f=(r,t)=>{for(var e in t||(t={}))jT.call(t,e)&&gf(r,e,t[e]);if(mf)for(var e of mf(t))zT.call(t,e)&&gf(r,e,t[e]);return r},bf=(r,t)=>HT(r,XT(t));const Je={name:"local-uniform-bit",vertex:{header:`
|
|
472
|
+
|
|
473
|
+
struct LocalUniforms {
|
|
474
|
+
uTransformMatrix:mat3x3<f32>,
|
|
475
|
+
uColor:vec4<f32>,
|
|
476
|
+
uRound:f32,
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
@group(1) @binding(0) var<uniform> localUniforms : LocalUniforms;
|
|
480
|
+
`,main:`
|
|
481
|
+
vColor *= localUniforms.uColor;
|
|
482
|
+
modelMatrix *= localUniforms.uTransformMatrix;
|
|
483
|
+
`,end:`
|
|
484
|
+
if(localUniforms.uRound == 1)
|
|
485
|
+
{
|
|
486
|
+
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
487
|
+
}
|
|
488
|
+
`}},vf=bf(_f({},Je),{vertex:bf(_f({},Je.vertex),{header:Je.vertex.header.replace("group(1)","group(2)")})}),ns={name:"local-uniform-bit",vertex:{header:`
|
|
489
|
+
|
|
490
|
+
uniform mat3 uTransformMatrix;
|
|
491
|
+
uniform vec4 uColor;
|
|
492
|
+
uniform float uRound;
|
|
493
|
+
`,main:`
|
|
494
|
+
vColor *= uColor;
|
|
495
|
+
modelMatrix = uTransformMatrix;
|
|
496
|
+
`,end:`
|
|
497
|
+
if(uRound == 1.)
|
|
498
|
+
{
|
|
499
|
+
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
500
|
+
}
|
|
501
|
+
`}},yf={name:"tiling-bit",vertex:{header:`
|
|
502
|
+
struct TilingUniforms {
|
|
503
|
+
uMapCoord:mat3x3<f32>,
|
|
504
|
+
uClampFrame:vec4<f32>,
|
|
505
|
+
uClampOffset:vec2<f32>,
|
|
506
|
+
uTextureTransform:mat3x3<f32>,
|
|
507
|
+
uSizeAnchor:vec4<f32>
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
@group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
|
|
511
|
+
@group(2) @binding(1) var uTexture: texture_2d<f32>;
|
|
512
|
+
@group(2) @binding(2) var uSampler: sampler;
|
|
513
|
+
`,main:`
|
|
514
|
+
uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy;
|
|
515
|
+
|
|
516
|
+
position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy;
|
|
517
|
+
`},fragment:{header:`
|
|
518
|
+
struct TilingUniforms {
|
|
519
|
+
uMapCoord:mat3x3<f32>,
|
|
520
|
+
uClampFrame:vec4<f32>,
|
|
521
|
+
uClampOffset:vec2<f32>,
|
|
522
|
+
uTextureTransform:mat3x3<f32>,
|
|
523
|
+
uSizeAnchor:vec4<f32>
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
@group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
|
|
527
|
+
@group(2) @binding(1) var uTexture: texture_2d<f32>;
|
|
528
|
+
@group(2) @binding(2) var uSampler: sampler;
|
|
529
|
+
`,main:`
|
|
530
|
+
|
|
531
|
+
var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV);
|
|
532
|
+
coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy;
|
|
533
|
+
var unclamped = coord;
|
|
534
|
+
coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw);
|
|
535
|
+
|
|
536
|
+
var bias = 0.;
|
|
537
|
+
|
|
538
|
+
if(unclamped.x == coord.x && unclamped.y == coord.y)
|
|
539
|
+
{
|
|
540
|
+
bias = -32.;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
outColor = textureSampleBias(uTexture, uSampler, coord, bias);
|
|
544
|
+
`}},xf={name:"tiling-bit",vertex:{header:`
|
|
545
|
+
uniform mat3 uTextureTransform;
|
|
546
|
+
uniform vec4 uSizeAnchor;
|
|
547
|
+
|
|
548
|
+
`,main:`
|
|
549
|
+
uv = (uTextureTransform * vec3(aUV, 1.0)).xy;
|
|
550
|
+
|
|
551
|
+
position = (position - uSizeAnchor.zw) * uSizeAnchor.xy;
|
|
552
|
+
`},fragment:{header:`
|
|
553
|
+
uniform sampler2D uTexture;
|
|
554
|
+
uniform mat3 uMapCoord;
|
|
555
|
+
uniform vec4 uClampFrame;
|
|
556
|
+
uniform vec2 uClampOffset;
|
|
557
|
+
`,main:`
|
|
558
|
+
|
|
559
|
+
vec2 coord = vUV + ceil(uClampOffset - vUV);
|
|
560
|
+
coord = (uMapCoord * vec3(coord, 1.0)).xy;
|
|
561
|
+
vec2 unclamped = coord;
|
|
562
|
+
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
|
|
563
|
+
|
|
564
|
+
outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
|
|
565
|
+
|
|
566
|
+
`}};let la,ua;class Tf extends At{constructor(){la!=null||(la=He({name:"tiling-sprite-shader",bits:[Je,yf,je]})),ua!=null||(ua=Xe({name:"tiling-sprite-shader",bits:[ns,xf,ze]}));const 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:ua,gpuProgram:la,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:P.EMPTY.source,uSampler:P.EMPTY.source.style}})}updateUniforms(t,e,i,s,n,o){const a=this.resources.tilingUniforms,l=o.width,u=o.height,c=o.textureMatrix,h=a.uniforms.uTextureTransform;h.set(i.a*l/t,i.b*l/e,i.c*u/t,i.d*u/e,i.tx/t,i.ty/e),h.invert(),a.uniforms.uMapCoord=c.mapCoord,a.uniforms.uClampFrame=c.uClampFrame,a.uniforms.uClampOffset=c.uClampOffset,a.uniforms.uTextureTransform=h,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=n,o&&(this.resources.uTexture=o.source,this.resources.uSampler=o.source.style)}}class Sf extends oe{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 Ef(r,t){const e=r.anchor.x,i=r.anchor.y;t[0]=-e*r.width,t[1]=-i*r.height,t[2]=(1-e)*r.width,t[3]=-i*r.height,t[4]=(1-e)*r.width,t[5]=(1-i)*r.height,t[6]=-e*r.width,t[7]=(1-i)*r.height}function Af(r,t,e,i){let s=0;const n=r.length/(t||2),o=i.a,a=i.b,l=i.c,u=i.d,c=i.tx,h=i.ty;for(e*=t;s<n;){const p=r[e],f=r[e+1];r[e]=o*p+l*f+c,r[e+1]=a*p+u*f+h,e+=t,s++}}function Pf(r,t){const e=r.texture,i=e.frame.width,s=e.frame.height;let n=0,o=0;r._applyAnchorToTexture&&(n=r.anchor.x,o=r.anchor.y),t[0]=t[6]=-n,t[2]=t[4]=1-n,t[1]=t[3]=-o,t[5]=t[7]=1-o;const a=G.shared;a.copyFrom(r._tileTransform.matrix),a.tx/=r.width,a.ty/=r.height,a.invert(),a.scale(r.width/i,r.height/s),Af(t,2,0,a)}const os=new Sf;class ca{constructor(t){this._state=Pt.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(t){const e=this._getTilingSpriteData(t),i=e.canBatch;this._updateCanBatch(t);const s=e.canBatch;if(s&&s===i){const{batchableMesh:n}=e;if(n&&n.texture._source!==t.texture._source)return!n._batcher.checkAndUpdateTexture(n,t.texture)}return i!==s}addRenderable(t,e){const i=this._renderer.renderPipes.batch;this._updateCanBatch(t);const s=this._getTilingSpriteData(t),{geometry:n,canBatch:o}=s;if(o){s.batchableMesh||(s.batchableMesh=new Wi);const a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=n,a.renderable=t,a.transform=t.groupTransform,a.texture=t._texture),a.roundPixels=this._renderer._roundPixels|t._roundPixels,i.addToBatch(a,e)}else i.break(e),s.shader||(s.shader=new Tf),this.updateRenderable(t),e.add(t)}execute(t){const{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;const i=e.resources.localUniforms.uniforms;i.uTransformMatrix=t.groupTransform,i.uRound=this._renderer._roundPixels|t._roundPixels,We(t.groupColorAlpha,i.uColor,0),this._state.blendMode=$e(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:os,shader:e,state:this._state})}updateRenderable(t){const e=this._getTilingSpriteData(t),{canBatch:i}=e;if(i){const{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s)}else if(t.didViewUpdate){const{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}}destroyRenderable(t){var e;const i=this._getTilingSpriteData(t);i.batchableMesh=null,(e=i.shader)==null||e.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){const e=new oe({indices:os.indices,positions:os.positions.slice(),uvs:os.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:!0,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){const e=this._getTilingSpriteData(t),{geometry:i}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),Pf(t,i.uvs),Ef(t,i.positions)}destroy(){for(const t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(t){const e=this._getTilingSpriteData(t),i=t.texture;let s=!0;return this._renderer.type===bt.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=i.textureMatrix.isSimple&&(s||i.source.isPowerOfTwo),e.canBatch}}ca.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"tilingSprite"},D.add(ca);var VT=Object.defineProperty,wf=Object.getOwnPropertySymbols,WT=Object.prototype.hasOwnProperty,YT=Object.prototype.propertyIsEnumerable,Rf=(r,t,e)=>t in r?VT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Mf=(r,t)=>{for(var e in t||(t={}))WT.call(t,e)&&Rf(r,e,t[e]);if(wf)for(var e of wf(t))YT.call(t,e)&&Rf(r,e,t[e]);return r};const Cf=class xy extends oe{constructor(...t){var e;super({});let i=(e=t[0])!=null?e:{};typeof i=="number"&&(i={width:i,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(i)}build(t){var e,i,s,n;t=Mf(Mf({},xy.defaultOptions),t),this.verticesX=(e=this.verticesX)!=null?e:t.verticesX,this.verticesY=(i=this.verticesY)!=null?i:t.verticesY,this.width=(s=this.width)!=null?s:t.width,this.height=(n=this.height)!=null?n:t.height;const o=this.verticesX*this.verticesY,a=[],l=[],u=[],c=this.verticesX-1,h=this.verticesY-1,p=this.width/c,f=this.height/h;for(let _=0;_<o;_++){const g=_%this.verticesX,b=_/this.verticesX|0;a.push(g*p,b*f),l.push(g/c,b/h)}const m=c*h;for(let _=0;_<m;_++){const g=_%c,b=_/c|0,v=b*this.verticesX+g,y=b*this.verticesX+g+1,T=(b+1)*this.verticesX+g,E=(b+1)*this.verticesX+g+1;u.push(v,y,T,y,E,T)}this.buffers[0].data=new Float32Array(a),this.buffers[1].data=new Float32Array(l),this.indexBuffer.data=new Uint32Array(u),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};Cf.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};let as=Cf;var KT=Object.defineProperty,Of=Object.getOwnPropertySymbols,qT=Object.prototype.hasOwnProperty,ZT=Object.prototype.propertyIsEnumerable,Gf=(r,t,e)=>t in r?KT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Bf=(r,t)=>{for(var e in t||(t={}))qT.call(t,e)&&Gf(r,e,t[e]);if(Of)for(var e of Of(t))ZT.call(t,e)&&Gf(r,e,t[e]);return r};const If=class Ty extends as{constructor(t={}){t=Bf(Bf({},Ty.defaultOptions),t),super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t)}update(t){var e,i,s,n,o,a,l,u;this.width=(e=t.width)!=null?e:this.width,this.height=(i=t.height)!=null?i:this.height,this._originalWidth=(s=t.originalWidth)!=null?s:this._originalWidth,this._originalHeight=(n=t.originalHeight)!=null?n:this._originalHeight,this._leftWidth=(o=t.leftWidth)!=null?o:this._leftWidth,this._rightWidth=(a=t.rightWidth)!=null?a:this._rightWidth,this._topHeight=(l=t.topHeight)!=null?l:this._topHeight,this._bottomHeight=(u=t.bottomHeight)!=null?u:this._bottomHeight,this.updateUvs(),this.updatePositions()}updatePositions(){const t=this.positions,e=this._leftWidth+this._rightWidth,i=this.width>e?1:this.width/e,s=this._topHeight+this._bottomHeight,n=this.height>s?1:this.height/s,o=Math.min(i,n);t[9]=t[11]=t[13]=t[15]=this._topHeight*o,t[17]=t[19]=t[21]=t[23]=this.height-this._bottomHeight*o,t[25]=t[27]=t[29]=t[31]=this.height,t[2]=t[10]=t[18]=t[26]=this._leftWidth*o,t[4]=t[12]=t[20]=t[28]=this.width-this._rightWidth*o,t[6]=t[14]=t[22]=t[30]=this.width,this.getBuffer("aPosition").update()}updateUvs(){const 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;const e=1/this._originalWidth,i=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=i*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}};If.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};let ae=If;class ha{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){const i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){const e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){const e=t._texture,i=this._getGpuSprite(t);return i.texture._source!==e._source?!i._batcher.checkAndUpdateTexture(i,e):!1}destroyRenderable(t){const e=this._gpuSpriteHash[t.uid];N.return(e.geometry),N.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.geometry.update(t),e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){const e=N.get(Wi);return e.geometry=N.get(ae),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}}ha.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"nineSliceSprite"},D.add(ha);class da{constructor(t){this._renderer=t}push(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}}da.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"filter"};const QT=new G;function Ff(r,t){return t.clear(),pa(r,t),t.isValid||t.set(0,0,0,0),r.renderGroup?t.applyMatrix(r.renderGroup.localTransform):t.applyMatrix(r.parentRenderGroup.worldTransform),t}function pa(r,t){if(r.localDisplayStatus!==7||!r.measurable)return;const e=!!r.effects.length;let i=t;if((r.renderGroup||e)&&(i=Lt.get().clear()),r.boundsArea)t.addRect(r.boundsArea,r.worldTransform);else{if(r.renderPipeId){const n=r.bounds;i.addFrame(n.minX,n.minY,n.maxX,n.maxY,r.groupTransform)}const s=r.children;for(let n=0;n<s.length;n++)pa(s[n],i)}if(e){let s=!1;for(let n=0;n<r.effects.length;n++)r.effects[n].addBounds&&(s||(s=!0,i.applyMatrix(r.parentRenderGroup.worldTransform)),r.effects[n].addBounds(i,!0));s&&(i.applyMatrix(r.parentRenderGroup.worldTransform.copyTo(QT).invert()),t.addBounds(i,r.relativeGroupTransform)),t.addBounds(i),Lt.return(i)}else r.renderGroup&&(t.addBounds(i,r.relativeGroupTransform),Lt.return(i))}function Df(r,t){t.clear();const e=t.matrix;for(let i=0;i<r.length;i++){const s=r[i];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,s.addBounds(t))}return t.matrix=e,t}const JT=new xe({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])});class fa{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 Ht({}),this.renderer=t}get activeBackTexture(){var t;return(t=this._activeFilterData)==null?void 0:t.backTexture}push(t){var e,i;const s=this.renderer,n=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());const o=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,n.length===0){o.skip=!0;return}const a=o.bounds;t.renderables?Df(t.renderables,a):t.filterEffect.filterArea?(a.clear(),a.addRect(t.filterEffect.filterArea),a.applyMatrix(t.container.worldTransform)):Ff(t.container,a);const l=s.renderTarget.renderTarget.colorTexture.source;let u=1/0,c=0,h=!0,p=!1,f=!1,m=!0;for(let _=0;_<n.length;_++){const g=n[_];if(u=Math.min(u,g.resolution==="inherit"?l._resolution:g.resolution),c+=g.padding,g.antialias==="off"?h=!1:g.antialias==="inherit"&&h&&(h=l.antialias),g.clipToViewport||(m=!1),!(g.compatibleRenderers&s.type)){f=!1;break}if(g.blendRequired&&!((i=(e=s.backBuffer)==null?void 0:e.useBackBuffer)==null||i)){f=!1;break}f=g.enabled||f,p=p||g.blendRequired}if(!f){o.skip=!0;return}if(a.scale(u),m){const _=s.renderTarget.rootViewPort;a.fitBounds(0,_.width,0,_.height)}if(a.ceil().scale(1/u).pad(c|0),!a.isPositive){o.skip=!0;return}o.skip=!1,o.bounds=a,o.blendRequired=p,o.container=t.container,o.filterEffect=t.filterEffect,o.previousRenderSurface=s.renderTarget.renderSurface,o.inputTexture=ht.getOptimalTexture(a.width,a.height,u,h),s.renderTarget.bind(o.inputTexture,!0),s.globalUniforms.push({offset:a})}pop(){const t=this.renderer;this._filterStackIndex--;const e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;const i=e.inputTexture,s=e.bounds;let n=P.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){const a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,l=t.renderTarget.getRenderTarget(e.previousRenderSurface);n=this.getBackTexture(l,s,a)}e.backTexture=n;const o=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(n.source,3),t.globalUniforms.pop(),o.length===1)o[0].apply(this,i,e.previousRenderSurface,!1),ht.returnTexture(i);else{let a=e.inputTexture,l=ht.getOptimalTexture(s.width,s.height,a.source._resolution,!1),u=0;for(u=0;u<o.length-1;++u){o[u].apply(this,a,l,!0);const c=a;a=l,l=c}o[u].apply(this,a,e.previousRenderSurface,!1),ht.returnTexture(a),ht.returnTexture(l)}e.blendRequired&&ht.returnTexture(n)}getBackTexture(t,e,i){const s=t.colorTexture.source._resolution,n=ht.getOptimalTexture(e.width,e.height,s,!1);let o=e.minX,a=e.minY;i&&(o-=i.minX,a-=i.minY),o=Math.floor(o*s),a=Math.floor(a*s);const l=Math.ceil(e.width*s),u=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,n,{x:o,y:a},{width:l,height:u},{x:0,y:0}),n}applyFilter(t,e,i,s){const n=this.renderer,o=this._filterStack[this._filterStackIndex],a=o.bounds,l=W.shared,u=o.previousRenderSurface===i;let c=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,h=this._filterStackIndex-1;for(;h>0&&this._filterStack[h].skip;)--h;h>0&&(c=this._filterStack[h].inputTexture.source._resolution);const p=this._filterGlobalUniforms,f=p.uniforms,m=f.uOutputFrame,_=f.uInputSize,g=f.uInputPixel,b=f.uInputClamp,v=f.uGlobalFrame,y=f.uOutputTexture;if(u){let M=this._filterStackIndex;for(;M>0;){M--;const w=this._filterStack[this._filterStackIndex-1];if(!w.skip){l.x=w.bounds.minX,l.y=w.bounds.minY;break}}m[0]=a.minX-l.x,m[1]=a.minY-l.y}else m[0]=0,m[1]=0;m[2]=e.frame.width,m[3]=e.frame.height,_[0]=e.source.width,_[1]=e.source.height,_[2]=1/_[0],_[3]=1/_[1],g[0]=e.source.pixelWidth,g[1]=e.source.pixelHeight,g[2]=1/g[0],g[3]=1/g[1],b[0]=.5*g[2],b[1]=.5*g[3],b[2]=e.frame.width*_[2]-.5*g[2],b[3]=e.frame.height*_[3]-.5*g[3];const T=this.renderer.renderTarget.rootRenderTarget.colorTexture;v[0]=l.x*c,v[1]=l.y*c,v[2]=T.source.width*c,v[3]=T.source.height*c;const E=this.renderer.renderTarget.getRenderTarget(i);if(n.renderTarget.bind(i,!!s),i instanceof P?(y[0]=i.frame.width,y[1]=i.frame.height):(y[0]=E.width,y[1]=E.height),y[2]=E.isRoot?-1:1,p.update(),n.renderPipes.uniformBatch){const M=n.renderPipes.uniformBatch.getUboResource(p);this._globalFilterBindGroup.setResource(M,0)}else this._globalFilterBindGroup.setResource(p,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,n.encoder.draw({geometry:JT,shader:t,state:t._state,topology:"triangle-list"}),n.type===bt.WEBGL&&n.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new ut,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){const i=this._activeFilterData,s=t.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),n=e.worldTransform.copyTo(G.shared);return n.invert(),s.prepend(n),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}}fa.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"filter"},D.add(fa),D.add(da);var tS={__proto__:null};const ma=[];D.handleByNamedList(x.Environment,ma);async function ga(r){if(!r)for(let t=0;t<ma.length;t++){const e=ma[t];if(e.value.test()){await e.value.load();return}}}async function eS(r){return ga(!r)}let kr;function _a(){if(typeof kr=="boolean")return kr;try{kr=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch(r){kr=!1}return kr}var vt=(r=>(r[r.NONE=0]="NONE",r[r.COLOR=16384]="COLOR",r[r.STENCIL=1024]="STENCIL",r[r.DEPTH=256]="DEPTH",r[r.COLOR_DEPTH=16640]="COLOR_DEPTH",r[r.COLOR_STENCIL=17408]="COLOR_STENCIL",r[r.DEPTH_STENCIL=1280]="DEPTH_STENCIL",r[r.ALL=17664]="ALL",r))(vt||{});class ba{constructor(t){this.items=[],this._name=t}emit(t,e,i,s,n,o,a,l){const{name:u,items:c}=this;for(let h=0,p=c.length;h<p;h++)c[h][u](t,e,i,s,n,o,a,l);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){const 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 rS=Object.defineProperty,Uf=Object.getOwnPropertySymbols,iS=Object.prototype.hasOwnProperty,sS=Object.prototype.propertyIsEnumerable,kf=(r,t,e)=>t in r?rS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ls=(r,t)=>{for(var e in t||(t={}))iS.call(t,e)&&kf(r,e,t[e]);if(Uf)for(var e of Uf(t))sS.call(t,e)&&kf(r,e,t[e]);return r};const nS=["init","destroy","contextChange","resolutionChange","reset","renderEnd","renderStart","render","update","postrender","prerender"],$f=class Sy extends mt{constructor(t){var e;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;const i=[...nS,...(e=this.config.runners)!=null?e:[]];this._addRunners(...i),this._unsafeEvalCheck()}async init(t={}){const e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await ga(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(const i in this._systemsHash){const s=this._systemsHash[i].constructor.defaultOptions;t=ls(ls({},s),t)}t=ls(ls({},Sy.defaultOptions),t),this._roundPixels=t.roundPixels?1:0;for(let i=0;i<this.runners.init.items.length;i++)await this.runners.init.items[i].init(t);this._initOptions=t}render(t,e){let i=t;if(i instanceof Q&&(i={container:i},e&&(i.target=e.renderTexture)),i.target||(i.target=this.view.renderTarget),i.target===this.view.renderTarget&&(this._lastObjectRendered=i.container,i.clearColor=this.background.colorRgba),i.clearColor){const s=Array.isArray(i.clearColor)&&i.clearColor.length===4;i.clearColor=s?i.clearColor:j.shared.setValue(i.clearColor).toArray()}i.transform||(i.container.updateLocalTransform(),i.transform=i.container.localTransform),this.runners.prerender.emit(i),this.runners.renderStart.emit(i),this.runners.render.emit(i),this.runners.renderEnd.emit(i),this.runners.postrender.emit(i)}resize(t,e,i){const s=this.view.resolution;this.view.resize(t,e,i),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),i!==void 0&&i!==s&&this.runners.resolutionChange.emit(i)}clear(t={}){var e;const i=this;t.target||(t.target=i.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),(e=t.clear)!=null||(t.clear=vt.ALL);const{clear:s,clearColor:n,target:o}=t;j.shared.setValue(n!=null?n:this.background.colorRgba),i.renderTarget.clear(o,s,j.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 ba(e)})}_addSystems(t){let e;for(e in t){const i=t[e];this._addSystem(i.value,i.name)}}_addSystem(t,e){const i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(const s in this.runners)this.runners[s].add(i);return this}_addPipes(t,e){const i=e.reduce((s,n)=>(s[n.name]=n.value,s),{});t.forEach(s=>{const n=s.value,o=s.name,a=i[o];this.renderPipes[o]=new n(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(!_a())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}};$f.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let $r=$f,va;function Lr(r){return va!==void 0||(va=(()=>{var t;const e={stencil:!0,failIfMajorPerformanceCaveat:r!=null?r:$r.defaultOptions.failIfMajorPerformanceCaveat};try{if(!L.get().getWebGLRenderingContext())return!1;let i=L.get().createCanvas().getContext("webgl",e);const s=!!((t=i==null?void 0:i.getContextAttributes())!=null&&t.stencil);if(i){const n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,s}catch(i){return!1}})()),va}let ya;async function Nr(r={}){return ya!==void 0||(ya=await(async()=>{const t=L.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(r)).requestDevice(),!0}catch(e){return!1}})()),ya}var oS=Object.defineProperty,Lf=Object.getOwnPropertySymbols,aS=Object.prototype.hasOwnProperty,lS=Object.prototype.propertyIsEnumerable,Nf=(r,t,e)=>t in r?oS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Hr=(r,t)=>{for(var e in t||(t={}))aS.call(t,e)&&Nf(r,e,t[e]);if(Lf)for(var e of Lf(t))lS.call(t,e)&&Nf(r,e,t[e]);return r};const Hf=["webgl","webgpu","canvas"];async function Xf(r){var t;let e=[];r.preference?(e.push(r.preference),Hf.forEach(o=>{o!==r.preference&&e.push(o)})):e=Hf.slice();let i,s={};for(let o=0;o<e.length;o++){const a=e[o];if(a==="webgpu"&&await Nr()){const{WebGPURenderer:l}=await Promise.resolve().then(function(){return ew});i=l,s=Hr(Hr({},r),r.webgpu);break}else if(a==="webgl"&&Lr((t=r.failIfMajorPerformanceCaveat)!=null?t:$r.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:l}=await Promise.resolve().then(function(){return DP});i=l,s=Hr(Hr({},r),r.webgl);break}else if(a==="canvas")throw s=Hr({},r),new Error("CanvasRenderer is not yet implemented")}if(delete s.webgpu,delete s.webgl,!i)throw new Error("No available renderer for the current environment");const n=new i;return await n.init(s),n}const uS=/^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i,Xr="8.5.0";class xa{static init(){var t;(t=globalThis.__PIXI_APP_INIT__)==null||t.call(globalThis,this,Xr)}static destroy(){}}xa.extension=x.Application;class Ta{constructor(t){this._renderer=t}init(){var t;(t=globalThis.__PIXI_RENDERER_INIT__)==null||t.call(globalThis,this._renderer,Xr)}destroy(){this._renderer=null}}Ta.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"initHook",priority:-10};var cS=Object.defineProperty,jf=Object.getOwnPropertySymbols,hS=Object.prototype.hasOwnProperty,dS=Object.prototype.propertyIsEnumerable,zf=(r,t,e)=>t in r?cS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,pS=(r,t)=>{for(var e in t||(t={}))hS.call(t,e)&&zf(r,e,t[e]);if(jf)for(var e of jf(t))dS.call(t,e)&&zf(r,e,t[e]);return r};const Vf=class Gu{constructor(...t){this.stage=new Q}async init(t){t=pS({},t),this.renderer=await Xf(t),Gu._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){const i=Gu._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};Vf._plugins=[];let Wf=Vf;D.handleByList(x.Application,Wf._plugins),D.add(xa);class Sa extends qo{constructor(t,e){var i;super();const{textures:s,data:n}=t;Object.keys(n.pages).forEach(o=>{const a=n.pages[parseInt(o,10)],l=s[a.id];this.pages.push({texture:l})}),Object.keys(n.chars).forEach(o=>{var a;const l=n.chars[o],{frame:u,source:c}=s[l.page],h=new V(l.x+u.x,l.y+u.y,l.width,l.height),p=new P({source:c,frame:h});this.chars[o]={id:o.codePointAt(0),xOffset:l.xOffset,yOffset:l.yOffset,xAdvance:l.xAdvance,kerning:(a=l.kerning)!=null?a:{},texture:p}}),this.baseRenderedFontSize=n.fontSize,this.baseMeasurementFontSize=n.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:n.fontSize},this.baseLineOffset=n.baseLineOffset,this.lineHeight=n.lineHeight,this.fontFamily=n.fontFamily,this.distanceField=(i=n.distanceField)!=null?i:{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){const{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){Dr.install(t)}static uninstall(t){Dr.uninstall(t)}}const us={test(r){return typeof r=="string"&&r.startsWith("info face=")},parse(r){var t,e,i;const s=r.match(/^[a-z]+\s+.+$/gm),n={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const m in s){const _=s[m].match(/^[a-z]+/gm)[0],g=s[m].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),b={};for(const v in g){const y=g[v].split("="),T=y[0],E=y[1].replace(/"/gm,""),M=parseFloat(E),w=isNaN(M)?E:M;b[T]=w}n[_].push(b)}const o={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[a]=n.info,[l]=n.common,[u]=(t=n.distanceField)!=null?t:[];u&&(o.distanceField={range:parseInt(u.distanceRange,10),type:u.fieldType}),o.fontSize=parseInt(a.size,10),o.fontFamily=a.face,o.lineHeight=parseInt(l.lineHeight,10);const c=n.page;for(let m=0;m<c.length;m++)o.pages.push({id:parseInt(c[m].id,10)||0,file:c[m].file});const h={};o.baseLineOffset=o.lineHeight-parseInt(l.base,10);const p=n.char;for(let m=0;m<p.length;m++){const _=p[m],g=parseInt(_.id,10);let b=(i=(e=_.letter)!=null?e:_.char)!=null?i:String.fromCharCode(g);b==="space"&&(b=" "),h[g]=b,o.chars[b]={id:g,page:parseInt(_.page,10)||0,x:parseInt(_.x,10),y:parseInt(_.y,10),width:parseInt(_.width,10),height:parseInt(_.height,10),xOffset:parseInt(_.xoffset,10),yOffset:parseInt(_.yoffset,10),xAdvance:parseInt(_.xadvance,10),kerning:{}}}const f=n.kerning||[];for(let m=0;m<f.length;m++){const _=parseInt(f[m].first,10),g=parseInt(f[m].second,10),b=parseInt(f[m].amount,10);o.chars[h[g]].kerning[h[_]]=b}return o}},Ea={test(r){const t=r;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(r){var t,e;const i={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},s=r.getElementsByTagName("info")[0],n=r.getElementsByTagName("common")[0],o=r.getElementsByTagName("distanceField")[0];o&&(i.distanceField={type:o.getAttribute("fieldType"),range:parseInt(o.getAttribute("distanceRange"),10)});const a=r.getElementsByTagName("page"),l=r.getElementsByTagName("char"),u=r.getElementsByTagName("kerning");i.fontSize=parseInt(s.getAttribute("size"),10),i.fontFamily=s.getAttribute("face"),i.lineHeight=parseInt(n.getAttribute("lineHeight"),10);for(let h=0;h<a.length;h++)i.pages.push({id:parseInt(a[h].getAttribute("id"),10)||0,file:a[h].getAttribute("file")});const c={};i.baseLineOffset=i.lineHeight-parseInt(n.getAttribute("base"),10);for(let h=0;h<l.length;h++){const p=l[h],f=parseInt(p.getAttribute("id"),10);let m=(e=(t=p.getAttribute("letter"))!=null?t:p.getAttribute("char"))!=null?e:String.fromCharCode(f);m==="space"&&(m=" "),c[f]=m,i.chars[m]={id:f,page:parseInt(p.getAttribute("page"),10)||0,x:parseInt(p.getAttribute("x"),10),y:parseInt(p.getAttribute("y"),10),width:parseInt(p.getAttribute("width"),10),height:parseInt(p.getAttribute("height"),10),xOffset:parseInt(p.getAttribute("xoffset"),10),yOffset:parseInt(p.getAttribute("yoffset"),10),xAdvance:parseInt(p.getAttribute("xadvance"),10),kerning:{}}}for(let h=0;h<u.length;h++){const p=parseInt(u[h].getAttribute("first"),10),f=parseInt(u[h].getAttribute("second"),10),m=parseInt(u[h].getAttribute("amount"),10);i.chars[c[f]].kerning[c[p]]=m}return i}},Aa={test(r){return typeof r=="string"&&r.includes("<font>")?Ea.test(L.get().parseXML(r)):!1},parse(r){return Ea.parse(L.get().parseXML(r))}},fS=[".xml",".fnt"],Yf={extension:{type:x.CacheParser,name:"cacheBitmapFont"},test:r=>r instanceof Sa,getCacheableAssets(r,t){const e={};return r.forEach(i=>{e[i]=t,e[`${i}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},Kf={extension:{type:x.LoadParser,priority:St.Normal},name:"loadBitmapFont",test(r){return fS.includes(gt.extname(r).toLowerCase())},async testParse(r){return us.test(r)||Aa.test(r)},async parse(r,t,e){const i=us.test(r)?us.parse(r):Aa.parse(r),{src:s}=t,{pages:n}=i,o=[],a=i.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let c=0;c<n.length;++c){const h=n[c].file;let p=gt.join(gt.dirname(s),h);p=vi(p,s),o.push({src:p,data:a})}const l=await e.load(o),u=o.map(c=>l[c.src]);return new Sa({data:i,textures:u},s)},async load(r,t){return await(await L.get().fetch(r)).text()},async unload(r,t,e){await Promise.all(r.pages.map(i=>e.unload(i.texture.source._sourceOrigin))),r.destroy()}};class qf{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;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i<e;i++)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())}}const Zf={extension:{type:x.CacheParser,name:"cacheTextureArray"},test:r=>Array.isArray(r)&&r.every(t=>t instanceof P),getCacheableAssets:(r,t)=>{const e={};return r.forEach(i=>{t.forEach((s,n)=>{e[i+(n===0?"":n+1)]=s})}),e}};async function Pa(r){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(r)).blob();await createImageBitmap(t)}catch(t){return!1}return!0}return!1}const Qf={extension:{type:x.DetectionParser,priority:1},test:async()=>Pa("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")},Jf=["png","jpg","jpeg"],tm={extension:{type:x.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...Jf],remove:async r=>r.filter(t=>!Jf.includes(t))},mS="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function cs(r){return mS?!1:document.createElement("video").canPlayType(r)!==""}const em={extension:{type:x.DetectionParser,priority:0},test:async()=>cs("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")},rm={extension:{type:x.DetectionParser,priority:0},test:async()=>cs("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")},im={extension:{type:x.DetectionParser,priority:0},test:async()=>cs("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")},sm={extension:{type:x.DetectionParser,priority:0},test:async()=>Pa("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};var gS=Object.defineProperty,_S=Object.defineProperties,bS=Object.getOwnPropertyDescriptors,nm=Object.getOwnPropertySymbols,vS=Object.prototype.hasOwnProperty,yS=Object.prototype.propertyIsEnumerable,om=(r,t,e)=>t in r?gS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,xS=(r,t)=>{for(var e in t||(t={}))vS.call(t,e)&&om(r,e,t[e]);if(nm)for(var e of nm(t))yS.call(t,e)&&om(r,e,t[e]);return r},TS=(r,t)=>_S(r,bS(t));class am{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const i={promise:null,parser:null};return i.promise=(async()=>{var s,n;let o=null,a=null;if(e.loadParser&&(a=this._parserHash[e.loadParser]),!a){for(let l=0;l<this.parsers.length;l++){const u=this.parsers[l];if(u.load&&(s=u.test)!=null&&s.call(u,t,e,this)){a=u;break}}if(!a)return null}o=await a.load(t,e,this),i.parser=a;for(let l=0;l<this.parsers.length;l++){const u=this.parsers[l];u.parse&&u.parse&&await((n=u.testParse)==null?void 0:n.call(u,o,e,this))&&(o=await u.parse(o,e,this)||o,i.parser=u)}return o})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0;const s={},n=yr(t),o=Gt(t,u=>({alias:[u],src:u,data:{}})),a=o.length,l=o.map(async u=>{const c=gt.toAbsolute(u.src);if(!s[u.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,u)),s[u.src]=await this.promiseCache[c].promise,e&&e(++i/a)}catch(h){throw delete this.promiseCache[c],delete s[u.src],new Error(`[Loader.load] Failed to load ${c}.
|
|
567
|
+
${h}`)}});return await Promise.all(l),n?s[o[0].src]:s}async unload(t){const e=Gt(t,i=>({alias:[i],src:i})).map(async i=>{var s,n;const o=gt.toAbsolute(i.src),a=this.promiseCache[o];if(a){const l=await a.promise;delete this.promiseCache[o],await((n=(s=a.parser)==null?void 0:s.unload)==null?void 0:n.call(s,l,i,this))}});await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name&&t[e.name],TS(xS({},t),{[e.name]:e})),{})}}function we(r,t){if(Array.isArray(t)){for(const e of t)if(r.startsWith(`data:${e}`))return!0;return!1}return r.startsWith(`data:${t}`)}function Bt(r,t){const e=r.split("?")[0],i=gt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const SS=".json",ES="application/json",lm={extension:{type:x.LoadParser,priority:St.Low},name:"loadJson",test(r){return we(r,ES)||Bt(r,SS)},async load(r){return await(await L.get().fetch(r)).json()}},AS=".txt",PS="text/plain",um={name:"loadTxt",extension:{type:x.LoadParser,priority:St.Low,name:"loadTxt"},test(r){return we(r,PS)||Bt(r,AS)},async load(r){return await(await L.get().fetch(r)).text()}};var wS=Object.defineProperty,RS=Object.defineProperties,MS=Object.getOwnPropertyDescriptors,cm=Object.getOwnPropertySymbols,CS=Object.prototype.hasOwnProperty,OS=Object.prototype.propertyIsEnumerable,hm=(r,t,e)=>t in r?wS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,GS=(r,t)=>{for(var e in t||(t={}))CS.call(t,e)&&hm(r,e,t[e]);if(cm)for(var e of cm(t))OS.call(t,e)&&hm(r,e,t[e]);return r},BS=(r,t)=>RS(r,MS(t));const IS=["normal","bold","100","200","300","400","500","600","700","800","900"],FS=[".ttf",".otf",".woff",".woff2"],DS=["font/ttf","font/otf","font/woff","font/woff2"],US=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function dm(r){const t=gt.extname(r),e=gt.basename(r,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let i=e.length>0;for(const n of e)if(!n.match(US)){i=!1;break}let s=e.join(" ");return i||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}const kS=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function $S(r){return kS.test(r)?r:encodeURI(r)}const pm={extension:{type:x.LoadParser,priority:St.Low},name:"loadWebFont",test(r){return we(r,DS)||Bt(r,FS)},async load(r,t){var e,i,s,n,o,a;const l=L.get().getFontFaceSet();if(l){const u=[],c=(i=(e=t.data)==null?void 0:e.family)!=null?i:dm(r),h=(o=(n=(s=t.data)==null?void 0:s.weights)==null?void 0:n.filter(f=>IS.includes(f)))!=null?o:["normal"],p=(a=t.data)!=null?a:{};for(let f=0;f<h.length;f++){const m=h[f],_=new FontFace(c,`url(${$S(r)})`,BS(GS({},p),{weight:m}));await _.load(),l.add(_),u.push(_)}return Y.set(`${c}-and-url`,{url:r,fontFaces:u}),u.length===1?u[0]:u}return null},unload(r){(Array.isArray(r)?r:[r]).forEach(t=>{Y.remove(t.family),L.get().getFontFaceSet().delete(t)})}};function hs(r,t=1){var e;const i=(e=ee.RETINA_PREFIX)==null?void 0:e.exec(r);return i?parseFloat(i[1]):t}function le(r,t,e){r.label=e,r._sourceOrigin=e;const i=new P({source:r,label:e}),s=()=>{delete t.promiseCache[e],Y.has(e)&&Y.remove(e)};return i.source.once("destroy",()=>{t.promiseCache[e]&&s()}),i.once("destroy",()=>{r.destroyed||s()}),i}var LS=Object.defineProperty,ds=Object.getOwnPropertySymbols,fm=Object.prototype.hasOwnProperty,mm=Object.prototype.propertyIsEnumerable,gm=(r,t,e)=>t in r?LS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,NS=(r,t)=>{for(var e in t||(t={}))fm.call(t,e)&&gm(r,e,t[e]);if(ds)for(var e of ds(t))mm.call(t,e)&&gm(r,e,t[e]);return r},HS=(r,t)=>{var e={};for(var i in r)fm.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&ds)for(var i of ds(r))t.indexOf(i)<0&&mm.call(r,i)&&(e[i]=r[i]);return e};const XS=".svg",jS="image/svg+xml",_m={extension:{type:x.LoadParser,priority:St.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(r){return we(r,jS)||Bt(r,XS)},async load(r,t,e){var i;return((i=t.data.parseAsGraphicsContext)!=null?i:this.config.parseAsGraphicsContext)?VS(r):zS(r,t,e,this.config.crossOrigin)},unload(r){r.destroy(!0)}};async function zS(r,t,e,i){var s,n,o,a,l;const u=await(await L.get().fetch(r)).blob(),c=URL.createObjectURL(u),h=new Image;h.src=c,h.crossOrigin=i,await h.decode(),URL.revokeObjectURL(c);const p=document.createElement("canvas"),f=p.getContext("2d"),m=((s=t.data)==null?void 0:s.resolution)||hs(r),_=(o=(n=t.data)==null?void 0:n.width)!=null?o:h.width,g=(l=(a=t.data)==null?void 0:a.height)!=null?l:h.height;p.width=_*m,p.height=g*m,f.drawImage(h,0,0,_*m,g*m);const b=t.data,{parseAsGraphicsContext:v}=b,y=HS(b,["parseAsGraphicsContext"]),T=new be(NS({resource:p,alphaMode:"premultiply-alpha-on-upload",resolution:m},y));return le(T,e,r)}async function VS(r){const t=await(await L.get().fetch(r)).text(),e=new pt;return e.svg(t),e}const WS=`(function(){"use strict";const e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";async function a(){try{if(typeof createImageBitmap!="function")return!1;const A=await(await fetch(e)).blob(),t=await createImageBitmap(A);return t.width===1&&t.height===1}catch(A){return!1}}a().then(A=>{self.postMessage(A)})})();
|
|
568
|
+
`;let tr=null,wa=class{constructor(){tr||(tr=URL.createObjectURL(new Blob([WS],{type:"application/javascript"}))),this.worker=new Worker(tr)}};wa.revokeObjectURL=function(){tr&&(URL.revokeObjectURL(tr),tr=null)};const YS='(function(){"use strict";async function s(a,t){const e=await fetch(a);if(!e.ok)throw new Error(`[WorkerManager.loadImageBitmap] Failed to fetch ${a}: ${e.status} ${e.statusText}`);const i=await e.blob();return t==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}self.onmessage=async a=>{try{const t=await s(a.data.data[0],a.data.data[1]);self.postMessage({data:t,uuid:a.data.uuid,id:a.data.id},[t])}catch(t){self.postMessage({error:t,uuid:a.data.uuid,id:a.data.id})}}})();\n';let er=null,bm=class{constructor(){er||(er=URL.createObjectURL(new Blob([YS],{type:"application/javascript"}))),this.worker=new Worker(er)}};bm.revokeObjectURL=function(){er&&(URL.revokeObjectURL(er),er=null)};let vm=0,Ra,KS=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=>{const{worker:e}=new wa;e.addEventListener("message",i=>{e.terminate(),wa.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){var i;return this._run("loadImageBitmap",[t,(i=e==null?void 0:e.data)==null?void 0:i.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Ra===void 0&&(Ra=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Ra&&(this._createdWorkers++,t=new bm().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();const i=new Promise((s,n)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:n})});return this._next(),i}_next(){if(!this._queue.length)return;const t=this._getWorker();if(!t)return;const e=this._queue.pop(),i=e.id;this._resolveHash[vm]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:vm++,id:i})}};const Ma=new KS;var qS=Object.defineProperty,ym=Object.getOwnPropertySymbols,ZS=Object.prototype.hasOwnProperty,QS=Object.prototype.propertyIsEnumerable,xm=(r,t,e)=>t in r?qS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,JS=(r,t)=>{for(var e in t||(t={}))ZS.call(t,e)&&xm(r,e,t[e]);if(ym)for(var e of ym(t))QS.call(t,e)&&xm(r,e,t[e]);return r};const t2=[".jpeg",".jpg",".png",".webp",".avif"],e2=["image/jpeg","image/png","image/webp","image/avif"];async function Tm(r,t){var e;const i=await L.get().fetch(r);if(!i.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${i.status} ${i.statusText}`);const s=await i.blob();return((e=t==null?void 0:t.data)==null?void 0:e.alphaMode)==="premultiplied-alpha"?createImageBitmap(s,{premultiplyAlpha:"none"}):createImageBitmap(s)}const Ca={name:"loadTextures",extension:{type:x.LoadParser,priority:St.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return we(r,e2)||Bt(r,t2)},async load(r,t,e){var i;let s=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Ma.isImageBitmapSupported()?s=await Ma.loadImageBitmap(r,t):s=await Tm(r,t):s=await new Promise(o=>{s=new Image,s.crossOrigin=this.config.crossOrigin,s.src=r,s.complete?o(s):s.onload=()=>{o(s)}});const n=new be(JS({resource:s,alphaMode:"premultiply-alpha-on-upload",resolution:((i=t.data)==null?void 0:i.resolution)||hs(r)},t.data));return le(n,e,r)},unload(r){r.destroy(!0)}};var r2=Object.defineProperty,i2=Object.defineProperties,s2=Object.getOwnPropertyDescriptors,Sm=Object.getOwnPropertySymbols,n2=Object.prototype.hasOwnProperty,o2=Object.prototype.propertyIsEnumerable,Em=(r,t,e)=>t in r?r2(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Oa=(r,t)=>{for(var e in t||(t={}))n2.call(t,e)&&Em(r,e,t[e]);if(Sm)for(var e of Sm(t))o2.call(t,e)&&Em(r,e,t[e]);return r},Am=(r,t)=>i2(r,s2(t));const Pm=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],a2=Pm.map(r=>`video/${r.substring(1)}`);function wm(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=Mm(t):e!==!1&&(r.crossOrigin=typeof e=="string"?e:"anonymous")}function Rm(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){n(),t()}function s(o){n(),e(o)}function n(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s)}})}function Mm(r,t=globalThis.location){if(r.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}const Cm={name:"loadVideo",extension:{type:x.LoadParser,name:"loadVideo"},test(r){const t=we(r,a2),e=Bt(r,Pm);return t||e},async load(r,t,e){var i,s;const n=Oa(Am(Oa({},Tr.defaultOptions),{resolution:((i=t.data)==null?void 0:i.resolution)||hs(r),alphaMode:((s=t.data)==null?void 0:s.alphaMode)||await $n()}),t.data),o=document.createElement("video"),a={preload:n.autoLoad!==!1?"auto":void 0,"webkit-playsinline":n.playsinline!==!1?"":void 0,playsinline:n.playsinline!==!1?"":void 0,muted:n.muted===!0?"":void 0,loop:n.loop===!0?"":void 0,autoplay:n.autoPlay!==!1?"":void 0};Object.keys(a).forEach(c=>{const h=a[c];h!==void 0&&o.setAttribute(c,h)}),n.muted===!0&&(o.muted=!0),wm(o,r,n.crossorigin);const l=document.createElement("source");let u;if(r.startsWith("data:"))u=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){const c=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();u=Tr.MIME_TYPES[c]||`video/${c}`}return l.src=r,u&&(l.type=u),new Promise(c=>{const h=async()=>{const p=new Tr(Am(Oa({},n),{resource:o}));o.removeEventListener("canplay",h),t.data.preload&&await Rm(o),c(le(p,e,r))};o.addEventListener("canplay",h),o.appendChild(l)})},unload(r){r.destroy(!0)}},Ga={extension:{type:x.ResolveParser,name:"resolveTexture"},test:Ca.test,parse:r=>{var t,e;return{resolution:parseFloat((e=(t=ee.RETINA_PREFIX.exec(r))==null?void 0:t[1])!=null?e:"1"),format:r.split(".").pop(),src:r}}},Om={extension:{type:x.ResolveParser,priority:-2,name:"resolveJson"},test:r=>ee.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:Ga.parse};class Gm{constructor(){this._detections=[],this._initialized=!1,this.resolver=new ee,this.loader=new am,this.cache=Y,this._backgroundLoader=new qf(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var e,i,s;if(this._initialized)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 l=t.manifest;typeof l=="string"&&(l=await this.load(l)),this.resolver.addManifest(l)}const n=(i=(e=t.texturePreference)==null?void 0:e.resolution)!=null?i:1,o=typeof n=="number"?[n]:n,a=await this._detectFormats({preferredFormats:(s=t.texturePreference)==null?void 0:s.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:a,resolution:o}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();const i=yr(t),s=Gt(t).map(a=>{if(typeof a!="string"){const l=this.resolver.getAlias(a);return l.some(u=>!this.resolver.hasKey(u))&&this.add(a),Array.isArray(l)?l[0]:l}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),n=this.resolver.resolve(s),o=await this._mapLoadToResolve(n,e);return i?o[s[0]]:o}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);const s=this.resolver.resolveBundle(t),n={},o=Object.keys(s);let a=0,l=0;const u=()=>{e==null||e(++a/l)},c=o.map(h=>{const p=s[h];return l+=Object.keys(p).length,this._mapLoadToResolve(p,u).then(f=>{n[h]=f})});return await Promise.all(c),i?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return Y.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=Y.get(t[i]);return e}async _mapLoadToResolve(t,e){const i=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;const s=await this.loader.load(i,e);this._backgroundLoader.active=!0;const n={};return i.forEach(o=>{const a=s[o.src],l=[o.src];o.alias&&l.push(...o.alias),l.forEach(u=>{n[u]=a}),Y.set(l,a)}),n}async unload(t){this._initialized||await this.init();const e=Gt(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Gt(t);const e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(i=>{Y.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}}const jr=new Gm;D.handleByList(x.LoadParser,jr.loader.parsers).handleByList(x.ResolveParser,jr.resolver.parsers).handleByList(x.CacheParser,jr.cache.parsers).handleByList(x.DetectionParser,jr.detections),D.add(Zf,tm,Qf,sm,em,rm,im,lm,um,pm,_m,Ca,Cm,Kf,Yf,Ga,Om);const Bm={loader:x.LoadParser,resolver:x.ResolveParser,cache:x.CacheParser,detection:x.DetectionParser};D.handle(x.Asset,r=>{const t=r.ref;Object.entries(Bm).filter(([e])=>!!t[e]).forEach(([e,i])=>{var s;return D.add(Object.assign(t[e],{extension:(s=t[e].extension)!=null?s:i}))})},r=>{const t=r.ref;Object.keys(Bm).filter(e=>!!t[e]).forEach(e=>D.remove(t[e]))});const l2={extension:{type:x.DetectionParser,priority:3},test:async()=>!!(await Nr()||Lr()),add:async r=>[...r,"basis"],remove:async r=>r.filter(t=>t!=="basis")};class zr extends tt{constructor(t){super(t),this.uploadMethodId="compressed",this.resource=t.resource,this.mipLevelCount=this.resource.length}}let ps;function Ba(){if(ps)return ps;const r=document.createElement("canvas").getContext("webgl");return r?(ps=[...r.getExtension("EXT_texture_compression_bptc")?["bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb"]:[],...r.getExtension("WEBGL_compressed_texture_s3tc")?["bc1-rgba-unorm","bc2-rgba-unorm","bc3-rgba-unorm"]:[],...r.getExtension("WEBGL_compressed_texture_s3tc_srgb")?["bc1-rgba-unorm-srgb","bc2-rgba-unorm-srgb","bc3-rgba-unorm-srgb"]:[],...r.getExtension("EXT_texture_compression_rgtc")?["bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm"]:[],...r.getExtension("WEBGL_compressed_texture_etc")?["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","eac-r11unorm","eac-rg11unorm"]:[],...r.getExtension("WEBGL_compressed_texture_astc")?["astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"]:[]],ps):[]}let fs;async function Ia(){if(fs)return fs;const r=await L.get().getNavigator().gpu.requestAdapter();return fs=[...r.features.has("texture-compression-bc")?["bc1-rgba-unorm","bc1-rgba-unorm-srgb","bc2-rgba-unorm","bc2-rgba-unorm-srgb","bc3-rgba-unorm","bc3-rgba-unorm-srgb","bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm","bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb"]:[],...r.features.has("texture-compression-etc2")?["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm"]:[],...r.features.has("texture-compression-astc")?["astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"]:[]],fs}let Fa;async function Da(){return Fa!==void 0||(Fa=await(async()=>{const r=await Nr(),t=Lr();if(r&&t){const e=await Ia(),i=Ba();return e.filter(s=>i.includes(s))}else{if(r)return await Ia();if(t)return Ba()}return[]})()),Fa}const Im=["r8unorm","r8snorm","r8uint","r8sint","r16uint","r16sint","r16float","rg8unorm","rg8snorm","rg8uint","rg8sint","r32uint","r32sint","r32float","rg16uint","rg16sint","rg16float","rgba8unorm","rgba8unorm-srgb","rgba8snorm","rgba8uint","rgba8sint","bgra8unorm","bgra8unorm-srgb","rgb9e5ufloat","rgb10a2unorm","rg11b10ufloat","rg32uint","rg32sint","rg32float","rgba16uint","rgba16sint","rgba16float","rgba32uint","rgba32sint","rgba32float","stencil8","depth16unorm","depth24plus","depth24plus-stencil8","depth32float","depth32float-stencil8"];let ms;async function Vr(){if(ms!==void 0)return ms;const r=await Da();return ms=[...Im,...r],ms}const u2='(function(){"use strict";function g(r,a){const t=r.getNumImages(),s=r.getNumLevels(0);if(!r.startTranscoding())throw new Error("startTranscoding failed");const m=[];for(let e=0;e<s;++e)for(let o=0;o<t;++o){const B=r.getImageTranscodedSizeInBytes(o,e,a),f=new Uint8Array(B);if(!r.transcodeImage(f,o,e,a,1,0))throw new Error("transcodeImage failed");m.push(f)}return m}const w={"bc3-rgba-unorm":3,"bc7-rgba-unorm":6,"etc2-rgba8unorm":1,"astc-4x4-unorm":10,rgba8unorm:13,rgba4unorm:16};function d(r){const a=w[r];if(a)return a;throw new Error(`Unsupported transcoderFormat: ${r}`)}const n={jsUrl:"basis/basis_transcoder.js",wasmUrl:"basis/basis_transcoder.wasm"};let u,i,c;async function l(){if(!c){const r=new URL(n.jsUrl,location.origin).href,a=new URL(n.wasmUrl,location.origin).href;importScripts(r),c=new Promise(t=>{BASIS({locateFile:s=>a}).then(s=>{s.initializeBasis(),t(s.BasisFile)})})}return c}async function b(r,a){const t=await fetch(r);if(t.ok){const s=await t.arrayBuffer();return new a(new Uint8Array(s))}throw new Error(`Failed to load Basis texture: ${r}`)}const h=["bc7-rgba-unorm","astc-4x4-unorm","etc2-rgba8unorm","bc3-rgba-unorm","rgba8unorm"];async function p(r){const a=await l(),t=await b(r,a),s=g(t,u);return{width:t.getImageWidth(0,0),height:t.getImageHeight(0,0),format:i,resource:s,alphaMode:"no-premultiply-alpha"}}async function y(r,a,t){r&&(n.jsUrl=r),a&&(n.wasmUrl=a),i=h.filter(s=>t.includes(s))[0],u=d(i),await l()}const U={init:async r=>{const{jsUrl:a,wasmUrl:t,supportedTextures:s}=r;await y(a,t,s)},load:async r=>{var a;try{const t=await p(r.url);return{type:"load",url:r.url,success:!0,textureOptions:t,transferables:(a=t.resource)==null?void 0:a.map(s=>s.buffer)}}catch(t){throw t}}};self.onmessage=async r=>{const a=r.data,t=await U[a.type](a);t&&self.postMessage(t,t.transferables)}})();\n';let rr=null,Fm=class{constructor(){rr||(rr=URL.createObjectURL(new Blob([u2],{type:"application/javascript"}))),this.worker=new Worker(rr)}};Fm.revokeObjectURL=function(){rr&&(URL.revokeObjectURL(rr),rr=null)};const gs={jsUrl:"https://files.pixijs.download/transcoders/basis/basis_transcoder.js",wasmUrl:"https://files.pixijs.download/transcoders/basis/basis_transcoder.wasm"};function c2(r){Object.assign(gs,r)}let Wr;const Dm={};function h2(r){return Wr||(Wr=new Fm().worker,Wr.onmessage=t=>{const{success:e,url:i,textureOptions:s}=t.data;e||console.warn("Failed to load Basis texture",i),Dm[i](s)},Wr.postMessage({type:"init",jsUrl:gs.jsUrl,wasmUrl:gs.wasmUrl,supportedTextures:r})),Wr}function Um(r,t){const e=h2(t);return new Promise(i=>{Dm[r]=i,e.postMessage({type:"load",url:r})})}const d2={extension:{type:x.LoadParser,priority:St.High,name:"loadBasis"},name:"loadBasis",test(r){return Bt(r,[".basis"])},async load(r,t,e){const i=await Vr(),s=await Um(r,i),n=new zr(s);return le(n,e,r)},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};function p2(r,t){const e=r.getNumImages(),i=r.getNumLevels(0);if(!r.startTranscoding())throw new Error("startTranscoding failed");const s=[];for(let n=0;n<i;++n)for(let o=0;o<e;++o){const a=r.getImageTranscodedSizeInBytes(o,n,t),l=new Uint8Array(a);if(!r.transcodeImage(l,o,n,t,1,0))throw new Error("transcodeImage failed");s.push(l)}return s}const f2={"bc3-rgba-unorm":3,"bc7-rgba-unorm":6,"etc2-rgba8unorm":1,"astc-4x4-unorm":10,rgba8unorm:13,rgba4unorm:16};function m2(r){const t=f2[r];if(t)return t;throw new Error(`Unsupported transcoderFormat: ${r}`)}const g2={MAGIC:0,SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19,PF_FLAGS:20,FOURCC:21,RGB_BITCOUNT:22,R_BIT_MASK:23,G_BIT_MASK:24,B_BIT_MASK:25,A_BIT_MASK:26},_2={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4};var Ua=(r=>(r[r.DXGI_FORMAT_UNKNOWN=0]="DXGI_FORMAT_UNKNOWN",r[r.DXGI_FORMAT_R32G32B32A32_TYPELESS=1]="DXGI_FORMAT_R32G32B32A32_TYPELESS",r[r.DXGI_FORMAT_R32G32B32A32_FLOAT=2]="DXGI_FORMAT_R32G32B32A32_FLOAT",r[r.DXGI_FORMAT_R32G32B32A32_UINT=3]="DXGI_FORMAT_R32G32B32A32_UINT",r[r.DXGI_FORMAT_R32G32B32A32_SINT=4]="DXGI_FORMAT_R32G32B32A32_SINT",r[r.DXGI_FORMAT_R32G32B32_TYPELESS=5]="DXGI_FORMAT_R32G32B32_TYPELESS",r[r.DXGI_FORMAT_R32G32B32_FLOAT=6]="DXGI_FORMAT_R32G32B32_FLOAT",r[r.DXGI_FORMAT_R32G32B32_UINT=7]="DXGI_FORMAT_R32G32B32_UINT",r[r.DXGI_FORMAT_R32G32B32_SINT=8]="DXGI_FORMAT_R32G32B32_SINT",r[r.DXGI_FORMAT_R16G16B16A16_TYPELESS=9]="DXGI_FORMAT_R16G16B16A16_TYPELESS",r[r.DXGI_FORMAT_R16G16B16A16_FLOAT=10]="DXGI_FORMAT_R16G16B16A16_FLOAT",r[r.DXGI_FORMAT_R16G16B16A16_UNORM=11]="DXGI_FORMAT_R16G16B16A16_UNORM",r[r.DXGI_FORMAT_R16G16B16A16_UINT=12]="DXGI_FORMAT_R16G16B16A16_UINT",r[r.DXGI_FORMAT_R16G16B16A16_SNORM=13]="DXGI_FORMAT_R16G16B16A16_SNORM",r[r.DXGI_FORMAT_R16G16B16A16_SINT=14]="DXGI_FORMAT_R16G16B16A16_SINT",r[r.DXGI_FORMAT_R32G32_TYPELESS=15]="DXGI_FORMAT_R32G32_TYPELESS",r[r.DXGI_FORMAT_R32G32_FLOAT=16]="DXGI_FORMAT_R32G32_FLOAT",r[r.DXGI_FORMAT_R32G32_UINT=17]="DXGI_FORMAT_R32G32_UINT",r[r.DXGI_FORMAT_R32G32_SINT=18]="DXGI_FORMAT_R32G32_SINT",r[r.DXGI_FORMAT_R32G8X24_TYPELESS=19]="DXGI_FORMAT_R32G8X24_TYPELESS",r[r.DXGI_FORMAT_D32_FLOAT_S8X24_UINT=20]="DXGI_FORMAT_D32_FLOAT_S8X24_UINT",r[r.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS=21]="DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS",r[r.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT=22]="DXGI_FORMAT_X32_TYPELESS_G8X24_UINT",r[r.DXGI_FORMAT_R10G10B10A2_TYPELESS=23]="DXGI_FORMAT_R10G10B10A2_TYPELESS",r[r.DXGI_FORMAT_R10G10B10A2_UNORM=24]="DXGI_FORMAT_R10G10B10A2_UNORM",r[r.DXGI_FORMAT_R10G10B10A2_UINT=25]="DXGI_FORMAT_R10G10B10A2_UINT",r[r.DXGI_FORMAT_R11G11B10_FLOAT=26]="DXGI_FORMAT_R11G11B10_FLOAT",r[r.DXGI_FORMAT_R8G8B8A8_TYPELESS=27]="DXGI_FORMAT_R8G8B8A8_TYPELESS",r[r.DXGI_FORMAT_R8G8B8A8_UNORM=28]="DXGI_FORMAT_R8G8B8A8_UNORM",r[r.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB=29]="DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",r[r.DXGI_FORMAT_R8G8B8A8_UINT=30]="DXGI_FORMAT_R8G8B8A8_UINT",r[r.DXGI_FORMAT_R8G8B8A8_SNORM=31]="DXGI_FORMAT_R8G8B8A8_SNORM",r[r.DXGI_FORMAT_R8G8B8A8_SINT=32]="DXGI_FORMAT_R8G8B8A8_SINT",r[r.DXGI_FORMAT_R16G16_TYPELESS=33]="DXGI_FORMAT_R16G16_TYPELESS",r[r.DXGI_FORMAT_R16G16_FLOAT=34]="DXGI_FORMAT_R16G16_FLOAT",r[r.DXGI_FORMAT_R16G16_UNORM=35]="DXGI_FORMAT_R16G16_UNORM",r[r.DXGI_FORMAT_R16G16_UINT=36]="DXGI_FORMAT_R16G16_UINT",r[r.DXGI_FORMAT_R16G16_SNORM=37]="DXGI_FORMAT_R16G16_SNORM",r[r.DXGI_FORMAT_R16G16_SINT=38]="DXGI_FORMAT_R16G16_SINT",r[r.DXGI_FORMAT_R32_TYPELESS=39]="DXGI_FORMAT_R32_TYPELESS",r[r.DXGI_FORMAT_D32_FLOAT=40]="DXGI_FORMAT_D32_FLOAT",r[r.DXGI_FORMAT_R32_FLOAT=41]="DXGI_FORMAT_R32_FLOAT",r[r.DXGI_FORMAT_R32_UINT=42]="DXGI_FORMAT_R32_UINT",r[r.DXGI_FORMAT_R32_SINT=43]="DXGI_FORMAT_R32_SINT",r[r.DXGI_FORMAT_R24G8_TYPELESS=44]="DXGI_FORMAT_R24G8_TYPELESS",r[r.DXGI_FORMAT_D24_UNORM_S8_UINT=45]="DXGI_FORMAT_D24_UNORM_S8_UINT",r[r.DXGI_FORMAT_R24_UNORM_X8_TYPELESS=46]="DXGI_FORMAT_R24_UNORM_X8_TYPELESS",r[r.DXGI_FORMAT_X24_TYPELESS_G8_UINT=47]="DXGI_FORMAT_X24_TYPELESS_G8_UINT",r[r.DXGI_FORMAT_R8G8_TYPELESS=48]="DXGI_FORMAT_R8G8_TYPELESS",r[r.DXGI_FORMAT_R8G8_UNORM=49]="DXGI_FORMAT_R8G8_UNORM",r[r.DXGI_FORMAT_R8G8_UINT=50]="DXGI_FORMAT_R8G8_UINT",r[r.DXGI_FORMAT_R8G8_SNORM=51]="DXGI_FORMAT_R8G8_SNORM",r[r.DXGI_FORMAT_R8G8_SINT=52]="DXGI_FORMAT_R8G8_SINT",r[r.DXGI_FORMAT_R16_TYPELESS=53]="DXGI_FORMAT_R16_TYPELESS",r[r.DXGI_FORMAT_R16_FLOAT=54]="DXGI_FORMAT_R16_FLOAT",r[r.DXGI_FORMAT_D16_UNORM=55]="DXGI_FORMAT_D16_UNORM",r[r.DXGI_FORMAT_R16_UNORM=56]="DXGI_FORMAT_R16_UNORM",r[r.DXGI_FORMAT_R16_UINT=57]="DXGI_FORMAT_R16_UINT",r[r.DXGI_FORMAT_R16_SNORM=58]="DXGI_FORMAT_R16_SNORM",r[r.DXGI_FORMAT_R16_SINT=59]="DXGI_FORMAT_R16_SINT",r[r.DXGI_FORMAT_R8_TYPELESS=60]="DXGI_FORMAT_R8_TYPELESS",r[r.DXGI_FORMAT_R8_UNORM=61]="DXGI_FORMAT_R8_UNORM",r[r.DXGI_FORMAT_R8_UINT=62]="DXGI_FORMAT_R8_UINT",r[r.DXGI_FORMAT_R8_SNORM=63]="DXGI_FORMAT_R8_SNORM",r[r.DXGI_FORMAT_R8_SINT=64]="DXGI_FORMAT_R8_SINT",r[r.DXGI_FORMAT_A8_UNORM=65]="DXGI_FORMAT_A8_UNORM",r[r.DXGI_FORMAT_R1_UNORM=66]="DXGI_FORMAT_R1_UNORM",r[r.DXGI_FORMAT_R9G9B9E5_SHAREDEXP=67]="DXGI_FORMAT_R9G9B9E5_SHAREDEXP",r[r.DXGI_FORMAT_R8G8_B8G8_UNORM=68]="DXGI_FORMAT_R8G8_B8G8_UNORM",r[r.DXGI_FORMAT_G8R8_G8B8_UNORM=69]="DXGI_FORMAT_G8R8_G8B8_UNORM",r[r.DXGI_FORMAT_BC1_TYPELESS=70]="DXGI_FORMAT_BC1_TYPELESS",r[r.DXGI_FORMAT_BC1_UNORM=71]="DXGI_FORMAT_BC1_UNORM",r[r.DXGI_FORMAT_BC1_UNORM_SRGB=72]="DXGI_FORMAT_BC1_UNORM_SRGB",r[r.DXGI_FORMAT_BC2_TYPELESS=73]="DXGI_FORMAT_BC2_TYPELESS",r[r.DXGI_FORMAT_BC2_UNORM=74]="DXGI_FORMAT_BC2_UNORM",r[r.DXGI_FORMAT_BC2_UNORM_SRGB=75]="DXGI_FORMAT_BC2_UNORM_SRGB",r[r.DXGI_FORMAT_BC3_TYPELESS=76]="DXGI_FORMAT_BC3_TYPELESS",r[r.DXGI_FORMAT_BC3_UNORM=77]="DXGI_FORMAT_BC3_UNORM",r[r.DXGI_FORMAT_BC3_UNORM_SRGB=78]="DXGI_FORMAT_BC3_UNORM_SRGB",r[r.DXGI_FORMAT_BC4_TYPELESS=79]="DXGI_FORMAT_BC4_TYPELESS",r[r.DXGI_FORMAT_BC4_UNORM=80]="DXGI_FORMAT_BC4_UNORM",r[r.DXGI_FORMAT_BC4_SNORM=81]="DXGI_FORMAT_BC4_SNORM",r[r.DXGI_FORMAT_BC5_TYPELESS=82]="DXGI_FORMAT_BC5_TYPELESS",r[r.DXGI_FORMAT_BC5_UNORM=83]="DXGI_FORMAT_BC5_UNORM",r[r.DXGI_FORMAT_BC5_SNORM=84]="DXGI_FORMAT_BC5_SNORM",r[r.DXGI_FORMAT_B5G6R5_UNORM=85]="DXGI_FORMAT_B5G6R5_UNORM",r[r.DXGI_FORMAT_B5G5R5A1_UNORM=86]="DXGI_FORMAT_B5G5R5A1_UNORM",r[r.DXGI_FORMAT_B8G8R8A8_UNORM=87]="DXGI_FORMAT_B8G8R8A8_UNORM",r[r.DXGI_FORMAT_B8G8R8X8_UNORM=88]="DXGI_FORMAT_B8G8R8X8_UNORM",r[r.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM=89]="DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM",r[r.DXGI_FORMAT_B8G8R8A8_TYPELESS=90]="DXGI_FORMAT_B8G8R8A8_TYPELESS",r[r.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB=91]="DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",r[r.DXGI_FORMAT_B8G8R8X8_TYPELESS=92]="DXGI_FORMAT_B8G8R8X8_TYPELESS",r[r.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB=93]="DXGI_FORMAT_B8G8R8X8_UNORM_SRGB",r[r.DXGI_FORMAT_BC6H_TYPELESS=94]="DXGI_FORMAT_BC6H_TYPELESS",r[r.DXGI_FORMAT_BC6H_UF16=95]="DXGI_FORMAT_BC6H_UF16",r[r.DXGI_FORMAT_BC6H_SF16=96]="DXGI_FORMAT_BC6H_SF16",r[r.DXGI_FORMAT_BC7_TYPELESS=97]="DXGI_FORMAT_BC7_TYPELESS",r[r.DXGI_FORMAT_BC7_UNORM=98]="DXGI_FORMAT_BC7_UNORM",r[r.DXGI_FORMAT_BC7_UNORM_SRGB=99]="DXGI_FORMAT_BC7_UNORM_SRGB",r[r.DXGI_FORMAT_AYUV=100]="DXGI_FORMAT_AYUV",r[r.DXGI_FORMAT_Y410=101]="DXGI_FORMAT_Y410",r[r.DXGI_FORMAT_Y416=102]="DXGI_FORMAT_Y416",r[r.DXGI_FORMAT_NV12=103]="DXGI_FORMAT_NV12",r[r.DXGI_FORMAT_P010=104]="DXGI_FORMAT_P010",r[r.DXGI_FORMAT_P016=105]="DXGI_FORMAT_P016",r[r.DXGI_FORMAT_420_OPAQUE=106]="DXGI_FORMAT_420_OPAQUE",r[r.DXGI_FORMAT_YUY2=107]="DXGI_FORMAT_YUY2",r[r.DXGI_FORMAT_Y210=108]="DXGI_FORMAT_Y210",r[r.DXGI_FORMAT_Y216=109]="DXGI_FORMAT_Y216",r[r.DXGI_FORMAT_NV11=110]="DXGI_FORMAT_NV11",r[r.DXGI_FORMAT_AI44=111]="DXGI_FORMAT_AI44",r[r.DXGI_FORMAT_IA44=112]="DXGI_FORMAT_IA44",r[r.DXGI_FORMAT_P8=113]="DXGI_FORMAT_P8",r[r.DXGI_FORMAT_A8P8=114]="DXGI_FORMAT_A8P8",r[r.DXGI_FORMAT_B4G4R4A4_UNORM=115]="DXGI_FORMAT_B4G4R4A4_UNORM",r[r.DXGI_FORMAT_P208=116]="DXGI_FORMAT_P208",r[r.DXGI_FORMAT_V208=117]="DXGI_FORMAT_V208",r[r.DXGI_FORMAT_V408=118]="DXGI_FORMAT_V408",r[r.DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE=119]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE",r[r.DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE=120]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE",r[r.DXGI_FORMAT_FORCE_UINT=121]="DXGI_FORMAT_FORCE_UINT",r))(Ua||{}),ka=(r=>(r[r.DDS_DIMENSION_TEXTURE1D=2]="DDS_DIMENSION_TEXTURE1D",r[r.DDS_DIMENSION_TEXTURE2D=3]="DDS_DIMENSION_TEXTURE2D",r[r.DDS_DIMENSION_TEXTURE3D=6]="DDS_DIMENSION_TEXTURE3D",r))(ka||{});function lt(r){return r.charCodeAt(0)+(r.charCodeAt(1)<<8)+(r.charCodeAt(2)<<16)+(r.charCodeAt(3)<<24)}var yt=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.R8G8B8=20]="R8G8B8",r[r.A8R8G8B8=21]="A8R8G8B8",r[r.X8R8G8B8=22]="X8R8G8B8",r[r.R5G6B5=23]="R5G6B5",r[r.X1R5G5B5=24]="X1R5G5B5",r[r.A1R5G5B5=25]="A1R5G5B5",r[r.A4R4G4B4=26]="A4R4G4B4",r[r.R3G3B2=27]="R3G3B2",r[r.A8=28]="A8",r[r.A8R3G3B2=29]="A8R3G3B2",r[r.X4R4G4B4=30]="X4R4G4B4",r[r.A2B10G10R10=31]="A2B10G10R10",r[r.A8B8G8R8=32]="A8B8G8R8",r[r.X8B8G8R8=33]="X8B8G8R8",r[r.G16R16=34]="G16R16",r[r.A2R10G10B10=35]="A2R10G10B10",r[r.A16B16G16R16=36]="A16B16G16R16",r[r.A8P8=40]="A8P8",r[r.P8=41]="P8",r[r.L8=50]="L8",r[r.A8L8=51]="A8L8",r[r.A4L4=52]="A4L4",r[r.V8U8=60]="V8U8",r[r.L6V5U5=61]="L6V5U5",r[r.X8L8V8U8=62]="X8L8V8U8",r[r.Q8W8V8U8=63]="Q8W8V8U8",r[r.V16U16=64]="V16U16",r[r.A2W10V10U10=67]="A2W10V10U10",r[r.Q16W16V16U16=110]="Q16W16V16U16",r[r.R16F=111]="R16F",r[r.G16R16F=112]="G16R16F",r[r.A16B16G16R16F=113]="A16B16G16R16F",r[r.R32F=114]="R32F",r[r.G32R32F=115]="G32R32F",r[r.A32B32G32R32F=116]="A32B32G32R32F",r[r.UYVY=lt("UYVY")]="UYVY",r[r.R8G8_B8G8=lt("RGBG")]="R8G8_B8G8",r[r.YUY2=lt("YUY2")]="YUY2",r[r.D3DFMT_G8R8_G8B8=lt("GRGB")]="D3DFMT_G8R8_G8B8",r[r.DXT1=lt("DXT1")]="DXT1",r[r.DXT2=lt("DXT2")]="DXT2",r[r.DXT3=lt("DXT3")]="DXT3",r[r.DXT4=lt("DXT4")]="DXT4",r[r.DXT5=lt("DXT5")]="DXT5",r[r.ATI1=lt("ATI1")]="ATI1",r[r.AT1N=lt("AT1N")]="AT1N",r[r.ATI2=lt("ATI2")]="ATI2",r[r.AT2N=lt("AT2N")]="AT2N",r[r.BC4U=lt("BC4U")]="BC4U",r[r.BC4S=lt("BC4S")]="BC4S",r[r.BC5U=lt("BC5U")]="BC5U",r[r.BC5S=lt("BC5S")]="BC5S",r[r.DX10=lt("DX10")]="DX10",r))(yt||{});const $a={[yt.DXT1]:"bc1-rgba-unorm",[yt.DXT2]:"bc2-rgba-unorm",[yt.DXT3]:"bc2-rgba-unorm",[yt.DXT4]:"bc3-rgba-unorm",[yt.DXT5]:"bc3-rgba-unorm",[yt.ATI1]:"bc4-r-unorm",[yt.BC4U]:"bc4-r-unorm",[yt.BC4S]:"bc4-r-snorm",[yt.ATI2]:"bc5-rg-unorm",[yt.BC5U]:"bc5-rg-unorm",[yt.BC5S]:"bc5-rg-snorm",36:"rgba16uint",110:"rgba16sint",111:"r16float",112:"rg16float",113:"rgba16float",114:"r32float",115:"rg32float",116:"rgba32float"},xt={70:"bc1-rgba-unorm",71:"bc1-rgba-unorm",72:"bc1-rgba-unorm-srgb",73:"bc2-rgba-unorm",74:"bc2-rgba-unorm",75:"bc2-rgba-unorm-srgb",76:"bc3-rgba-unorm",77:"bc3-rgba-unorm",78:"bc3-rgba-unorm-srgb",79:"bc4-r-unorm",80:"bc4-r-unorm",81:"bc4-r-snorm",82:"bc5-rg-unorm",83:"bc5-rg-unorm",84:"bc5-rg-snorm",94:"bc6h-rgb-ufloat",95:"bc6h-rgb-ufloat",96:"bc6h-rgb-float",97:"bc7-rgba-unorm",98:"bc7-rgba-unorm",99:"bc7-rgba-unorm-srgb",28:"rgba8unorm",29:"rgba8unorm-srgb",87:"bgra8unorm",91:"bgra8unorm-srgb",41:"r32float",49:"rg8unorm",56:"r16uint",61:"r8unorm",24:"rgb10a2unorm",11:"rgba16uint",13:"rgba16sint",10:"rgba16float",54:"r16float",34:"rg16float",16:"rg32float",2:"rgba32float"},I={MAGIC_VALUE:542327876,MAGIC_SIZE:4,HEADER_SIZE:124,HEADER_DX10_SIZE:20,PIXEL_FORMAT_FLAGS:{ALPHAPIXELS:1,ALPHA:2,FOURCC:4,RGB:64,RGBA:65,YUV:512,LUMINANCE:131072,LUMINANCEA:131073},RESOURCE_MISC_TEXTURECUBE:4,HEADER_FIELDS:g2,HEADER_DX10_FIELDS:_2,DXGI_FORMAT:Ua,D3D10_RESOURCE_DIMENSION:ka,D3DFMT:yt},km={"bc1-rgba-unorm":8,"bc1-rgba-unorm-srgb":8,"bc2-rgba-unorm":16,"bc2-rgba-unorm-srgb":16,"bc3-rgba-unorm":16,"bc3-rgba-unorm-srgb":16,"bc4-r-unorm":8,"bc4-r-snorm":8,"bc5-rg-unorm":16,"bc5-rg-snorm":16,"bc6h-rgb-ufloat":16,"bc6h-rgb-float":16,"bc7-rgba-unorm":16,"bc7-rgba-unorm-srgb":16};function $m(r,t){const{format:e,fourCC:i,width:s,height:n,dataOffset:o,mipmapCount:a}=v2(r);if(!t.includes(e))throw new Error(`Unsupported texture format: ${i} ${e}, supported: ${t}`);if(a<=1)return{format:e,width:s,height:n,resource:[new Uint8Array(r,o)],alphaMode:"no-premultiply-alpha"};const l=b2(e,s,n,o,a,r);return{format:e,width:s,height:n,resource:l,alphaMode:"no-premultiply-alpha"}}function b2(r,t,e,i,s,n){const o=[],a=km[r];let l=t,u=e,c=i;for(let h=0;h<s;++h){const p=a?Math.max(4,l)/4*Math.max(4,u)/4*a:l*u*4,f=new Uint8Array(n,c,p);o.push(f),c+=p,l=Math.max(l>>1,1),u=Math.max(u>>1,1)}return o}function v2(r){const t=new Uint32Array(r,0,I.HEADER_SIZE/Uint32Array.BYTES_PER_ELEMENT);if(t[I.HEADER_FIELDS.MAGIC]!==I.MAGIC_VALUE)throw new Error("Invalid magic number in DDS header");const e=t[I.HEADER_FIELDS.HEIGHT],i=t[I.HEADER_FIELDS.WIDTH],s=Math.max(1,t[I.HEADER_FIELDS.MIPMAP_COUNT]),n=t[I.HEADER_FIELDS.PF_FLAGS],o=t[I.HEADER_FIELDS.FOURCC],a=y2(t,n,o,r),l=I.MAGIC_SIZE+I.HEADER_SIZE+(o===I.D3DFMT.DX10?I.HEADER_DX10_SIZE:0);return{format:a,fourCC:o,width:i,height:e,dataOffset:l,mipmapCount:s}}function y2(r,t,e,i){if(t&I.PIXEL_FORMAT_FLAGS.FOURCC){if(e===I.D3DFMT.DX10){const s=new Uint32Array(i,I.MAGIC_SIZE+I.HEADER_SIZE,I.HEADER_DX10_SIZE/Uint32Array.BYTES_PER_ELEMENT);if(s[I.HEADER_DX10_FIELDS.MISC_FLAG]===I.RESOURCE_MISC_TEXTURECUBE)throw new Error("DDSParser does not support cubemap textures");if(s[I.HEADER_DX10_FIELDS.RESOURCE_DIMENSION]===I.D3D10_RESOURCE_DIMENSION.DDS_DIMENSION_TEXTURE3D)throw new Error("DDSParser does not supported 3D texture data");const n=s[I.HEADER_DX10_FIELDS.DXGI_FORMAT];if(n in xt)return xt[n];throw new Error(`DDSParser cannot parse texture data with DXGI format ${n}`)}if(e in $a)return $a[e];throw new Error(`DDSParser cannot parse texture data with fourCC format ${e}`)}if(t&I.PIXEL_FORMAT_FLAGS.RGB||t&I.PIXEL_FORMAT_FLAGS.RGBA)return x2(r);throw t&I.PIXEL_FORMAT_FLAGS.YUV?new Error("DDSParser does not supported YUV uncompressed texture data."):t&I.PIXEL_FORMAT_FLAGS.LUMINANCE||t&I.PIXEL_FORMAT_FLAGS.LUMINANCEA?new Error("DDSParser does not support single-channel (lumninance) texture data!"):t&I.PIXEL_FORMAT_FLAGS.ALPHA||t&I.PIXEL_FORMAT_FLAGS.ALPHAPIXELS?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}function x2(r){const t=r[I.HEADER_FIELDS.RGB_BITCOUNT],e=r[I.HEADER_FIELDS.R_BIT_MASK],i=r[I.HEADER_FIELDS.G_BIT_MASK],s=r[I.HEADER_FIELDS.B_BIT_MASK],n=r[I.HEADER_FIELDS.A_BIT_MASK];switch(t){case 32:if(e===255&&i===65280&&s===16711680&&n===4278190080)return xt[I.DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UNORM];if(e===16711680&&i===65280&&s===255&&n===4278190080)return xt[I.DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM];if(e===1072693248&&i===1047552&&s===1023&&n===3221225472)return xt[I.DXGI_FORMAT.DXGI_FORMAT_R10G10B10A2_UNORM];if(e===65535&&i===4294901760&&s===0&&n===0)return xt[I.DXGI_FORMAT.DXGI_FORMAT_R16G16_UNORM];if(e===4294967295&&i===0&&s===0&&n===0)return xt[I.DXGI_FORMAT.DXGI_FORMAT_R32_FLOAT];break;case 24:break;case 16:if(e===31744&&i===992&&s===31&&n===32768)return xt[I.DXGI_FORMAT.DXGI_FORMAT_B5G5R5A1_UNORM];if(e===63488&&i===2016&&s===31&&n===0)return xt[I.DXGI_FORMAT.DXGI_FORMAT_B5G6R5_UNORM];if(e===3840&&i===240&&s===15&&n===61440)return xt[I.DXGI_FORMAT.DXGI_FORMAT_B4G4R4A4_UNORM];if(e===255&&i===0&&s===0&&n===65280)return xt[I.DXGI_FORMAT.DXGI_FORMAT_R8G8_UNORM];if(e===65535&&i===0&&s===0&&n===0)return xt[I.DXGI_FORMAT.DXGI_FORMAT_R16_UNORM];break;case 8:if(e===255&&i===0&&s===0&&n===0)return xt[I.DXGI_FORMAT.DXGI_FORMAT_R8_UNORM];break}throw new Error(`DDSParser does not support uncompressed texture with configuration:
|
|
569
|
+
bitCount = ${t}, rBitMask = ${e}, gBitMask = ${i}, aBitMask = ${n}`)}const T2={extension:{type:x.LoadParser,priority:St.High,name:"loadDDS"},name:"loadDDS",test(r){return Bt(r,[".dds"])},async load(r,t,e){const i=await Vr(),s=await(await fetch(r)).arrayBuffer(),n=$m(s,i),o=new zr(n);return le(o,e,r)},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};var Lm=(r=>(r[r.RGBA8_SNORM=36759]="RGBA8_SNORM",r[r.RGBA=6408]="RGBA",r[r.RGBA8UI=36220]="RGBA8UI",r[r.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",r[r.RGBA8I=36238]="RGBA8I",r[r.RGBA8=32856]="RGBA8",r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",r[r.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",r[r.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",r[r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",r[r.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",r[r.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",r[r.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",r[r.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",r[r.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",r[r.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",r[r.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",r[r.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",r[r.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",r[r.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",r[r.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",r[r.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",r[r.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",r[r.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",r[r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",r[r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",r[r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",r))(Lm||{}),S2=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(S2||{}),E2=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(E2||{});const rt={FILE_HEADER_SIZE:64,FILE_IDENTIFIER:[171,75,84,88,32,49,49,187,13,10,26,10],FORMATS_TO_COMPONENTS:{6408:4,6407:3,33319:2,6403:1,6409:1,6410:2,6406:1},INTERNAL_FORMAT_TO_BYTES_PER_PIXEL:{33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,36283:.5,36284:.5,36285:1,36286:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,37808:1,37840:1,37809:.8,37841:.8,37810:.64,37842:.64,37811:.53375,37843:.53375,37812:.445,37844:.445,37813:.4,37845:.4,37814:.33375,37846:.33375,37815:.25,37847:.25,37816:.32,37848:.32,37817:.26625,37849:.26625,37818:.2,37850:.2,37819:.16,37851:.16,37820:.13375,37852:.13375,37821:.11125,37853:.11125,36492:1,36493:1,36494:1,36495:1},INTERNAL_FORMAT_TO_TEXTURE_FORMATS:{33776:"bc1-rgba-unorm",33777:"bc1-rgba-unorm",33778:"bc2-rgba-unorm",33779:"bc3-rgba-unorm",35916:"bc1-rgba-unorm-srgb",35917:"bc1-rgba-unorm-srgb",35918:"bc2-rgba-unorm-srgb",35919:"bc3-rgba-unorm-srgb",36283:"bc4-r-unorm",36284:"bc4-r-snorm",36285:"bc5-rg-unorm",36286:"bc5-rg-snorm",37488:"eac-r11unorm",37490:"eac-rg11snorm",37492:"etc2-rgb8unorm",37496:"etc2-rgba8unorm",37493:"etc2-rgb8unorm-srgb",37497:"etc2-rgba8unorm-srgb",37494:"etc2-rgb8a1unorm",37495:"etc2-rgb8a1unorm-srgb",37808:"astc-4x4-unorm",37840:"astc-4x4-unorm-srgb",37809:"astc-5x4-unorm",37841:"astc-5x4-unorm-srgb",37810:"astc-5x5-unorm",37842:"astc-5x5-unorm-srgb",37811:"astc-6x5-unorm",37843:"astc-6x5-unorm-srgb",37812:"astc-6x6-unorm",37844:"astc-6x6-unorm-srgb",37813:"astc-8x5-unorm",37845:"astc-8x5-unorm-srgb",37814:"astc-8x6-unorm",37846:"astc-8x6-unorm-srgb",37815:"astc-8x8-unorm",37847:"astc-8x8-unorm-srgb",37816:"astc-10x5-unorm",37848:"astc-10x5-unorm-srgb",37817:"astc-10x6-unorm",37849:"astc-10x6-unorm-srgb",37818:"astc-10x8-unorm",37850:"astc-10x8-unorm-srgb",37819:"astc-10x10-unorm",37851:"astc-10x10-unorm-srgb",37820:"astc-12x10-unorm",37852:"astc-12x10-unorm-srgb",37821:"astc-12x12-unorm",37853:"astc-12x12-unorm-srgb",36492:"bc7-rgba-unorm",36493:"bc7-rgba-unorm-srgb",36494:"bc6h-rgb-float",36495:"bc6h-rgb-ufloat",35907:"rgba8unorm-srgb",36759:"rgba8snorm",36220:"rgba8uint",36238:"rgba8sint",6408:"rgba8unorm"},FIELDS:{FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},TYPES_TO_BYTES_PER_COMPONENT:{5121:1,5123:2,5124:4,5125:4,5126:4,36193:8},TYPES_TO_BYTES_PER_PIXEL:{32819:2,32820:2,33635:2},ENDIANNESS:67305985};function Nm(r,t){const e=new DataView(r);if(!R2(e))throw new Error("Invalid KTX identifier in header");const{littleEndian:i,glType:s,glFormat:n,glInternalFormat:o,pixelWidth:a,pixelHeight:l,numberOfMipmapLevels:u,offset:c}=w2(e),h=rt.INTERNAL_FORMAT_TO_TEXTURE_FORMATS[o];if(!h)throw new Error(`Unknown texture format ${o}`);if(!t.includes(h))throw new Error(`Unsupported texture format: ${h}, supportedFormats: ${t}`);const p=P2(s,n,o),f=A2(e,s,p,a,l,c,u,i);return{format:h,width:a,height:l,resource:f,alphaMode:"no-premultiply-alpha"}}function A2(r,t,e,i,s,n,o,a){const l=i+3&-4,u=s+3&-4;let c=i*s;t===0&&(c=l*u);let h=c*e,p=i,f=s,m=l,_=u,g=n;const b=new Array(o);for(let v=0;v<o;v++){const y=r.getUint32(g,a);let T=g+4;b[v]=new Uint8Array(r.buffer,T,h),T+=h,g+=y+4,g=g%4!==0?g+4-g%4:g,p=p>>1||1,f=f>>1||1,m=p+4-1&-4,_=f+4-1&-4,h=m*_*e}return b}function P2(r,t,e){let i=rt.INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[e];if(r!==0&&(rt.TYPES_TO_BYTES_PER_COMPONENT[r]?i=rt.TYPES_TO_BYTES_PER_COMPONENT[r]*rt.FORMATS_TO_COMPONENTS[t]:i=rt.TYPES_TO_BYTES_PER_PIXEL[r]),i===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");return i}function w2(r){const t=r.getUint32(rt.FIELDS.ENDIANNESS,!0)===rt.ENDIANNESS,e=r.getUint32(rt.FIELDS.GL_TYPE,t),i=r.getUint32(rt.FIELDS.GL_FORMAT,t),s=r.getUint32(rt.FIELDS.GL_INTERNAL_FORMAT,t),n=r.getUint32(rt.FIELDS.PIXEL_WIDTH,t),o=r.getUint32(rt.FIELDS.PIXEL_HEIGHT,t)||1,a=r.getUint32(rt.FIELDS.PIXEL_DEPTH,t)||1,l=r.getUint32(rt.FIELDS.NUMBER_OF_ARRAY_ELEMENTS,t)||1,u=r.getUint32(rt.FIELDS.NUMBER_OF_FACES,t),c=r.getUint32(rt.FIELDS.NUMBER_OF_MIPMAP_LEVELS,t),h=r.getUint32(rt.FIELDS.BYTES_OF_KEY_VALUE_DATA,t);if(o===0||a!==1)throw new Error("Only 2D textures are supported");if(u!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(l!==1)throw new Error("WebGL does not support array textures");return{littleEndian:t,glType:e,glFormat:i,glInternalFormat:s,pixelWidth:n,pixelHeight:o,numberOfMipmapLevels:c,offset:rt.FILE_HEADER_SIZE+h}}function R2(r){for(let t=0;t<rt.FILE_IDENTIFIER.length;t++)if(r.getUint8(t)!==rt.FILE_IDENTIFIER[t])return!1;return!0}const M2={extension:{type:x.LoadParser,priority:St.High,name:"loadKTX"},name:"loadKTX",test(r){return Bt(r,".ktx")},async load(r,t,e){const i=await Vr(),s=await(await fetch(r)).arrayBuffer(),n=Nm(s,i),o=new zr(n);return le(o,e,r)},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}},C2='(function(){"use strict";const s={rgb8unorm:{convertedFormat:"rgba8unorm",convertFunction:i},"rgb8unorm-srgb":{convertedFormat:"rgba8unorm-srgb",convertFunction:i}};function f(r){const t=r.format;if(s[t]){const n=s[t].convertFunction,o=r.resource;for(let e=0;e<o.length;e++)o[e]=n(o[e]);r.format=s[t].convertedFormat}}function i(r){const t=r.byteLength/3,n=new Uint32Array(t);for(let o=0;o<t;++o)n[o]=r[o*3]+(r[o*3+1]<<8)+(r[o*3+2]<<16)+4278190080;return new Uint8Array(n.buffer)}function d(r){const t=[];for(let n=0;n<r.numLevels;n++){const o=r.getImageData(n,0,0),e=new Uint8Array(o.byteLength);e.set(o),t.push(e)}return t}const w={6408:"rgba8unorm",32856:"bgra8unorm",32857:"rgb10a2unorm",33189:"depth16unorm",33190:"depth24plus",33321:"r8unorm",33323:"rg8unorm",33325:"r16float",33326:"r32float",33327:"rg16float",33328:"rg32float",33329:"r8sint",33330:"r8uint",33331:"r16sint",33332:"r16uint",33333:"r32sint",33334:"r32uint",33335:"rg8sint",33336:"rg8uint",33337:"rg16sint",33338:"rg16uint",33339:"rg32sint",33340:"rg32uint",33778:"bc2-rgba-unorm",33779:"bc3-rgba-unorm",34836:"rgba32float",34842:"rgba16float",35056:"depth24plus-stencil8",35898:"rg11b10ufloat",35901:"rgb9e5ufloat",35907:"rgba8unorm-srgb",36012:"depth32float",36013:"depth32float-stencil8",36168:"stencil8",36208:"rgba32uint",36214:"rgba16uint",36220:"rgba8uint",36226:"rgba32sint",36232:"rgba16sint",36238:"rgba8sint",36492:"bc7-rgba-unorm",36756:"r8snorm",36757:"rg8snorm",36759:"rgba8snorm",37496:"etc2-rgba8unorm",37808:"astc-4x4-unorm"};function p(r){const t=w[r];if(t)return t;throw new Error(`Unsupported glInternalFormat: ${r}`)}const h={23:"rgb8unorm",37:"rgba8unorm",43:"rgba8unorm-srgb"};function F(r){const t=h[r];if(t)return t;throw new Error(`Unsupported VkFormat: ${r}`)}function U(r){return r.classId===2?F(r.vkFormat):p(r.glInternalformat)}const T={"bc3-rgba-unorm":"BC3_RGBA","bc7-rgba-unorm":"BC7_M5_RGBA","etc2-rgba8unorm":"ETC2_RGBA","astc-4x4-unorm":"ASTC_4x4_RGBA",rgba8unorm:"RGBA32",rg11b10ufloat:"R11F_G11F_B10F"};function y(r){const t=T[r];if(t)return t;throw new Error(`Unsupported transcoderFormat: ${r}`)}const a={jsUrl:"",wasmUrl:""};let l,u,c;async function g(){if(!c){const r=new URL(a.jsUrl,location.origin).href,t=new URL(a.wasmUrl,location.origin).href;importScripts(r),c=new Promise(n=>{LIBKTX({locateFile:o=>t}).then(o=>{n(o)})})}return c}async function v(r,t){const n=await fetch(r);if(n.ok){const o=await n.arrayBuffer();return new t.ktxTexture(new Uint8Array(o))}throw new Error(`Failed to load KTX(2) texture: ${r}`)}const x=["bc7-rgba-unorm","astc-4x4-unorm","etc2-rgba8unorm","bc3-rgba-unorm","rgba8unorm"];async function B(r){const t=await g(),n=await v(r,t);let o;if(n.needsTranscoding){o=u;const R=t.TranscodeTarget[l];if(n.transcodeBasis(R,0)!==t.ErrorCode.SUCCESS)throw new Error("Unable to transcode basis texture.")}else o=U(n);const e=d(n),b={width:n.baseWidth,height:n.baseHeight,format:o,mipLevelCount:n.numLevels,resource:e,alphaMode:"no-premultiply-alpha"};return f(b),b}async function A(r,t,n){r&&(a.jsUrl=r),t&&(a.wasmUrl=t),u=x.filter(o=>n.includes(o))[0],l=y(u),await g()}const m={init:async r=>{const{jsUrl:t,wasmUrl:n,supportedTextures:o}=r;await A(t,n,o)},load:async r=>{var t;try{const n=await B(r.url);return{type:"load",url:r.url,success:!0,textureOptions:n,transferables:(t=n.resource)==null?void 0:t.map(o=>o.buffer)}}catch(n){throw n}}};self.onmessage=async r=>{var t;const n=r.data,o=await((t=m[n.type])==null?void 0:t.call(m,n));o&&self.postMessage(o,o.transferables)}})();\n';let ir=null;class Hm{constructor(){ir||(ir=URL.createObjectURL(new Blob([C2],{type:"application/javascript"}))),this.worker=new Worker(ir)}}Hm.revokeObjectURL=function(){ir&&(URL.revokeObjectURL(ir),ir=null)};const _s={jsUrl:"https://files.pixijs.download/transcoders/ktx/libktx.js",wasmUrl:"https://files.pixijs.download/transcoders/ktx/libktx.wasm"};function O2(r){Object.assign(_s,r)}let Yr;const Xm={};function G2(r){return Yr||(Yr=new Hm().worker,Yr.onmessage=t=>{const{success:e,url:i,textureOptions:s}=t.data;e||console.warn("Failed to load KTX texture",i),Xm[i](s)},Yr.postMessage({type:"init",jsUrl:_s.jsUrl,wasmUrl:_s.wasmUrl,supportedTextures:r})),Yr}function jm(r,t){const e=G2(t);return new Promise(i=>{Xm[r]=i,e.postMessage({type:"load",url:r})})}const B2={extension:{type:x.LoadParser,priority:St.High,name:"loadKTX2"},name:"loadKTX2",test(r){return Bt(r,".ktx2")},async load(r,t,e){const i=await Vr(),s=await jm(r,i),n=new zr(s);return le(n,e,r)},async unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}},La={rgb8unorm:{convertedFormat:"rgba8unorm",convertFunction:zm},"rgb8unorm-srgb":{convertedFormat:"rgba8unorm-srgb",convertFunction:zm}};function I2(r){const t=r.format;if(La[t]){const e=La[t].convertFunction,i=r.resource;for(let s=0;s<i.length;s++)i[s]=e(i[s]);r.format=La[t].convertedFormat}}function zm(r){const t=r.byteLength/3,e=new Uint32Array(t);for(let i=0;i<t;++i)e[i]=r[i*3]+(r[i*3+1]<<8)+(r[i*3+2]<<16)+4278190080;return new Uint8Array(e.buffer)}function F2(r){const t=[];for(let e=0;e<r.numLevels;e++){const i=r.getImageData(e,0,0),s=new Uint8Array(i.byteLength);s.set(i),t.push(s)}return t}const D2={6408:"rgba8unorm",32856:"bgra8unorm",32857:"rgb10a2unorm",33189:"depth16unorm",33190:"depth24plus",33321:"r8unorm",33323:"rg8unorm",33325:"r16float",33326:"r32float",33327:"rg16float",33328:"rg32float",33329:"r8sint",33330:"r8uint",33331:"r16sint",33332:"r16uint",33333:"r32sint",33334:"r32uint",33335:"rg8sint",33336:"rg8uint",33337:"rg16sint",33338:"rg16uint",33339:"rg32sint",33340:"rg32uint",33778:"bc2-rgba-unorm",33779:"bc3-rgba-unorm",34836:"rgba32float",34842:"rgba16float",35056:"depth24plus-stencil8",35898:"rg11b10ufloat",35901:"rgb9e5ufloat",35907:"rgba8unorm-srgb",36012:"depth32float",36013:"depth32float-stencil8",36168:"stencil8",36208:"rgba32uint",36214:"rgba16uint",36220:"rgba8uint",36226:"rgba32sint",36232:"rgba16sint",36238:"rgba8sint",36492:"bc7-rgba-unorm",36756:"r8snorm",36757:"rg8snorm",36759:"rgba8snorm",37496:"etc2-rgba8unorm",37808:"astc-4x4-unorm"};function Vm(r){const t=D2[r];if(t)return t;throw new Error(`Unsupported glInternalFormat: ${r}`)}const U2={23:"rgb8unorm",37:"rgba8unorm",43:"rgba8unorm-srgb"};function Wm(r){const t=U2[r];if(t)return t;throw new Error(`Unsupported VkFormat: ${r}`)}function k2(r){return r.classId===2?Wm(r.vkFormat):Vm(r.glInternalformat)}const $2={"bc3-rgba-unorm":"BC3_RGBA","bc7-rgba-unorm":"BC7_M5_RGBA","etc2-rgba8unorm":"ETC2_RGBA","astc-4x4-unorm":"ASTC_4x4_RGBA",rgba8unorm:"RGBA32",rg11b10ufloat:"R11F_G11F_B10F"};function L2(r){const t=$2[r];if(t)return t;throw new Error(`Unsupported transcoderFormat: ${r}`)}const bs=["basis","bc7","bc6h","astc","etc2","bc5","bc4","bc3","bc2","bc1","eac"],N2={extension:x.ResolveParser,test:r=>Bt(r,[".ktx",".ktx2",".dds"]),parse:r=>{var t,e;let i;const s=r.split(".");if(s.length>2){const n=s[s.length-2];bs.includes(n)&&(i=n)}else i=s[s.length-1];return{resolution:parseFloat((e=(t=ee.RETINA_PREFIX.exec(r))==null?void 0:t[1])!=null?e:"1"),format:i,src:r}}};let vs;const H2={extension:{type:x.DetectionParser,priority:2},test:async()=>!!(await Nr()||Lr()),add:async r=>{const t=await Da();return vs=X2(t),[...vs,...r]},remove:async r=>vs?r.filter(t=>!(t in vs)):r};function X2(r){const t=["basis"],e={};return r.forEach(i=>{const s=i.split("-")[0];s&&!e[s]&&(e[s]=!0,t.push(s))}),t.sort((i,s)=>{const n=bs.indexOf(i),o=bs.indexOf(s);return n===-1?1:o===-1?-1:n-o}),t}const j2=new ut,Na=class{cull(t,e,i=!0){this._cullRecursive(t,e,i)}_cullRecursive(t,e,i=!0){var s;if(t.cullable&&t.measurable&&t.includeInBuild){const n=(s=t.cullArea)!=null?s:fr(t,i,j2);t.culled=n.x>=e.x+e.width||n.y>=e.y+e.height||n.x+n.width<=e.x||n.y+n.height<=e.y}else t.culled=!1;if(!(!t.cullableChildren||t.culled||!t.renderable||!t.measurable||!t.includeInBuild))for(let n=0;n<t.children.length;n++)this._cullRecursive(t.children[n],e,i)}};Na.shared=new Na;let Ym=Na;class Km{static init(){this._renderRef=this.render.bind(this),this.render=()=>{Ym.shared.cull(this.stage,this.renderer.screen),this.renderer.render({container:this.stage})}}static destroy(){this.render=this._renderRef}}Km.extension={priority:10,type:x.Application,name:"culler"};const z2={extension:{type:x.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(function(){return tS})}};var V2=Object.defineProperty,ys=Object.getOwnPropertySymbols,qm=Object.prototype.hasOwnProperty,Zm=Object.prototype.propertyIsEnumerable,Qm=(r,t,e)=>t in r?V2(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ha=(r,t)=>{for(var e in t||(t={}))qm.call(t,e)&&Qm(r,e,t[e]);if(ys)for(var e of ys(t))Zm.call(t,e)&&Qm(r,e,t[e]);return r},W2=(r,t)=>{var e={};for(var i in r)qm.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&ys)for(var i of ys(r))t.indexOf(i)<0&&Zm.call(r,i)&&(e[i]=r[i]);return e};const Jm=class Bu extends At{constructor(t){t=Ha(Ha({},Bu.defaultOptions),t),super(t),this.enabled=!0,this._state=Pt.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.clipToViewport=t.clipToViewport,this.addResource("uTexture",0,1)}apply(t,e,i,s){t.applyFilter(this,e,i,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){const e=t,{gpu:i,gl:s}=e,n=W2(e,["gpu","gl"]);let o,a;return i&&(o=_t.from(i)),s&&(a=Et.from(s)),new Bu(Ha({gpuProgram:o,glProgram:a},n))}};Jm.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};let Jt=Jm;var tg=`
|
|
570
|
+
in vec2 vTextureCoord;
|
|
571
|
+
in vec4 vColor;
|
|
572
|
+
|
|
573
|
+
out vec4 finalColor;
|
|
574
|
+
|
|
575
|
+
uniform float uBlend;
|
|
576
|
+
|
|
577
|
+
uniform sampler2D uTexture;
|
|
578
|
+
uniform sampler2D uBackTexture;
|
|
579
|
+
|
|
580
|
+
{FUNCTIONS}
|
|
581
|
+
|
|
582
|
+
void main()
|
|
583
|
+
{
|
|
584
|
+
vec4 back = texture(uBackTexture, vTextureCoord);
|
|
585
|
+
vec4 front = texture(uTexture, vTextureCoord);
|
|
586
|
+
float blendedAlpha = front.a + back.a * (1.0 - front.a);
|
|
587
|
+
|
|
588
|
+
{MAIN}
|
|
589
|
+
}
|
|
590
|
+
`,eg=`in vec2 aPosition;
|
|
591
|
+
out vec2 vTextureCoord;
|
|
592
|
+
out vec2 backgroundUv;
|
|
593
|
+
|
|
594
|
+
uniform vec4 uInputSize;
|
|
595
|
+
uniform vec4 uOutputFrame;
|
|
596
|
+
uniform vec4 uOutputTexture;
|
|
597
|
+
|
|
598
|
+
vec4 filterVertexPosition( void )
|
|
599
|
+
{
|
|
600
|
+
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
601
|
+
|
|
602
|
+
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
|
|
603
|
+
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
|
|
604
|
+
|
|
605
|
+
return vec4(position, 0.0, 1.0);
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
vec2 filterTextureCoord( void )
|
|
609
|
+
{
|
|
610
|
+
return aPosition * (uOutputFrame.zw * uInputSize.zw);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
void main(void)
|
|
614
|
+
{
|
|
615
|
+
gl_Position = filterVertexPosition();
|
|
616
|
+
vTextureCoord = filterTextureCoord();
|
|
617
|
+
}
|
|
618
|
+
`,rg=`
|
|
619
|
+
struct GlobalFilterUniforms {
|
|
620
|
+
uInputSize:vec4<f32>,
|
|
621
|
+
uInputPixel:vec4<f32>,
|
|
622
|
+
uInputClamp:vec4<f32>,
|
|
623
|
+
uOutputFrame:vec4<f32>,
|
|
624
|
+
uGlobalFrame:vec4<f32>,
|
|
625
|
+
uOutputTexture:vec4<f32>,
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
struct BlendUniforms {
|
|
629
|
+
uBlend:f32,
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
633
|
+
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
634
|
+
@group(0) @binding(2) var uSampler : sampler;
|
|
635
|
+
@group(0) @binding(3) var uBackTexture: texture_2d<f32>;
|
|
636
|
+
|
|
637
|
+
@group(1) @binding(0) var<uniform> blendUniforms : BlendUniforms;
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
struct VSOutput {
|
|
641
|
+
@builtin(position) position: vec4<f32>,
|
|
642
|
+
@location(0) uv : vec2<f32>
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
|
|
646
|
+
{
|
|
647
|
+
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
648
|
+
|
|
649
|
+
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
650
|
+
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
651
|
+
|
|
652
|
+
return vec4(position, 0.0, 1.0);
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
656
|
+
{
|
|
657
|
+
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
661
|
+
{
|
|
662
|
+
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
@vertex
|
|
666
|
+
fn mainVertex(
|
|
667
|
+
@location(0) aPosition : vec2<f32>,
|
|
668
|
+
) -> VSOutput {
|
|
669
|
+
return VSOutput(
|
|
670
|
+
filterVertexPosition(aPosition),
|
|
671
|
+
filterTextureCoord(aPosition)
|
|
672
|
+
);
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
{FUNCTIONS}
|
|
676
|
+
|
|
677
|
+
@fragment
|
|
678
|
+
fn mainFragment(
|
|
679
|
+
@location(0) uv: vec2<f32>
|
|
680
|
+
) -> @location(0) vec4<f32> {
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
var back = textureSample(uBackTexture, uSampler, uv);
|
|
684
|
+
var front = textureSample(uTexture, uSampler, uv);
|
|
685
|
+
var blendedAlpha = front.a + back.a * (1.0 - front.a);
|
|
686
|
+
|
|
687
|
+
var out = vec4<f32>(0.0,0.0,0.0,0.0);
|
|
688
|
+
|
|
689
|
+
{MAIN}
|
|
690
|
+
|
|
691
|
+
return out;
|
|
692
|
+
}`,Y2=Object.defineProperty,ig=Object.getOwnPropertySymbols,K2=Object.prototype.hasOwnProperty,q2=Object.prototype.propertyIsEnumerable,sg=(r,t,e)=>t in r?Y2(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ng=(r,t)=>{for(var e in t||(t={}))K2.call(t,e)&&sg(r,e,t[e]);if(ig)for(var e of ig(t))q2.call(t,e)&&sg(r,e,t[e]);return r};class Z2 extends Jt{constructor(t){const e=t.gpu,i=og(ng({source:rg},e)),s=_t.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:i,entryPoint:"mainFragment"}}),n=t.gl,o=og(ng({source:tg},n)),a=Et.from({vertex:eg,fragment:o}),l=new st({uBlend:{value:1,type:"f32"}});super({gpuProgram:s,glProgram:a,blendRequired:!0,resources:{blendUniforms:l,uBackTexture:P.EMPTY}})}}function og(r){const{source:t,functions:e,main:i}=r;return t.replace("{FUNCTIONS}",e).replace("{MAIN}",i)}const Q2=`
|
|
693
|
+
float getLuminosity(vec3 c) {
|
|
694
|
+
return 0.3 * c.r + 0.59 * c.g + 0.11 * c.b;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
vec3 setLuminosity(vec3 c, float lum) {
|
|
698
|
+
float modLum = lum - getLuminosity(c);
|
|
699
|
+
vec3 color = c.rgb + vec3(modLum);
|
|
700
|
+
|
|
701
|
+
// clip back into legal range
|
|
702
|
+
modLum = getLuminosity(color);
|
|
703
|
+
vec3 modLumVec = vec3(modLum);
|
|
704
|
+
|
|
705
|
+
float cMin = min(color.r, min(color.g, color.b));
|
|
706
|
+
float cMax = max(color.r, max(color.g, color.b));
|
|
707
|
+
|
|
708
|
+
if(cMin < 0.0) {
|
|
709
|
+
color = mix(modLumVec, color, modLum / (modLum - cMin));
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
if(cMax > 1.0) {
|
|
713
|
+
color = mix(modLumVec, color, (1.0 - modLum) / (cMax - modLum));
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
return color;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
float getSaturation(vec3 c) {
|
|
720
|
+
return max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b));
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
vec3 setSaturationMinMidMax(vec3 cSorted, float s) {
|
|
724
|
+
vec3 colorSorted = cSorted;
|
|
725
|
+
|
|
726
|
+
if(colorSorted.z > colorSorted.x) {
|
|
727
|
+
colorSorted.y = (((colorSorted.y - colorSorted.x) * s) / (colorSorted.z - colorSorted.x));
|
|
728
|
+
colorSorted.z = s;
|
|
729
|
+
}
|
|
730
|
+
else {
|
|
731
|
+
colorSorted.y = 0.0;
|
|
732
|
+
colorSorted.z = 0.0;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
colorSorted.x = 0.0;
|
|
736
|
+
|
|
737
|
+
return colorSorted;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
vec3 setSaturation(vec3 c, float s) {
|
|
741
|
+
vec3 color = c;
|
|
742
|
+
|
|
743
|
+
if(color.r <= color.g && color.r <= color.b) {
|
|
744
|
+
if(color.g <= color.b) {
|
|
745
|
+
color = setSaturationMinMidMax(color.rgb, s).rgb;
|
|
746
|
+
}
|
|
747
|
+
else {
|
|
748
|
+
color = setSaturationMinMidMax(color.rbg, s).rbg;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
else if(color.g <= color.r && color.g <= color.b) {
|
|
752
|
+
if(color.r <= color.b) {
|
|
753
|
+
color = setSaturationMinMidMax(color.grb, s).grb;
|
|
754
|
+
}
|
|
755
|
+
else {
|
|
756
|
+
color = setSaturationMinMidMax(color.gbr, s).gbr;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
else {
|
|
760
|
+
// Using bgr for both fixes part of hue
|
|
761
|
+
if(color.r <= color.g) {
|
|
762
|
+
color = setSaturationMinMidMax(color.brg, s).brg;
|
|
763
|
+
}
|
|
764
|
+
else {
|
|
765
|
+
color = setSaturationMinMidMax(color.bgr, s).bgr;
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
return color;
|
|
770
|
+
}
|
|
771
|
+
`,J2=`
|
|
772
|
+
fn getLuminosity(c: vec3<f32>) -> f32
|
|
773
|
+
{
|
|
774
|
+
return 0.3*c.r + 0.59*c.g + 0.11*c.b;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
fn setLuminosity(c: vec3<f32>, lum: f32) -> vec3<f32>
|
|
778
|
+
{
|
|
779
|
+
var modLum: f32 = lum - getLuminosity(c);
|
|
780
|
+
var color: vec3<f32> = c.rgb + modLum;
|
|
781
|
+
|
|
782
|
+
// clip back into legal range
|
|
783
|
+
modLum = getLuminosity(color);
|
|
784
|
+
let modLumVec = vec3<f32>(modLum);
|
|
785
|
+
|
|
786
|
+
let cMin: f32 = min(color.r, min(color.g, color.b));
|
|
787
|
+
let cMax: f32 = max(color.r, max(color.g, color.b));
|
|
788
|
+
|
|
789
|
+
if(cMin < 0.0)
|
|
790
|
+
{
|
|
791
|
+
color = mix(modLumVec, color, modLum / (modLum - cMin));
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
if(cMax > 1.0)
|
|
795
|
+
{
|
|
796
|
+
color = mix(modLumVec, color, (1 - modLum) / (cMax - modLum));
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
return color;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
fn getSaturation(c: vec3<f32>) -> f32
|
|
803
|
+
{
|
|
804
|
+
return max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b));
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
fn setSaturationMinMidMax(cSorted: vec3<f32>, s: f32) -> vec3<f32>
|
|
808
|
+
{
|
|
809
|
+
var colorSorted = cSorted;
|
|
810
|
+
|
|
811
|
+
if(colorSorted.z > colorSorted.x)
|
|
812
|
+
{
|
|
813
|
+
colorSorted.y = (((colorSorted.y - colorSorted.x) * s) / (colorSorted.z - colorSorted.x));
|
|
814
|
+
colorSorted.z = s;
|
|
815
|
+
}
|
|
816
|
+
else
|
|
817
|
+
{
|
|
818
|
+
colorSorted.y = 0;
|
|
819
|
+
colorSorted.z = 0;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
colorSorted.x = 0;
|
|
823
|
+
|
|
824
|
+
return colorSorted;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
fn setSaturation(c: vec3<f32>, s: f32) -> vec3<f32>
|
|
828
|
+
{
|
|
829
|
+
var color = c;
|
|
830
|
+
|
|
831
|
+
if (color.r <= color.g && color.r <= color.b)
|
|
832
|
+
{
|
|
833
|
+
if (color.g <= color.b)
|
|
834
|
+
{
|
|
835
|
+
color = vec3<f32>(setSaturationMinMidMax(color.rgb, s)).rgb;
|
|
836
|
+
}
|
|
837
|
+
else
|
|
838
|
+
{
|
|
839
|
+
color = vec3<f32>(setSaturationMinMidMax(color.rbg, s)).rbg;
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
else if (color.g <= color.r && color.g <= color.b)
|
|
843
|
+
{
|
|
844
|
+
if (color.r <= color.b)
|
|
845
|
+
{
|
|
846
|
+
color = vec3<f32>(setSaturationMinMidMax(color.grb, s)).grb;
|
|
847
|
+
}
|
|
848
|
+
else
|
|
849
|
+
{
|
|
850
|
+
color = vec3<f32>(setSaturationMinMidMax(color.gbr, s)).gbr;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
else
|
|
854
|
+
{
|
|
855
|
+
// Using bgr for both fixes part of hue
|
|
856
|
+
if (color.r <= color.g)
|
|
857
|
+
{
|
|
858
|
+
color = vec3<f32>(setSaturationMinMidMax(color.brg, s)).brg;
|
|
859
|
+
}
|
|
860
|
+
else
|
|
861
|
+
{
|
|
862
|
+
color = vec3<f32>(setSaturationMinMidMax(color.bgr, s)).bgr;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
return color;
|
|
867
|
+
}
|
|
868
|
+
`;var xs=`in vec2 aPosition;
|
|
869
|
+
out vec2 vTextureCoord;
|
|
870
|
+
|
|
871
|
+
uniform vec4 uInputSize;
|
|
872
|
+
uniform vec4 uOutputFrame;
|
|
873
|
+
uniform vec4 uOutputTexture;
|
|
874
|
+
|
|
875
|
+
vec4 filterVertexPosition( void )
|
|
876
|
+
{
|
|
877
|
+
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
878
|
+
|
|
879
|
+
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
|
|
880
|
+
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
|
|
881
|
+
|
|
882
|
+
return vec4(position, 0.0, 1.0);
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
vec2 filterTextureCoord( void )
|
|
886
|
+
{
|
|
887
|
+
return aPosition * (uOutputFrame.zw * uInputSize.zw);
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
void main(void)
|
|
891
|
+
{
|
|
892
|
+
gl_Position = filterVertexPosition();
|
|
893
|
+
vTextureCoord = filterTextureCoord();
|
|
894
|
+
}
|
|
895
|
+
`,ag=`
|
|
896
|
+
in vec2 vTextureCoord;
|
|
897
|
+
|
|
898
|
+
out vec4 finalColor;
|
|
899
|
+
|
|
900
|
+
uniform float uAlpha;
|
|
901
|
+
uniform sampler2D uTexture;
|
|
902
|
+
|
|
903
|
+
void main()
|
|
904
|
+
{
|
|
905
|
+
finalColor = texture(uTexture, vTextureCoord) * uAlpha;
|
|
906
|
+
}
|
|
907
|
+
`,Xa=`struct GlobalFilterUniforms {
|
|
908
|
+
uInputSize:vec4<f32>,
|
|
909
|
+
uInputPixel:vec4<f32>,
|
|
910
|
+
uInputClamp:vec4<f32>,
|
|
911
|
+
uOutputFrame:vec4<f32>,
|
|
912
|
+
uGlobalFrame:vec4<f32>,
|
|
913
|
+
uOutputTexture:vec4<f32>,
|
|
914
|
+
};
|
|
915
|
+
|
|
916
|
+
struct AlphaUniforms {
|
|
917
|
+
uAlpha:f32,
|
|
918
|
+
};
|
|
919
|
+
|
|
920
|
+
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
921
|
+
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
922
|
+
@group(0) @binding(2) var uSampler : sampler;
|
|
923
|
+
|
|
924
|
+
@group(1) @binding(0) var<uniform> alphaUniforms : AlphaUniforms;
|
|
925
|
+
|
|
926
|
+
struct VSOutput {
|
|
927
|
+
@builtin(position) position: vec4<f32>,
|
|
928
|
+
@location(0) uv : vec2<f32>
|
|
929
|
+
};
|
|
930
|
+
|
|
931
|
+
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
|
|
932
|
+
{
|
|
933
|
+
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
934
|
+
|
|
935
|
+
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
936
|
+
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
937
|
+
|
|
938
|
+
return vec4(position, 0.0, 1.0);
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
942
|
+
{
|
|
943
|
+
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
947
|
+
{
|
|
948
|
+
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
fn getSize() -> vec2<f32>
|
|
952
|
+
{
|
|
953
|
+
return gfu.uGlobalFrame.zw;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
@vertex
|
|
957
|
+
fn mainVertex(
|
|
958
|
+
@location(0) aPosition : vec2<f32>,
|
|
959
|
+
) -> VSOutput {
|
|
960
|
+
return VSOutput(
|
|
961
|
+
filterVertexPosition(aPosition),
|
|
962
|
+
filterTextureCoord(aPosition)
|
|
963
|
+
);
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
@fragment
|
|
967
|
+
fn mainFragment(
|
|
968
|
+
@location(0) uv: vec2<f32>,
|
|
969
|
+
@builtin(position) position: vec4<f32>
|
|
970
|
+
) -> @location(0) vec4<f32> {
|
|
971
|
+
|
|
972
|
+
var sample = textureSample(uTexture, uSampler, uv);
|
|
973
|
+
|
|
974
|
+
return sample * alphaUniforms.uAlpha;
|
|
975
|
+
}`,tE=Object.defineProperty,eE=Object.defineProperties,rE=Object.getOwnPropertyDescriptors,Ts=Object.getOwnPropertySymbols,lg=Object.prototype.hasOwnProperty,ug=Object.prototype.propertyIsEnumerable,cg=(r,t,e)=>t in r?tE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ja=(r,t)=>{for(var e in t||(t={}))lg.call(t,e)&&cg(r,e,t[e]);if(Ts)for(var e of Ts(t))ug.call(t,e)&&cg(r,e,t[e]);return r},iE=(r,t)=>eE(r,rE(t)),sE=(r,t)=>{var e={};for(var i in r)lg.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Ts)for(var i of Ts(r))t.indexOf(i)<0&&ug.call(r,i)&&(e[i]=r[i]);return e};const hg=class Ey extends Jt{constructor(t){t=ja(ja({},Ey.defaultOptions),t);const e=_t.from({vertex:{source:Xa,entryPoint:"mainVertex"},fragment:{source:Xa,entryPoint:"mainFragment"}}),i=Et.from({vertex:xs,fragment:ag,name:"alpha-filter"}),s=t,{alpha:n}=s,o=sE(s,["alpha"]),a=new st({uAlpha:{value:n,type:"f32"}});super(iE(ja({},o),{gpuProgram:e,glProgram:i,resources:{alphaUniforms:a}}))}get alpha(){return this.resources.alphaUniforms.uniforms.uAlpha}set alpha(t){this.resources.alphaUniforms.uniforms.uAlpha=t}};hg.defaultOptions={alpha:1};let nE=hg;const za={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},oE=["in vec2 vBlurTexCoords[%size%];","uniform sampler2D uTexture;","out vec4 finalColor;","void main(void)","{"," finalColor = vec4(0.0);"," %blur%","}"].join(`
|
|
976
|
+
`);function dg(r){const t=za[r],e=t.length;let i=oE,s="";const n="finalColor += texture(uTexture, vBlurTexCoords[%index%]) * %value%;";let o;for(let a=0;a<r;a++){let l=n.replace("%index%",a.toString());o=a,a>=e&&(o=r-a-1),l=l.replace("%value%",t[o].toString()),s+=l,s+=`
|
|
977
|
+
`}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i}const aE=`
|
|
978
|
+
in vec2 aPosition;
|
|
979
|
+
|
|
980
|
+
uniform float uStrength;
|
|
981
|
+
|
|
982
|
+
out vec2 vBlurTexCoords[%size%];
|
|
983
|
+
|
|
984
|
+
uniform vec4 uInputSize;
|
|
985
|
+
uniform vec4 uOutputFrame;
|
|
986
|
+
uniform vec4 uOutputTexture;
|
|
987
|
+
|
|
988
|
+
vec4 filterVertexPosition( void )
|
|
989
|
+
{
|
|
990
|
+
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
991
|
+
|
|
992
|
+
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
|
|
993
|
+
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
|
|
994
|
+
|
|
995
|
+
return vec4(position, 0.0, 1.0);
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
vec2 filterTextureCoord( void )
|
|
999
|
+
{
|
|
1000
|
+
return aPosition * (uOutputFrame.zw * uInputSize.zw);
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
void main(void)
|
|
1004
|
+
{
|
|
1005
|
+
gl_Position = filterVertexPosition();
|
|
1006
|
+
|
|
1007
|
+
float pixelStrength = uInputSize.%dimension% * uStrength;
|
|
1008
|
+
|
|
1009
|
+
vec2 textureCoord = filterTextureCoord();
|
|
1010
|
+
%blur%
|
|
1011
|
+
}`;function pg(r,t){const e=Math.ceil(r/2);let i=aE,s="",n;t?n="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * pixelStrength, 0.0);":n="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * pixelStrength);";for(let o=0;o<r;o++){let a=n.replace("%index%",o.toString());a=a.replace("%sampleIndex%",`${o-(e-1)}.0`),s+=a,s+=`
|
|
1012
|
+
`}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i=i.replace("%dimension%",t?"z":"w"),i}function fg(r,t){const e=pg(t,r),i=dg(t);return Et.from({vertex:e,fragment:i,name:`blur-${r?"horizontal":"vertical"}-pass-filter`})}var mg=`
|
|
1013
|
+
|
|
1014
|
+
struct GlobalFilterUniforms {
|
|
1015
|
+
uInputSize:vec4<f32>,
|
|
1016
|
+
uInputPixel:vec4<f32>,
|
|
1017
|
+
uInputClamp:vec4<f32>,
|
|
1018
|
+
uOutputFrame:vec4<f32>,
|
|
1019
|
+
uGlobalFrame:vec4<f32>,
|
|
1020
|
+
uOutputTexture:vec4<f32>,
|
|
1021
|
+
};
|
|
1022
|
+
|
|
1023
|
+
struct BlurUniforms {
|
|
1024
|
+
uStrength:f32,
|
|
1025
|
+
};
|
|
1026
|
+
|
|
1027
|
+
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
1028
|
+
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
1029
|
+
@group(0) @binding(2) var uSampler : sampler;
|
|
1030
|
+
|
|
1031
|
+
@group(1) @binding(0) var<uniform> blurUniforms : BlurUniforms;
|
|
1032
|
+
|
|
1033
|
+
|
|
1034
|
+
struct VSOutput {
|
|
1035
|
+
@builtin(position) position: vec4<f32>,
|
|
1036
|
+
%blur-struct%
|
|
1037
|
+
};
|
|
1038
|
+
|
|
1039
|
+
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
|
|
1040
|
+
{
|
|
1041
|
+
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
1042
|
+
|
|
1043
|
+
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
1044
|
+
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
1045
|
+
|
|
1046
|
+
return vec4(position, 0.0, 1.0);
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
1050
|
+
{
|
|
1051
|
+
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
1055
|
+
{
|
|
1056
|
+
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
fn getSize() -> vec2<f32>
|
|
1060
|
+
{
|
|
1061
|
+
return gfu.uGlobalFrame.zw;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
|
|
1065
|
+
@vertex
|
|
1066
|
+
fn mainVertex(
|
|
1067
|
+
@location(0) aPosition : vec2<f32>,
|
|
1068
|
+
) -> VSOutput {
|
|
1069
|
+
|
|
1070
|
+
let filteredCord = filterTextureCoord(aPosition);
|
|
1071
|
+
|
|
1072
|
+
let pixelStrength = gfu.uInputSize.%dimension% * blurUniforms.uStrength;
|
|
1073
|
+
|
|
1074
|
+
return VSOutput(
|
|
1075
|
+
filterVertexPosition(aPosition),
|
|
1076
|
+
%blur-vertex-out%
|
|
1077
|
+
);
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
@fragment
|
|
1081
|
+
fn mainFragment(
|
|
1082
|
+
@builtin(position) position: vec4<f32>,
|
|
1083
|
+
%blur-fragment-in%
|
|
1084
|
+
) -> @location(0) vec4<f32> {
|
|
1085
|
+
|
|
1086
|
+
var finalColor = vec4(0.0);
|
|
1087
|
+
|
|
1088
|
+
%blur-sampling%
|
|
1089
|
+
|
|
1090
|
+
return finalColor;
|
|
1091
|
+
}`;function gg(r,t){const e=za[t],i=e.length,s=[],n=[],o=[];for(let h=0;h<t;h++){s[h]=`@location(${h}) offset${h}: vec2<f32>,`,r?n[h]=`filteredCord + vec2(${h-i+1} * pixelStrength, 0.0),`:n[h]=`filteredCord + vec2(0.0, ${h-i+1} * pixelStrength),`;const p=h<i?h:t-h-1,f=e[p].toString();o[h]=`finalColor += textureSample(uTexture, uSampler, offset${h}) * ${f};`}const a=s.join(`
|
|
1092
|
+
`),l=n.join(`
|
|
1093
|
+
`),u=o.join(`
|
|
1094
|
+
`),c=mg.replace("%blur-struct%",a).replace("%blur-vertex-out%",l).replace("%blur-fragment-in%",a).replace("%blur-sampling%",u).replace("%dimension%",r?"z":"w");return _t.from({vertex:{source:c,entryPoint:"mainVertex"},fragment:{source:c,entryPoint:"mainFragment"}})}var lE=Object.defineProperty,_g=Object.getOwnPropertySymbols,uE=Object.prototype.hasOwnProperty,cE=Object.prototype.propertyIsEnumerable,bg=(r,t,e)=>t in r?lE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Va=(r,t)=>{for(var e in t||(t={}))uE.call(t,e)&&bg(r,e,t[e]);if(_g)for(var e of _g(t))cE.call(t,e)&&bg(r,e,t[e]);return r};const vg=class Ay extends Jt{constructor(t){t=Va(Va({},Ay.defaultOptions),t);const e=fg(t.horizontal,t.kernelSize),i=gg(t.horizontal,t.kernelSize);super(Va({glProgram:e,gpuProgram:i,resources:{blurUniforms:{uStrength:{value:0,type:"f32"}}}},t)),this.horizontal=t.horizontal,this._quality=0,this.quality=t.quality,this.blur=t.strength,this._uniforms=this.resources.blurUniforms.uniforms}apply(t,e,i,s){if(this._uniforms.uStrength=this.strength/this.passes,this.passes===1)t.applyFilter(this,e,i,s);else{const n=ht.getSameSizeTexture(e);let o=e,a=n;this._state.blend=!1;const l=t.renderer.type===bt.WEBGPU;for(let u=0;u<this.passes-1;u++){t.applyFilter(this,o,a,u===0?!0:l);const c=a;a=o,o=c}this._state.blend=!0,t.applyFilter(this,o,i,s),ht.returnTexture(n)}}get blur(){return this.strength}set blur(t){this.padding=1+Math.abs(t)*2,this.strength=t}get quality(){return this._quality}set quality(t){this._quality=t,this.passes=t}};vg.defaultOptions={strength:8,quality:4,kernelSize:5};let Ss=vg;var hE=Object.defineProperty,dE=Object.defineProperties,pE=Object.getOwnPropertyDescriptors,Es=Object.getOwnPropertySymbols,yg=Object.prototype.hasOwnProperty,xg=Object.prototype.propertyIsEnumerable,Tg=(r,t,e)=>t in r?hE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Kr=(r,t)=>{for(var e in t||(t={}))yg.call(t,e)&&Tg(r,e,t[e]);if(Es)for(var e of Es(t))xg.call(t,e)&&Tg(r,e,t[e]);return r},fE=(r,t)=>dE(r,pE(t)),mE=(r,t)=>{var e={};for(var i in r)yg.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Es)for(var i of Es(r))t.indexOf(i)<0&&xg.call(r,i)&&(e[i]=r[i]);return e};class Sg extends Jt{constructor(...t){var e;let i=(e=t[0])!=null?e:{};typeof i=="number"&&(i={strength:i},t[1]!==void 0&&(i.quality=t[1]),t[2]!==void 0&&(i.resolution=t[2]||"inherit"),t[3]!==void 0&&(i.kernelSize=t[3])),i=Kr(Kr({},Ss.defaultOptions),i);const s=i,{strength:n,strengthX:o,strengthY:a,quality:l}=s,u=mE(s,["strength","strengthX","strengthY","quality"]);super(fE(Kr({},u),{compatibleRenderers:bt.BOTH,resources:{}})),this._repeatEdgePixels=!1,this.blurXFilter=new Ss(Kr({horizontal:!0},i)),this.blurYFilter=new Ss(Kr({horizontal:!1},i)),this.quality=l,this.strengthX=o!=null?o:n,this.strengthY=a!=null?a:n,this.repeatEdgePixels=!1}apply(t,e,i,s){const n=Math.abs(this.blurXFilter.strength),o=Math.abs(this.blurYFilter.strength);if(n&&o){const a=ht.getSameSizeTexture(e);this.blurXFilter.blendMode="normal",this.blurXFilter.apply(t,e,a,!0),this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(t,a,i,s),ht.returnTexture(a)}else o?(this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(t,e,i,s)):(this.blurXFilter.blendMode=this.blendMode,this.blurXFilter.apply(t,e,i,s))}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.blur),Math.abs(this.blurYFilter.blur))*2}get strength(){if(this.strengthX!==this.strengthY)throw new Error("BlurFilter's strengthX and strengthY are different");return this.strengthX}set strength(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(t){this.blurXFilter.quality=this.blurYFilter.quality=t}get strengthX(){return this.blurXFilter.blur}set strengthX(t){this.blurXFilter.blur=t,this.updatePadding()}get strengthY(){return this.blurYFilter.blur}set strengthY(t){this.blurYFilter.blur=t,this.updatePadding()}get blur(){return this.strength}set blur(t){this.strength=t}get blurX(){return this.strengthX}set blurX(t){this.strengthX=t}get blurY(){return this.strengthY}set blurY(t){this.strengthY=t}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(t){this._repeatEdgePixels=t,this.updatePadding()}}Sg.defaultOptions={strength:8,quality:4,kernelSize:5};var Eg=`
|
|
1095
|
+
in vec2 vTextureCoord;
|
|
1096
|
+
in vec4 vColor;
|
|
1097
|
+
|
|
1098
|
+
out vec4 finalColor;
|
|
1099
|
+
|
|
1100
|
+
uniform float uColorMatrix[20];
|
|
1101
|
+
uniform float uAlpha;
|
|
1102
|
+
|
|
1103
|
+
uniform sampler2D uTexture;
|
|
1104
|
+
|
|
1105
|
+
float rand(vec2 co)
|
|
1106
|
+
{
|
|
1107
|
+
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
void main()
|
|
1111
|
+
{
|
|
1112
|
+
vec4 color = texture(uTexture, vTextureCoord);
|
|
1113
|
+
float randomValue = rand(gl_FragCoord.xy * 0.2);
|
|
1114
|
+
float diff = (randomValue - 0.5) * 0.5;
|
|
1115
|
+
|
|
1116
|
+
if (uAlpha == 0.0) {
|
|
1117
|
+
finalColor = color;
|
|
1118
|
+
return;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
if (color.a > 0.0) {
|
|
1122
|
+
color.rgb /= color.a;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
vec4 result;
|
|
1126
|
+
|
|
1127
|
+
result.r = (uColorMatrix[0] * color.r);
|
|
1128
|
+
result.r += (uColorMatrix[1] * color.g);
|
|
1129
|
+
result.r += (uColorMatrix[2] * color.b);
|
|
1130
|
+
result.r += (uColorMatrix[3] * color.a);
|
|
1131
|
+
result.r += uColorMatrix[4];
|
|
1132
|
+
|
|
1133
|
+
result.g = (uColorMatrix[5] * color.r);
|
|
1134
|
+
result.g += (uColorMatrix[6] * color.g);
|
|
1135
|
+
result.g += (uColorMatrix[7] * color.b);
|
|
1136
|
+
result.g += (uColorMatrix[8] * color.a);
|
|
1137
|
+
result.g += uColorMatrix[9];
|
|
1138
|
+
|
|
1139
|
+
result.b = (uColorMatrix[10] * color.r);
|
|
1140
|
+
result.b += (uColorMatrix[11] * color.g);
|
|
1141
|
+
result.b += (uColorMatrix[12] * color.b);
|
|
1142
|
+
result.b += (uColorMatrix[13] * color.a);
|
|
1143
|
+
result.b += uColorMatrix[14];
|
|
1144
|
+
|
|
1145
|
+
result.a = (uColorMatrix[15] * color.r);
|
|
1146
|
+
result.a += (uColorMatrix[16] * color.g);
|
|
1147
|
+
result.a += (uColorMatrix[17] * color.b);
|
|
1148
|
+
result.a += (uColorMatrix[18] * color.a);
|
|
1149
|
+
result.a += uColorMatrix[19];
|
|
1150
|
+
|
|
1151
|
+
vec3 rgb = mix(color.rgb, result.rgb, uAlpha);
|
|
1152
|
+
|
|
1153
|
+
// Premultiply alpha again.
|
|
1154
|
+
rgb *= result.a;
|
|
1155
|
+
|
|
1156
|
+
finalColor = vec4(rgb, result.a);
|
|
1157
|
+
}
|
|
1158
|
+
`,Wa=`struct GlobalFilterUniforms {
|
|
1159
|
+
uInputSize:vec4<f32>,
|
|
1160
|
+
uInputPixel:vec4<f32>,
|
|
1161
|
+
uInputClamp:vec4<f32>,
|
|
1162
|
+
uOutputFrame:vec4<f32>,
|
|
1163
|
+
uGlobalFrame:vec4<f32>,
|
|
1164
|
+
uOutputTexture:vec4<f32>,
|
|
1165
|
+
};
|
|
1166
|
+
|
|
1167
|
+
struct ColorMatrixUniforms {
|
|
1168
|
+
uColorMatrix:array<vec4<f32>, 5>,
|
|
1169
|
+
uAlpha:f32,
|
|
1170
|
+
};
|
|
1171
|
+
|
|
1172
|
+
|
|
1173
|
+
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
1174
|
+
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
1175
|
+
@group(0) @binding(2) var uSampler : sampler;
|
|
1176
|
+
@group(1) @binding(0) var<uniform> colorMatrixUniforms : ColorMatrixUniforms;
|
|
1177
|
+
|
|
1178
|
+
|
|
1179
|
+
struct VSOutput {
|
|
1180
|
+
@builtin(position) position: vec4<f32>,
|
|
1181
|
+
@location(0) uv : vec2<f32>,
|
|
1182
|
+
};
|
|
1183
|
+
|
|
1184
|
+
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
|
|
1185
|
+
{
|
|
1186
|
+
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
1187
|
+
|
|
1188
|
+
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
1189
|
+
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
1190
|
+
|
|
1191
|
+
return vec4(position, 0.0, 1.0);
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
1195
|
+
{
|
|
1196
|
+
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
@vertex
|
|
1200
|
+
fn mainVertex(
|
|
1201
|
+
@location(0) aPosition : vec2<f32>,
|
|
1202
|
+
) -> VSOutput {
|
|
1203
|
+
return VSOutput(
|
|
1204
|
+
filterVertexPosition(aPosition),
|
|
1205
|
+
filterTextureCoord(aPosition),
|
|
1206
|
+
);
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
|
|
1210
|
+
@fragment
|
|
1211
|
+
fn mainFragment(
|
|
1212
|
+
@location(0) uv: vec2<f32>,
|
|
1213
|
+
) -> @location(0) vec4<f32> {
|
|
1214
|
+
|
|
1215
|
+
|
|
1216
|
+
var c = textureSample(uTexture, uSampler, uv);
|
|
1217
|
+
|
|
1218
|
+
if (colorMatrixUniforms.uAlpha == 0.0) {
|
|
1219
|
+
return c;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
|
|
1223
|
+
// Un-premultiply alpha before applying the color matrix. See issue #3539.
|
|
1224
|
+
if (c.a > 0.0) {
|
|
1225
|
+
c.r /= c.a;
|
|
1226
|
+
c.g /= c.a;
|
|
1227
|
+
c.b /= c.a;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
var cm = colorMatrixUniforms.uColorMatrix;
|
|
1231
|
+
|
|
1232
|
+
|
|
1233
|
+
var result = vec4<f32>(0.);
|
|
1234
|
+
|
|
1235
|
+
result.r = (cm[0][0] * c.r);
|
|
1236
|
+
result.r += (cm[0][1] * c.g);
|
|
1237
|
+
result.r += (cm[0][2] * c.b);
|
|
1238
|
+
result.r += (cm[0][3] * c.a);
|
|
1239
|
+
result.r += cm[1][0];
|
|
1240
|
+
|
|
1241
|
+
result.g = (cm[1][1] * c.r);
|
|
1242
|
+
result.g += (cm[1][2] * c.g);
|
|
1243
|
+
result.g += (cm[1][3] * c.b);
|
|
1244
|
+
result.g += (cm[2][0] * c.a);
|
|
1245
|
+
result.g += cm[2][1];
|
|
1246
|
+
|
|
1247
|
+
result.b = (cm[2][2] * c.r);
|
|
1248
|
+
result.b += (cm[2][3] * c.g);
|
|
1249
|
+
result.b += (cm[3][0] * c.b);
|
|
1250
|
+
result.b += (cm[3][1] * c.a);
|
|
1251
|
+
result.b += cm[3][2];
|
|
1252
|
+
|
|
1253
|
+
result.a = (cm[3][3] * c.r);
|
|
1254
|
+
result.a += (cm[4][0] * c.g);
|
|
1255
|
+
result.a += (cm[4][1] * c.b);
|
|
1256
|
+
result.a += (cm[4][2] * c.a);
|
|
1257
|
+
result.a += cm[4][3];
|
|
1258
|
+
|
|
1259
|
+
var rgb = mix(c.rgb, result.rgb, colorMatrixUniforms.uAlpha);
|
|
1260
|
+
|
|
1261
|
+
rgb.r *= result.a;
|
|
1262
|
+
rgb.g *= result.a;
|
|
1263
|
+
rgb.b *= result.a;
|
|
1264
|
+
|
|
1265
|
+
return vec4(rgb, result.a);
|
|
1266
|
+
}`,gE=Object.defineProperty,_E=Object.defineProperties,bE=Object.getOwnPropertyDescriptors,Ag=Object.getOwnPropertySymbols,vE=Object.prototype.hasOwnProperty,yE=Object.prototype.propertyIsEnumerable,Pg=(r,t,e)=>t in r?gE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,xE=(r,t)=>{for(var e in t||(t={}))vE.call(t,e)&&Pg(r,e,t[e]);if(Ag)for(var e of Ag(t))yE.call(t,e)&&Pg(r,e,t[e]);return r},TE=(r,t)=>_E(r,bE(t));class SE extends Jt{constructor(t={}){const e=new st({uColorMatrix:{value:[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],type:"f32",size:20},uAlpha:{value:1,type:"f32"}}),i=_t.from({vertex:{source:Wa,entryPoint:"mainVertex"},fragment:{source:Wa,entryPoint:"mainFragment"}}),s=Et.from({vertex:xs,fragment:Eg,name:"color-matrix-filter"});super(TE(xE({},t),{gpuProgram:i,glProgram:s,resources:{colorMatrixUniforms:e}})),this.alpha=1}_loadMatrix(t,e=!1){let i=t;e&&(this._multiply(i,this.matrix,t),i=this._colorMatrix(i)),this.resources.colorMatrixUniforms.uniforms.uColorMatrix=i,this.resources.colorMatrixUniforms.update()}_multiply(t,e,i){return t[0]=e[0]*i[0]+e[1]*i[5]+e[2]*i[10]+e[3]*i[15],t[1]=e[0]*i[1]+e[1]*i[6]+e[2]*i[11]+e[3]*i[16],t[2]=e[0]*i[2]+e[1]*i[7]+e[2]*i[12]+e[3]*i[17],t[3]=e[0]*i[3]+e[1]*i[8]+e[2]*i[13]+e[3]*i[18],t[4]=e[0]*i[4]+e[1]*i[9]+e[2]*i[14]+e[3]*i[19]+e[4],t[5]=e[5]*i[0]+e[6]*i[5]+e[7]*i[10]+e[8]*i[15],t[6]=e[5]*i[1]+e[6]*i[6]+e[7]*i[11]+e[8]*i[16],t[7]=e[5]*i[2]+e[6]*i[7]+e[7]*i[12]+e[8]*i[17],t[8]=e[5]*i[3]+e[6]*i[8]+e[7]*i[13]+e[8]*i[18],t[9]=e[5]*i[4]+e[6]*i[9]+e[7]*i[14]+e[8]*i[19]+e[9],t[10]=e[10]*i[0]+e[11]*i[5]+e[12]*i[10]+e[13]*i[15],t[11]=e[10]*i[1]+e[11]*i[6]+e[12]*i[11]+e[13]*i[16],t[12]=e[10]*i[2]+e[11]*i[7]+e[12]*i[12]+e[13]*i[17],t[13]=e[10]*i[3]+e[11]*i[8]+e[12]*i[13]+e[13]*i[18],t[14]=e[10]*i[4]+e[11]*i[9]+e[12]*i[14]+e[13]*i[19]+e[14],t[15]=e[15]*i[0]+e[16]*i[5]+e[17]*i[10]+e[18]*i[15],t[16]=e[15]*i[1]+e[16]*i[6]+e[17]*i[11]+e[18]*i[16],t[17]=e[15]*i[2]+e[16]*i[7]+e[17]*i[12]+e[18]*i[17],t[18]=e[15]*i[3]+e[16]*i[8]+e[17]*i[13]+e[18]*i[18],t[19]=e[15]*i[4]+e[16]*i[9]+e[17]*i[14]+e[18]*i[19]+e[19],t}_colorMatrix(t){const e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e}brightness(t,e){const i=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)}tint(t,e){const[i,s,n]=j.shared.setValue(t).toArray(),o=[i,0,0,0,0,0,s,0,0,0,0,0,n,0,0,0,0,0,1,0];this._loadMatrix(o,e)}greyscale(t,e){const i=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)}grayscale(t,e){this.greyscale(t,e)}blackAndWhite(t){const e=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(e,t)}hue(t,e){t=(t||0)/180*Math.PI;const i=Math.cos(t),s=Math.sin(t),n=Math.sqrt,o=1/3,a=n(o),l=i+(1-i)*o,u=o*(1-i)-a*s,c=o*(1-i)+a*s,h=o*(1-i)+a*s,p=i+o*(1-i),f=o*(1-i)-a*s,m=o*(1-i)-a*s,_=o*(1-i)+a*s,g=i+o*(1-i),b=[l,u,c,0,0,h,p,f,0,0,m,_,g,0,0,0,0,0,1,0];this._loadMatrix(b,e)}contrast(t,e){const i=(t||0)+1,s=-.5*(i-1),n=[i,0,0,0,s,0,i,0,0,s,0,0,i,0,s,0,0,0,1,0];this._loadMatrix(n,e)}saturate(t=0,e){const i=t*2/3+1,s=(i-1)*-.5,n=[i,s,s,0,0,s,i,s,0,0,s,s,i,0,0,0,0,0,1,0];this._loadMatrix(n,e)}desaturate(){this.saturate(-1)}negative(t){const e=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(e,t)}sepia(t){const e=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(e,t)}technicolor(t){const e=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(e,t)}polaroid(t){const e=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(e,t)}toBGR(t){const e=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(e,t)}kodachrome(t){const e=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(e,t)}browni(t){const e=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(e,t)}vintage(t){const e=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(e,t)}colorTone(t,e,i,s,n){t=t||.2,e=e||.15,i=i||16770432,s=s||3375104;const o=j.shared,[a,l,u]=o.setValue(i).toArray(),[c,h,p]=o.setValue(s).toArray(),f=[.3,.59,.11,0,0,a,l,u,t,0,c,h,p,e,0,a-c,l-h,u-p,0,0];this._loadMatrix(f,n)}night(t,e){t=t||.1;const i=[t*-2,-t,0,0,0,-t,0,t,0,0,0,t,t*2,0,0,0,0,0,1,0];this._loadMatrix(i,e)}predator(t,e){const i=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(i,e)}lsd(t){const e=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(e,t)}reset(){const t=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(t,!1)}get matrix(){return this.resources.colorMatrixUniforms.uniforms.uColorMatrix}set matrix(t){this.resources.colorMatrixUniforms.uniforms.uColorMatrix=t}get alpha(){return this.resources.colorMatrixUniforms.uniforms.uAlpha}set alpha(t){this.resources.colorMatrixUniforms.uniforms.uAlpha=t}}var wg=`
|
|
1267
|
+
in vec2 vTextureCoord;
|
|
1268
|
+
in vec2 vFilterUv;
|
|
1269
|
+
|
|
1270
|
+
out vec4 finalColor;
|
|
1271
|
+
|
|
1272
|
+
uniform sampler2D uTexture;
|
|
1273
|
+
uniform sampler2D uMapTexture;
|
|
1274
|
+
|
|
1275
|
+
uniform vec4 uInputClamp;
|
|
1276
|
+
uniform highp vec4 uInputSize;
|
|
1277
|
+
uniform mat2 uRotation;
|
|
1278
|
+
uniform vec2 uScale;
|
|
1279
|
+
|
|
1280
|
+
void main()
|
|
1281
|
+
{
|
|
1282
|
+
vec4 map = texture(uMapTexture, vFilterUv);
|
|
1283
|
+
|
|
1284
|
+
vec2 offset = uInputSize.zw * (uRotation * (map.xy - 0.5)) * uScale;
|
|
1285
|
+
|
|
1286
|
+
finalColor = texture(uTexture, clamp(vTextureCoord + offset, uInputClamp.xy, uInputClamp.zw));
|
|
1287
|
+
}
|
|
1288
|
+
`,Rg=`in vec2 aPosition;
|
|
1289
|
+
out vec2 vTextureCoord;
|
|
1290
|
+
out vec2 vFilterUv;
|
|
1291
|
+
|
|
1292
|
+
|
|
1293
|
+
uniform vec4 uInputSize;
|
|
1294
|
+
uniform vec4 uOutputFrame;
|
|
1295
|
+
uniform vec4 uOutputTexture;
|
|
1296
|
+
|
|
1297
|
+
uniform mat3 uFilterMatrix;
|
|
1298
|
+
|
|
1299
|
+
vec4 filterVertexPosition( void )
|
|
1300
|
+
{
|
|
1301
|
+
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
1302
|
+
|
|
1303
|
+
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
|
|
1304
|
+
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
|
|
1305
|
+
|
|
1306
|
+
return vec4(position, 0.0, 1.0);
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
vec2 filterTextureCoord( void )
|
|
1310
|
+
{
|
|
1311
|
+
return aPosition * (uOutputFrame.zw * uInputSize.zw);
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
vec2 getFilterCoord( void )
|
|
1315
|
+
{
|
|
1316
|
+
return ( uFilterMatrix * vec3( filterTextureCoord(), 1.0) ).xy;
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
|
|
1320
|
+
void main(void)
|
|
1321
|
+
{
|
|
1322
|
+
gl_Position = filterVertexPosition();
|
|
1323
|
+
vTextureCoord = filterTextureCoord();
|
|
1324
|
+
vFilterUv = getFilterCoord();
|
|
1325
|
+
}
|
|
1326
|
+
`,Ya=`
|
|
1327
|
+
struct GlobalFilterUniforms {
|
|
1328
|
+
uInputSize:vec4<f32>,
|
|
1329
|
+
uInputPixel:vec4<f32>,
|
|
1330
|
+
uInputClamp:vec4<f32>,
|
|
1331
|
+
uOutputFrame:vec4<f32>,
|
|
1332
|
+
uGlobalFrame:vec4<f32>,
|
|
1333
|
+
uOutputTexture:vec4<f32>,
|
|
1334
|
+
};
|
|
1335
|
+
|
|
1336
|
+
struct DisplacementUniforms {
|
|
1337
|
+
uFilterMatrix:mat3x3<f32>,
|
|
1338
|
+
uScale:vec2<f32>,
|
|
1339
|
+
uRotation:mat2x2<f32>
|
|
1340
|
+
};
|
|
1341
|
+
|
|
1342
|
+
|
|
1343
|
+
|
|
1344
|
+
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
1345
|
+
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
1346
|
+
@group(0) @binding(2) var uSampler : sampler;
|
|
1347
|
+
|
|
1348
|
+
@group(1) @binding(0) var<uniform> filterUniforms : DisplacementUniforms;
|
|
1349
|
+
@group(1) @binding(1) var uMapTexture: texture_2d<f32>;
|
|
1350
|
+
@group(1) @binding(2) var uMapSampler : sampler;
|
|
1351
|
+
|
|
1352
|
+
struct VSOutput {
|
|
1353
|
+
@builtin(position) position: vec4<f32>,
|
|
1354
|
+
@location(0) uv : vec2<f32>,
|
|
1355
|
+
@location(1) filterUv : vec2<f32>,
|
|
1356
|
+
};
|
|
1357
|
+
|
|
1358
|
+
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
|
|
1359
|
+
{
|
|
1360
|
+
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
1361
|
+
|
|
1362
|
+
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
1363
|
+
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
1364
|
+
|
|
1365
|
+
return vec4(position, 0.0, 1.0);
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
1369
|
+
{
|
|
1370
|
+
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
1374
|
+
{
|
|
1375
|
+
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
fn getFilterCoord(aPosition:vec2<f32> ) -> vec2<f32>
|
|
1379
|
+
{
|
|
1380
|
+
return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
fn getSize() -> vec2<f32>
|
|
1384
|
+
{
|
|
1385
|
+
|
|
1386
|
+
|
|
1387
|
+
return gfu.uGlobalFrame.zw;
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
@vertex
|
|
1391
|
+
fn mainVertex(
|
|
1392
|
+
@location(0) aPosition : vec2<f32>,
|
|
1393
|
+
) -> VSOutput {
|
|
1394
|
+
return VSOutput(
|
|
1395
|
+
filterVertexPosition(aPosition),
|
|
1396
|
+
filterTextureCoord(aPosition),
|
|
1397
|
+
getFilterCoord(aPosition)
|
|
1398
|
+
);
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
@fragment
|
|
1402
|
+
fn mainFragment(
|
|
1403
|
+
@location(0) uv: vec2<f32>,
|
|
1404
|
+
@location(1) filterUv: vec2<f32>,
|
|
1405
|
+
@builtin(position) position: vec4<f32>
|
|
1406
|
+
) -> @location(0) vec4<f32> {
|
|
1407
|
+
|
|
1408
|
+
var map = textureSample(uMapTexture, uMapSampler, filterUv);
|
|
1409
|
+
|
|
1410
|
+
var offset = gfu.uInputSize.zw * (filterUniforms.uRotation * (map.xy - 0.5)) * filterUniforms.uScale;
|
|
1411
|
+
|
|
1412
|
+
return textureSample(uTexture, uSampler, clamp(uv + offset, gfu.uInputClamp.xy, gfu.uInputClamp.zw));
|
|
1413
|
+
}`,EE=Object.defineProperty,AE=Object.defineProperties,PE=Object.getOwnPropertyDescriptors,As=Object.getOwnPropertySymbols,Mg=Object.prototype.hasOwnProperty,Cg=Object.prototype.propertyIsEnumerable,Og=(r,t,e)=>t in r?EE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,wE=(r,t)=>{for(var e in t||(t={}))Mg.call(t,e)&&Og(r,e,t[e]);if(As)for(var e of As(t))Cg.call(t,e)&&Og(r,e,t[e]);return r},RE=(r,t)=>AE(r,PE(t)),ME=(r,t)=>{var e={};for(var i in r)Mg.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&As)for(var i of As(r))t.indexOf(i)<0&&Cg.call(r,i)&&(e[i]=r[i]);return e};class CE extends Jt{constructor(...t){let e=t[0];e instanceof Ft&&(e={sprite:e,scale:t[1]});const i=e,{sprite:s,scale:n}=i,o=ME(i,["sprite","scale"]);let a=n!=null?n:20;typeof a=="number"&&(a=new W(a,a));const l=new st({uFilterMatrix:{value:new G,type:"mat3x3<f32>"},uScale:{value:a,type:"vec2<f32>"},uRotation:{value:new Float32Array([0,0,0,0]),type:"mat2x2<f32>"}}),u=Et.from({vertex:Rg,fragment:wg,name:"displacement-filter"}),c=_t.from({vertex:{source:Ya,entryPoint:"mainVertex"},fragment:{source:Ya,entryPoint:"mainFragment"}}),h=s.texture.source;super(RE(wE({},o),{gpuProgram:c,glProgram:u,resources:{filterUniforms:l,uMapTexture:h,uMapSampler:h.style}})),this._sprite=e.sprite,this._sprite.renderable=!1}apply(t,e,i,s){const n=this.resources.filterUniforms.uniforms;t.calculateSpriteMatrix(n.uFilterMatrix,this._sprite);const o=this._sprite.worldTransform,a=Math.sqrt(o.a*o.a+o.b*o.b),l=Math.sqrt(o.c*o.c+o.d*o.d);a!==0&&l!==0&&(n.uRotation[0]=o.a/a,n.uRotation[1]=o.b/a,n.uRotation[2]=o.c/l,n.uRotation[3]=o.d/l),this.resources.uMapTexture=this._sprite.texture.source,t.applyFilter(this,e,i,s)}get scale(){return this.resources.filterUniforms.uniforms.uScale}}var Gg=`
|
|
1414
|
+
in vec2 vTextureCoord;
|
|
1415
|
+
in vec4 vColor;
|
|
1416
|
+
|
|
1417
|
+
out vec4 finalColor;
|
|
1418
|
+
|
|
1419
|
+
uniform float uNoise;
|
|
1420
|
+
uniform float uSeed;
|
|
1421
|
+
uniform sampler2D uTexture;
|
|
1422
|
+
|
|
1423
|
+
float rand(vec2 co)
|
|
1424
|
+
{
|
|
1425
|
+
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
void main()
|
|
1429
|
+
{
|
|
1430
|
+
vec4 color = texture(uTexture, vTextureCoord);
|
|
1431
|
+
float randomValue = rand(gl_FragCoord.xy * uSeed);
|
|
1432
|
+
float diff = (randomValue - 0.5) * uNoise;
|
|
1433
|
+
|
|
1434
|
+
// Un-premultiply alpha before applying the color matrix. See issue #3539.
|
|
1435
|
+
if (color.a > 0.0) {
|
|
1436
|
+
color.rgb /= color.a;
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
color.r += diff;
|
|
1440
|
+
color.g += diff;
|
|
1441
|
+
color.b += diff;
|
|
1442
|
+
|
|
1443
|
+
// Premultiply alpha again.
|
|
1444
|
+
color.rgb *= color.a;
|
|
1445
|
+
|
|
1446
|
+
finalColor = color;
|
|
1447
|
+
}
|
|
1448
|
+
`,Ka=`
|
|
1449
|
+
|
|
1450
|
+
struct GlobalFilterUniforms {
|
|
1451
|
+
uInputSize:vec4<f32>,
|
|
1452
|
+
uInputPixel:vec4<f32>,
|
|
1453
|
+
uInputClamp:vec4<f32>,
|
|
1454
|
+
uOutputFrame:vec4<f32>,
|
|
1455
|
+
uGlobalFrame:vec4<f32>,
|
|
1456
|
+
uOutputTexture:vec4<f32>,
|
|
1457
|
+
};
|
|
1458
|
+
|
|
1459
|
+
struct NoiseUniforms {
|
|
1460
|
+
uNoise:f32,
|
|
1461
|
+
uSeed:f32,
|
|
1462
|
+
};
|
|
1463
|
+
|
|
1464
|
+
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
1465
|
+
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
1466
|
+
@group(0) @binding(2) var uSampler : sampler;
|
|
1467
|
+
|
|
1468
|
+
@group(1) @binding(0) var<uniform> noiseUniforms : NoiseUniforms;
|
|
1469
|
+
|
|
1470
|
+
struct VSOutput {
|
|
1471
|
+
@builtin(position) position: vec4<f32>,
|
|
1472
|
+
@location(0) uv : vec2<f32>
|
|
1473
|
+
};
|
|
1474
|
+
|
|
1475
|
+
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
|
|
1476
|
+
{
|
|
1477
|
+
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
1478
|
+
|
|
1479
|
+
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
1480
|
+
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
1481
|
+
|
|
1482
|
+
return vec4(position, 0.0, 1.0);
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
1486
|
+
{
|
|
1487
|
+
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
1491
|
+
{
|
|
1492
|
+
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
fn getSize() -> vec2<f32>
|
|
1496
|
+
{
|
|
1497
|
+
return gfu.uGlobalFrame.zw;
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
@vertex
|
|
1501
|
+
fn mainVertex(
|
|
1502
|
+
@location(0) aPosition : vec2<f32>,
|
|
1503
|
+
) -> VSOutput {
|
|
1504
|
+
return VSOutput(
|
|
1505
|
+
filterVertexPosition(aPosition),
|
|
1506
|
+
filterTextureCoord(aPosition)
|
|
1507
|
+
);
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
fn rand(co:vec2<f32>) -> f32
|
|
1511
|
+
{
|
|
1512
|
+
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
|
|
1516
|
+
|
|
1517
|
+
@fragment
|
|
1518
|
+
fn mainFragment(
|
|
1519
|
+
@location(0) uv: vec2<f32>,
|
|
1520
|
+
@builtin(position) position: vec4<f32>
|
|
1521
|
+
) -> @location(0) vec4<f32> {
|
|
1522
|
+
|
|
1523
|
+
var pixelPosition = globalTextureCoord(position.xy);// / (getSize());//- gfu.uOutputFrame.xy);
|
|
1524
|
+
|
|
1525
|
+
|
|
1526
|
+
var sample = textureSample(uTexture, uSampler, uv);
|
|
1527
|
+
var randomValue = rand(pixelPosition.xy * noiseUniforms.uSeed);
|
|
1528
|
+
var diff = (randomValue - 0.5) * noiseUniforms.uNoise;
|
|
1529
|
+
|
|
1530
|
+
// Un-premultiply alpha before applying the color matrix. See issue #3539.
|
|
1531
|
+
if (sample.a > 0.0) {
|
|
1532
|
+
sample.r /= sample.a;
|
|
1533
|
+
sample.g /= sample.a;
|
|
1534
|
+
sample.b /= sample.a;
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
sample.r += diff;
|
|
1538
|
+
sample.g += diff;
|
|
1539
|
+
sample.b += diff;
|
|
1540
|
+
|
|
1541
|
+
// Premultiply alpha again.
|
|
1542
|
+
sample.r *= sample.a;
|
|
1543
|
+
sample.g *= sample.a;
|
|
1544
|
+
sample.b *= sample.a;
|
|
1545
|
+
|
|
1546
|
+
return sample;
|
|
1547
|
+
}`,OE=Object.defineProperty,GE=Object.defineProperties,BE=Object.getOwnPropertyDescriptors,Ps=Object.getOwnPropertySymbols,Bg=Object.prototype.hasOwnProperty,Ig=Object.prototype.propertyIsEnumerable,Fg=(r,t,e)=>t in r?OE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,qa=(r,t)=>{for(var e in t||(t={}))Bg.call(t,e)&&Fg(r,e,t[e]);if(Ps)for(var e of Ps(t))Ig.call(t,e)&&Fg(r,e,t[e]);return r},IE=(r,t)=>GE(r,BE(t)),FE=(r,t)=>{var e={};for(var i in r)Bg.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Ps)for(var i of Ps(r))t.indexOf(i)<0&&Ig.call(r,i)&&(e[i]=r[i]);return e};const Dg=class Py extends Jt{constructor(t={}){t=qa(qa({},Py.defaultOptions),t);const e=_t.from({vertex:{source:Ka,entryPoint:"mainVertex"},fragment:{source:Ka,entryPoint:"mainFragment"}}),i=Et.from({vertex:xs,fragment:Gg,name:"noise-filter"}),s=t,{noise:n,seed:o}=s,a=FE(s,["noise","seed"]);super(IE(qa({},a),{gpuProgram:e,glProgram:i,resources:{noiseUniforms:new st({uNoise:{value:1,type:"f32"},uSeed:{value:1,type:"f32"}})}})),this.noise=n,this.seed=o!=null?o:Math.random()}get noise(){return this.resources.noiseUniforms.uniforms.uNoise}set noise(t){this.resources.noiseUniforms.uniforms.uNoise=t}get seed(){return this.resources.noiseUniforms.uniforms.uSeed}set seed(t){this.resources.noiseUniforms.uniforms.uSeed=t}};Dg.defaultOptions={noise:.5};let DE=Dg;var Ug=`in vec2 vMaskCoord;
|
|
1548
|
+
in vec2 vTextureCoord;
|
|
1549
|
+
|
|
1550
|
+
uniform sampler2D uTexture;
|
|
1551
|
+
uniform sampler2D uMaskTexture;
|
|
1552
|
+
|
|
1553
|
+
uniform float uAlpha;
|
|
1554
|
+
uniform vec4 uMaskClamp;
|
|
1555
|
+
uniform float uInverse;
|
|
1556
|
+
|
|
1557
|
+
out vec4 finalColor;
|
|
1558
|
+
|
|
1559
|
+
void main(void)
|
|
1560
|
+
{
|
|
1561
|
+
float clip = step(3.5,
|
|
1562
|
+
step(uMaskClamp.x, vMaskCoord.x) +
|
|
1563
|
+
step(uMaskClamp.y, vMaskCoord.y) +
|
|
1564
|
+
step(vMaskCoord.x, uMaskClamp.z) +
|
|
1565
|
+
step(vMaskCoord.y, uMaskClamp.w));
|
|
1566
|
+
|
|
1567
|
+
// TODO look into why this is needed
|
|
1568
|
+
float npmAlpha = uAlpha;
|
|
1569
|
+
vec4 original = texture(uTexture, vTextureCoord);
|
|
1570
|
+
vec4 masky = texture(uMaskTexture, vMaskCoord);
|
|
1571
|
+
float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);
|
|
1572
|
+
|
|
1573
|
+
float a = alphaMul * masky.r * npmAlpha * clip;
|
|
1574
|
+
|
|
1575
|
+
if (uInverse == 1.0) {
|
|
1576
|
+
a = 1.0 - a;
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
finalColor = original * a;
|
|
1580
|
+
}
|
|
1581
|
+
`,kg=`in vec2 aPosition;
|
|
1582
|
+
|
|
1583
|
+
out vec2 vTextureCoord;
|
|
1584
|
+
out vec2 vMaskCoord;
|
|
1585
|
+
|
|
1586
|
+
|
|
1587
|
+
uniform vec4 uInputSize;
|
|
1588
|
+
uniform vec4 uOutputFrame;
|
|
1589
|
+
uniform vec4 uOutputTexture;
|
|
1590
|
+
uniform mat3 uFilterMatrix;
|
|
1591
|
+
|
|
1592
|
+
vec4 filterVertexPosition( vec2 aPosition )
|
|
1593
|
+
{
|
|
1594
|
+
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
1595
|
+
|
|
1596
|
+
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
|
|
1597
|
+
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
|
|
1598
|
+
|
|
1599
|
+
return vec4(position, 0.0, 1.0);
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
vec2 filterTextureCoord( vec2 aPosition )
|
|
1603
|
+
{
|
|
1604
|
+
return aPosition * (uOutputFrame.zw * uInputSize.zw);
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
vec2 getFilterCoord( vec2 aPosition )
|
|
1608
|
+
{
|
|
1609
|
+
return ( uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
void main(void)
|
|
1613
|
+
{
|
|
1614
|
+
gl_Position = filterVertexPosition(aPosition);
|
|
1615
|
+
vTextureCoord = filterTextureCoord(aPosition);
|
|
1616
|
+
vMaskCoord = getFilterCoord(aPosition);
|
|
1617
|
+
}
|
|
1618
|
+
`,Za=`struct GlobalFilterUniforms {
|
|
1619
|
+
uInputSize:vec4<f32>,
|
|
1620
|
+
uInputPixel:vec4<f32>,
|
|
1621
|
+
uInputClamp:vec4<f32>,
|
|
1622
|
+
uOutputFrame:vec4<f32>,
|
|
1623
|
+
uGlobalFrame:vec4<f32>,
|
|
1624
|
+
uOutputTexture:vec4<f32>,
|
|
1625
|
+
};
|
|
1626
|
+
|
|
1627
|
+
struct MaskUniforms {
|
|
1628
|
+
uFilterMatrix:mat3x3<f32>,
|
|
1629
|
+
uMaskClamp:vec4<f32>,
|
|
1630
|
+
uAlpha:f32,
|
|
1631
|
+
uInverse:f32,
|
|
1632
|
+
};
|
|
1633
|
+
|
|
1634
|
+
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
1635
|
+
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
1636
|
+
@group(0) @binding(2) var uSampler : sampler;
|
|
1637
|
+
|
|
1638
|
+
@group(1) @binding(0) var<uniform> filterUniforms : MaskUniforms;
|
|
1639
|
+
@group(1) @binding(1) var uMaskTexture: texture_2d<f32>;
|
|
1640
|
+
|
|
1641
|
+
struct VSOutput {
|
|
1642
|
+
@builtin(position) position: vec4<f32>,
|
|
1643
|
+
@location(0) uv : vec2<f32>,
|
|
1644
|
+
@location(1) filterUv : vec2<f32>,
|
|
1645
|
+
};
|
|
1646
|
+
|
|
1647
|
+
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
|
|
1648
|
+
{
|
|
1649
|
+
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
1650
|
+
|
|
1651
|
+
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
1652
|
+
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
1653
|
+
|
|
1654
|
+
return vec4(position, 0.0, 1.0);
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
1658
|
+
{
|
|
1659
|
+
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
1663
|
+
{
|
|
1664
|
+
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
fn getFilterCoord(aPosition:vec2<f32> ) -> vec2<f32>
|
|
1668
|
+
{
|
|
1669
|
+
return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
fn getSize() -> vec2<f32>
|
|
1673
|
+
{
|
|
1674
|
+
return gfu.uGlobalFrame.zw;
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
@vertex
|
|
1678
|
+
fn mainVertex(
|
|
1679
|
+
@location(0) aPosition : vec2<f32>,
|
|
1680
|
+
) -> VSOutput {
|
|
1681
|
+
return VSOutput(
|
|
1682
|
+
filterVertexPosition(aPosition),
|
|
1683
|
+
filterTextureCoord(aPosition),
|
|
1684
|
+
getFilterCoord(aPosition)
|
|
1685
|
+
);
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
@fragment
|
|
1689
|
+
fn mainFragment(
|
|
1690
|
+
@location(0) uv: vec2<f32>,
|
|
1691
|
+
@location(1) filterUv: vec2<f32>,
|
|
1692
|
+
@builtin(position) position: vec4<f32>
|
|
1693
|
+
) -> @location(0) vec4<f32> {
|
|
1694
|
+
|
|
1695
|
+
var maskClamp = filterUniforms.uMaskClamp;
|
|
1696
|
+
var uAlpha = filterUniforms.uAlpha;
|
|
1697
|
+
|
|
1698
|
+
var clip = step(3.5,
|
|
1699
|
+
step(maskClamp.x, filterUv.x) +
|
|
1700
|
+
step(maskClamp.y, filterUv.y) +
|
|
1701
|
+
step(filterUv.x, maskClamp.z) +
|
|
1702
|
+
step(filterUv.y, maskClamp.w));
|
|
1703
|
+
|
|
1704
|
+
var mask = textureSample(uMaskTexture, uSampler, filterUv);
|
|
1705
|
+
var source = textureSample(uTexture, uSampler, uv);
|
|
1706
|
+
var alphaMul = 1.0 - uAlpha * (1.0 - mask.a);
|
|
1707
|
+
|
|
1708
|
+
var a: f32 = alphaMul * mask.r * uAlpha * clip;
|
|
1709
|
+
|
|
1710
|
+
if (filterUniforms.uInverse == 1.0) {
|
|
1711
|
+
a = 1.0 - a;
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
return source * a;
|
|
1715
|
+
}
|
|
1716
|
+
`,UE=Object.defineProperty,kE=Object.defineProperties,$E=Object.getOwnPropertyDescriptors,ws=Object.getOwnPropertySymbols,$g=Object.prototype.hasOwnProperty,Lg=Object.prototype.propertyIsEnumerable,Ng=(r,t,e)=>t in r?UE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,LE=(r,t)=>{for(var e in t||(t={}))$g.call(t,e)&&Ng(r,e,t[e]);if(ws)for(var e of ws(t))Lg.call(t,e)&&Ng(r,e,t[e]);return r},NE=(r,t)=>kE(r,$E(t)),HE=(r,t)=>{var e={};for(var i in r)$g.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&ws)for(var i of ws(r))t.indexOf(i)<0&&Lg.call(r,i)&&(e[i]=r[i]);return e};class Hg extends Jt{constructor(t){const e=t,{sprite:i}=e,s=HE(e,["sprite"]),n=new Gn(i.texture),o=new st({uFilterMatrix:{value:new G,type:"mat3x3<f32>"},uMaskClamp:{value:n.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),a=_t.from({vertex:{source:Za,entryPoint:"mainVertex"},fragment:{source:Za,entryPoint:"mainFragment"}}),l=Et.from({vertex:kg,fragment:Ug,name:"mask-filter"});super(NE(LE({},s),{gpuProgram:a,glProgram:l,resources:{filterUniforms:o,uMaskTexture:i.texture.source}})),this.sprite=i,this._textureMatrix=n}set inverse(t){this.resources.filterUniforms.uniforms.uInverse=t?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(t,e,i,s){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,i,s)}}var XE=`fn getLuminosity(c: vec3<f32>) -> f32 {
|
|
1717
|
+
return 0.3 * c.r + 0.59 * c.g + 0.11 * c.b;
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1720
|
+
fn setLuminosity(c: vec3<f32>, lum: f32) -> vec3<f32> {
|
|
1721
|
+
let d: f32 = lum - getLuminosity(c);
|
|
1722
|
+
let newColor: vec3<f32> = c.rgb + vec3<f32>(d, d, d);
|
|
1723
|
+
|
|
1724
|
+
// clip back into legal range
|
|
1725
|
+
let newLum: f32 = getLuminosity(newColor);
|
|
1726
|
+
let cMin: f32 = min(newColor.r, min(newColor.g, newColor.b));
|
|
1727
|
+
let cMax: f32 = max(newColor.r, max(newColor.g, newColor.b));
|
|
1728
|
+
|
|
1729
|
+
let t1: f32 = newLum / (newLum - cMin);
|
|
1730
|
+
let t2: f32 = (1.0 - newLum) / (cMax - newLum);
|
|
1731
|
+
|
|
1732
|
+
let finalColor = mix(vec3<f32>(newLum, newLum, newLum), newColor, select(select(1.0, t2, cMax > 1.0), t1, cMin < 0.0));
|
|
1733
|
+
|
|
1734
|
+
return finalColor;
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
fn getSaturation(c: vec3<f32>) -> f32 {
|
|
1738
|
+
return max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b));
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
// Set saturation if color components are sorted in ascending order.
|
|
1742
|
+
fn setSaturationMinMidMax(cSorted: vec3<f32>, s: f32) -> vec3<f32> {
|
|
1743
|
+
var result: vec3<f32>;
|
|
1744
|
+
if (cSorted.z > cSorted.x) {
|
|
1745
|
+
let newY = (((cSorted.y - cSorted.x) * s) / (cSorted.z - cSorted.x));
|
|
1746
|
+
result = vec3<f32>(0.0, newY, s);
|
|
1747
|
+
} else {
|
|
1748
|
+
result = vec3<f32>(0.0, 0.0, 0.0);
|
|
1749
|
+
}
|
|
1750
|
+
return vec3<f32>(result.x, result.y, result.z);
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
fn setSaturation(c: vec3<f32>, s: f32) -> vec3<f32> {
|
|
1754
|
+
var result: vec3<f32> = c;
|
|
1755
|
+
|
|
1756
|
+
if (c.r <= c.g && c.r <= c.b) {
|
|
1757
|
+
if (c.g <= c.b) {
|
|
1758
|
+
result = setSaturationMinMidMax(result, s);
|
|
1759
|
+
} else {
|
|
1760
|
+
var temp: vec3<f32> = vec3<f32>(result.r, result.b, result.g);
|
|
1761
|
+
temp = setSaturationMinMidMax(temp, s);
|
|
1762
|
+
result = vec3<f32>(temp.r, temp.b, temp.g);
|
|
1763
|
+
}
|
|
1764
|
+
} else if (c.g <= c.r && c.g <= c.b) {
|
|
1765
|
+
if (c.r <= c.b) {
|
|
1766
|
+
var temp: vec3<f32> = vec3<f32>(result.g, result.r, result.b);
|
|
1767
|
+
temp = setSaturationMinMidMax(temp, s);
|
|
1768
|
+
result = vec3<f32>(temp.g, temp.r, temp.b);
|
|
1769
|
+
} else {
|
|
1770
|
+
var temp: vec3<f32> = vec3<f32>(result.g, result.b, result.r);
|
|
1771
|
+
temp = setSaturationMinMidMax(temp, s);
|
|
1772
|
+
result = vec3<f32>(temp.g, temp.b, temp.r);
|
|
1773
|
+
}
|
|
1774
|
+
} else {
|
|
1775
|
+
if (c.r <= c.g) {
|
|
1776
|
+
var temp: vec3<f32> = vec3<f32>(result.b, result.r, result.g);
|
|
1777
|
+
temp = setSaturationMinMidMax(temp, s);
|
|
1778
|
+
result = vec3<f32>(temp.b, temp.r, temp.g);
|
|
1779
|
+
} else {
|
|
1780
|
+
var temp: vec3<f32> = vec3<f32>(result.b, result.g, result.r);
|
|
1781
|
+
temp = setSaturationMinMidMax(temp, s);
|
|
1782
|
+
result = vec3<f32>(temp.b, temp.g, temp.r);
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
return result;
|
|
1787
|
+
}`;function Qa(r,t,e,i,s,n,o,a){const l=o-e,u=a-i,c=s-e,h=n-i,p=r-e,f=t-i,m=l*l+u*u,_=l*c+u*h,g=l*p+u*f,b=c*c+h*h,v=c*p+h*f,y=1/(m*b-_*_),T=(b*g-_*v)*y,E=(m*v-_*g)*y;return T>=0&&E>=0&&T+E<1}class Ja{constructor(t=0,e=0,i=0,s=0,n=0,o=0){this.type="triangle",this.x=t,this.y=e,this.x2=i,this.y2=s,this.x3=n,this.y3=o}contains(t,e){const i=(this.x-this.x3)*(e-this.y3)-(this.y-this.y3)*(t-this.x3),s=(this.x2-this.x)*(e-this.y)-(this.y2-this.y)*(t-this.x);if(i<0!=s<0&&i!==0&&s!==0)return!1;const n=(this.x3-this.x2)*(e-this.y2)-(this.y3-this.y2)*(t-this.x2);return n===0||n<0==i+s<=0}strokeContains(t,e,i){const s=i/2,n=s*s,{x:o,x2:a,x3:l,y:u,y2:c,y3:h}=this;return Cr(t,e,o,u,a,h)<=n||Cr(t,e,a,c,l,h)<=n||Cr(t,e,l,h,o,u)<=n}clone(){return new Ja(this.x,this.y,this.x2,this.y2,this.x3,this.y3)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x2=t.x2,this.y2=t.y2,this.x3=t.x3,this.y3=t.y3,this}copyTo(t){return t.copyFrom(this),t}getBounds(t){t=t||new V;const e=Math.min(this.x,this.x2,this.x3),i=Math.max(this.x,this.x2,this.x3),s=Math.min(this.y,this.y2,this.y3),n=Math.max(this.y,this.y2,this.y3);return t.x=e,t.y=s,t.width=i-e,t.height=n-s,t}}const Xg=class wy{constructor(t){this._tick=()=>{this.timeout=setTimeout(this._processQueue,0)},this._processQueue=()=>{const{queue:e}=this;let i=0;for(;e.length&&i<wy.uploadsPerFrame;){const s=e.shift();this.uploadQueueItem(s),i++}e.length?ct.system.addOnce(this._tick,this,Yt.UTILITY):this._resolve()},this.renderer=t,this.queue=[],this.resolves=[]}getQueue(){return[...this.queue]}add(t){const e=Array.isArray(t)?t:[t];for(const i of e)i instanceof Q?this._addContainer(i):this.resolveQueueItem(i,this.queue);return this}_addContainer(t){this.resolveQueueItem(t,this.queue);for(const e of t.children)this._addContainer(e)}upload(t){return t&&this.add(t),new Promise(e=>{this.queue.length?(this.resolves.push(e),this.dedupeQueue(),ct.system.addOnce(this._tick,this,Yt.UTILITY)):e()})}dedupeQueue(){const t=Object.create(null);let e=0;for(let i=0;i<this.queue.length;i++){const s=this.queue[i];t[s.uid]||(t[s.uid]=!0,this.queue[e++]=s)}this.queue.length=e}_resolve(){const{resolves:t}=this,e=t.slice(0);t.length=0;for(const i of e)i()}};Xg.uploadsPerFrame=4;let jg=Xg;var jE=Object.defineProperty,Rs=Object.getOwnPropertySymbols,zg=Object.prototype.hasOwnProperty,Vg=Object.prototype.propertyIsEnumerable,Wg=(r,t,e)=>t in r?jE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,zE=(r,t)=>{for(var e in t||(t={}))zg.call(t,e)&&Wg(r,e,t[e]);if(Rs)for(var e of Rs(t))Vg.call(t,e)&&Wg(r,e,t[e]);return r},VE=(r,t)=>{var e={};for(var i in r)zg.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Rs)for(var i of Rs(r))t.indexOf(i)<0&&Vg.call(r,i)&&(e[i]=r[i]);return e};class sr extends re{constructor(...t){var e;let i=t[0];i instanceof xe&&(i={geometry:i,shader:t[1]},t[3]&&(i.geometry.topology=t[3]));const s=i,{geometry:n,shader:o,texture:a,roundPixels:l,state:u}=s,c=VE(s,["geometry","shader","texture","roundPixels","state"]);super(zE({label:"Mesh"},c)),this.renderPipeId="mesh",this._shader=null,this.allowChildren=!1,this.shader=o!=null?o:null,this.texture=(e=a!=null?a:o==null?void 0:o.texture)!=null?e:P.WHITE,this.state=u!=null?u:Pt.for2d(),this._geometry=n,this._geometry.on("update",this.onViewUpdate,this),this.roundPixels=l!=null?l:!1}get material(){return this._shader}set shader(t){this._shader!==t&&(this._shader=t,this.onViewUpdate())}get shader(){return this._shader}set geometry(t){var e;this._geometry!==t&&((e=this._geometry)==null||e.off("update",this.onViewUpdate,this),t.on("update",this.onViewUpdate,this),this._geometry=t,this.onViewUpdate())}get geometry(){return this._geometry}set texture(t){t||(t=P.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this.shader&&(this.shader.texture=t),this._texture=t,this.onViewUpdate())}get texture(){return this._texture}get batched(){return this._shader||this.state.data&12?!1:this._geometry instanceof oe?this._geometry.batchMode==="auto"?this._geometry.positions.length/2<=100:this._geometry.batchMode==="batch":!1}get bounds(){return this._geometry.bounds}addBounds(t){t.addBounds(this.geometry.bounds)}containsPoint(t){const{x:e,y:i}=t;if(!this.bounds.containsPoint(e,i))return!1;const s=this.geometry.getBuffer("aPosition").data,n=this.geometry.topology==="triangle-strip"?3:1;if(this.geometry.getIndex()){const o=this.geometry.getIndex().data,a=o.length;for(let l=0;l+2<a;l+=n){const u=o[l]*2,c=o[l+1]*2,h=o[l+2]*2;if(Qa(e,i,s[u],s[u+1],s[c],s[c+1],s[h],s[h+1]))return!0}}else{const o=s.length/2;for(let a=0;a+2<o;a+=n){const l=a*2,u=(a+1)*2,c=(a+2)*2;if(Qa(e,i,s[l],s[l+1],s[u],s[u+1],s[c],s[c+1]))return!0}}return!1}destroy(t){var e;if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const i=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(i)}(e=this._geometry)==null||e.off("update",this.onViewUpdate,this),this._texture=null,this._geometry=null,this._shader=null}}var WE=Object.defineProperty,YE=Object.defineProperties,KE=Object.getOwnPropertyDescriptors,Ms=Object.getOwnPropertySymbols,Yg=Object.prototype.hasOwnProperty,Kg=Object.prototype.propertyIsEnumerable,qg=(r,t,e)=>t in r?WE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,qE=(r,t)=>{for(var e in t||(t={}))Yg.call(t,e)&&qg(r,e,t[e]);if(Ms)for(var e of Ms(t))Kg.call(t,e)&&qg(r,e,t[e]);return r},ZE=(r,t)=>YE(r,KE(t)),QE=(r,t)=>{var e={};for(var i in r)Yg.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Ms)for(var i of Ms(r))t.indexOf(i)<0&&Kg.call(r,i)&&(e[i]=r[i]);return e};class qr extends Ft{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});const i=e,{textures:s,autoUpdate:n}=i,o=QE(i,["textures","autoUpdate"]),[a]=s;super(ZE(qE({},o),{texture:a instanceof P?a:a.texture})),this._textures=null,this._durations=null,this._autoUpdate=n!=null?n:!0,this._isConnectedToTicker=!1,this.animationSpeed=1,this.loop=!0,this.updateAnchor=!1,this.onComplete=null,this.onFrameChange=null,this.onLoop=null,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=s}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(ct.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(ct.shared.add(this.update,this,Yt.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;const e=t.deltaTime,i=this.animationSpeed*e,s=this.currentFrame;if(this._durations!==null){let n=this._currentTime%1*this._durations[this.currentFrame];for(n+=i/60*1e3;n<0;)this._currentTime--,n+=this._durations[this.currentFrame];const o=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);n>=this._durations[this.currentFrame];)n-=this._durations[this.currentFrame]*o,this._currentTime+=o;this._currentTime+=n/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<s||this.animationSpeed<0&&this.currentFrame>s)&&this.onLoop(),this._updateTexture())}_updateTexture(){const t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){const e=[];for(let i=0;i<t.length;++i)e.push(P.from(t[i]));return new qr(e)}static fromImages(t){const e=[];for(let i=0;i<t.length;++i)e.push(P.from(t[i]));return new qr(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof P)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(let e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t}set currentFrame(t){if(t<0||t>this.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);const e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(ct.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(ct.shared.add(this.update,this),this._isConnectedToTicker=!0))}}class Zg{constructor({matrix:t,observer:e}={}){this.dirty=!0,this._matrix=t!=null?t:new G,this.observer=e,this.position=new nt(this,0,0),this.scale=new nt(this,1,1),this.pivot=new nt(this,0,0),this.skew=new nt(this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1}get matrix(){const t=this._matrix;return this.dirty&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this.dirty=!1),t}_onUpdate(t){var e;this.dirty=!0,t===this.skew&&this.updateSkew(),(e=this.observer)==null||e._onUpdate(this)}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this.dirty=!0}setFromMatrix(t){t.decompose(this),this.dirty=!0}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this.skew))}}var JE=Object.defineProperty,Cs=Object.getOwnPropertySymbols,Qg=Object.prototype.hasOwnProperty,Jg=Object.prototype.propertyIsEnumerable,t_=(r,t,e)=>t in r?JE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Zr=(r,t)=>{for(var e in t||(t={}))Qg.call(t,e)&&t_(r,e,t[e]);if(Cs)for(var e of Cs(t))Jg.call(t,e)&&t_(r,e,t[e]);return r},tA=(r,t)=>{var e={};for(var i in r)Qg.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Cs)for(var i of Cs(r))t.indexOf(i)<0&&Jg.call(r,i)&&(e[i]=r[i]);return e};const e_=class nn extends re{constructor(...t){let e=t[0]||{};e instanceof P&&(e={texture:e}),t.length>1&&(e.width=t[1],e.height=t[2]),e=Zr(Zr({},nn.defaultOptions),e);const i=e!=null?e:{},{texture:s,anchor:n,tilePosition:o,tileScale:a,tileRotation:l,width:u,height:c,applyAnchorToTexture:h,roundPixels:p}=i,f=tA(i,["texture","anchor","tilePosition","tileScale","tileRotation","width","height","applyAnchorToTexture","roundPixels"]);super(Zr({label:"TilingSprite"},f)),this.renderPipeId="tilingSprite",this.batched=!0,this.allowChildren=!1,this._anchor=new nt({_onUpdate:()=>{this.onViewUpdate()}}),this._applyAnchorToTexture=h,this.texture=s,this._width=u!=null?u:s.width,this._height=c!=null?c:s.height,this._tileTransform=new Zg({observer:{_onUpdate:()=>this.onViewUpdate()}}),n&&(this.anchor=n),this.tilePosition=o,this.tileScale=a,this.tileRotation=l,this.roundPixels=p!=null?p:!1}static from(t,e={}){return typeof t=="string"?new nn(Zr({texture:Y.get(t)},e)):new nn(Zr({texture:t},e))}get clampMargin(){return this._texture.textureMatrix.clampMargin}set clampMargin(t){this._texture.textureMatrix.clampMargin=t}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get tilePosition(){return this._tileTransform.position}set tilePosition(t){this._tileTransform.position.copyFrom(t)}get tileScale(){return this._tileTransform.scale}set tileScale(t){typeof t=="number"?this._tileTransform.scale.set(t):this._tileTransform.scale.copyFrom(t)}set tileRotation(t){this._tileTransform.rotation=t}get tileRotation(){return this._tileTransform.rotation}get tileTransform(){return this._tileTransform}get bounds(){return this._boundsDirty&&(this._updateBounds(),this._boundsDirty=!1),this._bounds}set texture(t){t||(t=P.EMPTY);const 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.onViewUpdate())}get texture(){return this._texture}set width(t){this._width=t,this.onViewUpdate()}get width(){return this._width}set height(t){this._height=t,this.onViewUpdate()}get height(){return this._height}setSize(t,e){var i;typeof t=="object"&&(e=(i=t.height)!=null?i:t.width,t=t.width),this._width=t,this._height=e!=null?e:t,this.onViewUpdate()}getSize(t){return t||(t={}),t.width=this._width,t.height=this._height,t}_updateBounds(){const t=this._bounds,e=this._anchor,i=this._width,s=this._height;t.maxX=-e._x*i,t.minX=t.maxX+i,t.maxY=-e._y*s,t.minY=t.maxY+s}addBounds(t){const e=this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}containsPoint(t){const e=this._width,i=this._height,s=-e*this._anchor._x;let n=0;return t.x>=s&&t.x<=s+e&&(n=-i*this._anchor._y,t.y>=n&&t.y<=n+i)}onViewUpdate(){this._boundsDirty=!0,super.onViewUpdate()}destroy(t=!1){if(super.destroy(t),this._anchor=null,this._tileTransform=null,this._bounds=null,typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(e)}this._texture=null}};e_.defaultOptions={texture:P.EMPTY,anchor:{x:0,y:0},tilePosition:{x:0,y:0},tileScale:{x:1,y:1},tileRotation:0,applyAnchorToTexture:!1};let r_=e_;var eA=Object.defineProperty,Os=Object.getOwnPropertySymbols,i_=Object.prototype.hasOwnProperty,s_=Object.prototype.propertyIsEnumerable,n_=(r,t,e)=>t in r?eA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,rA=(r,t)=>{for(var e in t||(t={}))i_.call(t,e)&&n_(r,e,t[e]);if(Os)for(var e of Os(t))s_.call(t,e)&&n_(r,e,t[e]);return r},iA=(r,t)=>{var e={};for(var i in r)i_.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Os)for(var i of Os(r))t.indexOf(i)<0&&s_.call(r,i)&&(e[i]=r[i]);return e};class Gs extends re{constructor(t,e){const i=t,{text:s,resolution:n,style:o,anchor:a,width:l,height:u,roundPixels:c}=i,h=iA(i,["text","resolution","style","anchor","width","height","roundPixels"]);super(rA({},h)),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=s!=null?s:"",this.style=o,this.resolution=n!=null?n:null,this.allowChildren=!1,this._anchor=new nt({_onUpdate:()=>{this.onViewUpdate()}}),a&&(this.anchor=a),this.roundPixels=c!=null?c:!1,l!==void 0&&(this.width=l),u!==void 0&&(this.height=u)}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){var e;t=t||{},(e=this._style)==null||e.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 bounds(){return this._boundsDirty&&(this._updateBounds(),this._boundsDirty=!1),this._bounds}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){var i;typeof t=="object"?(e=(i=t.height)!=null?i:t.width,t=t.width):e!=null||(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}addBounds(t){const e=this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}containsPoint(t){const e=this.bounds.width,i=this.bounds.height,s=-e*this.anchor.x;let n=0;return t.x>=s&&t.x<=s+e&&(n=-i*this.anchor.y,t.y>=n&&t.y<=n+i)}onViewUpdate(){this._boundsDirty=!0,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!=null&&t.style)&&this._style.destroy(t),this._style=null,this._text=null}}function Bs(r,t){var e;let i=(e=r[0])!=null?e:{};return(typeof i=="string"||r[1])&&(i={text:i,style:r[1]}),i}class tl extends Gs{constructor(...t){const e=Bs(t,"Text");super(e,Rt),this.renderPipeId="text"}_updateBounds(){const t=this._bounds,e=this._anchor,i=Ut.measureText(this._text,this._style),{width:s,height:n}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*n,t.maxY=t.minY+n}}class o_ extends jg{resolveQueueItem(t,e){return t instanceof Q?this.resolveContainerQueueItem(t,e):t instanceof tt||t instanceof P?e.push(t.source):t instanceof pt&&e.push(t),null}resolveContainerQueueItem(t,e){t instanceof Ft||t instanceof r_||t instanceof sr?e.push(t.texture.source):t instanceof tl?e.push(t):t instanceof Qe?e.push(t.context):t instanceof qr&&t.textures.forEach(i=>{i.source?e.push(i.source):e.push(i.texture.source)})}resolveGraphicsContextQueueItem(t){this.renderer.graphicsContext.getContextRenderData(t);const{instructions:e}=t;for(const i of e)if(i.action==="texture"){const{image:s}=i.data;return s.source}else if(i.action==="fill"){const{texture:s}=i.data.style;return s.source}return null}}class a_ extends Gs{constructor(...t){var e,i,s;const n=Bs(t,"BitmapText");(e=n.style)!=null||(n.style=n.style||{}),(s=(i=n.style).fill)!=null||(i.fill=16777215),super(n,Rt),this.renderPipeId="bitmapText"}_updateBounds(){const t=this._bounds,e=this._anchor,i=Dr.measureText(this.text,this._style),s=i.scale,n=i.offsetY*s;let o=i.width*s,a=i.height*s;const l=this._style._stroke;l&&(o+=l.width,a+=l.width),t.minX=-e._x*o,t.maxX=t.minX+o,t.minY=-e._y*(a+n),t.maxY=t.minY+a}set resolution(t){}get resolution(){return this._resolution}}class l_ extends Gs{constructor(...t){const e=Bs(t,"HtmlText");super(e,Pe),this.renderPipeId="htmlText"}_updateBounds(){const t=this._bounds,e=this._anchor,i=aa(this.text,this._style),{width:s,height:n}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*n,t.maxY=t.minY+n}}class u_ extends o_{uploadQueueItem(t){t instanceof tt?this.uploadTextureSource(t):t instanceof tl?this.uploadText(t):t instanceof l_?this.uploadHTMLText(t):t instanceof a_?this.uploadBitmapText(t):t instanceof pt&&this.uploadGraphicsContext(t)}uploadTextureSource(t){this.renderer.texture.initSource(t)}uploadText(t){this.renderer.renderPipes.text.initGpuText(t)}uploadBitmapText(t){this.renderer.renderPipes.bitmapText.initGpuText(t)}uploadHTMLText(t){this.renderer.renderPipes.htmlText.initGpuText(t)}uploadGraphicsContext(t){this.renderer.graphicsContext.getContextRenderData(t);const{instructions:e}=t;for(const i of e)if(i.action==="texture"){const{image:s}=i.data;this.uploadTextureSource(s.source)}else if(i.action==="fill"){const{texture:s}=i.data.style;this.uploadTextureSource(s.source)}return null}}class c_ extends u_{destroy(){clearTimeout(this.timeout),this.renderer=null,this.queue=null,this.resolves=null}}c_.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"prepare"};class el{constructor(){this._didUpload=!1,this._tempState=Pt.for2d()}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUpload=!1}start(t,e,i){const s=t.renderer;s.shader.bind(i,this._didUpload),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(e,i.glProgram)}execute(t,e){const i=t.renderer;this._didUpload=!0,this._tempState.blendMode=e.blendMode,i.state.set(this._tempState);const s=e.textures.textures;for(let n=0;n<e.textures.count;n++)i.texture.bind(s[n],n);i.geometry.draw("triangle-list",e.size,e.start)}}el.extension={type:[x.WebGLPipesAdaptor],name:"batch"};function sA(r){const t=[];let e=0;for(let i=0;i<r;i++)t[e]={texture:{sampleType:"float",viewDimension:"2d",multisampled:!1},binding:e,visibility:GPUShaderStage.FRAGMENT},e++,t[e]={sampler:{type:"filtering"},binding:e,visibility:GPUShaderStage.FRAGMENT},e++;return t}function nA(r){const t={};let e=0;for(let i=0;i<r;i++)t[`textureSource${i+1}`]=e++,t[`textureSampler${i+1}`]=e++;return t}const Is=Pt.for2d();class rl{start(t,e,i){const s=t.renderer,n=s.encoder,o=i.gpuProgram;this._shader=i,this._geometry=e,n.setGeometry(e,o),Is.blendMode="normal",s.pipeline.getPipeline(e,o,Is);const a=s.globalUniforms.bindGroup;n.resetBindGroup(1),n.setBindGroup(0,a,o)}execute(t,e){const i=this._shader.gpuProgram,s=t.renderer,n=s.encoder;if(!e.bindGroup){const l=e.textures;e.bindGroup=Pi(l.textures,l.count)}Is.blendMode=e.blendMode;const o=s.bindGroup.getBindGroup(e.bindGroup,i,1),a=s.pipeline.getPipeline(this._geometry,i,Is);e.bindGroup._touch(s.textureGC.count),n.setPipeline(a),n.renderPassEncoder.setBindGroup(1,o),n.renderPassEncoder.drawIndexed(e.size,1,e.start)}}rl.extension={type:[x.WebGPUPipesAdaptor],name:"batch"};const il=class Ry{constructor(t,e){this.state=Pt.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null);var i,s;this.renderer=t,this._adaptor=e,(s=(i=this._adaptor).init)==null||s.call(i,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 Di)),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(const i in this._activeBatches)this._activeBatches[i].begin()}addToBatch(t,e){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(e);let i=this._activeBatches[t.batcherName];i||(i=this._activeBatches[t.batcherName]=Ry.getBatcher(t.batcherName),i.begin()),this._activeBatch=i}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);const e=this._activeBatches;for(const i in e){const s=e[i],n=s.geometry;n.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),n.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!1)}}upload(t){const e=this._batchersByInstructionSet[t.uid];for(const i in e){const s=e[i],n=s.geometry;s.dirty&&(s.dirty=!1,n.buffers[0].update(s.attributeSize*4))}}execute(t){if(t.action==="startBatch"){const e=t.batcher,i=e.geometry,s=e.shader;this._adaptor.start(this,i,s)}this._adaptor.execute(this,t)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(const t in this._activeBatches)this._activeBatches[t].destroy();this._activeBatches=null}};il.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"batch"},il._availableBatchers=Object.create(null);let sl=il;D.handleByMap(x.Batcher,sl._availableBatchers),D.add(Di);function oA(r){const t=r.split(/([\n{}])/g).map(i=>i.trim()).filter(i=>i.length);let e="";return t.map(i=>{let s=e+i;return i==="{"?e+=" ":i==="}"&&(e=e.substr(0,e.length-4),s=e+i),s}).join(`
|
|
1788
|
+
`)}const h_={name:"texture-bit",vertex:{header:`
|
|
1789
|
+
|
|
1790
|
+
struct TextureUniforms {
|
|
1791
|
+
uTextureMatrix:mat3x3<f32>,
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
@group(2) @binding(2) var<uniform> textureUniforms : TextureUniforms;
|
|
1795
|
+
`,main:`
|
|
1796
|
+
uv = (textureUniforms.uTextureMatrix * vec3(uv, 1.0)).xy;
|
|
1797
|
+
`},fragment:{header:`
|
|
1798
|
+
@group(2) @binding(0) var uTexture: texture_2d<f32>;
|
|
1799
|
+
@group(2) @binding(1) var uSampler: sampler;
|
|
1800
|
+
|
|
1801
|
+
|
|
1802
|
+
`,main:`
|
|
1803
|
+
outColor = textureSample(uTexture, uSampler, vUV);
|
|
1804
|
+
`}},d_={name:"texture-bit",vertex:{header:`
|
|
1805
|
+
uniform mat3 uTextureMatrix;
|
|
1806
|
+
`,main:`
|
|
1807
|
+
uv = (uTextureMatrix * vec3(uv, 1.0)).xy;
|
|
1808
|
+
`},fragment:{header:`
|
|
1809
|
+
uniform sampler2D uTexture;
|
|
1810
|
+
|
|
1811
|
+
|
|
1812
|
+
`,main:`
|
|
1813
|
+
outColor = texture(uTexture, vUV);
|
|
1814
|
+
`}};function p_(r,t){const e=r.root,i=r.instructionSet;i.reset();const s=t.renderPipes?t:t.batch.renderer,n=s.renderPipes;n.batch.buildStart(i),n.blendMode.buildStart(),n.colorMask.buildStart(),e.sortableChildren&&e.sortChildren(),f_(e,i,s,!0),n.batch.buildEnd(i),n.blendMode.buildEnd(i)}function Qr(r,t,e){const i=e.renderPipes?e:e.batch.renderer;r.globalDisplayStatus<7||!r.includeInBuild||(r.sortableChildren&&r.sortChildren(),r.isSimple?aA(r,t,i):f_(r,t,i,!1))}function aA(r,t,e){if(r.renderPipeId){const i=r,{renderPipes:s,renderableGC:n}=e;s.blendMode.setBlendMode(i,r.groupBlendMode,t),s[i.renderPipeId].addRenderable(i,t),n.addRenderable(i,t),i.didViewUpdate=!1}if(!r.renderGroup){const i=r.children,s=i.length;for(let n=0;n<s;n++)Qr(i[n],t,e)}}function f_(r,t,e,i){const{renderPipes:s,renderableGC:n}=e;if(!i&&r.renderGroup)s.renderGroup.addRenderGroup(r.renderGroup,t);else{for(let u=0;u<r.effects.length;u++){const c=r.effects[u];s[c.pipe].push(c,r,t)}const o=r,a=o.renderPipeId;a&&(s.blendMode.setBlendMode(o,o.groupBlendMode,t),s[a].addRenderable(o,t),n.addRenderable(o,t),o.didViewUpdate=!1);const l=r.children;if(l.length)for(let u=0;u<l.length;u++)Qr(l[u],t,e);for(let u=r.effects.length-1;u>=0;u--){const c=r.effects[u];s[c.pipe].pop(c,r,t)}}}const lA=new ut;let uA=class extends pr{constructor(){super(),this.filters=[new Hg({sprite:new Ft(P.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}};class nl{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,i){const s=this._renderer;if(s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.renderMaskToTexture){const n=t.mask;n.includeInBuild=!0,Qr(n,i,s),n.includeInBuild=!1}s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){const e=this._renderer,i=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){const s=N.get(uA);if(s.inverse=t.inverse,i){t.mask.mask.measurable=!0;const n=fr(t.mask.mask,!0,lA);t.mask.mask.measurable=!1,n.ceil();const o=e.renderTarget.renderTarget.colorTexture.source,a=ht.getOptimalTexture(n.width,n.height,o._resolution,o.antialias);e.renderTarget.push(a,!0),e.globalUniforms.push({offset:n,worldColor:4294967295});const l=s.sprite;l.texture=a,l.worldTransform.tx=n.minX,l.worldTransform.ty=n.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"){const s=this._activeMaskStage[this._activeMaskStage.length-1];i&&(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();const s=this._activeMaskStage.pop();i&&ht.returnTexture(s.filterTexture),N.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}}nl.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"alphaMask"};class ol{constructor(t){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=t}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(t,e,i){this._renderer.renderPipes.batch.break(i);const s=this._colorStack;s[this._colorStackIndex]=s[this._colorStackIndex-1]&t.mask;const n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,i){this._renderer.renderPipes.batch.break(i);const s=this._colorStack;this._colorStackIndex--;const n=s[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}}ol.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"colorMask"};class cA{constructor(t){this.priority=0,this.pipe="scissorMask",this.mask=t,this.mask.renderable=!1,this.mask.measurable=!1}addBounds(t,e){Si(this.mask,t,e)}addLocalBounds(t,e){Ei(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}reset(){this.mask.measurable=!0,this.mask=null}destroy(){this.reset()}}class al{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,i){var s,n;const o=t,a=this._renderer;a.renderPipes.batch.break(i),a.renderPipes.blendMode.setBlendMode(o.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});const l=o.mask;l.includeInBuild=!0,this._maskHash.has(o)||this._maskHash.set(o,{instructionsStart:0,instructionsLength:0});const u=this._maskHash.get(o);u.instructionsStart=i.instructionSize,Qr(l,i,a),l.includeInBuild=!1,a.renderPipes.batch.break(i),i.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});const c=i.instructionSize-u.instructionsStart-1;u.instructionsLength=c;const h=a.renderTarget.renderTarget.uid;(n=(s=this._maskStackHash)[h])!=null||(s[h]=0)}pop(t,e,i){const s=t,n=this._renderer;n.renderPipes.batch.break(i),n.renderPipes.blendMode.setBlendMode(s.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});const o=this._maskHash.get(t);for(let a=0;a<o.instructionsLength;a++)i.instructions[i.instructionSize++]=i.instructions[o.instructionsStart++];i.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e,i;const s=this._renderer,n=s.renderTarget.renderTarget.uid;let o=(i=(e=this._maskStackHash)[n])!=null?i:e[n]=0;t.action==="pushMaskBegin"?(s.renderTarget.ensureDepthStencil(),s.stencil.setStencilMode(et.RENDERING_MASK_ADD,o),o++,s.colorMask.setMask(0)):t.action==="pushMaskEnd"?(t.inverse?s.stencil.setStencilMode(et.INVERSE_MASK_ACTIVE,o):s.stencil.setStencilMode(et.MASK_ACTIVE,o),s.colorMask.setMask(15)):t.action==="popMaskBegin"?(s.colorMask.setMask(0),o!==0?s.stencil.setStencilMode(et.RENDERING_MASK_REMOVE,o):(s.renderTarget.clear(null,vt.STENCIL),s.stencil.setStencilMode(et.DISABLED,o)),o--):t.action==="popMaskEnd"&&(t.inverse?s.stencil.setStencilMode(et.INVERSE_MASK_ACTIVE,o):s.stencil.setStencilMode(et.MASK_ACTIVE,o),s.colorMask.setMask(15)),this._maskStackHash[n]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}}al.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"stencilMask"};var Jr=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(Jr||{});class m_{constructor(t,e){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}class ll{constructor(t){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBuffers")}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){this._gpuBuffers=Object.create(null),this._gl=this._renderer.gl}getGlBuffer(t){return this._gpuBuffers[t.uid]||this.createGLBuffer(t)}bind(t){const{_gl:e}=this,i=this.getGlBuffer(t);e.bindBuffer(i.type,i.buffer)}bindBufferBase(t,e){const{_gl:i}=this;if(this._boundBufferBases[e]!==t){const s=this.getGlBuffer(t);this._boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,s.buffer)}}bindBufferRange(t,e,i){const{_gl:s}=this;i=i||0;const n=this.getGlBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,n.buffer,i*256,256)}updateBuffer(t){const{_gl:e}=this,i=this.getGlBuffer(t);if(t._updateID===i.updateID)return i;i.updateID=t._updateID,e.bindBuffer(i.type,i.buffer);const s=t.data;if(i.byteLength>=t.data.byteLength)e.bufferSubData(i.type,0,s,0,t._updateSize/s.BYTES_PER_ELEMENT);else{const n=t.descriptor.usage&$.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;i.byteLength=s.byteLength,e.bufferData(i.type,s,n)}return i}destroyAll(){const t=this._gl;for(const e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){const i=this._gpuBuffers[t.uid],s=this._gl;e||s.deleteBuffer(i.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){const{_gl:e}=this;let i=Jr.ARRAY_BUFFER;t.descriptor.usage&$.INDEX?i=Jr.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&$.UNIFORM&&(i=Jr.UNIFORM_BUFFER);const s=new m_(e.createBuffer(),i);return this._gpuBuffers[t.uid]=s,t.on("destroy",this.onBufferDestroy,this),s}}ll.extension={type:[x.WebGLSystem],name:"buffer"};var hA=Object.defineProperty,dA=Object.defineProperties,pA=Object.getOwnPropertyDescriptors,g_=Object.getOwnPropertySymbols,fA=Object.prototype.hasOwnProperty,mA=Object.prototype.propertyIsEnumerable,__=(r,t,e)=>t in r?hA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Fs=(r,t)=>{for(var e in t||(t={}))fA.call(t,e)&&__(r,e,t[e]);if(g_)for(var e of g_(t))mA.call(t,e)&&__(r,e,t[e]);return r},b_=(r,t)=>dA(r,pA(t));const ul=class My{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){var e,i;t=Fs(Fs({},My.defaultOptions),t);let s=this.multiView=t.multiView;if(t.context&&s&&(jt("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),s=!1),s?this.canvas=L.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{const n=this._renderer.background.alpha<1,o=(e=t.premultipliedAlpha)!=null?e:!0,a=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:n,premultipliedAlpha:o,antialias:a,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:(i=t.powerPreference)!=null?i:"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&jt("multiView is disabled, but targetCanvas is not the main canvas");return}const{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 L.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(t),this._renderer.runners.contextChange.emit(t);const e=this._renderer.view.canvas;e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(t,e){let i;const s=this.canvas;if(t===2&&(i=s.getContext("webgl2",e)),!i&&(i=s.getContext("webgl",e),!i))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=i,this.initFromContext(this.gl)}getExtensions(){const{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=b_(Fs({},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=b_(Fs({},e),{colorBufferFloat:t.getExtension("EXT_color_buffer_float")});const i=t.getExtension("WEBGL_provoking_vertex");i&&i.provokingVertexWEBGL(i.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(t){t.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{var e;this.gl.isContextLost()&&((e=this.extensions.loseContext)==null||e.restoreContext())},0))}handleContextRestored(){this._renderer.runners.contextChange.emit(this.gl)}destroy(){var t;const e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),(t=this.extensions.loseContext)==null||t.loseContext()}forceContextLoss(){var t;(t=this.extensions.loseContext)==null||t.loseContext(),this._contextLossForced=!0}validateContext(t){const e=t.getContextAttributes();e&&e.stencil;const i=this.supports,s=this.webGLVersion===2,n=this.extensions;i.uint32Indices=s||!!n.uint32ElementIndex,i.uniformBufferObject=s,i.vertexArrayObject=s||!!n.vertexArrayObject,i.srgbTextures=s||!!n.srgb,i.nonPowOf2wrapping=s,i.nonPowOf2mipmaps=s,i.msaa=s,i.uint32Indices}};ul.extension={type:[x.WebGLSystem],name:"context"},ul.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};let v_=ul;function cl(r,t){var e,i,s;for(const n in r.attributes){const o=r.attributes[n],a=t[n];a?((e=o.format)!=null||(o.format=a.format),(i=o.offset)!=null||(o.offset=a.offset),(s=o.instance)!=null||(o.instance=a.instance)):jt(`Attribute ${n} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}gA(r)}function gA(r){var t,e;const{buffers:i,attributes:s}=r,n={},o={};for(const a in i){const l=i[a];n[l.uid]=0,o[l.uid]=0}for(const a in s){const l=s[a];n[l.buffer.uid]+=qt(l.format).stride}for(const a in s){const l=s[a];(t=l.stride)!=null||(l.stride=n[l.buffer.uid]),(e=l.start)!=null||(l.start=o[l.buffer.uid]),o[l.buffer.uid]+=qt(l.format).stride}}var Ds=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(Ds||{}),hl=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(hl||{}),y_=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(y_||{}),z=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(z||{});const x_={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};function T_(r){var t;return(t=x_[r])!=null?t:x_.float32}const _A={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5};class dl{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(){const 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");const e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=s=>e.bindVertexArrayOES(s),t.deleteVertexArray=s=>e.deleteVertexArrayOES(s));const i=this._renderer.context.extensions.vertexAttribDivisorANGLE;i&&(t.drawArraysInstanced=(s,n,o,a)=>{i.drawArraysInstancedANGLE(s,n,o,a)},t.drawElementsInstanced=(s,n,o,a,l)=>{i.drawElementsInstancedANGLE(s,n,o,a,l)},t.vertexAttribDivisor=(s,n)=>i.vertexAttribDivisorANGLE(s,n)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){const i=this.gl;this._activeGeometry=t;const s=this.getVao(t,e);this._activeVao!==s&&(this._activeVao=s,i.bindVertexArray(s)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this._renderer.buffer;for(let i=0;i<t.buffers.length;i++){const s=t.buffers[i];e.updateBuffer(s)}}checkCompatibility(t,e){const i=t.attributes,s=e._attributeData;for(const n in s)if(!i[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(t,e){const i=t.attributes,s=e._attributeData,n=["g",t.uid];for(const o in i)s[o]&&n.push(o,s[o].location);return n.join("-")}getVao(t,e){var i;return((i=this._geometryVaoHash[t.uid])==null?void 0:i[e._key])||this.initGeometryVao(t,e)}initGeometryVao(t,e,i=!0){const s=this._renderer.gl,n=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);const o=this.getSignature(t,e);this._geometryVaoHash[t.uid]||(this._geometryVaoHash[t.uid]=Object.create(null),t.on("destroy",this.onGeometryDestroy,this));const a=this._geometryVaoHash[t.uid];let l=a[o];if(l)return a[e._key]=l,l;cl(t,e._attributeData);const u=t.buffers;l=s.createVertexArray(),s.bindVertexArray(l);for(let c=0;c<u.length;c++){const h=u[c];n.bind(h)}return this.activateVao(t,e),a[e._key]=l,a[o]=l,s.bindVertexArray(null),l}onGeometryDestroy(t,e){const i=this._geometryVaoHash[t.uid],s=this.gl;if(i){if(e)for(const n in i)this._activeVao!==i[n]&&this.unbind(),s.deleteVertexArray(i[n]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){const e=this.gl;for(const i in this._geometryVaoHash){if(t)for(const s in this._geometryVaoHash[i]){const n=this._geometryVaoHash[i];this._activeVao!==n&&this.unbind(),e.deleteVertexArray(n[s])}this._geometryVaoHash[i]=null}}activateVao(t,e){var i,s;const n=this._renderer.gl,o=this._renderer.buffer,a=t.attributes;t.indexBuffer&&o.bind(t.indexBuffer);let l=null;for(const u in a){const c=a[u],h=c.buffer,p=o.getGlBuffer(h),f=e._attributeData[u];if(f){l!==p&&(o.bind(h),l=p);const m=f.location;n.enableVertexAttribArray(m);const _=qt(c.format),g=T_(c.format);if(((i=f.format)==null?void 0:i.substring(1,4))==="int"?n.vertexAttribIPointer(m,_.size,g,c.stride,c.offset):n.vertexAttribPointer(m,_.size,g,_.normalised,c.stride,c.offset),c.instance)if(this.hasInstance){const b=(s=c.divisor)!=null?s:1;n.vertexAttribDivisor(m,b)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,i,s){const{gl:n}=this._renderer,o=this._activeGeometry,a=_A[o.topology||t];if(s||(s=o.instanceCount),o.indexBuffer){const l=o.indexBuffer.data.BYTES_PER_ELEMENT,u=l===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;s>1?n.drawElementsInstanced(a,e||o.indexBuffer.data.length,u,(i||0)*l,s):n.drawElements(a,e||o.indexBuffer.data.length,u,(i||0)*l)}else s>1?n.drawArraysInstanced(a,i||0,e||o.getSize(),s):n.drawArrays(a,i||0,e||o.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}}dl.extension={type:[x.WebGLSystem],name:"geometry"};var bA=Object.defineProperty,S_=Object.getOwnPropertySymbols,vA=Object.prototype.hasOwnProperty,yA=Object.prototype.propertyIsEnumerable,E_=(r,t,e)=>t in r?bA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,A_=(r,t)=>{for(var e in t||(t={}))vA.call(t,e)&&E_(r,e,t[e]);if(S_)for(var e of S_(t))yA.call(t,e)&&E_(r,e,t[e]);return r};const xA=new xe({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),pl=class Cy{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){const{useBackBuffer:e,antialias:i}=A_(A_({},Cy.defaultOptions),t);this.useBackBuffer=e,this._antialias=i,this._renderer.context.supports.msaa||(jt("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Pt.for2d();const s=new Et({vertex:`
|
|
1815
|
+
attribute vec2 aPosition;
|
|
1816
|
+
out vec2 vUv;
|
|
1817
|
+
|
|
1818
|
+
void main() {
|
|
1819
|
+
gl_Position = vec4(aPosition, 0.0, 1.0);
|
|
1820
|
+
|
|
1821
|
+
vUv = (aPosition + 1.0) / 2.0;
|
|
1822
|
+
|
|
1823
|
+
// flip dem UVs
|
|
1824
|
+
vUv.y = 1.0 - vUv.y;
|
|
1825
|
+
}`,fragment:`
|
|
1826
|
+
in vec2 vUv;
|
|
1827
|
+
out vec4 finalColor;
|
|
1828
|
+
|
|
1829
|
+
uniform sampler2D uTexture;
|
|
1830
|
+
|
|
1831
|
+
void main() {
|
|
1832
|
+
finalColor = texture(uTexture, vUv);
|
|
1833
|
+
}`,name:"big-triangle"});this._bigTriangleShader=new At({glProgram:s,resources:{uTexture:P.WHITE.source}})}renderStart(t){const e=this._renderer.renderTarget.getRenderTarget(t.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!e.isRoot,this._useBackBufferThisRender){const i=this._renderer.renderTarget.getRenderTarget(t.target);this._targetTexture=i.colorTexture,t.target=this._getBackBufferTexture(i.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){const 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:xA,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new P({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)}};pl.extension={type:[x.WebGLSystem],name:"backBuffer",priority:1},pl.defaultOptions={useBackBuffer:!1};let P_=pl;class fl{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)))}}fl.extension={type:[x.WebGLSystem],name:"colorMask"};class ml{constructor(t){this.commandFinished=Promise.resolve(),this._renderer=t}setGeometry(t,e){this._renderer.geometry.bind(t,e.glProgram)}finishRenderPass(){}draw(t){const e=this._renderer,{geometry:i,shader:s,state:n,skipSync:o,topology:a,size:l,start:u,instanceCount:c}=t;e.shader.bind(s,o),e.geometry.bind(i,e.shader._activeProgram),n&&e.state.set(n),e.geometry.draw(a,l,u,c!=null?c:i.instanceCount)}destroy(){this._renderer=null}}ml.extension={type:[x.WebGLSystem],name:"encoder"};class w_{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}const te=[];te[et.NONE]=void 0,te[et.DISABLED]={stencilWriteMask:0,stencilReadMask:0},te[et.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}},te[et.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}},te[et.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}},te[et.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}};class gl{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:et.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._stencilCache.enabled=!1,this._stencilCache.stencilMode=et.NONE,this._stencilCache.stencilReference=0}onRenderTargetChange(t){if(this._activeRenderTarget===t)return;this._activeRenderTarget=t;let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:et.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){const i=this._renderTargetStencilState[this._activeRenderTarget.uid],s=this._gl,n=te[t],o=this._stencilCache;if(i.stencilMode=t,i.stencilReference=e,t===et.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!==o.stencilMode||o.stencilReference!==e)&&(o.stencilMode=t,o.stencilReference=e,s.stencilFunc(this._comparisonFuncMapping[n.stencilBack.compare],e,255),s.stencilOp(s.KEEP,s.KEEP,this._stencilOpsMapping[n.stencilBack.passOp]))}}gl.extension={type:[x.WebGLSystem],name:"stencil"};class _l{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!_a())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){const e=this.getUniformGroupData(t);t.buffer||(t.buffer=new dt({data:new Float32Array(e.layout.size/4),usage:$.UNIFORM|$.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){const e=t._signature;let i=this._syncFunctionHash[e];if(!i){const s=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),n=this._adaptor.createUboElements(s),o=this._generateUboSync(n.uboElements);i=this._syncFunctionHash[e]={layout:n,syncFunction:o}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,i){const s=this.getUniformGroupData(t);return t.buffer||(t.buffer=new dt({data:new Float32Array(s.layout.size/4),usage:$.UNIFORM|$.COPY_DST})),e||(e=t.buffer.data),i||(i=0),s.syncFunction(t.uniforms,e,i),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;const e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}const bl={f32:4,"vec2<f32>":8,"vec3<f32>":12,"vec4<f32>":16,"mat2x2<f32>":32,"mat3x3<f32>":48,"mat4x4<f32>":64};function R_(r){const t=r.map(n=>({data:n,offset:0,size:0}));let e=0,i=0,s=0;for(let n=0;n<t.length;n++){const o=t[n];if(e=bl[o.data.type],!e)throw new Error(`Unknown type ${o.data.type}`);if(o.data.size>1&&(e=Math.max(e,16)*o.data.size),o.size=e,i%e!==0&&i<16){const a=i%e%16;i+=a,s+=a}i+e>16?(s=Math.ceil(s/16)*16,o.offset=s,s+=e,i=e):(o.offset=s,i+=e,s+=e)}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}const ue=[{type:"mat3x3<f32>",test:r=>r.value.a!==void 0,ubo:`
|
|
1834
|
+
var matrix = uv[name].toArray(true);
|
|
1835
|
+
data[offset] = matrix[0];
|
|
1836
|
+
data[offset + 1] = matrix[1];
|
|
1837
|
+
data[offset + 2] = matrix[2];
|
|
1838
|
+
data[offset + 4] = matrix[3];
|
|
1839
|
+
data[offset + 5] = matrix[4];
|
|
1840
|
+
data[offset + 6] = matrix[5];
|
|
1841
|
+
data[offset + 8] = matrix[6];
|
|
1842
|
+
data[offset + 9] = matrix[7];
|
|
1843
|
+
data[offset + 10] = matrix[8];
|
|
1844
|
+
`,uniform:`
|
|
1845
|
+
gl.uniformMatrix3fv(ud[name].location, false, uv[name].toArray(true));
|
|
1846
|
+
`},{type:"vec4<f32>",test:r=>r.type==="vec4<f32>"&&r.size===1&&r.value.width!==void 0,ubo:`
|
|
1847
|
+
v = uv[name];
|
|
1848
|
+
data[offset] = v.x;
|
|
1849
|
+
data[offset + 1] = v.y;
|
|
1850
|
+
data[offset + 2] = v.width;
|
|
1851
|
+
data[offset + 3] = v.height;
|
|
1852
|
+
`,uniform:`
|
|
1853
|
+
cv = ud[name].value;
|
|
1854
|
+
v = uv[name];
|
|
1855
|
+
if (cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) {
|
|
1856
|
+
cv[0] = v.x;
|
|
1857
|
+
cv[1] = v.y;
|
|
1858
|
+
cv[2] = v.width;
|
|
1859
|
+
cv[3] = v.height;
|
|
1860
|
+
gl.uniform4f(ud[name].location, v.x, v.y, v.width, v.height);
|
|
1861
|
+
}
|
|
1862
|
+
`},{type:"vec2<f32>",test:r=>r.type==="vec2<f32>"&&r.size===1&&r.value.x!==void 0,ubo:`
|
|
1863
|
+
v = uv[name];
|
|
1864
|
+
data[offset] = v.x;
|
|
1865
|
+
data[offset + 1] = v.y;
|
|
1866
|
+
`,uniform:`
|
|
1867
|
+
cv = ud[name].value;
|
|
1868
|
+
v = uv[name];
|
|
1869
|
+
if (cv[0] !== v.x || cv[1] !== v.y) {
|
|
1870
|
+
cv[0] = v.x;
|
|
1871
|
+
cv[1] = v.y;
|
|
1872
|
+
gl.uniform2f(ud[name].location, v.x, v.y);
|
|
1873
|
+
}
|
|
1874
|
+
`},{type:"vec4<f32>",test:r=>r.type==="vec4<f32>"&&r.size===1&&r.value.red!==void 0,ubo:`
|
|
1875
|
+
v = uv[name];
|
|
1876
|
+
data[offset] = v.red;
|
|
1877
|
+
data[offset + 1] = v.green;
|
|
1878
|
+
data[offset + 2] = v.blue;
|
|
1879
|
+
data[offset + 3] = v.alpha;
|
|
1880
|
+
`,uniform:`
|
|
1881
|
+
cv = ud[name].value;
|
|
1882
|
+
v = uv[name];
|
|
1883
|
+
if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) {
|
|
1884
|
+
cv[0] = v.red;
|
|
1885
|
+
cv[1] = v.green;
|
|
1886
|
+
cv[2] = v.blue;
|
|
1887
|
+
cv[3] = v.alpha;
|
|
1888
|
+
gl.uniform4f(ud[name].location, v.red, v.green, v.blue, v.alpha);
|
|
1889
|
+
}
|
|
1890
|
+
`},{type:"vec3<f32>",test:r=>r.type==="vec3<f32>"&&r.size===1&&r.value.red!==void 0,ubo:`
|
|
1891
|
+
v = uv[name];
|
|
1892
|
+
data[offset] = v.red;
|
|
1893
|
+
data[offset + 1] = v.green;
|
|
1894
|
+
data[offset + 2] = v.blue;
|
|
1895
|
+
`,uniform:`
|
|
1896
|
+
cv = ud[name].value;
|
|
1897
|
+
v = uv[name];
|
|
1898
|
+
if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue) {
|
|
1899
|
+
cv[0] = v.red;
|
|
1900
|
+
cv[1] = v.green;
|
|
1901
|
+
cv[2] = v.blue;
|
|
1902
|
+
gl.uniform3f(ud[name].location, v.red, v.green, v.blue);
|
|
1903
|
+
}
|
|
1904
|
+
`}];function vl(r,t,e,i){const s=[`
|
|
1905
|
+
var v = null;
|
|
1906
|
+
var v2 = null;
|
|
1907
|
+
var t = 0;
|
|
1908
|
+
var index = 0;
|
|
1909
|
+
var name = null;
|
|
1910
|
+
var arrayOffset = null;
|
|
1911
|
+
`];let n=0;for(let a=0;a<r.length;a++){const l=r[a],u=l.data.name;let c=!1,h=0;for(let p=0;p<ue.length;p++)if(ue[p].test(l.data)){h=l.offset/4,s.push(`name = "${u}";`,`offset += ${h-n};`,ue[p][t]||ue[p].ubo),c=!0;break}if(!c)if(l.data.size>1)h=l.offset/4,s.push(e(l,h-n));else{const p=i[l.data.type];h=l.offset/4,s.push(`
|
|
1912
|
+
v = uv.${u};
|
|
1913
|
+
offset += ${h-n};
|
|
1914
|
+
${p};
|
|
1915
|
+
`)}n=h}const o=s.join(`
|
|
1916
|
+
`);return new Function("uv","data","offset",o)}var TA=Object.defineProperty,SA=Object.defineProperties,EA=Object.getOwnPropertyDescriptors,M_=Object.getOwnPropertySymbols,AA=Object.prototype.hasOwnProperty,PA=Object.prototype.propertyIsEnumerable,C_=(r,t,e)=>t in r?TA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,wA=(r,t)=>{for(var e in t||(t={}))AA.call(t,e)&&C_(r,e,t[e]);if(M_)for(var e of M_(t))PA.call(t,e)&&C_(r,e,t[e]);return r},RA=(r,t)=>SA(r,EA(t));function nr(r,t){return`
|
|
1917
|
+
for (let i = 0; i < ${r*t}; i++) {
|
|
1918
|
+
data[offset + (((i / ${r})|0) * 4) + (i % ${r})] = v[i];
|
|
1919
|
+
}
|
|
1920
|
+
`}const yl={f32:`
|
|
1921
|
+
data[offset] = v;`,i32:`
|
|
1922
|
+
data[offset] = v;`,"vec2<f32>":`
|
|
1923
|
+
data[offset] = v[0];
|
|
1924
|
+
data[offset + 1] = v[1];`,"vec3<f32>":`
|
|
1925
|
+
data[offset] = v[0];
|
|
1926
|
+
data[offset + 1] = v[1];
|
|
1927
|
+
data[offset + 2] = v[2];`,"vec4<f32>":`
|
|
1928
|
+
data[offset] = v[0];
|
|
1929
|
+
data[offset + 1] = v[1];
|
|
1930
|
+
data[offset + 2] = v[2];
|
|
1931
|
+
data[offset + 3] = v[3];`,"mat2x2<f32>":`
|
|
1932
|
+
data[offset] = v[0];
|
|
1933
|
+
data[offset + 1] = v[1];
|
|
1934
|
+
data[offset + 4] = v[2];
|
|
1935
|
+
data[offset + 5] = v[3];`,"mat3x3<f32>":`
|
|
1936
|
+
data[offset] = v[0];
|
|
1937
|
+
data[offset + 1] = v[1];
|
|
1938
|
+
data[offset + 2] = v[2];
|
|
1939
|
+
data[offset + 4] = v[3];
|
|
1940
|
+
data[offset + 5] = v[4];
|
|
1941
|
+
data[offset + 6] = v[5];
|
|
1942
|
+
data[offset + 8] = v[6];
|
|
1943
|
+
data[offset + 9] = v[7];
|
|
1944
|
+
data[offset + 10] = v[8];`,"mat4x4<f32>":`
|
|
1945
|
+
for (let i = 0; i < 16; i++) {
|
|
1946
|
+
data[offset + i] = v[i];
|
|
1947
|
+
}`,"mat3x2<f32>":nr(3,2),"mat4x2<f32>":nr(4,2),"mat2x3<f32>":nr(2,3),"mat4x3<f32>":nr(4,3),"mat2x4<f32>":nr(2,4),"mat3x4<f32>":nr(3,4)},O_=RA(wA({},yl),{"mat2x2<f32>":`
|
|
1948
|
+
data[offset] = v[0];
|
|
1949
|
+
data[offset + 1] = v[1];
|
|
1950
|
+
data[offset + 2] = v[2];
|
|
1951
|
+
data[offset + 3] = v[3];
|
|
1952
|
+
`});function G_(r,t){const e=Math.max(bl[r.data.type]/16,1),i=r.data.value.length/r.data.size,s=(4-i%4)%4;return`
|
|
1953
|
+
v = uv.${r.data.name};
|
|
1954
|
+
offset += ${t};
|
|
1955
|
+
|
|
1956
|
+
arrayOffset = offset;
|
|
1957
|
+
|
|
1958
|
+
t = 0;
|
|
1959
|
+
|
|
1960
|
+
for(var i=0; i < ${r.data.size*e}; i++)
|
|
1961
|
+
{
|
|
1962
|
+
for(var j = 0; j < ${i}; j++)
|
|
1963
|
+
{
|
|
1964
|
+
data[arrayOffset++] = v[t++];
|
|
1965
|
+
}
|
|
1966
|
+
${s!==0?`arrayOffset += ${s};`:""}
|
|
1967
|
+
}
|
|
1968
|
+
`}function B_(r){return vl(r,"uboStd40",G_,yl)}class xl extends _l{constructor(){super({createUboElements:R_,generateUboSync:B_})}}xl.extension={type:[x.WebGLSystem],name:"ubo"};class I_{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,i,s,n){const o=this._renderTargetSystem,a=this._renderer,l=o.getGpuRenderTarget(t),u=a.gl;return this.finishRenderPass(t),u.bindFramebuffer(u.FRAMEBUFFER,l.resolveTargetFramebuffer),a.texture.bind(e,0),u.copyTexSubImage2D(u.TEXTURE_2D,0,n.x,n.y,i.x,i.y,s.width,s.height),e}startRenderPass(t,e=!0,i,s){const n=this._renderTargetSystem,o=t.colorTexture,a=n.getGpuRenderTarget(t);let l=s.y;t.isRoot&&(l=o.pixelHeight-s.height),t.colorTextures.forEach(h=>{this._renderer.texture.unbind(h)});const u=this._renderer.gl;u.bindFramebuffer(u.FRAMEBUFFER,a.framebuffer);const c=this._viewPortCache;(c.x!==s.x||c.y!==l||c.width!==s.width||c.height!==s.height)&&(c.x=s.x,c.y=l,c.width=s.width,c.height=s.height,u.viewport(s.x,l,s.width,s.height)),!a.depthStencilRenderBuffer&&(t.stencil||t.depth)&&this._initStencil(a),this.clear(t,e,i)}finishRenderPass(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);if(!e.msaa)return;const i=this._renderer.gl;i.bindFramebuffer(i.FRAMEBUFFER,e.resolveTargetFramebuffer),i.bindFramebuffer(i.READ_FRAMEBUFFER,e.framebuffer),i.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,i.COLOR_BUFFER_BIT,i.NEAREST),i.bindFramebuffer(i.FRAMEBUFFER,e.framebuffer)}initGpuRenderTarget(t){const e=this._renderer,i=e.gl,s=new w_;return t.colorTexture.resource===e.canvas?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),s.framebuffer=null,s):(this._initColor(t,s),i.bindFramebuffer(i.FRAMEBUFFER,null),s)}destroyGpuRenderTarget(t){const e=this._renderer.gl;t.framebuffer&&(e.deleteFramebuffer(t.framebuffer),t.framebuffer=null),t.resolveTargetFramebuffer&&(e.deleteFramebuffer(t.resolveTargetFramebuffer),t.resolveTargetFramebuffer=null),t.depthStencilRenderBuffer&&(e.deleteRenderbuffer(t.depthStencilRenderBuffer),t.depthStencilRenderBuffer=null),t.msaaRenderBuffer.forEach(i=>{e.deleteRenderbuffer(i)}),t.msaaRenderBuffer=null}clear(t,e,i){if(!e)return;const s=this._renderTargetSystem;typeof e=="boolean"&&(e=e?vt.ALL:vt.NONE);const n=this._renderer.gl;if(e&vt.COLOR){i!=null||(i=s.defaultClearColor);const o=this._clearColorCache,a=i;(o[0]!==a[0]||o[1]!==a[1]||o[2]!==a[2]||o[3]!==a[3])&&(o[0]=a[0],o[1]=a[1],o[2]=a[2],o[3]=a[3],n.clearColor(a[0],a[1],a[2],a[3]))}n.clear(e)}resizeGpuRenderTarget(t){if(t.isRoot)return;const e=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,e),(t.stencil||t.depth)&&this._resizeStencil(e)}_initColor(t,e){const i=this._renderer,s=i.gl,n=s.createFramebuffer();if(e.resolveTargetFramebuffer=n,s.bindFramebuffer(s.FRAMEBUFFER,n),e.width=t.colorTexture.source.pixelWidth,e.height=t.colorTexture.source.pixelHeight,t.colorTextures.forEach((o,a)=>{const l=o.source;l.antialias&&(i.context.supports.msaa?e.msaa=!0:jt("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),i.texture.bindSource(l,0);const u=i.texture.getGlSource(l).texture;s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+a,3553,u,0)}),e.msaa){const o=s.createFramebuffer();e.framebuffer=o,s.bindFramebuffer(s.FRAMEBUFFER,o),t.colorTextures.forEach((a,l)=>{const u=s.createRenderbuffer();e.msaaRenderBuffer[l]=u})}else e.framebuffer=n;this._resizeColor(t,e)}_resizeColor(t,e){const i=t.colorTexture.source;if(e.width=i.pixelWidth,e.height=i.pixelHeight,t.colorTextures.forEach((s,n)=>{n!==0&&s.source.resize(i.width,i.height,i._resolution)}),e.msaa){const s=this._renderer,n=s.gl,o=e.framebuffer;n.bindFramebuffer(n.FRAMEBUFFER,o),t.colorTextures.forEach((a,l)=>{const u=a.source;s.texture.bindSource(u,0);const c=s.texture.getGlSource(u).internalFormat,h=e.msaaRenderBuffer[l];n.bindRenderbuffer(n.RENDERBUFFER,h),n.renderbufferStorageMultisample(n.RENDERBUFFER,4,c,u.pixelWidth,u.pixelHeight),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+l,n.RENDERBUFFER,h)})}}_initStencil(t){if(t.framebuffer===null)return;const e=this._renderer.gl,i=e.createRenderbuffer();t.depthStencilRenderBuffer=i,e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,i),this._resizeStencil(t)}_resizeStencil(t){const 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)}postrender(t){if(this._renderer.context.multiView&&ie.test(t.colorTexture.resource)){const e=this._renderer.context.canvas,i=t.colorTexture;i.context2D.drawImage(e,0,i.pixelHeight-e.height)}}}function F_(r,t,e,i,s,n){const o=n?1:-1;return r.identity(),r.a=1/i*2,r.d=o*(1/s*2),r.tx=-1-t*r.a,r.ty=-o-e*r.d,r}var MA=Object.defineProperty,D_=Object.getOwnPropertySymbols,CA=Object.prototype.hasOwnProperty,OA=Object.prototype.propertyIsEnumerable,U_=(r,t,e)=>t in r?MA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,GA=(r,t)=>{for(var e in t||(t={}))CA.call(t,e)&&U_(r,e,t[e]);if(D_)for(var e of D_(t))OA.call(t,e)&&U_(r,e,t[e]);return r};const or=new Map;function Tl(r,t){if(!or.has(r)){const e=new P({source:new ie(GA({resource:r},t))}),i=()=>{or.get(r)===e&&or.delete(r)};e.once("destroy",i),e.source.once("destroy",i),or.set(r,e)}return or.get(r)}function BA(r){return or.has(r)}function k_(r){const t=r.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var IA=Object.defineProperty,$_=Object.getOwnPropertySymbols,FA=Object.prototype.hasOwnProperty,DA=Object.prototype.propertyIsEnumerable,L_=(r,t,e)=>t in r?IA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,N_=(r,t)=>{for(var e in t||(t={}))FA.call(t,e)&&L_(r,e,t[e]);if($_)for(var e of $_(t))DA.call(t,e)&&L_(r,e,t[e]);return r};const H_=class Oy{constructor(t={}){if(this.uid=Z("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t=N_(N_({},Oy.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(i=>i.source)];const 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 P||t.depthStencilTexture instanceof tt?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){const 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,i=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((n,o)=>{s&&o===0||n.source.resize(t,e,i)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,i)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(t=>{t.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};H_.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};let Us=H_;class Sl{constructor(t){this.rootViewPort=new V,this.viewport=new V,this.onRenderTargetChange=new ba("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:i,frame:s}){this._renderTargetStack.length=0,this.push(t,e,i,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=k_(this.rootRenderTarget)}postrender(){var t,e;(e=(t=this.adaptor).postrender)==null||e.call(t,this.rootRenderTarget)}bind(t,e=!0,i,s){const n=this.getRenderTarget(t),o=this.renderTarget!==n;this.renderTarget=n,this.renderSurface=t;const a=this.getGpuRenderTarget(n);(n.pixelWidth!==a.width||n.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(n),a.width=n.pixelWidth,a.height=n.pixelHeight);const l=n.colorTexture,u=this.viewport,c=l.pixelWidth,h=l.pixelHeight;if(!s&&t instanceof P&&(s=t.frame),s){const p=l._resolution;u.x=s.x*p+.5|0,u.y=s.y*p+.5|0,u.width=s.width*p+.5|0,u.height=s.height*p+.5|0}else u.x=0,u.y=0,u.width=c,u.height=h;return F_(this.projectionMatrix,0,0,u.width/l.resolution,u.height/l.resolution,!n.isRoot),this.adaptor.startRenderPass(n,e,i,u),o&&this.onRenderTargetChange.emit(n),n}clear(t,e=vt.ALL,i){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,i,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=vt.ALL,i,s){const n=this.bind(t,e,i,s);return this._renderTargetStack.push({renderTarget:n,frame:s}),n}pop(){this._renderTargetStack.pop();const t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){var e;return t.isTexture&&(t=t.source),(e=this._renderSurfaceToRenderTargetHash.get(t))!=null?e:this._initRenderTarget(t)}copyToTexture(t,e,i,s,n){i.x<0&&(s.width+=i.x,n.x-=i.x,i.x=0),i.y<0&&(s.height+=i.y,n.y-=i.y,i.y=0);const{pixelWidth:o,pixelHeight:a}=t;return s.width=Math.min(s.width,o-i.x),s.height=Math.min(s.height,a-i.y),this.adaptor.copyToTexture(t,e,i,s,n)}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 ie.test(t)&&(t=Tl(t).source),t instanceof Us?e=t:t instanceof tt&&(e=new Us({colorTextures:[t]}),ie.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);const i=this._gpuRenderTargetHash[e.uid];i&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(i))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}}class El extends Sl{constructor(t){super(t),this.adaptor=new I_,this.adaptor.init(t,this)}}El.extension={type:[x.WebGLSystem],name:"renderTarget"};class ks extends mt{constructor({buffer:t,offset:e,size:i}){super(),this.uid=Z("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=Z("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=i,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=Z("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}function X_(r,t){const e=[],i=[`
|
|
1969
|
+
var g = s.groups;
|
|
1970
|
+
var sS = r.shader;
|
|
1971
|
+
var p = s.glProgram;
|
|
1972
|
+
var ugS = r.uniformGroup;
|
|
1973
|
+
var resources;
|
|
1974
|
+
`];let s=!1,n=0,o=0;const a=t._getProgramData(r.glProgram);for(const u in r.groups){const c=r.groups[u];e.push(`
|
|
1975
|
+
resources = g[${u}].resources;
|
|
1976
|
+
`);for(const h in c.resources){const p=c.resources[h];if(p instanceof st)p.ubo?e.push(`
|
|
1977
|
+
sS.bindUniformBlock(
|
|
1978
|
+
resources[${h}],
|
|
1979
|
+
sS._uniformBindMap[${u}[${h}],
|
|
1980
|
+
${n++}
|
|
1981
|
+
);
|
|
1982
|
+
`):e.push(`
|
|
1983
|
+
ugS.updateUniformGroup(resources[${h}], p, sD);
|
|
1984
|
+
`);else if(p instanceof ks)e.push(`
|
|
1985
|
+
sS.bindUniformBlock(
|
|
1986
|
+
resources[${h}],
|
|
1987
|
+
sS._uniformBindMap[${u}[${h}],
|
|
1988
|
+
${n++}
|
|
1989
|
+
);
|
|
1990
|
+
`);else if(p instanceof tt){const f=r._uniformBindMap[u][h],m=a.uniformData[f];m&&(s||(s=!0,i.push(`
|
|
1991
|
+
var tS = r.texture;
|
|
1992
|
+
`)),t._gl.uniform1i(m.location,o),e.push(`
|
|
1993
|
+
tS.bind(resources[${h}], ${o});
|
|
1994
|
+
`),o++)}}}const l=[...i,...e].join(`
|
|
1995
|
+
`);return new Function("r","s","sD",l)}class UA{}class j_{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 Al(r,t,e){const i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}function Pl(r){const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function wl(r,t){switch(r){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 Pl(2*t);case"bvec3":return Pl(3*t);case"bvec4":return Pl(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}let $s=null;const z_={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"},kA={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 Rl(r,t){if(!$s){const e=Object.keys(z_);$s={};for(let i=0;i<e.length;++i){const s=e[i];$s[r[s]]=z_[s]}}return $s[t]}function V_(r,t){const e=Rl(r,t);return kA[e]||"float32"}function W_(r,t,e=!1){const i={},s=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let o=0;o<s;o++){const a=t.getActiveAttrib(r,o);if(a.name.startsWith("gl_"))continue;const l=V_(t,a.type);i[a.name]={location:0,format:l,stride:qt(l).stride,offset:0,instance:!1,start:0}}const n=Object.keys(i);if(e){n.sort((o,a)=>o>a?1:-1);for(let o=0;o<n.length;o++)i[n[o]].location=o,t.bindAttribLocation(r,o,n[o]);t.linkProgram(r)}else for(let o=0;o<n.length;o++)i[n[o]].location=t.getAttribLocation(r,n[o]);return i}function Y_(r,t){if(!t.ACTIVE_UNIFORM_BLOCKS)return{};const e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORM_BLOCKS);for(let s=0;s<i;s++){const n=t.getActiveUniformBlockName(r,s),o=t.getUniformBlockIndex(r,n),a=t.getActiveUniformBlockParameter(r,s,t.UNIFORM_BLOCK_DATA_SIZE);e[n]={name:n,index:o,size:a}}return e}function K_(r,t){const e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){const n=t.getActiveUniform(r,s),o=n.name.replace(/\[.*?\]$/,""),a=!!n.name.match(/\[.*?\]$/),l=Rl(t,n.type);e[o]={name:o,index:s,type:l,size:n.size,isArray:a,value:wl(l,n.size)}}return e}function q_(r,t){const e=r.getShaderSource(t).split(`
|
|
1996
|
+
`).map((u,c)=>`${c}: ${u}`),i=r.getShaderInfoLog(t),s=i.split(`
|
|
1997
|
+
`),n={},o=s.map(u=>parseFloat(u.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(u=>u&&!n[u]?(n[u]=!0,!0):!1),a=[""];o.forEach(u=>{e[u-1]=`%c${e[u-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const l=e.join(`
|
|
1998
|
+
`);a[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function Z_(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||q_(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||q_(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}function Q_(r,t){const e=Al(r,r.VERTEX_SHADER,t.vertex),i=Al(r,r.FRAGMENT_SHADER,t.fragment),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);const n=t.transformFeedbackVaryings;n&&(typeof r.transformFeedbackVaryings!="function"||r.transformFeedbackVaryings(s,n.names,n.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||Z_(r,s,e,i),t._attributeData=W_(s,r,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=K_(s,r),t._uniformBlockData=Y_(s,r),r.deleteShader(e),r.deleteShader(i);const o={};for(const a in t._uniformData){const l=t._uniformData[a];o[a]={location:r.getUniformLocation(s,a),value:wl(l.type,l.size)}}return new j_(s,o)}const Ls={textureCount:0,blockIndex:0};class Ml{constructor(t){this._activeProgram=null,this._programDataHash=Object.create(null),this._nextIndex=0,this._boundUniformsIdsToIndexHash=Object.create(null),this._boundIndexToUniformsHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_programDataHash")}contextChange(t){this._gl=t,this._maxBindings=t.MAX_UNIFORM_BUFFER_BINDINGS?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0,this._programDataHash=Object.create(null),this._boundUniformsIdsToIndexHash=Object.create(null),this._boundIndexToUniformsHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null,this.maxTextures=ve()}bind(t,e){if(this._setProgram(t.glProgram),e)return;Ls.textureCount=0,Ls.blockIndex=0;let i=this._shaderSyncFunctions[t.glProgram._key];i||(i=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),i(this._renderer,t,Ls)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,Ls)}bindUniformBlock(t,e,i=0){const s=this._renderer.buffer,n=this._getProgramData(this._activeProgram),o=t._bufferResource;o&&this._renderer.ubo.updateUniformGroup(t),s.updateBuffer(t.buffer);let a=this._boundUniformsIdsToIndexHash[t.uid];if(a===void 0){const c=this._nextIndex++%this._maxBindings,h=this._boundIndexToUniformsHash[c];h&&(this._boundUniformsIdsToIndexHash[h.uid]=void 0),a=this._boundUniformsIdsToIndexHash[t.uid]=c,this._boundIndexToUniformsHash[c]=t,o?s.bindBufferRange(t.buffer,c,t.offset):s.bindBufferBase(t.buffer,c)}const l=this._gl,u=this._activeProgram._uniformBlockData[e].index;n.uniformBlockBindings[i]!==a&&(n.uniformBlockBindings[i]=a,l.uniformBlockBinding(n.program,u,a))}_setProgram(t){if(this._activeProgram===t)return;this._activeProgram=t;const e=this._getProgramData(t);this._gl.useProgram(e.program)}_getProgramData(t){return this._programDataHash[t._key]||this._createProgramData(t)}_createProgramData(t){const e=t._key;return this._programDataHash[e]=Q_(this._gl,t),this._programDataHash[e]}destroy(){for(const t of Object.keys(this._programDataHash))this._programDataHash[t].destroy(),this._programDataHash[t]=null;this._programDataHash=null,this._boundUniformsIdsToIndexHash=null}_generateShaderSync(t,e){return X_(t,e)}}Ml.extension={type:[x.WebGLSystem],name:"shader"};const J_={f32:`if (cv !== v) {
|
|
1999
|
+
cu.value = v;
|
|
2000
|
+
gl.uniform1f(location, v);
|
|
2001
|
+
}`,"vec2<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
2002
|
+
cv[0] = v[0];
|
|
2003
|
+
cv[1] = v[1];
|
|
2004
|
+
gl.uniform2f(location, v[0], v[1]);
|
|
2005
|
+
}`,"vec3<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
2006
|
+
cv[0] = v[0];
|
|
2007
|
+
cv[1] = v[1];
|
|
2008
|
+
cv[2] = v[2];
|
|
2009
|
+
gl.uniform3f(location, v[0], v[1], v[2]);
|
|
2010
|
+
}`,"vec4<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
2011
|
+
cv[0] = v[0];
|
|
2012
|
+
cv[1] = v[1];
|
|
2013
|
+
cv[2] = v[2];
|
|
2014
|
+
cv[3] = v[3];
|
|
2015
|
+
gl.uniform4f(location, v[0], v[1], v[2], v[3]);
|
|
2016
|
+
}`,i32:`if (cv !== v) {
|
|
2017
|
+
cu.value = v;
|
|
2018
|
+
gl.uniform1i(location, v);
|
|
2019
|
+
}`,"vec2<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
2020
|
+
cv[0] = v[0];
|
|
2021
|
+
cv[1] = v[1];
|
|
2022
|
+
gl.uniform2i(location, v[0], v[1]);
|
|
2023
|
+
}`,"vec3<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
2024
|
+
cv[0] = v[0];
|
|
2025
|
+
cv[1] = v[1];
|
|
2026
|
+
cv[2] = v[2];
|
|
2027
|
+
gl.uniform3i(location, v[0], v[1], v[2]);
|
|
2028
|
+
}`,"vec4<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
2029
|
+
cv[0] = v[0];
|
|
2030
|
+
cv[1] = v[1];
|
|
2031
|
+
cv[2] = v[2];
|
|
2032
|
+
cv[3] = v[3];
|
|
2033
|
+
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
2034
|
+
}`,u32:`if (cv !== v) {
|
|
2035
|
+
cu.value = v;
|
|
2036
|
+
gl.uniform1ui(location, v);
|
|
2037
|
+
}`,"vec2<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
2038
|
+
cv[0] = v[0];
|
|
2039
|
+
cv[1] = v[1];
|
|
2040
|
+
gl.uniform2ui(location, v[0], v[1]);
|
|
2041
|
+
}`,"vec3<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
2042
|
+
cv[0] = v[0];
|
|
2043
|
+
cv[1] = v[1];
|
|
2044
|
+
cv[2] = v[2];
|
|
2045
|
+
gl.uniform3ui(location, v[0], v[1], v[2]);
|
|
2046
|
+
}`,"vec4<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
2047
|
+
cv[0] = v[0];
|
|
2048
|
+
cv[1] = v[1];
|
|
2049
|
+
cv[2] = v[2];
|
|
2050
|
+
cv[3] = v[3];
|
|
2051
|
+
gl.uniform4ui(location, v[0], v[1], v[2], v[3]);
|
|
2052
|
+
}`,bool:`if (cv !== v) {
|
|
2053
|
+
cu.value = v;
|
|
2054
|
+
gl.uniform1i(location, v);
|
|
2055
|
+
}`,"vec2<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
2056
|
+
cv[0] = v[0];
|
|
2057
|
+
cv[1] = v[1];
|
|
2058
|
+
gl.uniform2i(location, v[0], v[1]);
|
|
2059
|
+
}`,"vec3<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
2060
|
+
cv[0] = v[0];
|
|
2061
|
+
cv[1] = v[1];
|
|
2062
|
+
cv[2] = v[2];
|
|
2063
|
+
gl.uniform3i(location, v[0], v[1], v[2]);
|
|
2064
|
+
}`,"vec4<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
2065
|
+
cv[0] = v[0];
|
|
2066
|
+
cv[1] = v[1];
|
|
2067
|
+
cv[2] = v[2];
|
|
2068
|
+
cv[3] = v[3];
|
|
2069
|
+
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
2070
|
+
}`,"mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);"},tb={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 eb(r,t){const e=[`
|
|
2071
|
+
var v = null;
|
|
2072
|
+
var cv = null;
|
|
2073
|
+
var cu = null;
|
|
2074
|
+
var t = 0;
|
|
2075
|
+
var gl = renderer.gl;
|
|
2076
|
+
var name = null;
|
|
2077
|
+
`];for(const i in r.uniforms){if(!t[i]){r.uniforms[i]instanceof st?r.uniforms[i].ubo?e.push(`
|
|
2078
|
+
renderer.shader.bindUniformBlock(uv.${i}, "${i}");
|
|
2079
|
+
`):e.push(`
|
|
2080
|
+
renderer.shader.updateUniformGroup(uv.${i});
|
|
2081
|
+
`):r.uniforms[i]instanceof ks&&e.push(`
|
|
2082
|
+
renderer.shader.bindBufferResource(uv.${i}, "${i}");
|
|
2083
|
+
`);continue}const s=r.uniformStructures[i];let n=!1;for(let o=0;o<ue.length;o++){const a=ue[o];if(s.type===a.type&&a.test(s)){e.push(`name = "${i}";`,ue[o].uniform),n=!0;break}}if(!n){const o=(s.size===1?J_:tb)[s.type].replace("location",`ud["${i}"].location`);e.push(`
|
|
2084
|
+
cu = ud["${i}"];
|
|
2085
|
+
cv = cu.value;
|
|
2086
|
+
v = uv["${i}"];
|
|
2087
|
+
${o};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
|
|
2088
|
+
`))}class Cl{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,i){const s=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==s.uniformDirtyGroups[t.uid])&&(s.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(s.uniformData,t.uniforms,this._renderer,i))}_getUniformSyncFunction(t,e){var i;return((i=this._uniformGroupSyncHash[t._signature])==null?void 0:i[e._key])||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){const i=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),s=this._getSignature(t,e._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(t,e._uniformData)),i[e._key]=this._cache[s],i[e._key]}_generateUniformsSync(t,e){return eb(t,e)}_getSignature(t,e,i){const s=t.uniforms,n=[`${i}-`];for(const o in s)n.push(o),e[o]&&n.push(e[o].type);return n.join("-")}destroy(){this._renderer=null,this._cache=null}}Cl.extension={type:[x.WebGLSystem],name:"uniformGroup"};function $A(r){return r=r.replaceAll("texture2D","texture").replaceAll("gl_FragColor","finalColor").replaceAll("varying","in"),r=`
|
|
2089
|
+
out vec4 finalColor;
|
|
2090
|
+
${r}
|
|
2091
|
+
`,r}const LA={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function NA(r){return LA[r]}function rb(r){const t={};if(t.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t.add=[r.ONE,r.ONE],t.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof L.get().getWebGLRenderingContext()))t.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{const e=r.getExtension("EXT_blend_minmax");e&&(t.min=[r.ONE,r.ONE,r.ONE,r.ONE,e.MIN_EXT,e.MIN_EXT],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,e.MAX_EXT,e.MAX_EXT])}return t}const HA=0,XA=1,jA=2,zA=3,VA=4,WA=5,ib=class Iu{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[HA]=this.setBlend,this.map[XA]=this.setOffset,this.map[jA]=this.setCullFace,this.map[zA]=this.setDepthTest,this.map[VA]=this.setFrontFace,this.map[WA]=this.setDepthMask,this.checks=[],this.defaultState=Pt.for2d()}contextChange(t){this.gl=t,this.blendModesMap=rb(t),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;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(Iu._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(Iu._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.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;const e=this.blendModesMap[t],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){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){const i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,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}};ib.extension={type:[x.WebGLSystem],name:"state"};let sb=ib;class nb{constructor(t){this.target=hl.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=z.UNSIGNED_BYTE,this.internalFormat=Ds.RGBA,this.format=Ds.RGBA,this.samplerType=0}}const ob={id:"buffer",upload(r,t,e){t.width===r.width||t.height===r.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,r.width,r.height,0,t.format,t.type,r.resource),t.width=r.width,t.height=r.height}},YA={"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},ab={id:"compressed",upload(r,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let i=r.pixelWidth,s=r.pixelHeight;const n=!!YA[r.format];for(let o=0;o<r.resource.length;o++){const a=r.resource[o];n?e.compressedTexImage2D(e.TEXTURE_2D,o,t.internalFormat,i,s,0,a):e.texImage2D(e.TEXTURE_2D,o,t.internalFormat,i,s,0,t.format,t.type,a),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}},Ol={id:"image",upload(r,t,e,i){const s=r.alphaMode==="premultiply-alpha-on-upload";e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s);const n=t.width,o=t.height,a=r.pixelWidth,l=r.pixelHeight,u=r.resourceWidth,c=r.resourceHeight;u<a||c<l?((n!==a||o!==l)&&e.texImage2D(t.target,0,t.internalFormat,a,l,0,t.format,t.type,null),i===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,u,c,t.format,t.type,r.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource)):n===a||o===l?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource):i===2?e.texImage2D(t.target,0,t.internalFormat,a,l,0,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,r.resource),t.width=a,t.height=l}},lb={id:"video",upload(r,t,e,i){if(!r.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}Ol.upload(r,t,e,i)}},Gl={linear:9729,nearest:9728},ub={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},Ns={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},cb={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519};function Bl(r,t,e,i,s,n,o,a){const l=n;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){const u=Ns[o?"clamp-to-edge":r.addressModeU],c=Ns[o?"clamp-to-edge":r.addressModeV],h=Ns[o?"clamp-to-edge":r.addressModeW];t[s](l,t.TEXTURE_WRAP_S,u),t[s](l,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[s](l,t.TEXTURE_WRAP_R,h)}if((!a||r.magFilter!=="linear")&&t[s](l,t.TEXTURE_MAG_FILTER,Gl[r.magFilter]),e){if(!a||r.mipmapFilter!=="linear"){const u=ub[r.minFilter][r.mipmapFilter];t[s](l,t.TEXTURE_MIN_FILTER,u)}}else t[s](l,t.TEXTURE_MIN_FILTER,Gl[r.minFilter]);if(i&&r.maxAnisotropy>1){const u=Math.min(r.maxAnisotropy,t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](l,i.TEXTURE_MAX_ANISOTROPY_EXT,u)}r.compare&&t[s](l,t.TEXTURE_COMPARE_FUNC,cb[r.compare])}function hb(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var KA=Object.defineProperty,qA=Object.defineProperties,ZA=Object.getOwnPropertyDescriptors,db=Object.getOwnPropertySymbols,QA=Object.prototype.hasOwnProperty,JA=Object.prototype.propertyIsEnumerable,pb=(r,t,e)=>t in r?KA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Re=(r,t)=>{for(var e in t||(t={}))QA.call(t,e)&&pb(r,e,t[e]);if(db)for(var e of db(t))JA.call(t,e)&&pb(r,e,t[e]);return r},tP=(r,t)=>qA(r,ZA(t));function fb(r,t){let e={},i=r.RGBA;return r instanceof L.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},i=r.RGBA8),Re(Re(Re(Re(Re(Re(tP(Re({r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA},e),{rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:i,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8}),t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{}),t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{}),t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{}),t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{}),t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{}),t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{})}function mb(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}function eP(r){r instanceof Uint8ClampedArray&&(r=new Uint8Array(r.buffer));const t=r.length;for(let e=0;e<t;e+=4){const i=r[e+3];if(i!==0){const s=255.001/i;r[e]=r[e]*s+.5,r[e+1]=r[e+1]*s+.5,r[e+2]=r[e+2]*s+.5}}}const rP=4;class Il{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:Ol,buffer:ob,video:lb,compressed:ab},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=fb(t,this._renderer.context.extensions),this._mapFormatToType=mb(t),this._mapFormatToFormat=hb(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null);for(let e=0;e<16;e++)this.bind(P.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){const i=t.source;t?(this.bindSource(i,e),this._useSeparateSamplers&&this._bindSampler(i.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){const i=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t=t||P.EMPTY.source;const s=this.getGlSource(t);i.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){const i=this._gl;if(!t){this._boundSamplers[e]=null,i.bindSampler(e,null);return}const s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,i.bindSampler(e,s))}unbind(t){const e=t.source,i=this._boundTextures,s=this._gl;for(let n=0;n<i.length;n++)if(i[n]===e){this._activateLocation(n);const o=this.getGlSource(e);s.bindTexture(o.target,null),i[n]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){const e=this._gl,i=new nb(e.createTexture());if(i.type=this._mapFormatToType[t.format],i.internalFormat=this._mapFormatToInternalFormat[t.format],i.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){const s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=i,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),i}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){const i=this._gl,s=this.getGlSource(t);i.bindTexture(i.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,Bl(t.style,i,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){const e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){const e=this._gl,i=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=t,this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,i,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);const i=this.getGlSource(t);this._gl.generateMipmap(i.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){const e=this._gl,i=this._gl.createSampler();return this._glSamplers[t._resourceId]=i,Bl(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){const{pixels:e,width:i,height:s}=this.getPixels(t),n=L.get().createCanvas();n.width=i,n.height=s;const o=n.getContext("2d");if(o){const a=o.createImageData(i,s);a.data.set(e),o.putImageData(a,0,0)}return n}getPixels(t){const e=t.source.resolution,i=t.frame,s=Math.max(Math.round(i.width*e),1),n=Math.max(Math.round(i.height*e),1),o=new Uint8Array(rP*s*n),a=this._renderer,l=a.renderTarget.getRenderTarget(t),u=a.renderTarget.getGpuRenderTarget(l),c=a.gl;return c.bindFramebuffer(c.FRAMEBUFFER,u.resolveTargetFramebuffer),c.readPixels(Math.round(i.x*e),Math.round(i.y*e),s,n,c.RGBA,c.UNSIGNED_BYTE,o),{pixels:new Uint8ClampedArray(o.buffer),width:s,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}}Il.extension={type:[x.WebGLSystem],name:"texture"};class Fl{init(){const 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=ve(),i=Xe({name:"graphics",bits:[Oi,Bi(e),ns,ze]});this.shader=new At({glProgram:i,resources:{localUniforms:t,batchSamplers:Ii(e)}})}execute(t,e){const i=e.context,s=i.customShader||this.shader,n=t.renderer,o=n.graphicsContext,{batcher:a,instructions:l}=o.getContextRenderData(i);s.groups[0]=n.globalUniforms.bindGroup,n.state.set(t.state),n.shader.bind(s),n.geometry.bind(a.geometry,s.glProgram);const u=l.instructions;for(let c=0;c<l.instructionSize;c++){const h=u[c];if(h.size){for(let p=0;p<h.textures.count;p++)n.texture.bind(h.textures.textures[p],p);n.geometry.draw("triangle-list",h.size,h.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}}Fl.extension={type:[x.WebGLPipesAdaptor],name:"graphics"};class Dl{init(){const t=Xe({name:"mesh",bits:[ns,d_,ze]});this._shader=new At({glProgram:t,resources:{uTexture:P.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new G}}}})}execute(t,e){const i=t.renderer;let s=e._shader;if(s){if(!s.glProgram)return}else{s=this._shader;const n=e.texture,o=n.source;s.resources.uTexture=o,s.resources.uSampler=o.style,s.resources.textureUniforms.uniforms.uTextureMatrix=n.textureMatrix.mapCoord}s.groups[100]=i.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}Dl.extension={type:[x.WebGLPipesAdaptor],name:"mesh"};class Ul{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}}Ul.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"customRender"};function kl(r,t){const e=r.instructionSet,i=e.instructions;for(let s=0;s<e.instructionSize;s++){const n=i[s];t[n.renderPipeId].execute(n)}}class $l{constructor(t){this._renderer=t}addRenderGroup(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&(this._renderer.globalUniforms.push({worldTransformMatrix:t.worldTransform,worldColor:t.worldColorAlpha}),kl(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop())}destroy(){this._renderer=null}}$l.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"renderGroup"};function Hs(r,t){t||(t=0);for(let e=t;e<r.length&&r[e];e++)r[e]=null}function Ll(r,t=[]){t.push(r);for(let e=0;e<r.renderGroupChildren.length;e++)Ll(r.renderGroupChildren[e],t);return t}function Nl(r,t,e){const i=r>>16&255,s=r>>8&255,n=r&255,o=t>>16&255,a=t>>8&255,l=t&255,u=i+(o-i)*e,c=s+(a-s)*e,h=n+(l-n)*e;return(u<<16)+(c<<8)+h}const ar=16777215;function Hl(r,t){return r===ar||t===ar?r+t-ar:Nl(r,t,.5)}function iP(r,t,e){const i=(e>>24&255)/255,s=t*i*255,n=((r&255)<<16)+(r&65280)+(r>>16&255),o=e&16777215;let a;return n===ar||o===ar?a=n+o-ar:a=Nl(n,o,.5),a+(s<<24)}const sP=new Q,gb=Ie|gr|mi;function Xl(r,t=!1){_b(r);const e=r.childrenToUpdate,i=r.updateTick++;for(const s in e){const n=Number(s),o=e[s],a=o.list,l=o.index;for(let u=0;u<l;u++){const c=a[u];c.parentRenderGroup===r&&c.relativeRenderGroupDepth===n&&jl(c,i,0)}Hs(a,l),o.index=0}if(t)for(let s=0;s<r.renderGroupChildren.length;s++)Xl(r.renderGroupChildren[s],t)}function _b(r){const t=r.root;let e;if(r.renderGroupParent){const i=r.renderGroupParent;r.worldTransform.appendFrom(t.relativeGroupTransform,i.worldTransform),r.worldColor=Hl(t.groupColor,i.worldColor),e=t.groupAlpha*i.worldAlpha}else r.worldTransform.copyFrom(t.localTransform),r.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,r.worldAlpha=e,r.worldColorAlpha=r.worldColor+((e*255|0)<<24)}function jl(r,t,e){if(t===r.updateTick)return;r.updateTick=t,r.didChange=!1;const i=r.localTransform;r.updateLocalTransform();const s=r.parent;if(s&&!s.renderGroup?(e=e|r._updateFlags,r.relativeGroupTransform.appendFrom(i,s.relativeGroupTransform),e&gb&&bb(r,s,e)):(e=r._updateFlags,r.relativeGroupTransform.copyFrom(i),e&gb&&bb(r,sP,e)),!r.renderGroup){const n=r.children,o=n.length;for(let u=0;u<o;u++)jl(n[u],t,e);const a=r.parentRenderGroup,l=r;l.renderPipeId&&!a.structureDidChange&&a.updateRenderable(l)}}function bb(r,t,e){if(e&gr){r.groupColor=Hl(r.localColor,t.groupColor);let i=r.localAlpha*t.groupAlpha;i=i<0?0:i>1?1:i,r.groupAlpha=i,r.groupColorAlpha=r.groupColor+((i*255|0)<<24)}e&mi&&(r.groupBlendMode=r.localBlendMode==="inherit"?t.groupBlendMode:r.localBlendMode),e&Ie&&(r.globalDisplayStatus=r.localDisplayStatus&t.globalDisplayStatus),r._updateFlags=0}function vb(r,t){const{list:e,index:i}=r.childrenRenderablesToUpdate;let s=!1;for(let n=0;n<i;n++){const o=e[n];if(s=t[o.renderPipeId].validateRenderable(o),s)break}return r.structureDidChange=s,s}const nP=new G;class zl{constructor(t){this._renderer=t}render({container:t,transform:e}){t.isRenderGroup=!0;const i=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;const n=this._renderer,o=Ll(t.renderGroup,[]);let a=nP;e&&(a=a.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));const l=n.renderPipes;for(let u=0;u<o.length;u++){const c=o[u];c.runOnRender(),c.instructionSet.renderPipes=l,c.structureDidChange?Hs(c.childrenRenderablesToUpdate.list,0):vb(c,l),Xl(c),c.structureDidChange?(c.structureDidChange=!1,p_(c,n)):oP(c),c.childrenRenderablesToUpdate.index=0,n.renderPipes.batch.upload(c.instructionSet)}n.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),kl(t.renderGroup,l),l.uniformBatch&&l.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(a),t.parent=i,t.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}}zl.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"renderGroup"};function oP(r){const{list:t,index:e}=r.childrenRenderablesToUpdate;for(let i=0;i<e;i++){const s=t[i];s.didViewUpdate&&r.updateRenderable(s)}Hs(t,e)}class Vl{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){const i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){const e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){const e=t._texture,i=this._getGpuSprite(t);return i.texture._source!==e._source?!i._batcher.checkAndUpdateTexture(i,e):!1}destroyRenderable(t){const e=this._gpuSpriteHash[t.uid];N.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.bounds=t.bounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){const e=N.get(Yi);return e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.bounds=t.bounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuSpriteHash)N.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}}Vl.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"sprite"};var aP=Object.defineProperty,yb=Object.getOwnPropertySymbols,lP=Object.prototype.hasOwnProperty,uP=Object.prototype.propertyIsEnumerable,xb=(r,t,e)=>t in r?aP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Tb=(r,t)=>{for(var e in t||(t={}))lP.call(t,e)&&xb(r,e,t[e]);if(yb)for(var e of yb(t))uP.call(t,e)&&xb(r,e,t[e]);return r};const Wl=class Gy{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new j(0),this.color=this._backgroundColor,this.alpha=1}init(t){t=Tb(Tb({},Gy.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(){}};Wl.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"background",priority:0},Wl.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};let Sb=Wl;const ti={};D.handle(x.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");ti[r.name]=r.ref},r=>{delete ti[r.name]});class Yl{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t}setBlendMode(t,e,i){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(i),this._isAdvanced=!!ti[e],this._isAdvanced&&(this._beginAdvancedBlendMode(i),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);const e=this._activeBlendMode;if(!ti[e])return;let i=this._filterHash[e];i||(i=this._filterHash[e]=new pr,i.filters=[new ti[e]]);const s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:i,canBundle:!1};this._renderableList=s.renderables,t.add(s)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(const t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}}Yl.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"blendMode"};var cP=Object.defineProperty,Eb=Object.getOwnPropertySymbols,hP=Object.prototype.hasOwnProperty,dP=Object.prototype.propertyIsEnumerable,Ab=(r,t,e)=>t in r?cP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Kl=(r,t)=>{for(var e in t||(t={}))hP.call(t,e)&&Ab(r,e,t[e]);if(Eb)for(var e of Eb(t))dP.call(t,e)&&Ab(r,e,t[e]);return r};const ql={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Zl=class By{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof Q||t instanceof P?Kl({target:t},e):Kl(Kl({},e),t)}async image(t){const e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,By.defaultImageOptions);const{format:e,quality:i}=t,s=this.canvas(t);if(s.toBlob!==void 0)return new Promise((n,o)=>{s.toBlob(a=>{if(!a){o(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>n(l.result),l.onerror=o,l.readAsDataURL(a)},ql[e],i)});if(s.toDataURL!==void 0)return s.toDataURL(ql[e],i);if(s.convertToBlob!==void 0){const n=await s.convertToBlob({type:ql[e],quality:i});return new Promise((o,a)=>{const l=new FileReader;l.onload=()=>o(l.result),l.onerror=a,l.readAsDataURL(n)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);const e=t.target,i=this._renderer;if(e instanceof P)return i.texture.generateCanvas(e);const s=i.textureGenerator.generateTexture(t),n=i.texture.generateCanvas(s);return s.destroy(),n}pixels(t){t=this._normalizeOptions(t);const e=t.target,i=this._renderer,s=e instanceof P?e:i.textureGenerator.generateTexture(t),n=i.texture.getPixels(s);return e instanceof Q&&s.destroy(),n}texture(t){return t=this._normalizeOptions(t),t.target instanceof P?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){var e;t=this._normalizeOptions(t);const i=this.canvas(t),s=document.createElement("a");s.download=(e=t.filename)!=null?e:"image.png",s.href=i.toDataURL("image/png"),document.body.appendChild(s),s.click(),document.body.removeChild(s)}log(t){var e;const i=(e=t.width)!=null?e:200;t=this._normalizeOptions(t);const s=this.canvas(t),n=s.toDataURL();console.log(`[Pixi Texture] ${s.width}px ${s.height}px`);const o=["font-size: 1px;",`padding: ${i}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};Zl.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"extract"},Zl.defaultImageOptions={format:"png",quality:1};let Pb=Zl;class Xs extends P{static create(t){return new Xs({source:new tt(t)})}resize(t,e,i){return this.source.resize(t,e,i),this}}var pP=Object.defineProperty,fP=Object.defineProperties,mP=Object.getOwnPropertyDescriptors,wb=Object.getOwnPropertySymbols,gP=Object.prototype.hasOwnProperty,_P=Object.prototype.propertyIsEnumerable,Rb=(r,t,e)=>t in r?pP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,bP=(r,t)=>{for(var e in t||(t={}))gP.call(t,e)&&Rb(r,e,t[e]);if(wb)for(var e of wb(t))_P.call(t,e)&&Rb(r,e,t[e]);return r},vP=(r,t)=>fP(r,mP(t));const yP=new V,xP=new ut,TP=[0,0,0,0];class Ql{constructor(t){this._renderer=t}generateTexture(t){var e;t instanceof Q&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});const i=t.resolution||this._renderer.resolution,s=t.antialias||this._renderer.view.antialias,n=t.target;let o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:j.shared.setValue(o).toArray():o=TP;const a=((e=t.frame)==null?void 0:e.copyTo(yP))||pi(n,xP).rectangle;a.width=Math.max(a.width,1/i)|0,a.height=Math.max(a.height,1/i)|0;const l=Xs.create(vP(bP({},t.textureSourceOptions),{width:a.width,height:a.height,resolution:i,antialias:s})),u=G.shared.translate(-a.x,-a.y);return this._renderer.render({container:n,transform:u,target:l,clearColor:o}),l.source.updateMipmaps(),l}destroy(){this._renderer=null}}Ql.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"textureGenerator"};class Jl{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:i,worldColor:s,offset:n}){const o=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:o,worldTransformMatrix:new G,worldColor:4294967295,offset:new W},l={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||o.size,worldTransformMatrix:i||a.worldTransformMatrix,worldColor:s||a.worldColor,offset:n||a.offset,bindGroup:null},u=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(u);const c=u.uniforms;c.uProjectionMatrix=l.projectionMatrix,c.uResolution=l.resolution,c.uWorldTransformMatrix.copyFrom(l.worldTransformMatrix),c.uWorldTransformMatrix.tx-=l.offset.x,c.uWorldTransformMatrix.ty-=l.offset.y,We(l.worldColor,c.uWorldColorAlpha,0),u.update();let h;this._renderer.renderPipes.uniformBatch?h=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(u,!1):(h=this._bindGroupPool.pop()||new Ht,this._activeBindGroups.push(h),h.setResource(u,0)),l.bindGroup=h,this._currentGlobalUniformData=l}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 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}}Jl.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"globalUniforms"};let SP=1;class tu{constructor(){this._tasks=[],this._offset=0}init(){ct.system.add(this._update,this)}repeat(t,e,i=!0){const s=SP++;let n=0;return i&&(this._offset+=1e3,n=this._offset),this._tasks.push({func:t,duration:e,start:performance.now(),offset:n,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(){const t=performance.now();for(let e=0;e<this._tasks.length;e++){const i=this._tasks[e];if(t-i.offset-i.last>=i.duration){const s=t-i.start;i.func(s),i.last=t}}}destroy(){ct.system.remove(this._update,this),this._tasks.length=0}}tu.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"scheduler",priority:0};let Mb=!1;function Cb(r){if(!Mb){if(L.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){const t=[`%c %c %c %c %c PixiJS %c v${Xr} (${r}) http://www.pixijs.com/
|
|
2092
|
+
|
|
2093
|
+
`,"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 ${Xr} - ${r} - http://www.pixijs.com/`);Mb=!0}}class js{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}`),Cb(e)}}}js.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"hello",priority:-2},js.defaultOptions={hello:!1};function Ob(r){let t=!1;for(const i in r)if(r[i]==null){t=!0;break}if(!t)return r;const e=Object.create(null);for(const i in r){const s=r[i];s&&(e[i]=s)}return e}function Gb(r){let t=0;for(let e=0;e<r.length;e++)r[e]==null?t++:r[e-t]=r[e];return r.length=r.length-t,r}var EP=Object.defineProperty,Bb=Object.getOwnPropertySymbols,AP=Object.prototype.hasOwnProperty,PP=Object.prototype.propertyIsEnumerable,Ib=(r,t,e)=>t in r?EP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Fb=(r,t)=>{for(var e in t||(t={}))AP.call(t,e)&&Ib(r,e,t[e]);if(Bb)for(var e of Bb(t))PP.call(t,e)&&Ib(r,e,t[e]);return r};const eu=class Iy{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t=Fb(Fb({},Iy.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(const e of this._managedHashes)e.context[e.hash]=Ob(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(const 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(){this._now=performance.now()}addRenderable(t,e){this.enabled&&(t._lastUsed=this._now,t._lastInstructionTick===-1&&(this._managedRenderables.push(t),t.once("destroyed",this._removeRenderable,this)),t._lastInstructionTick=e.tick)}run(){var t,e,i;const s=performance.now(),n=this._managedRenderables,o=this._renderer.renderPipes;let a=0;for(let l=0;l<n.length;l++){const u=n[l];if(u===null){a++;continue}const c=(t=u.renderGroup)!=null?t:u.parentRenderGroup,h=(i=(e=c==null?void 0:c.instructionSet)==null?void 0:e.tick)!=null?i:-1;u._lastInstructionTick!==h&&s-u._lastUsed>this.maxUnusedTime?(u.destroyed||o[u.renderPipeId].destroyRenderable(u),u._lastInstructionTick=-1,a++,u.off("destroyed",this._removeRenderable,this)):n[l-a]=u}n.length=n.length-a}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(t){const e=this._managedRenderables.indexOf(t);e>=0&&(t.off("destroyed",this._removeRenderable,this),this._managedRenderables[e]=null)}};eu.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"renderableGC",priority:0},eu.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};let Db=eu;var wP=Object.defineProperty,Ub=Object.getOwnPropertySymbols,RP=Object.prototype.hasOwnProperty,MP=Object.prototype.propertyIsEnumerable,kb=(r,t,e)=>t in r?wP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,$b=(r,t)=>{for(var e in t||(t={}))RP.call(t,e)&&kb(r,e,t[e]);if(Ub)for(var e of Ub(t))MP.call(t,e)&&kb(r,e,t[e]);return r};const ru=class Fy{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){var e;t=$b($b({},Fy.defaultOptions),t),this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=(e=t.textureGCAMaxIdle)!=null?e: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(){const t=this._renderer.texture.managedTextures;for(let e=0;e<t.length;e++){const i=t[e];i.autoGarbageCollect&&i.resource&&i._touched>-1&&this.count-i._touched>this.maxIdle&&(i._touched=-1,i.unload())}}destroy(){this._renderer=null}};ru.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"textureGC"},ru.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:3600,textureGCCheckCountMax:600};let Lb=ru;var CP=Object.defineProperty,Nb=Object.getOwnPropertySymbols,OP=Object.prototype.hasOwnProperty,GP=Object.prototype.propertyIsEnumerable,Hb=(r,t,e)=>t in r?CP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Xb=(r,t)=>{for(var e in t||(t={}))OP.call(t,e)&&Hb(r,e,t[e]);if(Nb)for(var e of Nb(t))GP.call(t,e)&&Hb(r,e,t[e]);return r};const iu=class Dy{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=Xb(Xb({},Dy.defaultOptions),t),t.view&&(t.canvas=t.view),this.screen=new V(0,0,t.width,t.height),this.canvas=t.canvas||L.get().createCanvas(),this.antialias=!!t.antialias,this.texture=Tl(this.canvas,t),this.renderTarget=new Us({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,i){this.texture.source.resize(t,e,i),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){(typeof t=="boolean"?t:t!=null&&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};let jb=iu;const su=[Sb,Jl,js,jb,zl,Lb,Ql,Pb,Ta,Db,tu],nu=[Yl,sl,Vl,$l,nl,al,ol,Ul],BP=[...su,xl,P_,v_,ll,Il,El,dl,Cl,Ml,ml,sb,gl,fl],IP=[...nu],FP=[el,Dl,Fl],zb=[],Vb=[],Wb=[];D.handleByNamedList(x.WebGLSystem,zb),D.handleByNamedList(x.WebGLPipes,Vb),D.handleByNamedList(x.WebGLPipesAdaptor,Wb),D.add(...BP,...IP,...FP);class Yb extends $r{constructor(){const t={name:"webgl",type:bt.WEBGL,systems:zb,renderPipes:Vb,renderPipeAdaptors:Wb};super(t)}}var DP={__proto__:null,WebGLRenderer:Yb};class ou{constructor(t){this._hash=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_hash")}contextChange(t){this._gpu=t}getBindGroup(t,e,i){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,i)}_createBindGroup(t,e,i){var s;const n=this._gpu.device,o=e.layout[i],a=[],l=this._renderer;for(const h in o){const p=(s=t.resources[h])!=null?s:t.resources[o[h]];let f;if(p._resourceType==="uniformGroup"){const m=p;l.ubo.updateUniformGroup(m);const _=m.buffer;f={buffer:l.buffer.getGPUBuffer(_),offset:0,size:_.descriptor.size}}else if(p._resourceType==="buffer"){const m=p;f={buffer:l.buffer.getGPUBuffer(m),offset:0,size:m.descriptor.size}}else if(p._resourceType==="bufferResource"){const m=p;f={buffer:l.buffer.getGPUBuffer(m.buffer),offset:m.offset,size:m.size}}else if(p._resourceType==="textureSampler"){const m=p;f=l.texture.getGpuSampler(m)}else if(p._resourceType==="textureSource"){const m=p;f=l.texture.getGpuSource(m).createView({})}a.push({binding:o[h],resource:f})}const u=l.shader.getProgramData(e).bindGroups[i],c=n.createBindGroup({layout:u,entries:a});return this._hash[t._key]=c,c}destroy(){for(const t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}}ou.extension={type:[x.WebGPUSystem],name:"bindGroup"};class au{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){const e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),i=t.data;return t._updateID&&i&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,i.buffer,0,(t._updateSize||i.byteLength)+3&-4)),e}destroyAll(){for(const 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));const e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(wi(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}}au.extension={type:[x.WebGPUSystem],name:"buffer"};function UP(r,t){const e=r.descriptor.size,i=t.gpu.device,s=new dt({data:new Float32Array(24e5),usage:$.MAP_READ|$.COPY_DST}),n=t.buffer.createGPUBuffer(s),o=i.createCommandEncoder();o.copyBufferToBuffer(t.buffer.getGPUBuffer(r),0,n,0,e),i.queue.submit([o.finish()]),n.mapAsync(GPUMapMode.READ,0,e).then(()=>{n.getMappedRange(0,e),n.unmap()})}class Kb{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}`);const e=this.byteIndex;let i=e+t*4;if(i=Math.ceil(i/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,i>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=i,e}addGroup(t){const e=this.addEmptyGroup(t.length);for(let i=0;i<t.length;i++)this.data[e/4+i]=t[i];return e}destroy(){this._buffer.destroy(),this._buffer=null,this.data=null}}class lu{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}}lu.extension={type:[x.WebGPUSystem],name:"colorMask"};class zs{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){const e=await L.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),i=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(n=>e.features.has(n)),s=await e.requestDevice({requiredFeatures:i});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}}zs.extension={type:[x.WebGPUSystem],name:"device"},zs.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};var kP=Object.defineProperty,qb=Object.getOwnPropertySymbols,$P=Object.prototype.hasOwnProperty,LP=Object.prototype.propertyIsEnumerable,Zb=(r,t,e)=>t in r?kP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Qb=(r,t)=>{for(var e in t||(t={}))$P.call(t,e)&&Zb(r,e,t[e]);if(qb)for(var e of qb(t))LP.call(t,e)&&Zb(r,e,t[e]);return r};class uu{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,i,s){const n=this._renderer.pipeline.getPipeline(t,e,i,s);this.setPipeline(n)}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;const e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,i){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);const s=this._renderer.bindGroup.getBindGroup(e,i,t);this.renderPassEncoder.setBindGroup(t,s)}setGeometry(t,e){const i=this._renderer.pipeline.getBufferNamesToBind(t,e);for(const s in i)this._setVertexBuffer(s,t.attributes[i[s]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(const i in t.groups){const s=t.groups[i];e||this._syncBindGroup(s),this.setBindGroup(i,s,t.gpuProgram)}}_syncBindGroup(t){for(const e in t.resources){const i=t.resources[e];i.isUniformGroup&&this._renderer.ubo.updateUniformGroup(i)}}draw(t){const{geometry:e,shader:i,state:s,topology:n,size:o,start:a,instanceCount:l,skipSync:u}=t;this.setPipelineFromGeometryProgramAndState(e,i.gpuProgram,s,n),this.setGeometry(e,i.gpuProgram),this._setShaderBindGroups(i,u),e.indexBuffer?this.renderPassEncoder.drawIndexed(o||e.indexBuffer.data.length,l||e.instanceCount,a||0):this.renderPassEncoder.draw(o||e.getSize(),l||e.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){const t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);const e=this._boundPipeline,i=Qb({},this._boundVertexBuffer),s=this._boundIndexBuffer,n=Qb({},this._boundBindGroup);this._clearCache();const o=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(o.x,o.y,o.width,o.height,0,1),this.setPipeline(e);for(const a in i)this._setVertexBuffer(a,i[a]);for(const a in n)this.setBindGroup(a,n[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}}uu.extension={type:[x.WebGPUSystem],name:"encoder",priority:1};class cu{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:et.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){const i=this._renderTargetStencilState[this._activeRenderTarget.uid];i.stencilMode=t,i.stencilReference=e;const 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}}cu.extension={type:[x.WebGPUSystem],name:"stencil"};const ei={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}};function Jb(r){const t=r.map(i=>({data:i,offset:0,size:0}));let e=0;for(let i=0;i<t.length;i++){const s=t[i];let n=ei[s.data.type].size;const o=ei[s.data.type].align;if(!ei[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(n=Math.max(n,o)*s.data.size),e=Math.ceil(e/o)*o,s.size=n,s.offset=e,e+=n}return e=Math.ceil(e/16)*16,{uboElements:t,size:e}}function tv(r,t){const{size:e,align:i}=ei[r.data.type],s=(i-e)/4;return`
|
|
2094
|
+
v = uv.${r.data.name};
|
|
2095
|
+
${t!==0?`offset += ${t};`:""}
|
|
2096
|
+
|
|
2097
|
+
arrayOffset = offset;
|
|
2098
|
+
|
|
2099
|
+
t = 0;
|
|
2100
|
+
|
|
2101
|
+
for(var i=0; i < ${r.data.size*(e/4)}; i++)
|
|
2102
|
+
{
|
|
2103
|
+
for(var j = 0; j < ${e/4}; j++)
|
|
2104
|
+
{
|
|
2105
|
+
data[arrayOffset++] = v[t++];
|
|
2106
|
+
}
|
|
2107
|
+
${s!==0?`arrayOffset += ${s};`:""}
|
|
2108
|
+
}
|
|
2109
|
+
`}function ev(r){return vl(r,"uboWgsl",tv,O_)}class hu extends _l{constructor(){super({createUboElements:Jb,generateUboSync:ev})}}hu.extension={type:[x.WebGPUSystem],name:"ubo"};const ce=128;class du{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 Kb({minUniformOffsetAlignment:ce});const e=256/ce;for(let i=0;i<e;i++){let s=$.UNIFORM|$.COPY_DST;i===0&&(s|=$.COPY_SRC),this._buffers.push(new dt({data:this._batchBuffer.data,usage:s}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(const 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);const i=t.buffer.data,s=this._batchBuffer.addEmptyGroup(i.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,s/4),this._bindGroupHash[t.uid]=this._getBindGroup(s/ce),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);const e=t.buffer.data,i=this._batchBuffer.addGroup(e);return this._getBufferResource(i/ce)}getArrayBindGroup(t){const e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/ce)}getArrayBufferResource(t){const e=this._batchBuffer.addGroup(t)/ce;return this._getBufferResource(e)}_getBufferResource(t){if(!this._bufferResources[t]){const e=this._buffers[t%2];this._bufferResources[t]=new ks({buffer:e,offset:(t/2|0)*256,size:ce})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){const e=new Ht({0:this._getBufferResource(t)});this._bindGroups[t]=e}return this._bindGroups[t]}_uploadBindGroups(){const t=this._renderer.buffer,e=this._buffers[0];e.update(this._batchBuffer.byteIndex),t.updateBuffer(e);const i=this._renderer.gpu.device.createCommandEncoder();for(let s=1;s<this._buffers.length;s++){const n=this._buffers[s];i.copyBufferToBuffer(t.getGPUBuffer(e),ce,t.getGPUBuffer(n),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([i.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}}du.extension={type:[x.WebGPUPipes],name:"uniformBatch"};var NP=Object.defineProperty,HP=Object.defineProperties,XP=Object.getOwnPropertyDescriptors,rv=Object.getOwnPropertySymbols,jP=Object.prototype.hasOwnProperty,zP=Object.prototype.propertyIsEnumerable,iv=(r,t,e)=>t in r?NP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,VP=(r,t)=>{for(var e in t||(t={}))jP.call(t,e)&&iv(r,e,t[e]);if(rv)for(var e of rv(t))zP.call(t,e)&&iv(r,e,t[e]);return r},WP=(r,t)=>HP(r,XP(t));const YP={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};function KP(r,t,e,i,s){return r<<24|t<<16|e<<10|i<<5|s}function qP(r,t,e,i){return e<<6|r<<3|i<<1|t}class pu{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(et.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=te[t],this._updatePipeHash())}setPipeline(t,e,i,s){const n=this.getPipeline(t,e,i);s.setPipeline(n)}getPipeline(t,e,i,s){t._layoutKey||(cl(t,e.attributeData),this._generateBufferKey(t)),s=s||t.topology;const n=KP(t._layoutKey,e._layoutKey,i.data,i._blendModeId,YP[s]);return this._pipeCache[n]?this._pipeCache[n]:(this._pipeCache[n]=this._createPipeline(t,e,i,s),this._pipeCache[n])}_createPipeline(t,e,i,s){const n=this._gpu.device,o=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(i);a[0].writeMask=this._stencilMode===et.RENDERING_MASK_ADD?0:this._colorMask;const l=this._renderer.shader.getProgramData(e).pipeline,u={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:o},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:a},primitive:{topology:s,cullMode:i.cullMode},layout:l,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(u.depthStencil=WP(VP({},this._stencilState),{format:"depth24plus-stencil8",depthWriteEnabled:i.depthTest,depthCompare:i.depthTest?"less":"always"})),n.createRenderPipeline(u)}_getModule(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){const e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){const e=[];let i=0;const s=Object.keys(t.attributes).sort();for(let o=0;o<s.length;o++){const a=t.attributes[s[o]];e[i++]=a.offset,e[i++]=a.format,e[i++]=a.stride,e[i++]=a.instance}const n=e.join("|");return t._layoutKey=Le(n,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){const e=[];let i=0;const s=Object.keys(t.attributeData).sort();for(let o=0;o<s.length;o++){const a=t.attributeData[s[o]];e[i++]=a.location}const n=e.join("|");return t._attributeLocationsKey=Le(n,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){const i=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[i])return this._bindingNamesCache[i];const s=this._createVertexBufferLayouts(t,e),n=Object.create(null),o=e.attributeData;for(let a=0;a<s.length;a++)for(const l in o)if(o[l].location===a){n[a]=l;break}return this._bindingNamesCache[i]=n,n}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);const i=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[i])return this._bufferLayoutsCache[i];const s=[];return t.buffers.forEach(n=>{var o;const a={arrayStride:0,stepMode:"vertex",attributes:[]},l=a.attributes;for(const u in e.attributeData){const c=t.attributes[u];((o=c.divisor)!=null?o:1)!==1&&jt(`Attribute ${u} has an invalid divisor value of '${c.divisor}'. WebGPU only supports a divisor value of 1`),c.buffer===n&&(a.arrayStride=c.stride,a.stepMode=c.instance?"instance":"vertex",l.push({shaderLocation:e.attributeData[u].location,offset:c.offset,format:c.format}))}l.length&&s.push(a)}),this._bufferLayoutsCache[i]=s,s}_updatePipeHash(){const t=qP(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}}pu.extension={type:[x.WebGPUSystem],name:"pipeline"};class sv{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}class nv{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,i,s,n){const o=this._renderer,a=this._getGpuColorTexture(t),l=o.texture.getGpuSource(e.source);return o.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:i},{texture:l,origin:n},s),e}startRenderPass(t,e=!0,i,s){const n=this._renderTargetSystem.getGpuRenderTarget(t),o=this.getDescriptor(t,e,i);n.descriptor=o,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(s)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,i){typeof e=="boolean"&&(e=e?vt.ALL:vt.NONE);const s=this._renderTargetSystem,n=s.getGpuRenderTarget(t),o=t.colorTextures.map((l,u)=>{const c=n.contexts[u];let h,p;c?h=c.getCurrentTexture().createView():h=this._renderer.texture.getGpuSource(l).createView({mipLevelCount:1}),n.msaaTextures[u]&&(p=h,h=this._renderer.texture.getTextureView(n.msaaTextures[u]));const f=e&vt.COLOR?"clear":"load";return i!=null||(i=s.defaultClearColor),{view:h,resolveTarget:p,clearValue:i,storeOp:"store",loadOp:f}});let a;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=n.msaa?4:1),t.depthStencilTexture){const l=e&vt.STENCIL?"clear":"load",u=e&vt.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:l,depthClearValue:1,depthLoadOp:u,depthStoreOp:"store"}}return{colorAttachments:o,depthStencilAttachment:a}}clear(t,e=!0,i,s){if(!e)return;const{gpu:n,encoder:o}=this._renderer,a=n.device;if(o.commandEncoder===null){const l=a.createCommandEncoder(),u=this.getDescriptor(t,e,i),c=l.beginRenderPass(u);c.setViewport(s.x,s.y,s.width,s.height,0,1),c.end();const h=l.finish();a.queue.submit([h])}else this.startRenderPass(t,e,i,s)}initGpuRenderTarget(t){t.isRoot=!0;const e=new sv;return t.colorTextures.forEach((i,s)=>{if(ie.test(i.resource)){const n=i.resource.getContext("webgpu"),o=i.transparent?"premultiplied":"opaque";try{n.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:o})}catch(a){console.error(a)}e.contexts[s]=n}if(e.msaa=i.source.antialias,i.source.antialias){const n=new tt({width:0,height:0,sampleCount:4});e.msaaTextures[s]=n}}),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){const e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((i,s)=>{const n=e.msaaTextures[s];n==null||n.resize(i.source.width,i.source.height,i.source._resolution)})}}class fu extends Sl{constructor(t){super(t),this.adaptor=new nv,this.adaptor.init(t,this)}}fu.extension={type:[x.WebGPUSystem],name:"renderTarget"};class mu{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){const e=this._gpu.device,i=t.gpuLayout.map(n=>e.createBindGroupLayout({entries:n})),s={bindGroupLayouts:i};return this._gpuProgramData[t._layoutKey]={bindGroups:i,pipeline:e.createPipelineLayout(s)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}}mu.extension={type:[x.WebGPUSystem],name:"shader"};const ft={};ft.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},ft.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}},ft.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}},ft.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},ft.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},ft.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}},ft["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}},ft["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}},ft["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}},ft.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}},ft.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}},ft.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}};class gu{constructor(){this.defaultState=new Pt,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:ft[t.blendMode]||ft.normal}]}destroy(){this.gpu=null}}gu.extension={type:[x.WebGPUSystem],name:"state"};const ov={type:"image",upload(r,t,e){const i=r.resource,s=(r.pixelWidth|0)*(r.pixelHeight|0),n=i.byteLength/s;e.device.queue.writeTexture({texture:t},i,{offset:0,rowsPerImage:r.pixelHeight,bytesPerRow:r.pixelHeight*n},{width:r.pixelWidth,height:r.pixelHeight,depthOrArrayLayers:1})}},_u={"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}},ZP={blockBytes:4,blockWidth:1,blockHeight:1},av={type:"compressed",upload(r,t,e){let i=r.pixelWidth,s=r.pixelHeight;const n=_u[r.format]||ZP;for(let o=0;o<r.resource.length;o++){const a=r.resource[o],l=Math.ceil(i/n.blockWidth)*n.blockBytes;e.device.queue.writeTexture({texture:t,mipLevel:o},a,{offset:0,bytesPerRow:l},{width:Math.ceil(i/n.blockWidth)*n.blockWidth,height:Math.ceil(s/n.blockHeight)*n.blockHeight,depthOrArrayLayers:1}),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}},bu={type:"image",upload(r,t,e){const i=r.resource;if(!i)return;const s=Math.min(t.width,r.resourceWidth||r.pixelWidth),n=Math.min(t.height,r.resourceHeight||r.pixelHeight),o=r.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:i},{texture:t,premultipliedAlpha:o},{width:s,height:n})}},lv={type:"video",upload(r,t,e){bu.upload(r,t,e)}};class uv{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:`
|
|
2110
|
+
var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
|
2111
|
+
vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
|
|
2112
|
+
|
|
2113
|
+
struct VertexOutput {
|
|
2114
|
+
@builtin(position) position : vec4<f32>,
|
|
2115
|
+
@location(0) texCoord : vec2<f32>,
|
|
2116
|
+
};
|
|
2117
|
+
|
|
2118
|
+
@vertex
|
|
2119
|
+
fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput {
|
|
2120
|
+
var output : VertexOutput;
|
|
2121
|
+
output.texCoord = pos[vertexIndex] * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5);
|
|
2122
|
+
output.position = vec4<f32>(pos[vertexIndex], 0.0, 1.0);
|
|
2123
|
+
return output;
|
|
2124
|
+
}
|
|
2125
|
+
|
|
2126
|
+
@group(0) @binding(0) var imgSampler : sampler;
|
|
2127
|
+
@group(0) @binding(1) var img : texture_2d<f32>;
|
|
2128
|
+
|
|
2129
|
+
@fragment
|
|
2130
|
+
fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
|
|
2131
|
+
return textureSample(img, imgSampler, texCoord);
|
|
2132
|
+
}
|
|
2133
|
+
`})),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){const e=this._getMipmapPipeline(t.format);if(t.dimension==="3d"||t.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let i=t;const s=t.depthOrArrayLayers||1,n=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!n){const l={size:{width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};i=this.device.createTexture(l)}const o=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let l=0;l<s;++l){let u=t.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:l,arrayLayerCount:1}),c=n?1:0;for(let h=1;h<t.mipLevelCount;++h){const p=i.createView({baseMipLevel:c++,mipLevelCount:1,dimension:"2d",baseArrayLayer:l,arrayLayerCount:1}),f=o.beginRenderPass({colorAttachments:[{view:p,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:u}]});f.setPipeline(e),f.setBindGroup(0,m),f.draw(3,1,0,0),f.end(),u=p}}if(!n){const l={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s};for(let u=1;u<t.mipLevelCount;++u)o.copyTextureToTexture({texture:i,mipLevel:u-1},{texture:t,mipLevel:u},l),l.width=Math.ceil(l.width/2),l.height=Math.ceil(l.height/2)}return this.device.queue.submit([o.finish()]),n||i.destroy(),t}}class vu{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:bu,buffer:ov,video:lv,compressed:av},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){const l=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(l))+1}let e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC);const i=_u[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(t.pixelWidth/i.blockWidth)*i.blockWidth,n=Math.ceil(t.pixelHeight/i.blockHeight)*i.blockHeight,o={label:t.label,size:{width:s,height:n},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},a=this._gpu.device.createTexture(o);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){const 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){const e=this._gpuSources[t.uid];e&&(this._gpuSources[t.uid]=null,e.destroy())}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new uv(this._gpu.device));const 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){const 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){var e;return(e=this._bindGroupHash[t.uid])!=null?e:this._createTextureBindGroup(t)}_createTextureBindGroup(t){const e=t.source;return this._bindGroupHash[t.uid]=new Ht({0:e,1:e.style,2:new st({uTextureMatrix:{type:"mat3x3<f32>",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){var e;const i=t.source;return(e=this._textureViewHash[i.uid])!=null?e:this._createTextureView(i)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){const e=this._renderer,i=e.gpu.device.createCommandEncoder(),s=L.get().createCanvas();s.width=t.source.pixelWidth,s.height=t.source.pixelHeight;const n=s.getContext("webgpu");return n.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:L.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),i.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:n.getCurrentTexture()},{width:s.width,height:s.height}),e.gpu.device.queue.submit([i.finish()]),s}getPixels(t){const e=this.generateCanvas(t),i=Xt.getOptimalCanvasAndContext(e.width,e.height),s=i.context;s.drawImage(e,0,0);const{width:n,height:o}=e,a=s.getImageData(0,0,n,o),l=new Uint8ClampedArray(a.data.buffer);return Xt.returnCanvasAndContext(i),{pixels:l,width:n,height:o}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null;for(const t of Object.keys(this._bindGroupHash)){const e=Number(t),i=this._bindGroupHash[e];i==null||i.destroy(),this._bindGroupHash[e]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}}vu.extension={type:[x.WebGPUSystem],name:"texture"};class yu{init(){const 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=He({name:"graphics",bits:[Ci,Gi(ve()),vf,je]});this.shader=new At({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){const i=e.context,s=i.customShader||this.shader,n=t.renderer,o=n.graphicsContext,{batcher:a,instructions:l}=o.getContextRenderData(i),u=n.encoder;u.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state),u.setGeometry(a.geometry,s.gpuProgram);const c=n.globalUniforms.bindGroup;u.setBindGroup(0,c,s.gpuProgram);const h=n.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);u.setBindGroup(2,h,s.gpuProgram);const p=l.instructions;for(let f=0;f<l.instructionSize;f++){const m=p[f];if(s.groups[1]=m.bindGroup,!m.gpuBindGroup){const _=m.textures;m.bindGroup=Pi(_.textures,_.count),m.gpuBindGroup=n.bindGroup.getBindGroup(m.bindGroup,s.gpuProgram,1)}u.setBindGroup(1,m.bindGroup,s.gpuProgram),u.renderPassEncoder.drawIndexed(m.size,1,m.start)}}destroy(){this.shader.destroy(!0),this.shader=null}}yu.extension={type:[x.WebGPUPipesAdaptor],name:"graphics"};class xu{init(){const t=He({name:"mesh",bits:[Je,h_,je]});this._shader=new At({gpuProgram:t,resources:{uTexture:P.EMPTY._source,uSampler:P.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new G}}}})}execute(t,e){const i=t.renderer;let s=e._shader;if(!s)s=this._shader,s.groups[2]=i.texture.getTextureBindGroup(e.texture);else if(!s.gpuProgram)return;const n=s.gpuProgram;if(n.autoAssignGlobalUniforms&&(s.groups[0]=i.globalUniforms.bindGroup),n.autoAssignLocalUniforms){const o=t.localUniforms;s.groups[1]=i.renderPipes.uniformBatch.getUniformBindGroup(o,!0)}i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}xu.extension={type:[x.WebGPUPipesAdaptor],name:"mesh"};const QP=[...su,hu,uu,zs,au,vu,fu,mu,gu,pu,lu,cu,ou],JP=[...nu,du],tw=[rl,xu,yu],cv=[],hv=[],dv=[];D.handleByNamedList(x.WebGPUSystem,cv),D.handleByNamedList(x.WebGPUPipes,hv),D.handleByNamedList(x.WebGPUPipesAdaptor,dv),D.add(...QP,...JP,...tw);class pv extends $r{constructor(){const t={name:"webgpu",type:bt.WEBGPU,systems:cv,renderPipes:hv,renderPipeAdaptors:dv};super(t)}}var ew={__proto__:null,WebGPURenderer:pv};const rw={POINTS:"point-list",LINES:"line-list",LINE_STRIP:"line-strip",TRIANGLES:"triangle-list",TRIANGLE_STRIP:"triangle-strip"},iw=new Proxy(rw,{get(r,t){return r[t]}}),sw=new V(0,0,1,1);function nw(r,t,e){e||(e=sw);const i=t.pixelWidth,s=t.pixelHeight;return r.x=e.x*i|0,r.y=e.y*s|0,r.width=e.width*i|0,r.height=e.height*s|0,r}var fv=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(fv||{}),Tu=(r=>(r.CLAMP="clamp-to-edge",r.REPEAT="repeat",r.MIRRORED_REPEAT="mirror-repeat",r))(Tu||{});const ow=new Proxy(Tu,{get(r,t){return r[t]}});var Su=(r=>(r.NEAREST="nearest",r.LINEAR="linear",r))(Su||{});const aw=new Proxy(Su,{get(r,t){return r[t]}});class lw{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,i){const s=e.width,n=e.height;if(i){const o=t.width/2/s,a=t.height/2/n,l=t.x/s+o,u=t.y/n+a;i=k.add(i,k.NW),this.x0=l+o*k.uX(i),this.y0=u+a*k.uY(i),i=k.add(i,2),this.x1=l+o*k.uX(i),this.y1=u+a*k.uY(i),i=k.add(i,2),this.x2=l+o*k.uX(i),this.y2=u+a*k.uY(i),i=k.add(i,2),this.x3=l+o*k.uX(i),this.y3=u+a*k.uY(i)}else this.x0=t.x/s,this.y0=t.y/n,this.x1=(t.x+t.width)/s,this.y1=t.y/n,this.x2=(t.x+t.width)/s,this.y2=(t.y+t.height)/n,this.x3=t.x/s,this.y3=(t.y+t.height)/n;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}}let uw=0;function cw(){return uw++}function hw(r){const t=r.toString(),e=t.indexOf("{"),i=t.lastIndexOf("}");if(e===-1||i===-1)throw new Error("getFunctionBody: No body found in function definition");return t.slice(e+1,i).trim()}var dw=Object.defineProperty,Vs=Object.getOwnPropertySymbols,mv=Object.prototype.hasOwnProperty,gv=Object.prototype.propertyIsEnumerable,_v=(r,t,e)=>t in r?dw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,pw=(r,t)=>{for(var e in t||(t={}))mv.call(t,e)&&_v(r,e,t[e]);if(Vs)for(var e of Vs(t))gv.call(t,e)&&_v(r,e,t[e]);return r},fw=(r,t)=>{var e={};for(var i in r)mv.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Vs)for(var i of Vs(r))t.indexOf(i)<0&&gv.call(r,i)&&(e[i]=r[i]);return e};class mw extends Q{constructor(t){var e,i;typeof t=="function"&&(t={render:t});const s=t,{render:n}=s,o=fw(s,["render"]);super(pw({label:"RenderContainer"},o)),this.batched=!1,this._lastUsed=0,this._lastInstructionTick=-1,this.bounds=new ut,this.canBundle=!1,this.renderPipeId="customRender",n&&(this.render=n),this.containsPoint=(e=t.containsPoint)!=null?e:()=>!1,this.addBounds=(i=t.addBounds)!=null?i:()=>!1}render(t){}}function gw(r,t){const e=t._scale,i=t._pivot,s=t._position,n=e._x,o=e._y,a=i._x,l=i._y;r.a=t._cx*n,r.b=t._sx*n,r.c=t._cy*o,r.d=t._sy*o,r.tx=s._x-(a*r.a+l*r.c),r.ty=s._y-(a*r.b+l*r.d)}function _w(r,t,e){const i=r.a,s=r.b,n=r.c,o=r.d,a=r.tx,l=r.ty,u=t.a,c=t.b,h=t.c,p=t.d;e.a=i*u+s*h,e.b=i*c+s*p,e.c=n*u+o*h,e.d=n*c+o*p,e.tx=a*u+l*h+t.tx,e.ty=a*c+l*p+t.ty}const bw={rectangle:mo,polygon:fo,triangle:go,circle:Zt,ellipse:Zt,roundedRectangle:Zt};function vw(r){r instanceof se&&(r={path:r,textureMatrix:null,out:null});const t=[],e=[],i=[],s=r.path.shapePath,n=r.textureMatrix;s.shapePrimitives.forEach(({shape:a,transform:l})=>{const u=i.length,c=t.length/2,h=[],p=bw[a.type];p.build(a,h),l&&Ui(h,l),p.triangulate(h,t,2,c,i,u);const f=e.length/2;n?(l&&n.append(l.clone().invert()),oo(t,2,c,e,f,2,t.length/2-c,n)):ao(e,f,2,t.length/2-c)});const o=r.out;return o?(o.positions=new Float32Array(t),o.uvs=new Float32Array(e),o.indices=new Uint32Array(i),o):new oe({positions:new Float32Array(t),uvs:new Float32Array(e),indices:new Uint32Array(i)})}function bv(r,t,e,i){const s=e.buffers[0],n=s.data,{verticesX:o,verticesY:a}=e,l=r/(o-1),u=t/(a-1);let c=0;const h=i[0],p=i[1],f=i[2],m=i[3],_=i[4],g=i[5],b=i[6],v=i[7],y=i[8];for(let T=0;T<n.length;T+=2){const E=c%o*l,M=(c/o|0)*u,w=h*E+p*M+f,C=m*E+_*M+g,S=b*E+v*M+y;n[T]=w/S,n[T+1]=C/S,c++}s.update()}function vv(r,t){const e=t[0],i=t[1],s=t[2],n=t[3],o=t[4],a=t[5],l=t[6],u=t[7],c=t[8];return r[0]=o*c-a*u,r[1]=s*u-i*c,r[2]=i*a-s*o,r[3]=a*l-n*c,r[4]=e*c-s*l,r[5]=s*n-e*a,r[6]=n*u-o*l,r[7]=i*l-e*u,r[8]=e*o-i*n,r}function yv(r,t,e){const i=t[0],s=t[1],n=t[2],o=t[3],a=t[4],l=t[5],u=t[6],c=t[7],h=t[8],p=e[0],f=e[1],m=e[2],_=e[3],g=e[4],b=e[5],v=e[6],y=e[7],T=e[8];return r[0]=p*i+f*o+m*u,r[1]=p*s+f*a+m*c,r[2]=p*n+f*l+m*h,r[3]=_*i+g*o+b*u,r[4]=_*s+g*a+b*c,r[5]=_*n+g*l+b*h,r[6]=v*i+y*o+T*u,r[7]=v*s+y*a+T*c,r[8]=v*n+y*l+T*h,r}function yw(r,t,e){const i=e[0],s=e[1],n=e[2];return r[0]=t[0]*i+t[1]*s+t[2]*n,r[1]=t[3]*i+t[4]*s+t[5]*n,r[2]=t[6]*i+t[7]*s+t[8]*n,r}const xw=[0,0,0,0,0,0,0,0,0],Tw=[0,0,0],Ws=[0,0,0];function xv(r,t,e,i,s,n,o,a,l){const u=xw;u[0]=t,u[1]=i,u[2]=n,u[3]=e,u[4]=s,u[5]=o,u[6]=1,u[7]=1,u[8]=1;const c=vv(r,u);Ws[0]=a,Ws[1]=l,Ws[2]=1;const h=yw(Tw,c,Ws),p=r;return r[0]=h[0],r[1]=0,r[2]=0,r[3]=0,r[4]=h[1],r[5]=0,r[6]=0,r[7]=0,r[8]=h[2],yv(r,p,u)}const Sw=[0,0,0,0,0,0,0,0,0],Ew=[0,0,0,0,0,0,0,0,0];function Tv(r,t,e,i,s,n,o,a,l,u,c,h,p,f,m,_,g){const b=xv(Sw,t,e,n,o,u,c,f,m),v=xv(Ew,i,s,a,l,h,p,_,g);return yv(r,vv(b,b),v)}class Sv extends as{constructor(t){super(t),this._projectionMatrix=[0,0,0,0,0,0,0,0,0];const{width:e,height:i}=t;this.corners=[0,0,e,0,e,i,0,i]}setCorners(t,e,i,s,n,o,a,l){const u=this.corners;u[0]=t,u[1]=e,u[2]=i,u[3]=s,u[4]=n,u[5]=o,u[6]=a,u[7]=l,this.updateProjection()}updateProjection(){const{width:t,height:e}=this,i=this.corners,s=Tv(this._projectionMatrix,0,0,i[0],i[1],t,0,i[2],i[3],t,e,i[4],i[5],0,e,i[6],i[7]);bv(t,e,this,s)}}var Aw=Object.defineProperty,Pw=Object.defineProperties,ww=Object.getOwnPropertyDescriptors,Ys=Object.getOwnPropertySymbols,Ev=Object.prototype.hasOwnProperty,Av=Object.prototype.propertyIsEnumerable,Pv=(r,t,e)=>t in r?Aw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Eu=(r,t)=>{for(var e in t||(t={}))Ev.call(t,e)&&Pv(r,e,t[e]);if(Ys)for(var e of Ys(t))Av.call(t,e)&&Pv(r,e,t[e]);return r},Rw=(r,t)=>Pw(r,ww(t)),Mw=(r,t)=>{var e={};for(var i in r)Ev.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Ys)for(var i of Ys(r))t.indexOf(i)<0&&Av.call(r,i)&&(e[i]=r[i]);return e};const wv=class Uy extends sr{constructor(t){t=Eu(Eu({},Uy.defaultOptions),t);const e=t,{texture:i,verticesX:s,verticesY:n}=e,o=Mw(e,["texture","verticesX","verticesY"]),a=new Sv(Nt({width:i.width,height:i.height,verticesX:s,verticesY:n}));super(Nt(Rw(Eu({},o),{geometry:a}))),this._texture=i,this.geometry.setCorners(t.x0,t.y0,t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)}textureUpdated(){const t=this.geometry;if(!t)return;const{width:e,height:i}=this.texture;(t.width!==e||t.height!==i)&&(t.width=e,t.height=i,t.updateProjection())}set texture(t){this._texture!==t&&(super.texture=t,this.textureUpdated())}get texture(){return this._texture}setCorners(t,e,i,s,n,o,a,l){this.geometry.setCorners(t,e,i,s,n,o,a,l)}};wv.defaultOptions={texture:P.WHITE,verticesX:10,verticesY:10,x0:0,y0:0,x1:100,y1:0,x2:100,y2:100,x3:0,y3:100};let Cw=wv;var Ow=Object.defineProperty,Gw=Object.defineProperties,Bw=Object.getOwnPropertyDescriptors,Ks=Object.getOwnPropertySymbols,Rv=Object.prototype.hasOwnProperty,Mv=Object.prototype.propertyIsEnumerable,Cv=(r,t,e)=>t in r?Ow(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Iw=(r,t)=>{for(var e in t||(t={}))Rv.call(t,e)&&Cv(r,e,t[e]);if(Ks)for(var e of Ks(t))Mv.call(t,e)&&Cv(r,e,t[e]);return r},Fw=(r,t)=>Gw(r,Bw(t)),Dw=(r,t)=>{var e={};for(var i in r)Rv.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Ks)for(var i of Ks(r))t.indexOf(i)<0&&Mv.call(r,i)&&(e[i]=r[i]);return e};class Uw extends sr{constructor(t){const e=t,{texture:i,verticesX:s,verticesY:n}=e,o=Dw(e,["texture","verticesX","verticesY"]),a=new as(Nt({width:i.width,height:i.height,verticesX:s,verticesY:n}));super(Nt(Fw(Iw({},o),{geometry:a,texture:i}))),this.texture=i,this.autoResize=!0}textureUpdated(){const t=this.geometry,{width:e,height:i}=this.texture;this.autoResize&&(t.width!==e||t.height!==i)&&(t.width=e,t.height=i,t.build({}))}set texture(t){var e;(e=this._texture)==null||e.off("update",this.textureUpdated,this),super.texture=t,t.on("update",this.textureUpdated,this),this.textureUpdated()}get texture(){return this._texture}destroy(t){this.texture.off("update",this.textureUpdated,this),super.destroy(t)}}var kw=Object.defineProperty,Ov=Object.getOwnPropertySymbols,$w=Object.prototype.hasOwnProperty,Lw=Object.prototype.propertyIsEnumerable,Gv=(r,t,e)=>t in r?kw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Bv=(r,t)=>{for(var e in t||(t={}))$w.call(t,e)&&Gv(r,e,t[e]);if(Ov)for(var e of Ov(t))Lw.call(t,e)&&Gv(r,e,t[e]);return r};const Iv=class ky extends oe{constructor(t){const{width:e,points:i,textureScale:s}=Bv(Bv({},ky.defaultOptions),t);super({positions:new Float32Array(i.length*4),uvs:new Float32Array(i.length*4),indices:new Uint32Array((i.length-1)*6)}),this.points=i,this._width=e,this.textureScale=s,this._build()}get width(){return this._width}_build(){const t=this.points;if(!t)return;const e=this.getBuffer("aPosition"),i=this.getBuffer("aUV"),s=this.getIndex();if(t.length<1)return;e.data.length/4!==t.length&&(e.data=new Float32Array(t.length*4),i.data=new Float32Array(t.length*4),s.data=new Uint16Array((t.length-1)*6));const n=i.data,o=s.data;n[0]=0,n[1]=0,n[2]=0,n[3]=1;let a=0,l=t[0];const u=this._width*this.textureScale,c=t.length;for(let p=0;p<c;p++){const f=p*4;if(this.textureScale>0){const m=l.x-t[p].x,_=l.y-t[p].y,g=Math.sqrt(m*m+_*_);l=t[p],a+=g/u}else a=p/(c-1);n[f]=a,n[f+1]=0,n[f+2]=a,n[f+3]=1}let h=0;for(let p=0;p<c-1;p++){const f=p*2;o[h++]=f,o[h++]=f+1,o[h++]=f+2,o[h++]=f+2,o[h++]=f+1,o[h++]=f+3}i.update(),s.update(),this.updateVertices()}updateVertices(){const t=this.points;if(t.length<1)return;let e=t[0],i,s=0,n=0;const o=this.buffers[0].data,a=t.length,l=this.textureScale>0?this.textureScale*this._width/2:this._width/2;for(let u=0;u<a;u++){const c=t[u],h=u*4;u<t.length-1?i=t[u+1]:i=c,n=-(i.x-e.x),s=i.y-e.y;let p=(1-u/(a-1))*10;p>1&&(p=1);const f=Math.sqrt(s*s+n*n);f<1e-6?(s=0,n=0):(s/=f,n/=f,s*=l,n*=l),o[h]=c.x+s,o[h+1]=c.y+n,o[h+2]=c.x-s,o[h+3]=c.y-n,e=c}this.buffers[0].update()}update(){this.textureScale>0?this._build():this.updateVertices()}};Iv.defaultOptions={width:200,points:[],textureScale:0};let Fv=Iv;var Nw=Object.defineProperty,Hw=Object.defineProperties,Xw=Object.getOwnPropertyDescriptors,qs=Object.getOwnPropertySymbols,Dv=Object.prototype.hasOwnProperty,Uv=Object.prototype.propertyIsEnumerable,kv=(r,t,e)=>t in r?Nw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Au=(r,t)=>{for(var e in t||(t={}))Dv.call(t,e)&&kv(r,e,t[e]);if(qs)for(var e of qs(t))Uv.call(t,e)&&kv(r,e,t[e]);return r},jw=(r,t)=>Hw(r,Xw(t)),zw=(r,t)=>{var e={};for(var i in r)Dv.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&qs)for(var i of qs(r))t.indexOf(i)<0&&Uv.call(r,i)&&(e[i]=r[i]);return e};const $v=class $y extends sr{constructor(t){const e=Au(Au({},$y.defaultOptions),t),{texture:i,points:s,textureScale:n}=e,o=zw(e,["texture","points","textureScale"]),a=new Fv(Nt({width:i.height,points:s,textureScale:n}));n>0&&(i.source.style.addressMode="repeat"),super(Nt(jw(Au({},o),{texture:i,geometry:a}))),this.autoUpdate=!0,this.onRender=this._render}_render(){const t=this.geometry;(this.autoUpdate||t._width!==this.texture.height)&&(t._width=this.texture.height,t.update())}};$v.defaultOptions={textureScale:0};let Vw=$v;var Ww=Object.defineProperty,Yw=Object.defineProperties,Kw=Object.getOwnPropertyDescriptors,Zs=Object.getOwnPropertySymbols,Lv=Object.prototype.hasOwnProperty,Nv=Object.prototype.propertyIsEnumerable,Hv=(r,t,e)=>t in r?Ww(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,qw=(r,t)=>{for(var e in t||(t={}))Lv.call(t,e)&&Hv(r,e,t[e]);if(Zs)for(var e of Zs(t))Nv.call(t,e)&&Hv(r,e,t[e]);return r},Zw=(r,t)=>Yw(r,Kw(t)),Qw=(r,t)=>{var e={};for(var i in r)Lv.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Zs)for(var i of Zs(r))t.indexOf(i)<0&&Nv.call(r,i)&&(e[i]=r[i]);return e};class Jw extends sr{constructor(t){const e=t,{texture:i,vertices:s,uvs:n,indices:o,topology:a}=e,l=Qw(e,["texture","vertices","uvs","indices","topology"]),u=new oe(Nt({positions:s,uvs:n,indices:o,topology:a}));super(Nt(Zw(qw({},l),{texture:i,geometry:u}))),this.autoUpdate=!0,this.onRender=this._render}get vertices(){return this.geometry.getBuffer("aPosition").data}set vertices(t){this.geometry.getBuffer("aPosition").data=t}_render(){this.autoUpdate&&this.geometry.getBuffer("aPosition").update()}}function tR(r,t){const{width:e,height:i}=r.frame;return t.scale(1/e,1/i),t}var eR=Object.defineProperty,Xv=Object.getOwnPropertySymbols,rR=Object.prototype.hasOwnProperty,iR=Object.prototype.propertyIsEnumerable,jv=(r,t,e)=>t in r?eR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,zv=(r,t)=>{for(var e in t||(t={}))rR.call(t,e)&&jv(r,e,t[e]);if(Xv)for(var e of Xv(t))iR.call(t,e)&&jv(r,e,t[e]);return r};const Vv=class Fu{constructor(t){if(t instanceof P)this.texture=t,fi(this,Fu.defaultOptions,{});else{const e=zv(zv({},Fu.defaultOptions),t);fi(this,e,{})}}get alpha(){return this._alpha}set alpha(t){this._alpha=Math.min(Math.max(t,0),1),this._updateColor()}get tint(){const t=this._tint;return((t&255)<<16)+(t&65280)+(t>>16&255)}set tint(t){typeof t=="number"?this._tint=t:this._tint=j.shared.setValue(t).toBgrNumber(),this._updateColor()}_updateColor(){this.color=this._tint+((this._alpha*255|0)<<24)}};Vv.defaultOptions={anchorX:0,anchorY:0,x:0,y:0,scaleX:1,scaleY:1,rotation:0,tint:16777215,alpha:1};let sR=Vv;const Pu={vertex:{attributeName:"aVertex",format:"float32x2",code:`
|
|
2134
|
+
const texture = p.texture;
|
|
2135
|
+
const sx = p.scaleX;
|
|
2136
|
+
const sy = p.scaleY;
|
|
2137
|
+
const ax = p.anchorX;
|
|
2138
|
+
const ay = p.anchorY;
|
|
2139
|
+
const trim = texture.trim;
|
|
2140
|
+
const orig = texture.orig;
|
|
2141
|
+
|
|
2142
|
+
if (trim)
|
|
2143
|
+
{
|
|
2144
|
+
w1 = trim.x - (ax * orig.width);
|
|
2145
|
+
w0 = w1 + trim.width;
|
|
2146
|
+
|
|
2147
|
+
h1 = trim.y - (ay * orig.height);
|
|
2148
|
+
h0 = h1 + trim.height;
|
|
2149
|
+
}
|
|
2150
|
+
else
|
|
2151
|
+
{
|
|
2152
|
+
w1 = -ax * (orig.width);
|
|
2153
|
+
w0 = w1 + orig.width;
|
|
2154
|
+
|
|
2155
|
+
h1 = -ay * (orig.height);
|
|
2156
|
+
h0 = h1 + orig.height;
|
|
2157
|
+
}
|
|
2158
|
+
|
|
2159
|
+
f32v[offset] = w1 * sx;
|
|
2160
|
+
f32v[offset + 1] = h1 * sy;
|
|
2161
|
+
|
|
2162
|
+
f32v[offset + stride] = w0 * sx;
|
|
2163
|
+
f32v[offset + stride + 1] = h1 * sy;
|
|
2164
|
+
|
|
2165
|
+
f32v[offset + (stride * 2)] = w0 * sx;
|
|
2166
|
+
f32v[offset + (stride * 2) + 1] = h0 * sy;
|
|
2167
|
+
|
|
2168
|
+
f32v[offset + (stride * 3)] = w1 * sx;
|
|
2169
|
+
f32v[offset + (stride * 3) + 1] = h0 * sy;
|
|
2170
|
+
`,dynamic:!1},position:{attributeName:"aPosition",format:"float32x2",code:`
|
|
2171
|
+
var x = p.x;
|
|
2172
|
+
var y = p.y;
|
|
2173
|
+
|
|
2174
|
+
f32v[offset] = x;
|
|
2175
|
+
f32v[offset + 1] = y;
|
|
2176
|
+
|
|
2177
|
+
f32v[offset + stride] = x;
|
|
2178
|
+
f32v[offset + stride + 1] = y;
|
|
2179
|
+
|
|
2180
|
+
f32v[offset + (stride * 2)] = x;
|
|
2181
|
+
f32v[offset + (stride * 2) + 1] = y;
|
|
2182
|
+
|
|
2183
|
+
f32v[offset + (stride * 3)] = x;
|
|
2184
|
+
f32v[offset + (stride * 3) + 1] = y;
|
|
2185
|
+
`,dynamic:!0},rotation:{attributeName:"aRotation",format:"float32",code:`
|
|
2186
|
+
var rotation = p.rotation;
|
|
2187
|
+
|
|
2188
|
+
f32v[offset] = rotation;
|
|
2189
|
+
f32v[offset + stride] = rotation;
|
|
2190
|
+
f32v[offset + (stride * 2)] = rotation;
|
|
2191
|
+
f32v[offset + (stride * 3)] = rotation;
|
|
2192
|
+
`,dynamic:!1},uvs:{attributeName:"aUV",format:"float32x2",code:`
|
|
2193
|
+
var uvs = p.texture.uvs;
|
|
2194
|
+
|
|
2195
|
+
f32v[offset] = uvs.x0;
|
|
2196
|
+
f32v[offset + 1] = uvs.y0;
|
|
2197
|
+
|
|
2198
|
+
f32v[offset + stride] = uvs.x1;
|
|
2199
|
+
f32v[offset + stride + 1] = uvs.y1;
|
|
2200
|
+
|
|
2201
|
+
f32v[offset + (stride * 2)] = uvs.x2;
|
|
2202
|
+
f32v[offset + (stride * 2) + 1] = uvs.y2;
|
|
2203
|
+
|
|
2204
|
+
f32v[offset + (stride * 3)] = uvs.x3;
|
|
2205
|
+
f32v[offset + (stride * 3) + 1] = uvs.y3;
|
|
2206
|
+
`,dynamic:!1},color:{attributeName:"aColor",format:"unorm8x4",code:`
|
|
2207
|
+
const c = p.color;
|
|
2208
|
+
|
|
2209
|
+
u32v[offset] = c;
|
|
2210
|
+
u32v[offset + stride] = c;
|
|
2211
|
+
u32v[offset + (stride * 2)] = c;
|
|
2212
|
+
u32v[offset + (stride * 3)] = c;
|
|
2213
|
+
`,dynamic:!1}};var nR=Object.defineProperty,oR=Object.defineProperties,aR=Object.getOwnPropertyDescriptors,Qs=Object.getOwnPropertySymbols,Wv=Object.prototype.hasOwnProperty,Yv=Object.prototype.propertyIsEnumerable,Kv=(r,t,e)=>t in r?nR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,lr=(r,t)=>{for(var e in t||(t={}))Wv.call(t,e)&&Kv(r,e,t[e]);if(Qs)for(var e of Qs(t))Yv.call(t,e)&&Kv(r,e,t[e]);return r},qv=(r,t)=>oR(r,aR(t)),lR=(r,t)=>{var e={};for(var i in r)Wv.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Qs)for(var i of Qs(r))t.indexOf(i)<0&&Yv.call(r,i)&&(e[i]=r[i]);return e};const uR={minX:0,minY:0,maxX:0,maxY:0},Zv=class Du extends re{constructor(t={}){t=qv(lr(lr({},Du.defaultOptions),t),{dynamicProperties:lr(lr({},Du.defaultOptions.dynamicProperties),t==null?void 0:t.dynamicProperties)});const e=t,{dynamicProperties:i,shader:s,roundPixels:n,texture:o,particles:a}=e,l=lR(e,["dynamicProperties","shader","roundPixels","texture","particles"]);super(lr({label:"ParticleContainer"},l)),this.renderPipeId="particle",this.batched=!1,this._childrenDirty=!1,this.texture=o||null,this.shader=s,this._properties={};for(const u in Pu){const c=Pu[u],h=i[u];this._properties[u]=qv(lr({},c),{dynamic:h})}this.allowChildren=!0,this.roundPixels=n!=null?n:!1,this.particleChildren=a!=null?a:[]}addParticle(...t){for(let e=0;e<t.length;e++)this.particleChildren.push(t[e]);return this.onViewUpdate(),t[0]}removeParticle(...t){let e=!1;for(let i=0;i<t.length;i++){const s=this.particleChildren.indexOf(t[i]);s>-1&&(this.particleChildren.splice(s,1),e=!0)}return e&&this.onViewUpdate(),t[0]}update(){this._childrenDirty=!0}onViewUpdate(){this._childrenDirty=!0,super.onViewUpdate()}get bounds(){return jt("ParticleContainer does not calculated bounds as it would slow things down, its up to you to set this via the boundsArea property"),uR}addBounds(t){jt("ParticleContainer does not calculated bounds as it would slow things down, its up to you to set this via the boundsArea property")}destroy(t=!1){var e,i,s;if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const n=typeof t=="boolean"?t:t==null?void 0:t.textureSource,o=(i=this.texture)!=null?i:(e=this.particleChildren[0])==null?void 0:e.texture;o&&o.destroy(n)}this.texture=null,(s=this.shader)==null||s.destroy()}removeParticles(t,e){const i=this.particleChildren.splice(t,e);return this.onViewUpdate(),i}removeParticleAt(t){const e=this.particleChildren.splice(t,1);return this.onViewUpdate(),e[0]}addParticleAt(t,e){return this.particleChildren.splice(e,0,t),this.onViewUpdate(),t}addChild(...t){throw new Error("ParticleContainer.addChild() is not available. Please use ParticleContainer.addParticle()")}removeChild(...t){throw new Error("ParticleContainer.removeChild() is not available. Please use ParticleContainer.removeParticle()")}removeChildren(t,e){throw new Error("ParticleContainer.removeChildren() is not available. Please use ParticleContainer.removeParticles()")}removeChildAt(t){throw new Error("ParticleContainer.removeChildAt() is not available. Please use ParticleContainer.removeParticleAt()")}getChildAt(t){throw new Error("ParticleContainer.getChildAt() is not available. Please use ParticleContainer.getParticleAt()")}setChildIndex(t,e){throw new Error("ParticleContainer.setChildIndex() is not available. Please use ParticleContainer.setParticleIndex()")}getChildIndex(t){throw new Error("ParticleContainer.getChildIndex() is not available. Please use ParticleContainer.getParticleIndex()")}addChildAt(t,e){throw new Error("ParticleContainer.addChildAt() is not available. Please use ParticleContainer.addParticleAt()")}swapChildren(t,e){throw new Error("ParticleContainer.swapChildren() is not available. Please use ParticleContainer.swapParticles()")}reparentChild(...t){throw new Error("ParticleContainer.reparentChild() is not available with the particle container")}reparentChildAt(t,e){throw new Error("ParticleContainer.reparentChildAt() is not available with the particle container")}};Zv.defaultOptions={dynamicProperties:{vertex:!1,position:!0,rotation:!1,uvs:!1,color:!1},roundPixels:!1};let cR=Zv;var hR=Object.defineProperty,Js=Object.getOwnPropertySymbols,Qv=Object.prototype.hasOwnProperty,Jv=Object.prototype.propertyIsEnumerable,ty=(r,t,e)=>t in r?hR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,dR=(r,t)=>{for(var e in t||(t={}))Qv.call(t,e)&&ty(r,e,t[e]);if(Js)for(var e of Js(t))Jv.call(t,e)&&ty(r,e,t[e]);return r},pR=(r,t)=>{var e={};for(var i in r)Qv.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Js)for(var i of Js(r))t.indexOf(i)<0&&Jv.call(r,i)&&(e[i]=r[i]);return e};const ey=class Ly extends re{constructor(t){var e,i,s,n,o,a,l,u,c,h;t instanceof P&&(t={texture:t});const p=t,{width:f,height:m,leftWidth:_,rightWidth:g,topHeight:b,bottomHeight:v,texture:y,roundPixels:T}=p,E=pR(p,["width","height","leftWidth","rightWidth","topHeight","bottomHeight","texture","roundPixels"]);super(dR({label:"NineSliceSprite"},E)),this.renderPipeId="nineSliceSprite",this.batched=!0,this._leftWidth=(i=_!=null?_:(e=y==null?void 0:y.defaultBorders)==null?void 0:e.left)!=null?i:ae.defaultOptions.leftWidth,this._topHeight=(n=b!=null?b:(s=y==null?void 0:y.defaultBorders)==null?void 0:s.top)!=null?n:ae.defaultOptions.topHeight,this._rightWidth=(a=g!=null?g:(o=y==null?void 0:y.defaultBorders)==null?void 0:o.right)!=null?a:ae.defaultOptions.rightWidth,this._bottomHeight=(u=v!=null?v:(l=y==null?void 0:y.defaultBorders)==null?void 0:l.bottom)!=null?u:ae.defaultOptions.bottomHeight,this.bounds.maxX=this._width=(c=f!=null?f:y.width)!=null?c:ae.defaultOptions.width,this.bounds.maxY=this._height=(h=m!=null?m:y.height)!=null?h:ae.defaultOptions.height,this.allowChildren=!1,this.texture=y!=null?y:Ly.defaultOptions.texture,this.roundPixels=T!=null?T:!1}get bounds(){return this._bounds}get width(){return this._width}set width(t){this.bounds.maxX=this._width=t,this.onViewUpdate()}get height(){return this._height}set height(t){this.bounds.maxY=this._height=t,this.onViewUpdate()}setSize(t,e){var i;typeof t=="object"&&(e=(i=t.height)!=null?i:t.width,t=t.width),this.bounds.maxX=this._width=t,this.bounds.maxY=this._height=e!=null?e:t,this.onViewUpdate()}getSize(t){return t||(t={}),t.width=this._width,t.height=this._height,t}get leftWidth(){return this._leftWidth}set leftWidth(t){this._leftWidth=t,this.onViewUpdate()}get topHeight(){return this._topHeight}set topHeight(t){this._topHeight=t,this.onViewUpdate()}get rightWidth(){return this._rightWidth}set rightWidth(t){this._rightWidth=t,this.onViewUpdate()}get bottomHeight(){return this._bottomHeight}set bottomHeight(t){this._bottomHeight=t,this.onViewUpdate()}get texture(){return this._texture}set texture(t){t||(t=P.EMPTY);const 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.onViewUpdate())}get originalWidth(){return this._texture.width}get originalHeight(){return this._texture.height}addBounds(t){const e=this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}destroy(t){if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(e)}this._texture=null}};ey.defaultOptions={texture:P.EMPTY};let ry=ey;class fR extends ry{constructor(...t){let e=t[0];e instanceof P&&(e={texture:e,leftWidth:t[1],topHeight:t[2],rightWidth:t[3],bottomHeight:t[4]}),super(e)}}function mR(r,t){return t instanceof Rt||t instanceof Pe?t:r==="html"?new Pe(t):new Rt(t)}async function gR(r,t,e=200){const i=await t.extract.base64(r);await t.encoder.commandFinished;const s=e;console.log(`logging texture ${r.source.width}px ${r.source.height}px`);const n=["font-size: 1px;",`padding: ${s}px 300px;`,`background: url(${i}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",n)}var _R=Object.defineProperty,bR=Object.defineProperties,vR=Object.getOwnPropertyDescriptors,iy=Object.getOwnPropertySymbols,yR=Object.prototype.hasOwnProperty,xR=Object.prototype.propertyIsEnumerable,sy=(r,t,e)=>t in r?_R(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ny=(r,t)=>{for(var e in t||(t={}))yR.call(t,e)&&sy(r,e,t[e]);if(iy)for(var e of iy(t))xR.call(t,e)&&sy(r,e,t[e]);return r},TR=(r,t)=>bR(r,vR(t));const SR=["#000080","#228B22","#8B0000","#4169E1","#008080","#800000","#9400D3","#FF8C00","#556B2F","#8B008B"];let ER=0;function oy(r,t=0,e={color:"#000000"}){r.renderGroup&&(e.color=SR[ER++]);let i="";for(let o=0;o<t;o++)i+=" ";let s=r.label;!s&&r instanceof Ft&&(s=`sprite:${r.texture.label}`);let n=`%c ${i}|- ${s} (worldX:${r.worldTransform.tx}, relativeRenderX:${r.relativeGroupTransform.tx}, renderX:${r.groupTransform.tx}, localX:${r.x})`;r.renderGroup&&(n+=" (RenderGroup)"),r.filters&&(n+="(*filters)"),console.log(n,`color:${e.color}; font-weight:bold;`),t++;for(let o=0;o<r.children.length;o++){const a=r.children[o];oy(a,t,ny({},e))}}function ay(r,t=0,e={index:0,color:"#000000"}){let i="";for(let n=0;n<t;n++)i+=" ";const s=`%c ${i}- ${e.index}: ${r.root.label} worldX:${r.worldTransform.tx}`;console.log(s,`color:${e.color}; font-weight:bold;`),t++;for(let n=0;n<r.renderGroupChildren.length;n++){const o=r.renderGroupChildren[n];ay(o,t,TR(ny({},e),{index:n}))}}return d.AbstractBitmapFont=qo,d.AbstractRenderer=$r,d.AbstractText=Gs,d.AccessibilitySystem=Sn,d.AlphaFilter=nE,d.AlphaMask=Fn,d.AlphaMaskPipe=nl,d.AnimatedSprite=qr,d.Application=Wf,d.ApplicationInitHook=xa,d.Assets=jr,d.AssetsClass=Gm,d.BLEND_TO_NPM=vh,d.BUFFER_TYPE=Jr,d.BackgroundLoader=qf,d.BackgroundSystem=Sb,d.Batch=Eh,d.BatchGeometry=Oh,d.BatchTextureArray=yh,d.BatchableGraphics=ki,d.BatchableMesh=Wi,d.BatchableSprite=Yi,d.Batcher=Mh,d.BatcherPipe=sl,d.BigPool=N,d.BindGroup=Ht,d.BindGroupSystem=ou,d.BitmapFont=Sa,d.BitmapFontManager=Dr,d.BitmapText=a_,d.BitmapTextPipe=ea,d.BlendModeFilter=Z2,d.BlendModePipe=Yl,d.BlurFilter=Sg,d.BlurFilterPass=Ss,d.Bounds=ut,d.BrowserAdapter=Nc,d.Buffer=dt,d.BufferImageSource=xi,d.BufferResource=ks,d.BufferUsage=$,d.CLEAR=vt,d.Cache=Y,d.CanvasPool=Xt,d.CanvasPoolClass=Zd,d.CanvasSource=ie,d.CanvasTextMetrics=Ut,d.CanvasTextPipe=Go,d.CanvasTextSystem=Vo,d.Circle=Ki,d.Color=j,d.ColorMask=Dn,d.ColorMaskPipe=ol,d.ColorMatrixFilter=SE,d.CompressedSource=zr,d.Container=Q,d.Culler=Ym,d.CullerPlugin=Km,d.CustomRenderPipe=Ul,d.D3D10_RESOURCE_DIMENSION=ka,d.D3DFMT=yt,d.DATA_URI=uS,d.DDS=I,d.DEG_TO_RAD=rc,d.DEPRECATED_SCALE_MODES=Su,d.DEPRECATED_WRAP_MODES=Tu,d.DOMAdapter=L,d.DRAW_MODES=iw,d.DXGI_FORMAT=Ua,d.DXGI_TO_TEXTURE_FORMAT=xt,d.DefaultBatcher=Di,d.DefaultShader=yd,d.DisplacementFilter=CE,d.DynamicBitmapFont=Qo,d.Ellipse=qi,d.EventBoundary=Uc,d.EventEmitter=mt,d.EventSystem=wn,d.EventsTicker=Kt,d.ExtensionType=x,d.ExtractSystem=Pb,d.FOURCC_TO_TEXTURE_FORMAT=$a,d.FederatedContainer=Lc,d.FederatedEvent=Fe,d.FederatedMouseEvent=_r,d.FederatedPointerEvent=Ot,d.FederatedWheelEvent=de,d.FillGradient=Ye,d.FillPattern=Mr,d.Filter=Jt,d.FilterEffect=pr,d.FilterPipe=da,d.FilterSystem=fa,d.FontStylePromiseCache=Ur,d.GAUSSIAN_VALUES=za,d.GL_FORMATS=Ds,d.GL_INTERNAL_FORMAT=Lm,d.GL_TARGETS=hl,d.GL_TYPES=z,d.GL_WRAP_MODES=y_,d.GenerateTextureSystem=Ql,d.Geometry=xe,d.GlBackBufferSystem=P_,d.GlBatchAdaptor=el,d.GlBuffer=m_,d.GlBufferSystem=ll,d.GlColorMaskSystem=fl,d.GlContextSystem=v_,d.GlEncoderSystem=ml,d.GlGeometrySystem=dl,d.GlGraphicsAdaptor=Fl,d.GlMeshAdaptor=Dl,d.GlParticleContainerAdaptor=Xd,d.GlParticleContainerPipe=Co,d.GlProgram=Et,d.GlProgramData=j_,d.GlRenderTarget=w_,d.GlRenderTargetAdaptor=I_,d.GlRenderTargetSystem=El,d.GlShaderSystem=Ml,d.GlStateSystem=sb,d.GlStencilSystem=gl,d.GlTexture=nb,d.GlTextureSystem=Il,d.GlUboSystem=xl,d.GlUniformGroupSystem=Cl,d.GlobalUniformSystem=Jl,d.GpuBatchAdaptor=rl,d.GpuBlendModesToPixi=ft,d.GpuBufferSystem=au,d.GpuColorMaskSystem=lu,d.GpuDeviceSystem=zs,d.GpuEncoderSystem=uu,d.GpuGraphicsAdaptor=yu,d.GpuGraphicsContext=Nd,d.GpuMeshAdapter=xu,d.GpuMipmapGenerator=uv,d.GpuParticleContainerAdaptor=qd,d.GpuParticleContainerPipe=Oo,d.GpuProgram=_t,d.GpuReadBuffer=UP,d.GpuRenderTarget=sv,d.GpuRenderTargetAdaptor=nv,d.GpuRenderTargetSystem=fu,d.GpuShaderSystem=mu,d.GpuStateSystem=gu,d.GpuStencilModesToPixi=te,d.GpuStencilSystem=cu,d.GpuTextureSystem=vu,d.GpuUboSystem=hu,d.GpuUniformBatchPipe=du,d.Graphics=Qe,d.GraphicsContext=pt,d.GraphicsContextRenderData=Hd,d.GraphicsContextSystem=Vi,d.GraphicsPath=se,d.GraphicsPipe=Ao,d.HTMLText=l_,d.HTMLTextPipe=ra,d.HTMLTextRenderData=na,d.HTMLTextStyle=Pe,d.HTMLTextSystem=ss,d.HelloSystem=js,d.IGLUniformData=UA,d.ImageSource=be,d.InstructionSet=_n,d.KTX=rt,d.Loader=am,d.LoaderParserPriority=St,d.MSAA_QUALITY=fv,d.MaskEffectManager=hi,d.MaskEffectManagerClass=nc,d.MaskFilter=Hg,d.Matrix=G,d.Mesh=sr,d.MeshGeometry=oe,d.MeshPipe=Po,d.MeshPlane=Uw,d.MeshRope=Vw,d.MeshSimple=Jw,d.NOOP=Mn,d.NineSliceGeometry=ae,d.NineSlicePlane=fR,d.NineSliceSprite=ry,d.NineSliceSpritePipe=ha,d.NoiseFilter=DE,d.ObservablePoint=nt,d.PI_2=tc,d.Particle=sR,d.ParticleBuffer=Vd,d.ParticleContainer=cR,d.ParticleContainerPipe=Mo,d.ParticleShader=Kd,d.PerspectiveMesh=Cw,d.PerspectivePlaneGeometry=Sv,d.PipelineSystem=pu,d.PlaneGeometry=as,d.Point=W,d.Polygon=Ke,d.Pool=ci,d.PoolGroupClass=ic,d.PrepareBase=jg,d.PrepareQueue=o_,d.PrepareSystem=c_,d.PrepareUpload=u_,d.QuadGeometry=Sf,d.RAD_TO_DEG=ec,d.Rectangle=V,d.RenderContainer=mw,d.RenderGroup=bc,d.RenderGroupPipe=$l,d.RenderGroupSystem=zl,d.RenderTarget=Us,d.RenderTargetSystem=Sl,d.RenderTexture=Xs,d.RenderableGCSystem=Db,d.RendererInitHook=Ta,d.RendererType=bt,d.ResizePlugin=En,d.Resolver=ee,d.RopeGeometry=Fv,d.RoundedRectangle=Qi,d.SCALE_MODES=aw,d.STENCIL_MODES=et,d.SVGParser=_p,d.SVGToGraphicsPath=op,d.SchedulerSystem=tu,d.ScissorMask=cA,d.SdfShader=Lp,d.Shader=At,d.ShaderStage=Ne,d.ShapePath=fp,d.SharedRenderPipes=nu,d.SharedSystems=su,d.Sprite=Ft,d.SpritePipe=Vl,d.Spritesheet=Bn,d.State=Pt,d.StencilMask=Un,d.StencilMaskPipe=al,d.SystemRunner=ba,d.TEXTURE_FORMAT_BLOCK_SIZE=km,d.Text=tl,d.TextStyle=Rt,d.Texture=P,d.TextureGCSystem=Lb,d.TextureMatrix=Gn,d.TexturePool=ht,d.TexturePoolClass=tp,d.TextureSource=tt,d.TextureStyle=On,d.TextureUvs=lw,d.Ticker=ct,d.TickerListener=bi,d.TickerPlugin=An,d.TilingSprite=r_,d.TilingSpritePipe=ca,d.TilingSpriteShader=Tf,d.Transform=Zg,d.Triangle=Ja,d.UNIFORM_TO_ARRAY_SETTERS=tb,d.UNIFORM_TO_SINGLE_SETTERS=J_,d.UNIFORM_TYPES_MAP=cd,d.UNIFORM_TYPES_VALUES=so,d.UPDATE_BLEND=mi,d.UPDATE_COLOR=gr,d.UPDATE_PRIORITY=Yt,d.UPDATE_TRANSFORM=m0,d.UPDATE_VISIBLE=Ie,d.UboBatch=Kb,d.UboSystem=_l,d.UniformGroup=st,d.VERSION=Xr,d.VideoSource=Tr,d.ViewContainer=re,d.ViewSystem=jb,d.ViewableBuffer=ye,d.WGSL_ALIGN_SIZE_DATA=ei,d.WGSL_TO_STD40_SIZE=bl,d.WRAP_MODES=ow,d.WebGLRenderer=Yb,d.WebGPURenderer=pv,d.WorkerManager=Ma,d._getGlobalBounds=mn,d._getGlobalBoundsRecursive=pa,d.accessibilityTarget=Fc,d.addBits=Zn,d.addMaskBounds=Si,d.addMaskLocalBounds=Ei,d.addProgramDefines=Ih,d.alphaFrag=ag,d.alphaWgsl=Xa,d.applyMatrix=Af,d.applyProjectiveTransformationToPlane=bv,d.applyStyleParams=Bl,d.assignWithIgnore=fi,d.autoDetectEnvironment=eS,d.autoDetectRenderer=Xf,d.autoDetectSource=mx,d.basisTranscoderUrls=gs,d.bitmapFontCachePlugin=Yf,d.bitmapFontTextParser=us,d.bitmapFontXMLParser=Ea,d.bitmapFontXMLStringParser=Aa,d.blendTemplateFrag=tg,d.blendTemplateVert=eg,d.blendTemplateWgsl=rg,d.blockDataMap=_u,d.blurTemplateWgsl=mg,d.boundsPool=Lt,d.browserExt=z2,d.buildAdaptiveBezier=Fo,d.buildAdaptiveQuadratic=lp,d.buildArc=ko,d.buildArcTo=up,d.buildArcToSvg=hp,d.buildCircle=Zt,d.buildContextBatches=$d,d.buildEllipse=Rd,d.buildGeometryFromPath=vw,d.buildInstructions=p_,d.buildLine=Bd,d.buildPolygon=fo,d.buildRectangle=mo,d.buildRoundedRectangle=Md,d.buildSimpleUvs=ao,d.buildTriangle=go,d.buildUvs=oo,d.cacheTextureArray=Zf,d.calculateProjection=F_,d.checkChildrenDidChange=gn,d.checkDataUrl=we,d.checkExtension=Bt,d.checkMaxIfStatementsInShader=_h,d.childrenHelperMixin=sc,d.cleanArray=Gb,d.cleanHash=Ob,d.clearList=Hs,d.closePointEps=Cd,d.collectAllRenderables=Qr,d.collectRenderGroups=Ll,d.color32BitToUniform=We,d.colorBit=Ci,d.colorBitGl=Oi,d.colorMatrixFilterFrag=Eg,d.colorMatrixFilterWgsl=Wa,d.colorToUniform=S1,d.compareModeToGlCompare=cb,d.compileHighShader=Qh,d.compileHighShaderGl=Jh,d.compileHighShaderGlProgram=Xe,d.compileHighShaderGpuProgram=He,d.compileHooks=Qn,d.compileInputs=Jn,d.compileOutputs=Zh,d.compileShader=Al,d.compute2DProjection=Tv,d.convertFormatIfRequired=I2,d.convertToList=Gt,d.copySearchParams=vi,d.createIdFromString=Le,d.createIndicesForQuads=wo,d.createLevelBuffers=p2,d.createLevelBuffersFromKTX=F2,d.createStringVariations=jc,d.createTexture=le,d.createUboElementsSTD40=R_,d.createUboElementsWGSL=Jb,d.createUboSyncFunction=vl,d.createUboSyncFunctionSTD40=B_,d.createUboSyncFunctionWGSL=ev,d.crossOrigin=wm,d.cullingMixin=Ju,d.curveEps=lo,d.defaultFilterVert=xs,d.defaultValue=wl,d.definedProps=Nt,d.deprecation=no,d.detectAvif=Qf,d.detectBasis=l2,d.detectCompressed=H2,d.detectDefaults=tm,d.detectMp4=em,d.detectOgv=rm,d.detectVideoAlphaMode=$n,d.detectWebm=im,d.detectWebp=sm,d.determineCrossOrigin=Mm,d.displacementFrag=wg,d.displacementVert=Rg,d.displacementWgsl=Ya,d.earcut=kd,d.effectsMixin=uc,d.ensureAttributes=cl,d.ensureIsBuffer=Vn,d.ensureOptions=Bs,d.ensurePrecision=Fh,d.ensureTextStyle=mR,d.executeInstructions=kl,d.extensions=D,d.extractAttributesFromGlProgram=W_,d.extractAttributesFromGpuProgram=jh,d.extractFontFamilies=sf,d.extractStructAndGroups=Mi,d.fastCopy=wi,d.findHooksRx=Yh,d.findMixin=cc,d.fontStringFromTextStyle=Ir,d.formatShader=oA,d.fragmentGPUTemplate=id,d.fragmentGlTemplate=nd,d.generateArraySyncSTD40=G_,d.generateArraySyncWGSL=tv,d.generateBlurFragSource=dg,d.generateBlurGlProgram=fg,d.generateBlurProgram=gg,d.generateBlurVertSource=pg,d.generateGPULayout=sA,d.generateGpuLayoutGroups=zh,d.generateLayout=nA,d.generateLayoutHash=Vh,d.generateParticleUpdateFunction=jd,d.generateProgram=Q_,d.generateShaderSyncCode=X_,d.generateTextStyleKey=Ho,d.generateTextureBatchBit=Gi,d.generateTextureBatchBitGl=Bi,d.generateUID=cw,d.generateUniformsSync=eb,d.getAdjustedBlendModeBlend=$e,d.getAttributeInfoFromFormat=qt,d.getBatchSamplersUniformGroup=Ii,d.getBitmapTextLayout=Jo,d.getCanvasBoundingBox=ip,d.getCanvasFillStyle=Fr,d.getCanvasTexture=Tl,d.getDefaultUniformValue=hd,d.getFastGlobalBounds=Ff,d.getFontCss=of,d.getFontFamilyName=dm,d.getGeometryBounds=Ch,d.getGlTypeFromFormat=T_,d.getGlobalBounds=fr,d.getGlobalRenderableBounds=Df,d.getLocalBounds=pi,d.getMatrixRelativeToParent=In,d.getMaxFragmentPrecision=Bh,d.getMaxTexturesPerBatch=ve,d.getOrientationOfPoints=Od,d.getParent=pc,d.getPo2TextureFromSource=jo,d.getResolutionOfUrl=hs,d.getSVGUrl=af,d.getSupportedCompressedTextureFormats=Da,d.getSupportedGPUCompressedTextureFormats=Ia,d.getSupportedGlCompressedTextureFormats=Ba,d.getSupportedTextureFormats=Vr,d.getTemporaryCanvasFromImage=lf,d.getTestContext=Xn,d.getTextureBatchBindGroup=Pi,d.getTextureDefaultMatrix=tR,d.getTextureFormatFromKTXTexture=k2,d.getUboData=Y_,d.getUniformData=K_,d.getUrlExtension=Wc,d.glFormatToGPUFormat=Vm,d.glUploadBufferImageResource=ob,d.glUploadCompressedTextureResource=ab,d.glUploadImageResource=Ol,d.glUploadVideoResource=lb,d.globalUniformsBit=od,d.globalUniformsBitGl=ad,d.globalUniformsUBOBitGl=Fx,d.gpuFormatToBasisTranscoderFormat=m2,d.gpuFormatToKTXBasisTranscoderFormat=L2,d.gpuUploadBufferImageResource=ov,d.gpuUploadCompressedTextureResource=av,d.gpuUploadImageResource=bu,d.gpuUploadVideoResource=lv,d.groupD8=k,d.hasCachedCanvasTexture=BA,d.hslWgsl=XE,d.hslgl=Q2,d.hslgpu=J2,d.injectBits=to,d.insertVersion=Dh,d.isMobile=Gc,d.isPow2=Cn,d.isRenderingToScreen=k_,d.isSafari=Kp,d.isSingleItem=yr,d.isWebGLSupported=Lr,d.isWebGPUSupported=Nr,d.ktxTranscoderUrls=_s,d.loadBasis=d2,d.loadBasisOnWorker=Um,d.loadBitmapFont=Kf,d.loadDDS=T2,d.loadEnvironmentExtensions=ga,d.loadFontAsBase64=nf,d.loadFontCSS=oa,d.loadImageBitmap=Tm,d.loadJson=lm,d.loadKTX=M2,d.loadKTX2=B2,d.loadKTX2onWorker=jm,d.loadSVGImage=uf,d.loadSvg=_m,d.loadTextures=Ca,d.loadTxt=um,d.loadVideoTextures=Cm,d.loadWebFont=pm,d.localUniformBit=Je,d.localUniformBitGl=ns,d.localUniformBitGroup2=vf,d.localUniformMSDFBit=Dp,d.localUniformMSDFBitGl=Up,d.log2=H0,d.logDebugTexture=gR,d.logProgramError=Z_,d.logRenderGroupScene=ay,d.logScene=oy,d.mSDFBit=kp,d.mSDFBitGl=$p,d.mapFormatToGlFormat=hb,d.mapFormatToGlInternalFormat=fb,d.mapFormatToGlType=mb,d.mapGlToVertexFormat=V_,d.mapSize=NA,d.mapType=Rl,d.mapWebGLBlendModesToPixi=rb,d.maskFrag=Ug,d.maskVert=kg,d.maskWgsl=Za,d.matrixPool=$t,d.measureHtmlText=aa,d.measureMixin=fc,d.migrateFragmentFromV7toV8=$A,d.mipmapScaleModeToGlFilter=ub,d.mixColors=Hl,d.mixHexColors=Nl,d.mixStandardAnd32BitColors=iP,d.multiplyHexColors=Ad,d.nextPow2=_e,d.noiseFrag=Gg,d.noiseWgsl=Ka,d.nonCompressedFormats=Im,d.normalizeExtensionPriority=cr,d.nssvg=ia,d.nsxhtml=sa,d.onRenderMixin=mc,d.parseDDS=$m,d.parseFunctionBody=hw,d.parseKTX=Nm,d.particleData=Pu,d.particlesFrag=Wd,d.particlesVert=Yd,d.particlesWgsl=Ro,d.path=gt,d.pointInTriangle=Qa,d.preloadVideo=Rm,d.removeItems=fn,d.removeStructAndGroupDuplicates=Wh,d.resetUids=l0,d.resolveCharacters=Zo,d.resolveCompressedTextureUrl=N2,d.resolveJsonUrl=Om,d.resolveTextureUrl=Ga,d.resourceToTexture=mh,d.roundPixelsBit=je,d.roundPixelsBitGl=ze,d.roundedShapeArc=dp,d.roundedShapeQuadraticCurve=pp,d.sayHello=Cb,d.scaleModeToGlFilter=Gl,d.setBasisTranscoderPath=c2,d.setKTXTranscoderPath=O2,d.setPositions=Ef,d.setProgramName=Uh,d.setUvs=Pf,d.shapeBuilders=Rr,d.sortMixin=gc,d.spritesheetAsset=uh,d.squaredDistanceToLineSegment=Cr,d.stripVersion=kh,d.testImageFormat=Pa,d.testVideoFormat=cs,d.textStyleToCSS=qp,d.textureBit=h_,d.textureBitGl=d_,d.textureFrom=gh,d.tilingBit=yf,d.tilingBitGl=xf,d.toFillStyle=ne,d.toLocalGlobalMixin=_c,d.toStrokeStyle=Br,d.transformVertices=Ui,d.triangulateWithHoles=po,d.uboSyncFunctionsSTD40=yl,d.uboSyncFunctionsWGSL=O_,d.uid=Z,d.uniformParsers=ue,d.unpremultiplyAlpha=eP,d.unsafeEvalSupported=_a,d.updateLocalTransform=gw,d.updateQuadBounds=xr,d.updateRenderGroupTransform=_b,d.updateRenderGroupTransforms=Xl,d.updateTransformAndChildren=jl,d.updateTransformBackwards=mr,d.updateWorldTransform=_w,d.v8_0_0=Kx,d.v8_3_4=Ed,d.validFormats=bs,d.validateRenderables=vb,d.vertexGPUTemplate=rd,d.vertexGlTemplate=sd,d.viewportFromFrame=nw,d.vkFormatToGPUFormat=Wm,d.warn=jt,d.wrapModeToGlAddress=Ns,d}({});
|
|
2214
|
+
//# sourceMappingURL=pixi.min.js.map
|