pixi.js 7.3.0 → 7.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/pixi.js +99 -139
- package/dist/pixi.js.map +1 -1
- package/dist/pixi.min.js +58 -58
- package/dist/pixi.min.js.map +1 -1
- package/dist/pixi.min.mjs +57 -57
- package/dist/pixi.min.mjs.map +1 -1
- package/dist/pixi.mjs +99 -139
- package/dist/pixi.mjs.map +1 -1
- package/package.json +31 -31
package/dist/pixi.min.mjs
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* pixi.js - v7.3.
|
|
3
|
-
* Compiled
|
|
2
|
+
* pixi.js - v7.3.2
|
|
3
|
+
* Compiled Fri, 20 Oct 2023 15:28:31 UTC
|
|
4
4
|
*
|
|
5
5
|
* pixi.js is licensed under the MIT License.
|
|
6
6
|
* http://www.opensource.org/licenses/mit-license
|
|
7
|
-
*/var De=(i=>(i[i.WEBGL_LEGACY=0]="WEBGL_LEGACY",i[i.WEBGL=1]="WEBGL",i[i.WEBGL2=2]="WEBGL2",i))(De||{}),ro=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.WEBGL=1]="WEBGL",i[i.CANVAS=2]="CANVAS",i))(ro||{}),hr=(i=>(i[i.COLOR=16384]="COLOR",i[i.DEPTH=256]="DEPTH",i[i.STENCIL=1024]="STENCIL",i))(hr||{}),H=(i=>(i[i.NORMAL=0]="NORMAL",i[i.ADD=1]="ADD",i[i.MULTIPLY=2]="MULTIPLY",i[i.SCREEN=3]="SCREEN",i[i.OVERLAY=4]="OVERLAY",i[i.DARKEN=5]="DARKEN",i[i.LIGHTEN=6]="LIGHTEN",i[i.COLOR_DODGE=7]="COLOR_DODGE",i[i.COLOR_BURN=8]="COLOR_BURN",i[i.HARD_LIGHT=9]="HARD_LIGHT",i[i.SOFT_LIGHT=10]="SOFT_LIGHT",i[i.DIFFERENCE=11]="DIFFERENCE",i[i.EXCLUSION=12]="EXCLUSION",i[i.HUE=13]="HUE",i[i.SATURATION=14]="SATURATION",i[i.COLOR=15]="COLOR",i[i.LUMINOSITY=16]="LUMINOSITY",i[i.NORMAL_NPM=17]="NORMAL_NPM",i[i.ADD_NPM=18]="ADD_NPM",i[i.SCREEN_NPM=19]="SCREEN_NPM",i[i.NONE=20]="NONE",i[i.SRC_OVER=0]="SRC_OVER",i[i.SRC_IN=21]="SRC_IN",i[i.SRC_OUT=22]="SRC_OUT",i[i.SRC_ATOP=23]="SRC_ATOP",i[i.DST_OVER=24]="DST_OVER",i[i.DST_IN=25]="DST_IN",i[i.DST_OUT=26]="DST_OUT",i[i.DST_ATOP=27]="DST_ATOP",i[i.ERASE=26]="ERASE",i[i.SUBTRACT=28]="SUBTRACT",i[i.XOR=29]="XOR",i))(H||{}),zt=(i=>(i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN",i))(zt||{}),A=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(A||{}),je=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(je||{}),k=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(k||{}),P=(i=>(i[i.FLOAT=0]="FLOAT",i[i.INT=1]="INT",i[i.UINT=2]="UINT",i))(P||{}),ee=(i=>(i[i.NEAREST=0]="NEAREST",i[i.LINEAR=1]="LINEAR",i))(ee||{}),re=(i=>(i[i.CLAMP=33071]="CLAMP",i[i.REPEAT=10497]="REPEAT",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i))(re||{}),Kt=(i=>(i[i.OFF=0]="OFF",i[i.POW2=1]="POW2",i[i.ON=2]="ON",i[i.ON_MANUAL=3]="ON_MANUAL",i))(Kt||{}),bt=(i=>(i[i.NPM=0]="NPM",i[i.UNPACK=1]="UNPACK",i[i.PMA=2]="PMA",i[i.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",i[i.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",i[i.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",i))(bt||{}),Xt=(i=>(i[i.NO=0]="NO",i[i.YES=1]="YES",i[i.AUTO=2]="AUTO",i[i.BLEND=0]="BLEND",i[i.CLEAR=1]="CLEAR",i[i.BLIT=2]="BLIT",i))(Xt||{}),nn=(i=>(i[i.AUTO=0]="AUTO",i[i.MANUAL=1]="MANUAL",i))(nn||{}),It=(i=>(i.LOW="lowp",i.MEDIUM="mediump",i.HIGH="highp",i))(It||{}),ut=(i=>(i[i.NONE=0]="NONE",i[i.SCISSOR=1]="SCISSOR",i[i.STENCIL=2]="STENCIL",i[i.SPRITE=3]="SPRITE",i[i.COLOR=4]="COLOR",i))(ut||{}),Vh=(i=>(i[i.RED=1]="RED",i[i.GREEN=2]="GREEN",i[i.BLUE=4]="BLUE",i[i.ALPHA=8]="ALPHA",i))(Vh||{}),ht=(i=>(i[i.NONE=0]="NONE",i[i.LOW=2]="LOW",i[i.MEDIUM=4]="MEDIUM",i[i.HIGH=8]="HIGH",i))(ht||{}),Yt=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(Yt||{});const Xh={createCanvas:(i,t)=>{const e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>{var i;return(i=document.baseURI)!=null?i:window.location.href},getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")},O={ADAPTER:Xh,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var Oi=/iPhone/i,vn=/iPod/i,yn=/iPad/i,xn=/\biOS-universal(?:.+)Mac\b/i,Bi=/\bAndroid(?:.+)Mobile\b/i,bn=/Android/i,Be=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Ps=/Silk/i,Qt=/Windows Phone/i,Tn=/\bWindows(?:.+)ARM\b/i,En=/BlackBerry/i,An=/BB10/i,wn=/Opera Mini/i,Sn=/\b(CriOS|Chrome)(?:.+)Mobile/i,In=/Mobile(?:.+)Firefox\b/i,Rn=function(i){return typeof i!="undefined"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream=="undefined"};function jh(i){return function(t){return t.test(i)}}function Cn(i){var t={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator!="undefined"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?t.userAgent=i:i&&i.userAgent&&(t={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var e=t.userAgent,s=e.split("[FBAN");typeof s[1]!="undefined"&&(e=s[0]),s=e.split("Twitter"),typeof s[1]!="undefined"&&(e=s[0]);var r=jh(e),n={apple:{phone:r(Oi)&&!r(Qt),ipod:r(vn),tablet:!r(Oi)&&(r(yn)||Rn(t))&&!r(Qt),universal:r(xn),device:(r(Oi)||r(vn)||r(yn)||r(xn)||Rn(t))&&!r(Qt)},amazon:{phone:r(Be),tablet:!r(Be)&&r(Ps),device:r(Be)||r(Ps)},android:{phone:!r(Qt)&&r(Be)||!r(Qt)&&r(Bi),tablet:!r(Qt)&&!r(Be)&&!r(Bi)&&(r(Ps)||r(bn)),device:!r(Qt)&&(r(Be)||r(Ps)||r(Bi)||r(bn))||r(/\bokhttp\b/i)},windows:{phone:r(Qt),tablet:r(Tn),device:r(Qt)||r(Tn)},other:{blackberry:r(En),blackberry10:r(An),opera:r(wn),firefox:r(In),chrome:r(Sn),device:r(En)||r(An)||r(wn)||r(In)||r(Sn)},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 Pn;const zh=(Pn=Cn.default)!=null?Pn:Cn,Wt=zh(globalThis.navigator);O.RETINA_PREFIX=/@([0-9\.]+)x/;O.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Fi=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function no(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var an={exports:{}},Em=an.exports;(function(i){"use strict";var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function r(h,l,u){this.fn=h,this.context=l,this.once=u||!1}function n(h,l,u,c,d){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new r(u,c||h,d),p=e?e+l:l;return h._events[p]?h._events[p].fn?h._events[p]=[h._events[p],f]:h._events[p].push(f):(h._events[p]=f,h._eventsCount++),h}function a(h,l){--h._eventsCount===0?h._events=new s:delete h._events[l]}function o(){this._events=new s,this._eventsCount=0}o.prototype.eventNames=function(){var l=[],u,c;if(this._eventsCount===0)return l;for(c in u=this._events)t.call(u,c)&&l.push(e?c.slice(1):c);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(u)):l},o.prototype.listeners=function(l){var u=e?e+l:l,c=this._events[u];if(!c)return[];if(c.fn)return[c.fn];for(var d=0,f=c.length,p=new Array(f);d<f;d++)p[d]=c[d].fn;return p},o.prototype.listenerCount=function(l){var u=e?e+l:l,c=this._events[u];return c?c.fn?1:c.length:0},o.prototype.emit=function(l,u,c,d,f,p){var m=e?e+l:l;if(!this._events[m])return!1;var g=this._events[m],y=arguments.length,x,_;if(g.fn){switch(g.once&&this.removeListener(l,g.fn,void 0,!0),y){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,u),!0;case 3:return g.fn.call(g.context,u,c),!0;case 4:return g.fn.call(g.context,u,c,d),!0;case 5:return g.fn.call(g.context,u,c,d,f),!0;case 6:return g.fn.call(g.context,u,c,d,f,p),!0}for(_=1,x=new Array(y-1);_<y;_++)x[_-1]=arguments[_];g.fn.apply(g.context,x)}else{var v=g.length,T;for(_=0;_<v;_++)switch(g[_].once&&this.removeListener(l,g[_].fn,void 0,!0),y){case 1:g[_].fn.call(g[_].context);break;case 2:g[_].fn.call(g[_].context,u);break;case 3:g[_].fn.call(g[_].context,u,c);break;case 4:g[_].fn.call(g[_].context,u,c,d);break;default:if(!x)for(T=1,x=new Array(y-1);T<y;T++)x[T-1]=arguments[T];g[_].fn.apply(g[_].context,x)}}return!0},o.prototype.on=function(l,u,c){return n(this,l,u,c,!1)},o.prototype.once=function(l,u,c){return n(this,l,u,c,!0)},o.prototype.removeListener=function(l,u,c,d){var f=e?e+l:l;if(!this._events[f])return this;if(!u)return a(this,f),this;var p=this._events[f];if(p.fn)p.fn===u&&(!d||p.once)&&(!c||p.context===c)&&a(this,f);else{for(var m=0,g=[],y=p.length;m<y;m++)(p[m].fn!==u||d&&!p[m].once||c&&p[m].context!==c)&&g.push(p[m]);g.length?this._events[f]=g.length===1?g[0]:g:a(this,f)}return this},o.prototype.removeAllListeners=function(l){var u;return l?(u=e?e+l:l,this._events[u]&&a(this,u)):(this._events=new s,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=e,o.EventEmitter=o,i.exports=o})(an);var Wh=an.exports,Ke=no(Wh),bi={exports:{}},Am=bi.exports;bi.exports=Ti;var wm=bi.exports.default=Ti;function Ti(i,t,e){e=e||2;var s=t&&t.length,r=s?t[0]*e:i.length,n=ao(i,0,r,e,!0),a=[];if(!n||n.next===n.prev)return a;var o,h,l,u,c,d,f;if(s&&(n=Qh(i,t,n,e)),i.length>80*e){o=l=i[0],h=u=i[1];for(var p=e;p<r;p+=e)c=i[p],d=i[p+1],c<o&&(o=c),d<h&&(h=d),c>l&&(l=c),d>u&&(u=d);f=Math.max(l-o,u-h),f=f!==0?32767/f:0}return gs(n,a,e,o,h,f,0),a}function ao(i,t,e,s,r){var n,a;if(r===cr(i,t,e,s)>0)for(n=t;n<e;n+=s)a=Mn(n,i[n],i[n+1],a);else for(n=e-s;n>=t;n-=s)a=Mn(n,i[n],i[n+1],a);return a&&Ei(a,a.next)&&(vs(a),a=a.next),a}function Pe(i,t){if(!i)return i;t||(t=i);var e=i,s;do if(s=!1,!e.steiner&&(Ei(e,e.next)||st(e.prev,e,e.next)===0)){if(vs(e),e=t=e.prev,e===e.next)break;s=!0}else e=e.next;while(s||e!==t);return t}function gs(i,t,e,s,r,n,a){if(i){!a&&n&&il(i,s,r,n);for(var o=i,h,l;i.prev!==i.next;){if(h=i.prev,l=i.next,n?qh(i,s,r,n):Yh(i)){t.push(h.i/e|0),t.push(i.i/e|0),t.push(l.i/e|0),vs(i),i=l.next,o=l.next;continue}if(i=l,i===o){a?a===1?(i=Kh(Pe(i),t,e),gs(i,t,e,s,r,n,2)):a===2&&Zh(i,t,e,s,r,n):gs(Pe(i),t,e,s,r,n,1);break}}}}function Yh(i){var t=i.prev,e=i,s=i.next;if(st(t,e,s)>=0)return!1;for(var r=t.x,n=e.x,a=s.x,o=t.y,h=e.y,l=s.y,u=r<n?r<a?r:a:n<a?n:a,c=o<h?o<l?o:l:h<l?h:l,d=r>n?r>a?r:a:n>a?n:a,f=o>h?o>l?o:l:h>l?h:l,p=s.next;p!==t;){if(p.x>=u&&p.x<=d&&p.y>=c&&p.y<=f&&Ve(r,o,n,h,a,l,p.x,p.y)&&st(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function qh(i,t,e,s){var r=i.prev,n=i,a=i.next;if(st(r,n,a)>=0)return!1;for(var o=r.x,h=n.x,l=a.x,u=r.y,c=n.y,d=a.y,f=o<h?o<l?o:l:h<l?h:l,p=u<c?u<d?u:d:c<d?c:d,m=o>h?o>l?o:l:h>l?h:l,g=u>c?u>d?u:d:c>d?c:d,y=lr(f,p,t,e,s),x=lr(m,g,t,e,s),_=i.prevZ,v=i.nextZ;_&&_.z>=y&&v&&v.z<=x;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==r&&_!==a&&Ve(o,u,h,c,l,d,_.x,_.y)&&st(_.prev,_,_.next)>=0||(_=_.prevZ,v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==r&&v!==a&&Ve(o,u,h,c,l,d,v.x,v.y)&&st(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;_&&_.z>=y;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==r&&_!==a&&Ve(o,u,h,c,l,d,_.x,_.y)&&st(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;v&&v.z<=x;){if(v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==r&&v!==a&&Ve(o,u,h,c,l,d,v.x,v.y)&&st(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Kh(i,t,e){var s=i;do{var r=s.prev,n=s.next.next;!Ei(r,n)&&oo(r,s,s.next,n)&&_s(r,n)&&_s(n,r)&&(t.push(r.i/e|0),t.push(s.i/e|0),t.push(n.i/e|0),vs(s),vs(s.next),s=i=n),s=s.next}while(s!==i);return Pe(s)}function Zh(i,t,e,s,r,n){var a=i;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&al(a,o)){var h=ho(a,o);a=Pe(a,a.next),h=Pe(h,h.next),gs(a,t,e,s,r,n,0),gs(h,t,e,s,r,n,0);return}o=o.next}a=a.next}while(a!==i)}function Qh(i,t,e,s){var r=[],n,a,o,h,l;for(n=0,a=t.length;n<a;n++)o=t[n]*s,h=n<a-1?t[n+1]*s:i.length,l=ao(i,o,h,s,!1),l===l.next&&(l.steiner=!0),r.push(nl(l));for(r.sort(Jh),n=0;n<r.length;n++)e=tl(r[n],e);return e}function Jh(i,t){return i.x-t.x}function tl(i,t){var e=el(i,t);if(!e)return t;var s=ho(e,i);return Pe(s,s.next),Pe(e,e.next)}function el(i,t){var e=t,s=i.x,r=i.y,n=-1/0,a;do{if(r<=e.y&&r>=e.next.y&&e.next.y!==e.y){var o=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(o<=s&&o>n&&(n=o,a=e.x<e.next.x?e:e.next,o===s))return a}e=e.next}while(e!==t);if(!a)return null;var h=a,l=a.x,u=a.y,c=1/0,d;e=a;do s>=e.x&&e.x>=l&&s!==e.x&&Ve(r<u?s:n,r,l,u,r<u?n:s,r,e.x,e.y)&&(d=Math.abs(r-e.y)/(s-e.x),_s(e,i)&&(d<c||d===c&&(e.x>a.x||e.x===a.x&&sl(a,e)))&&(a=e,c=d)),e=e.next;while(e!==h);return a}function sl(i,t){return st(i.prev,i,t.prev)<0&&st(t.next,i,i.next)<0}function il(i,t,e,s){var r=i;do r.z===0&&(r.z=lr(r.x,r.y,t,e,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,rl(r)}function rl(i){var t,e,s,r,n,a,o,h,l=1;do{for(e=i,i=null,n=null,a=0;e;){for(a++,s=e,o=0,t=0;t<l&&(o++,s=s.nextZ,!!s);t++);for(h=l;o>0||h>0&&s;)o!==0&&(h===0||!s||e.z<=s.z)?(r=e,e=e.nextZ,o--):(r=s,s=s.nextZ,h--),n?n.nextZ=r:i=r,r.prevZ=n,n=r;e=s}n.nextZ=null,l*=2}while(a>1);return i}function lr(i,t,e,s,r){return i=(i-e)*r|0,t=(t-s)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function nl(i){var t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function Ve(i,t,e,s,r,n,a,o){return(r-a)*(t-o)>=(i-a)*(n-o)&&(i-a)*(s-o)>=(e-a)*(t-o)&&(e-a)*(n-o)>=(r-a)*(s-o)}function al(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!ol(i,t)&&(_s(i,t)&&_s(t,i)&&hl(i,t)&&(st(i.prev,i,t.prev)||st(i,t.prev,t))||Ei(i,t)&&st(i.prev,i,i.next)>0&&st(t.prev,t,t.next)>0)}function st(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function Ei(i,t){return i.x===t.x&&i.y===t.y}function oo(i,t,e,s){var r=Ds(st(i,t,e)),n=Ds(st(i,t,s)),a=Ds(st(e,s,i)),o=Ds(st(e,s,t));return!!(r!==n&&a!==o||r===0&&Ms(i,e,t)||n===0&&Ms(i,s,t)||a===0&&Ms(e,i,s)||o===0&&Ms(e,t,s))}function Ms(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function Ds(i){return i>0?1:i<0?-1:0}function ol(i,t){var e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&oo(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function _s(i,t){return st(i.prev,i,i.next)<0?st(i,t,i.next)>=0&&st(i,i.prev,t)>=0:st(i,t,i.prev)<0||st(i,i.next,t)<0}function hl(i,t){var e=i,s=!1,r=(i.x+t.x)/2,n=(i.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&r<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(s=!s),e=e.next;while(e!==i);return s}function ho(i,t){var e=new ur(i.i,i.x,i.y),s=new ur(t.i,t.x,t.y),r=i.next,n=t.prev;return i.next=t,t.prev=i,e.next=r,r.prev=e,s.next=e,e.prev=s,n.next=s,s.prev=n,s}function Mn(i,t,e,s){var r=new ur(i,t,e);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function vs(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function ur(i,t,e){this.i=i,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Ti.deviation=function(i,t,e,s){var r=t&&t.length,n=r?t[0]*e:i.length,a=Math.abs(cr(i,0,n,e));if(r)for(var o=0,h=t.length;o<h;o++){var l=t[o]*e,u=o<h-1?t[o+1]*e:i.length;a-=Math.abs(cr(i,l,u,e))}var c=0;for(o=0;o<s.length;o+=3){var d=s[o]*e,f=s[o+1]*e,p=s[o+2]*e;c+=Math.abs((i[d]-i[p])*(i[f+1]-i[d+1])-(i[d]-i[f])*(i[p+1]-i[d+1]))}return a===0&&c===0?0:Math.abs((c-a)/a)};function cr(i,t,e,s){for(var r=0,n=t,a=e-s;n<e;n+=s)r+=(i[a]-i[n])*(i[n+1]+i[a+1]),a=n;return r}Ti.flatten=function(i){for(var t=i[0][0].length,e={vertices:[],holes:[],dimensions:t},s=0,r=0;r<i.length;r++){for(var n=0;n<i[r].length;n++)for(var a=0;a<t;a++)e.vertices.push(i[r][n][a]);r>0&&(s+=i[r-1].length,e.holes.push(s))}return e};var ll=bi.exports,lo=no(ll),ws={},oi={exports:{}};/*! https://mths.be/punycode v1.3.2 by @mathias */var Sm=oi.exports;(function(i,t){(function(e){var s=t&&!t.nodeType&&t,r=i&&!i.nodeType&&i,n=typeof Fi=="object"&&Fi;(n.global===n||n.window===n||n.self===n)&&(e=n);var a,o=2147483647,h=36,l=1,u=26,c=38,d=700,f=72,p=128,m="-",g=/^xn--/,y=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=h-l,T=Math.floor,B=String.fromCharCode,w;function E(R){throw RangeError(_[R])}function M(R,I){for(var Y=R.length,Z=[];Y--;)Z[Y]=I(R[Y]);return Z}function U(R,I){var Y=R.split("@"),Z="";Y.length>1&&(Z=Y[0]+"@",R=Y[1]),R=R.replace(x,".");var Q=R.split("."),ct=M(Q,I).join(".");return Z+ct}function W(R){for(var I=[],Y=0,Z=R.length,Q,ct;Y<Z;)Q=R.charCodeAt(Y++),Q>=55296&&Q<=56319&&Y<Z?(ct=R.charCodeAt(Y++),(ct&64512)==56320?I.push(((Q&1023)<<10)+(ct&1023)+65536):(I.push(Q),Y--)):I.push(Q);return I}function F(R){return M(R,function(I){var Y="";return I>65535&&(I-=65536,Y+=B(I>>>10&1023|55296),I=56320|I&1023),Y+=B(I),Y}).join("")}function b(R){return R-48<10?R-22:R-65<26?R-65:R-97<26?R-97:h}function S(R,I){return R+22+75*(R<26)-((I!=0)<<5)}function G(R,I,Y){var Z=0;for(R=Y?T(R/d):R>>1,R+=T(R/I);R>v*u>>1;Z+=h)R=T(R/v);return T(Z+(v+1)*R/(R+c))}function z(R){var I=[],Y=R.length,Z,Q=0,ct=p,at=f,dt,_t,Tt,pt,J,ot,lt,kt,Gt;for(dt=R.lastIndexOf(m),dt<0&&(dt=0),_t=0;_t<dt;++_t)R.charCodeAt(_t)>=128&&E("not-basic"),I.push(R.charCodeAt(_t));for(Tt=dt>0?dt+1:0;Tt<Y;){for(pt=Q,J=1,ot=h;Tt>=Y&&E("invalid-input"),lt=b(R.charCodeAt(Tt++)),(lt>=h||lt>T((o-Q)/J))&&E("overflow"),Q+=lt*J,kt=ot<=at?l:ot>=at+u?u:ot-at,!(lt<kt);ot+=h)Gt=h-kt,J>T(o/Gt)&&E("overflow"),J*=Gt;Z=I.length+1,at=G(Q-pt,Z,pt==0),T(Q/Z)>o-ct&&E("overflow"),ct+=T(Q/Z),Q%=Z,I.splice(Q++,0,ct)}return F(I)}function $(R){var I,Y,Z,Q,ct,at,dt,_t,Tt,pt,J,ot=[],lt,kt,Gt,Qe;for(R=W(R),lt=R.length,I=p,Y=0,ct=f,at=0;at<lt;++at)J=R[at],J<128&&ot.push(B(J));for(Z=Q=ot.length,Q&&ot.push(m);Z<lt;){for(dt=o,at=0;at<lt;++at)J=R[at],J>=I&&J<dt&&(dt=J);for(kt=Z+1,dt-I>T((o-Y)/kt)&&E("overflow"),Y+=(dt-I)*kt,I=dt,at=0;at<lt;++at)if(J=R[at],J<I&&++Y>o&&E("overflow"),J==I){for(_t=Y,Tt=h;pt=Tt<=ct?l:Tt>=ct+u?u:Tt-ct,!(_t<pt);Tt+=h)Qe=_t-pt,Gt=h-pt,ot.push(B(S(pt+Qe%Gt,0))),_t=T(Qe/Gt);ot.push(B(S(_t,0))),ct=G(Y,kt,Z==Q),Y=0,++Z}++Y,++I}return ot.join("")}function V(R){return U(R,function(I){return g.test(I)?z(I.slice(4).toLowerCase()):I})}function rt(R){return U(R,function(I){return y.test(I)?"xn--"+$(I):I})}if(a={version:"1.3.2",ucs2:{decode:W,encode:F},decode:z,encode:$,toASCII:rt,toUnicode:V},s&&r)if(i.exports==s)r.exports=a;else for(w in a)a.hasOwnProperty(w)&&(s[w]=a[w]);else e.punycode=a})(Fi)})(oi,oi.exports);var ul=oi.exports;var cl={isString:function(i){return typeof i=="string"},isObject:function(i){return typeof i=="object"&&i!==null},isNull:function(i){return i===null},isNullOrUndefined:function(i){return i==null}};var ys={};function dl(i,t){return Object.prototype.hasOwnProperty.call(i,t)}var fl=function(i,t,e,s){t=t||"&",e=e||"=";var r={};if(typeof i!="string"||i.length===0)return r;var n=/\+/g;i=i.split(t);var a=1e3;s&&typeof s.maxKeys=="number"&&(a=s.maxKeys);var o=i.length;a>0&&o>a&&(o=a);for(var h=0;h<o;++h){var l=i[h].replace(n,"%20"),u=l.indexOf(e),c,d,f,p;u>=0?(c=l.substr(0,u),d=l.substr(u+1)):(c=l,d=""),f=decodeURIComponent(c),p=decodeURIComponent(d),dl(r,f)?Array.isArray(r[f])?r[f].push(p):r[f]=[r[f],p]:r[f]=p}return r};var Je=function(i){switch(typeof i){case"string":return i;case"boolean":return i?"true":"false";case"number":return isFinite(i)?i:"";default:return""}},pl=function(i,t,e,s){return t=t||"&",e=e||"=",i===null&&(i=void 0),typeof i=="object"?Object.keys(i).map(function(r){var n=encodeURIComponent(Je(r))+e;return Array.isArray(i[r])?i[r].map(function(a){return n+encodeURIComponent(Je(a))}).join(t):n+encodeURIComponent(Je(i[r]))}).join(t):s?encodeURIComponent(Je(s))+e+encodeURIComponent(Je(i)):""};var ml,gl,Im=ys.decode=gl=ys.parse=fl,Rm=ys.encode=ml=ys.stringify=pl,_l=ul,jt=cl,vl=ws.parse=Ss,yl=ws.resolve=Pl,Cm=ws.resolveObject=Ml,xl=ws.format=Cl,Pm=ws.Url=Ct;function Ct(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var bl=/^([a-z0-9.+-]+:)/i,Tl=/:[0-9]*$/,El=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Al=["<",">",'"',"`"," ","\r",`
|
|
8
|
-
`," "],
|
|
7
|
+
*/var De=(i=>(i[i.WEBGL_LEGACY=0]="WEBGL_LEGACY",i[i.WEBGL=1]="WEBGL",i[i.WEBGL2=2]="WEBGL2",i))(De||{}),ro=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.WEBGL=1]="WEBGL",i[i.CANVAS=2]="CANVAS",i))(ro||{}),hr=(i=>(i[i.COLOR=16384]="COLOR",i[i.DEPTH=256]="DEPTH",i[i.STENCIL=1024]="STENCIL",i))(hr||{}),H=(i=>(i[i.NORMAL=0]="NORMAL",i[i.ADD=1]="ADD",i[i.MULTIPLY=2]="MULTIPLY",i[i.SCREEN=3]="SCREEN",i[i.OVERLAY=4]="OVERLAY",i[i.DARKEN=5]="DARKEN",i[i.LIGHTEN=6]="LIGHTEN",i[i.COLOR_DODGE=7]="COLOR_DODGE",i[i.COLOR_BURN=8]="COLOR_BURN",i[i.HARD_LIGHT=9]="HARD_LIGHT",i[i.SOFT_LIGHT=10]="SOFT_LIGHT",i[i.DIFFERENCE=11]="DIFFERENCE",i[i.EXCLUSION=12]="EXCLUSION",i[i.HUE=13]="HUE",i[i.SATURATION=14]="SATURATION",i[i.COLOR=15]="COLOR",i[i.LUMINOSITY=16]="LUMINOSITY",i[i.NORMAL_NPM=17]="NORMAL_NPM",i[i.ADD_NPM=18]="ADD_NPM",i[i.SCREEN_NPM=19]="SCREEN_NPM",i[i.NONE=20]="NONE",i[i.SRC_OVER=0]="SRC_OVER",i[i.SRC_IN=21]="SRC_IN",i[i.SRC_OUT=22]="SRC_OUT",i[i.SRC_ATOP=23]="SRC_ATOP",i[i.DST_OVER=24]="DST_OVER",i[i.DST_IN=25]="DST_IN",i[i.DST_OUT=26]="DST_OUT",i[i.DST_ATOP=27]="DST_ATOP",i[i.ERASE=26]="ERASE",i[i.SUBTRACT=28]="SUBTRACT",i[i.XOR=29]="XOR",i))(H||{}),zt=(i=>(i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN",i))(zt||{}),E=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(E||{}),je=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(je||{}),U=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(U||{}),M=(i=>(i[i.FLOAT=0]="FLOAT",i[i.INT=1]="INT",i[i.UINT=2]="UINT",i))(M||{}),ee=(i=>(i[i.NEAREST=0]="NEAREST",i[i.LINEAR=1]="LINEAR",i))(ee||{}),re=(i=>(i[i.CLAMP=33071]="CLAMP",i[i.REPEAT=10497]="REPEAT",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i))(re||{}),Kt=(i=>(i[i.OFF=0]="OFF",i[i.POW2=1]="POW2",i[i.ON=2]="ON",i[i.ON_MANUAL=3]="ON_MANUAL",i))(Kt||{}),bt=(i=>(i[i.NPM=0]="NPM",i[i.UNPACK=1]="UNPACK",i[i.PMA=2]="PMA",i[i.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",i[i.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",i[i.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",i))(bt||{}),Xt=(i=>(i[i.NO=0]="NO",i[i.YES=1]="YES",i[i.AUTO=2]="AUTO",i[i.BLEND=0]="BLEND",i[i.CLEAR=1]="CLEAR",i[i.BLIT=2]="BLIT",i))(Xt||{}),nn=(i=>(i[i.AUTO=0]="AUTO",i[i.MANUAL=1]="MANUAL",i))(nn||{}),It=(i=>(i.LOW="lowp",i.MEDIUM="mediump",i.HIGH="highp",i))(It||{}),ct=(i=>(i[i.NONE=0]="NONE",i[i.SCISSOR=1]="SCISSOR",i[i.STENCIL=2]="STENCIL",i[i.SPRITE=3]="SPRITE",i[i.COLOR=4]="COLOR",i))(ct||{}),Xh=(i=>(i[i.RED=1]="RED",i[i.GREEN=2]="GREEN",i[i.BLUE=4]="BLUE",i[i.ALPHA=8]="ALPHA",i))(Xh||{}),ht=(i=>(i[i.NONE=0]="NONE",i[i.LOW=2]="LOW",i[i.MEDIUM=4]="MEDIUM",i[i.HIGH=8]="HIGH",i))(ht||{}),Yt=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(Yt||{});const jh={createCanvas:(i,t)=>{const e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>{var i;return(i=document.baseURI)!=null?i:window.location.href},getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")},D={ADAPTER:jh,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var Oi=/iPhone/i,vn=/iPod/i,yn=/iPad/i,xn=/\biOS-universal(?:.+)Mac\b/i,Bi=/\bAndroid(?:.+)Mobile\b/i,bn=/Android/i,Be=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Ps=/Silk/i,Qt=/Windows Phone/i,Tn=/\bWindows(?:.+)ARM\b/i,En=/BlackBerry/i,An=/BB10/i,wn=/Opera Mini/i,Sn=/\b(CriOS|Chrome)(?:.+)Mobile/i,In=/Mobile(?:.+)Firefox\b/i,Rn=function(i){return typeof i!="undefined"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream=="undefined"};function zh(i){return function(t){return t.test(i)}}function Cn(i){var t={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator!="undefined"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?t.userAgent=i:i&&i.userAgent&&(t={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var e=t.userAgent,s=e.split("[FBAN");typeof s[1]!="undefined"&&(e=s[0]),s=e.split("Twitter"),typeof s[1]!="undefined"&&(e=s[0]);var r=zh(e),n={apple:{phone:r(Oi)&&!r(Qt),ipod:r(vn),tablet:!r(Oi)&&(r(yn)||Rn(t))&&!r(Qt),universal:r(xn),device:(r(Oi)||r(vn)||r(yn)||r(xn)||Rn(t))&&!r(Qt)},amazon:{phone:r(Be),tablet:!r(Be)&&r(Ps),device:r(Be)||r(Ps)},android:{phone:!r(Qt)&&r(Be)||!r(Qt)&&r(Bi),tablet:!r(Qt)&&!r(Be)&&!r(Bi)&&(r(Ps)||r(bn)),device:!r(Qt)&&(r(Be)||r(Ps)||r(Bi)||r(bn))||r(/\bokhttp\b/i)},windows:{phone:r(Qt),tablet:r(Tn),device:r(Qt)||r(Tn)},other:{blackberry:r(En),blackberry10:r(An),opera:r(wn),firefox:r(In),chrome:r(Sn),device:r(En)||r(An)||r(wn)||r(In)||r(Sn)},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 Pn;const Wh=(Pn=Cn.default)!=null?Pn:Cn,Wt=Wh(globalThis.navigator);D.RETINA_PREFIX=/@([0-9\.]+)x/;D.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Fi=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function no(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var an={exports:{}},Sm=an.exports;(function(i){"use strict";var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function r(h,l,u){this.fn=h,this.context=l,this.once=u||!1}function n(h,l,u,c,d){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new r(u,c||h,d),p=e?e+l:l;return h._events[p]?h._events[p].fn?h._events[p]=[h._events[p],f]:h._events[p].push(f):(h._events[p]=f,h._eventsCount++),h}function a(h,l){--h._eventsCount===0?h._events=new s:delete h._events[l]}function o(){this._events=new s,this._eventsCount=0}o.prototype.eventNames=function(){var l=[],u,c;if(this._eventsCount===0)return l;for(c in u=this._events)t.call(u,c)&&l.push(e?c.slice(1):c);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(u)):l},o.prototype.listeners=function(l){var u=e?e+l:l,c=this._events[u];if(!c)return[];if(c.fn)return[c.fn];for(var d=0,f=c.length,p=new Array(f);d<f;d++)p[d]=c[d].fn;return p},o.prototype.listenerCount=function(l){var u=e?e+l:l,c=this._events[u];return c?c.fn?1:c.length:0},o.prototype.emit=function(l,u,c,d,f,p){var m=e?e+l:l;if(!this._events[m])return!1;var g=this._events[m],v=arguments.length,x,_;if(g.fn){switch(g.once&&this.removeListener(l,g.fn,void 0,!0),v){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,u),!0;case 3:return g.fn.call(g.context,u,c),!0;case 4:return g.fn.call(g.context,u,c,d),!0;case 5:return g.fn.call(g.context,u,c,d,f),!0;case 6:return g.fn.call(g.context,u,c,d,f,p),!0}for(_=1,x=new Array(v-1);_<v;_++)x[_-1]=arguments[_];g.fn.apply(g.context,x)}else{var y=g.length,T;for(_=0;_<y;_++)switch(g[_].once&&this.removeListener(l,g[_].fn,void 0,!0),v){case 1:g[_].fn.call(g[_].context);break;case 2:g[_].fn.call(g[_].context,u);break;case 3:g[_].fn.call(g[_].context,u,c);break;case 4:g[_].fn.call(g[_].context,u,c,d);break;default:if(!x)for(T=1,x=new Array(v-1);T<v;T++)x[T-1]=arguments[T];g[_].fn.apply(g[_].context,x)}}return!0},o.prototype.on=function(l,u,c){return n(this,l,u,c,!1)},o.prototype.once=function(l,u,c){return n(this,l,u,c,!0)},o.prototype.removeListener=function(l,u,c,d){var f=e?e+l:l;if(!this._events[f])return this;if(!u)return a(this,f),this;var p=this._events[f];if(p.fn)p.fn===u&&(!d||p.once)&&(!c||p.context===c)&&a(this,f);else{for(var m=0,g=[],v=p.length;m<v;m++)(p[m].fn!==u||d&&!p[m].once||c&&p[m].context!==c)&&g.push(p[m]);g.length?this._events[f]=g.length===1?g[0]:g:a(this,f)}return this},o.prototype.removeAllListeners=function(l){var u;return l?(u=e?e+l:l,this._events[u]&&a(this,u)):(this._events=new s,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=e,o.EventEmitter=o,i.exports=o})(an);var Yh=an.exports,Ke=no(Yh),bi={exports:{}},Im=bi.exports;bi.exports=Ti;var Rm=bi.exports.default=Ti;function Ti(i,t,e){e=e||2;var s=t&&t.length,r=s?t[0]*e:i.length,n=ao(i,0,r,e,!0),a=[];if(!n||n.next===n.prev)return a;var o,h,l,u,c,d,f;if(s&&(n=Jh(i,t,n,e)),i.length>80*e){o=l=i[0],h=u=i[1];for(var p=e;p<r;p+=e)c=i[p],d=i[p+1],c<o&&(o=c),d<h&&(h=d),c>l&&(l=c),d>u&&(u=d);f=Math.max(l-o,u-h),f=f!==0?32767/f:0}return gs(n,a,e,o,h,f,0),a}function ao(i,t,e,s,r){var n,a;if(r===cr(i,t,e,s)>0)for(n=t;n<e;n+=s)a=Mn(n,i[n],i[n+1],a);else for(n=e-s;n>=t;n-=s)a=Mn(n,i[n],i[n+1],a);return a&&Ei(a,a.next)&&(vs(a),a=a.next),a}function Pe(i,t){if(!i)return i;t||(t=i);var e=i,s;do if(s=!1,!e.steiner&&(Ei(e,e.next)||st(e.prev,e,e.next)===0)){if(vs(e),e=t=e.prev,e===e.next)break;s=!0}else e=e.next;while(s||e!==t);return t}function gs(i,t,e,s,r,n,a){if(i){!a&&n&&rl(i,s,r,n);for(var o=i,h,l;i.prev!==i.next;){if(h=i.prev,l=i.next,n?Kh(i,s,r,n):qh(i)){t.push(h.i/e|0),t.push(i.i/e|0),t.push(l.i/e|0),vs(i),i=l.next,o=l.next;continue}if(i=l,i===o){a?a===1?(i=Zh(Pe(i),t,e),gs(i,t,e,s,r,n,2)):a===2&&Qh(i,t,e,s,r,n):gs(Pe(i),t,e,s,r,n,1);break}}}}function qh(i){var t=i.prev,e=i,s=i.next;if(st(t,e,s)>=0)return!1;for(var r=t.x,n=e.x,a=s.x,o=t.y,h=e.y,l=s.y,u=r<n?r<a?r:a:n<a?n:a,c=o<h?o<l?o:l:h<l?h:l,d=r>n?r>a?r:a:n>a?n:a,f=o>h?o>l?o:l:h>l?h:l,p=s.next;p!==t;){if(p.x>=u&&p.x<=d&&p.y>=c&&p.y<=f&&Ve(r,o,n,h,a,l,p.x,p.y)&&st(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Kh(i,t,e,s){var r=i.prev,n=i,a=i.next;if(st(r,n,a)>=0)return!1;for(var o=r.x,h=n.x,l=a.x,u=r.y,c=n.y,d=a.y,f=o<h?o<l?o:l:h<l?h:l,p=u<c?u<d?u:d:c<d?c:d,m=o>h?o>l?o:l:h>l?h:l,g=u>c?u>d?u:d:c>d?c:d,v=lr(f,p,t,e,s),x=lr(m,g,t,e,s),_=i.prevZ,y=i.nextZ;_&&_.z>=v&&y&&y.z<=x;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==r&&_!==a&&Ve(o,u,h,c,l,d,_.x,_.y)&&st(_.prev,_,_.next)>=0||(_=_.prevZ,y.x>=f&&y.x<=m&&y.y>=p&&y.y<=g&&y!==r&&y!==a&&Ve(o,u,h,c,l,d,y.x,y.y)&&st(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;_&&_.z>=v;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==r&&_!==a&&Ve(o,u,h,c,l,d,_.x,_.y)&&st(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;y&&y.z<=x;){if(y.x>=f&&y.x<=m&&y.y>=p&&y.y<=g&&y!==r&&y!==a&&Ve(o,u,h,c,l,d,y.x,y.y)&&st(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function Zh(i,t,e){var s=i;do{var r=s.prev,n=s.next.next;!Ei(r,n)&&oo(r,s,s.next,n)&&_s(r,n)&&_s(n,r)&&(t.push(r.i/e|0),t.push(s.i/e|0),t.push(n.i/e|0),vs(s),vs(s.next),s=i=n),s=s.next}while(s!==i);return Pe(s)}function Qh(i,t,e,s,r,n){var a=i;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&ol(a,o)){var h=ho(a,o);a=Pe(a,a.next),h=Pe(h,h.next),gs(a,t,e,s,r,n,0),gs(h,t,e,s,r,n,0);return}o=o.next}a=a.next}while(a!==i)}function Jh(i,t,e,s){var r=[],n,a,o,h,l;for(n=0,a=t.length;n<a;n++)o=t[n]*s,h=n<a-1?t[n+1]*s:i.length,l=ao(i,o,h,s,!1),l===l.next&&(l.steiner=!0),r.push(al(l));for(r.sort(tl),n=0;n<r.length;n++)e=el(r[n],e);return e}function tl(i,t){return i.x-t.x}function el(i,t){var e=sl(i,t);if(!e)return t;var s=ho(e,i);return Pe(s,s.next),Pe(e,e.next)}function sl(i,t){var e=t,s=i.x,r=i.y,n=-1/0,a;do{if(r<=e.y&&r>=e.next.y&&e.next.y!==e.y){var o=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(o<=s&&o>n&&(n=o,a=e.x<e.next.x?e:e.next,o===s))return a}e=e.next}while(e!==t);if(!a)return null;var h=a,l=a.x,u=a.y,c=1/0,d;e=a;do s>=e.x&&e.x>=l&&s!==e.x&&Ve(r<u?s:n,r,l,u,r<u?n:s,r,e.x,e.y)&&(d=Math.abs(r-e.y)/(s-e.x),_s(e,i)&&(d<c||d===c&&(e.x>a.x||e.x===a.x&&il(a,e)))&&(a=e,c=d)),e=e.next;while(e!==h);return a}function il(i,t){return st(i.prev,i,t.prev)<0&&st(t.next,i,i.next)<0}function rl(i,t,e,s){var r=i;do r.z===0&&(r.z=lr(r.x,r.y,t,e,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,nl(r)}function nl(i){var t,e,s,r,n,a,o,h,l=1;do{for(e=i,i=null,n=null,a=0;e;){for(a++,s=e,o=0,t=0;t<l&&(o++,s=s.nextZ,!!s);t++);for(h=l;o>0||h>0&&s;)o!==0&&(h===0||!s||e.z<=s.z)?(r=e,e=e.nextZ,o--):(r=s,s=s.nextZ,h--),n?n.nextZ=r:i=r,r.prevZ=n,n=r;e=s}n.nextZ=null,l*=2}while(a>1);return i}function lr(i,t,e,s,r){return i=(i-e)*r|0,t=(t-s)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function al(i){var t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function Ve(i,t,e,s,r,n,a,o){return(r-a)*(t-o)>=(i-a)*(n-o)&&(i-a)*(s-o)>=(e-a)*(t-o)&&(e-a)*(n-o)>=(r-a)*(s-o)}function ol(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!hl(i,t)&&(_s(i,t)&&_s(t,i)&&ll(i,t)&&(st(i.prev,i,t.prev)||st(i,t.prev,t))||Ei(i,t)&&st(i.prev,i,i.next)>0&&st(t.prev,t,t.next)>0)}function st(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function Ei(i,t){return i.x===t.x&&i.y===t.y}function oo(i,t,e,s){var r=Ds(st(i,t,e)),n=Ds(st(i,t,s)),a=Ds(st(e,s,i)),o=Ds(st(e,s,t));return!!(r!==n&&a!==o||r===0&&Ms(i,e,t)||n===0&&Ms(i,s,t)||a===0&&Ms(e,i,s)||o===0&&Ms(e,t,s))}function Ms(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function Ds(i){return i>0?1:i<0?-1:0}function hl(i,t){var e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&oo(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function _s(i,t){return st(i.prev,i,i.next)<0?st(i,t,i.next)>=0&&st(i,i.prev,t)>=0:st(i,t,i.prev)<0||st(i,i.next,t)<0}function ll(i,t){var e=i,s=!1,r=(i.x+t.x)/2,n=(i.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&r<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(s=!s),e=e.next;while(e!==i);return s}function ho(i,t){var e=new ur(i.i,i.x,i.y),s=new ur(t.i,t.x,t.y),r=i.next,n=t.prev;return i.next=t,t.prev=i,e.next=r,r.prev=e,s.next=e,e.prev=s,n.next=s,s.prev=n,s}function Mn(i,t,e,s){var r=new ur(i,t,e);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function vs(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function ur(i,t,e){this.i=i,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Ti.deviation=function(i,t,e,s){var r=t&&t.length,n=r?t[0]*e:i.length,a=Math.abs(cr(i,0,n,e));if(r)for(var o=0,h=t.length;o<h;o++){var l=t[o]*e,u=o<h-1?t[o+1]*e:i.length;a-=Math.abs(cr(i,l,u,e))}var c=0;for(o=0;o<s.length;o+=3){var d=s[o]*e,f=s[o+1]*e,p=s[o+2]*e;c+=Math.abs((i[d]-i[p])*(i[f+1]-i[d+1])-(i[d]-i[f])*(i[p+1]-i[d+1]))}return a===0&&c===0?0:Math.abs((c-a)/a)};function cr(i,t,e,s){for(var r=0,n=t,a=e-s;n<e;n+=s)r+=(i[a]-i[n])*(i[n+1]+i[a+1]),a=n;return r}Ti.flatten=function(i){for(var t=i[0][0].length,e={vertices:[],holes:[],dimensions:t},s=0,r=0;r<i.length;r++){for(var n=0;n<i[r].length;n++)for(var a=0;a<t;a++)e.vertices.push(i[r][n][a]);r>0&&(s+=i[r-1].length,e.holes.push(s))}return e};var ul=bi.exports,lo=no(ul),ws={},oi={exports:{}};/*! https://mths.be/punycode v1.3.2 by @mathias */var Cm=oi.exports;(function(i,t){(function(e){var s=t&&!t.nodeType&&t,r=i&&!i.nodeType&&i,n=typeof Fi=="object"&&Fi;(n.global===n||n.window===n||n.self===n)&&(e=n);var a,o=2147483647,h=36,l=1,u=26,c=38,d=700,f=72,p=128,m="-",g=/^xn--/,v=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=h-l,T=Math.floor,P=String.fromCharCode,w;function A(R){throw RangeError(_[R])}function B(R,I){for(var Y=R.length,Z=[];Y--;)Z[Y]=I(R[Y]);return Z}function k(R,I){var Y=R.split("@"),Z="";Y.length>1&&(Z=Y[0]+"@",R=Y[1]),R=R.replace(x,".");var Q=R.split("."),dt=B(Q,I).join(".");return Z+dt}function W(R){for(var I=[],Y=0,Z=R.length,Q,dt;Y<Z;)Q=R.charCodeAt(Y++),Q>=55296&&Q<=56319&&Y<Z?(dt=R.charCodeAt(Y++),(dt&64512)==56320?I.push(((Q&1023)<<10)+(dt&1023)+65536):(I.push(Q),Y--)):I.push(Q);return I}function F(R){return B(R,function(I){var Y="";return I>65535&&(I-=65536,Y+=P(I>>>10&1023|55296),I=56320|I&1023),Y+=P(I),Y}).join("")}function b(R){return R-48<10?R-22:R-65<26?R-65:R-97<26?R-97:h}function S(R,I){return R+22+75*(R<26)-((I!=0)<<5)}function G(R,I,Y){var Z=0;for(R=Y?T(R/d):R>>1,R+=T(R/I);R>y*u>>1;Z+=h)R=T(R/y);return T(Z+(y+1)*R/(R+c))}function z(R){var I=[],Y=R.length,Z,Q=0,dt=p,at=f,ft,vt,Tt,mt,J,ot,ut,kt,Gt;for(ft=R.lastIndexOf(m),ft<0&&(ft=0),vt=0;vt<ft;++vt)R.charCodeAt(vt)>=128&&A("not-basic"),I.push(R.charCodeAt(vt));for(Tt=ft>0?ft+1:0;Tt<Y;){for(mt=Q,J=1,ot=h;Tt>=Y&&A("invalid-input"),ut=b(R.charCodeAt(Tt++)),(ut>=h||ut>T((o-Q)/J))&&A("overflow"),Q+=ut*J,kt=ot<=at?l:ot>=at+u?u:ot-at,!(ut<kt);ot+=h)Gt=h-kt,J>T(o/Gt)&&A("overflow"),J*=Gt;Z=I.length+1,at=G(Q-mt,Z,mt==0),T(Q/Z)>o-dt&&A("overflow"),dt+=T(Q/Z),Q%=Z,I.splice(Q++,0,dt)}return F(I)}function $(R){var I,Y,Z,Q,dt,at,ft,vt,Tt,mt,J,ot=[],ut,kt,Gt,Qe;for(R=W(R),ut=R.length,I=p,Y=0,dt=f,at=0;at<ut;++at)J=R[at],J<128&&ot.push(P(J));for(Z=Q=ot.length,Q&&ot.push(m);Z<ut;){for(ft=o,at=0;at<ut;++at)J=R[at],J>=I&&J<ft&&(ft=J);for(kt=Z+1,ft-I>T((o-Y)/kt)&&A("overflow"),Y+=(ft-I)*kt,I=ft,at=0;at<ut;++at)if(J=R[at],J<I&&++Y>o&&A("overflow"),J==I){for(vt=Y,Tt=h;mt=Tt<=dt?l:Tt>=dt+u?u:Tt-dt,!(vt<mt);Tt+=h)Qe=vt-mt,Gt=h-mt,ot.push(P(S(mt+Qe%Gt,0))),vt=T(Qe/Gt);ot.push(P(S(vt,0))),dt=G(Y,kt,Z==Q),Y=0,++Z}++Y,++I}return ot.join("")}function V(R){return k(R,function(I){return g.test(I)?z(I.slice(4).toLowerCase()):I})}function rt(R){return k(R,function(I){return v.test(I)?"xn--"+$(I):I})}if(a={version:"1.3.2",ucs2:{decode:W,encode:F},decode:z,encode:$,toASCII:rt,toUnicode:V},s&&r)if(i.exports==s)r.exports=a;else for(w in a)a.hasOwnProperty(w)&&(s[w]=a[w]);else e.punycode=a})(Fi)})(oi,oi.exports);var cl=oi.exports;var dl={isString:function(i){return typeof i=="string"},isObject:function(i){return typeof i=="object"&&i!==null},isNull:function(i){return i===null},isNullOrUndefined:function(i){return i==null}};var ys={};function fl(i,t){return Object.prototype.hasOwnProperty.call(i,t)}var pl=function(i,t,e,s){t=t||"&",e=e||"=";var r={};if(typeof i!="string"||i.length===0)return r;var n=/\+/g;i=i.split(t);var a=1e3;s&&typeof s.maxKeys=="number"&&(a=s.maxKeys);var o=i.length;a>0&&o>a&&(o=a);for(var h=0;h<o;++h){var l=i[h].replace(n,"%20"),u=l.indexOf(e),c,d,f,p;u>=0?(c=l.substr(0,u),d=l.substr(u+1)):(c=l,d=""),f=decodeURIComponent(c),p=decodeURIComponent(d),fl(r,f)?Array.isArray(r[f])?r[f].push(p):r[f]=[r[f],p]:r[f]=p}return r};var Je=function(i){switch(typeof i){case"string":return i;case"boolean":return i?"true":"false";case"number":return isFinite(i)?i:"";default:return""}},ml=function(i,t,e,s){return t=t||"&",e=e||"=",i===null&&(i=void 0),typeof i=="object"?Object.keys(i).map(function(r){var n=encodeURIComponent(Je(r))+e;return Array.isArray(i[r])?i[r].map(function(a){return n+encodeURIComponent(Je(a))}).join(t):n+encodeURIComponent(Je(i[r]))}).join(t):s?encodeURIComponent(Je(s))+e+encodeURIComponent(Je(i)):""};var gl,_l,Pm=ys.decode=_l=ys.parse=pl,Mm=ys.encode=gl=ys.stringify=ml,vl=cl,jt=dl,yl=ws.parse=Ss,xl=ws.resolve=Ml,Dm=ws.resolveObject=Dl,bl=ws.format=Pl,Om=ws.Url=Ct;function Ct(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var Tl=/^([a-z0-9.+-]+:)/i,El=/:[0-9]*$/,Al=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,wl=["<",">",'"',"`"," ","\r",`
|
|
8
|
+
`," "],Sl=["{","}","|","\\","^","`"].concat(wl),dr=["'"].concat(Sl),Dn=["%","/","?",";","#"].concat(dr),On=["/","?","#"],Il=255,Bn=/^[+a-z0-9A-Z_-]{0,63}$/,Rl=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Cl={javascript:!0,"javascript:":!0},fr={javascript:!0,"javascript:":!0},ze={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},pr=ys;function Ss(i,t,e){if(i&&jt.isObject(i)&&i instanceof Ct)return i;var s=new Ct;return s.parse(i,t,e),s}Ct.prototype.parse=function(i,t,e){if(!jt.isString(i))throw new TypeError("Parameter 'url' must be a string, not "+typeof i);var s=i.indexOf("?"),r=s!==-1&&s<i.indexOf("#")?"?":"#",n=i.split(r),a=/\\/g;n[0]=n[0].replace(a,"/"),i=n.join(r);var o=i;if(o=o.trim(),!e&&i.split("#").length===1){var h=Al.exec(o);if(h)return this.path=o,this.href=o,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=pr.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=Tl.exec(o);if(l){l=l[0];var u=l.toLowerCase();this.protocol=u,o=o.substr(l.length)}if(e||l||o.match(/^\/\/[^@\/]+@[^@\/]+/)){var c=o.substr(0,2)==="//";c&&!(l&&fr[l])&&(o=o.substr(2),this.slashes=!0)}if(!fr[l]&&(c||l&&!ze[l])){for(var d=-1,f=0;f<On.length;f++){var p=o.indexOf(On[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,g;d===-1?g=o.lastIndexOf("@"):g=o.lastIndexOf("@",d),g!==-1&&(m=o.slice(0,g),o=o.slice(g+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<Dn.length;f++){var p=o.indexOf(Dn[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=o.length),this.host=o.slice(0,d),o=o.slice(d),this.parseHost(),this.hostname=this.hostname||"";var v=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!v)for(var x=this.hostname.split(/\./),f=0,_=x.length;f<_;f++){var y=x[f];if(y&&!y.match(Bn)){for(var T="",P=0,w=y.length;P<w;P++)y.charCodeAt(P)>127?T+="x":T+=y[P];if(!T.match(Bn)){var A=x.slice(0,f),B=x.slice(f+1),k=y.match(Rl);k&&(A.push(k[1]),B.unshift(k[2])),B.length&&(o="/"+B.join(".")+o),this.hostname=A.join(".");break}}}this.hostname.length>Il?this.hostname="":this.hostname=this.hostname.toLowerCase(),v||(this.hostname=vl.toASCII(this.hostname));var W=this.port?":"+this.port:"",F=this.hostname||"";this.host=F+W,this.href+=this.host,v&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),o[0]!=="/"&&(o="/"+o))}if(!Cl[u])for(var f=0,_=dr.length;f<_;f++){var b=dr[f];if(o.indexOf(b)!==-1){var S=encodeURIComponent(b);S===b&&(S=escape(b)),o=o.split(b).join(S)}}var G=o.indexOf("#");G!==-1&&(this.hash=o.substr(G),o=o.slice(0,G));var z=o.indexOf("?");if(z!==-1?(this.search=o.substr(z),this.query=o.substr(z+1),t&&(this.query=pr.parse(this.query)),o=o.slice(0,z)):t&&(this.search="",this.query={}),o&&(this.pathname=o),ze[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var W=this.pathname||"",$=this.search||"";this.path=W+$}return this.href=this.format(),this};function Pl(i){return jt.isString(i)&&(i=Ss(i)),i instanceof Ct?i.format():Ct.prototype.format.call(i)}Ct.prototype.format=function(){var i=this.auth||"";i&&(i=encodeURIComponent(i),i=i.replace(/%3A/i,":"),i+="@");var t=this.protocol||"",e=this.pathname||"",s=this.hash||"",r=!1,n="";this.host?r=i+this.host:this.hostname&&(r=i+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(r+=":"+this.port)),this.query&&jt.isObject(this.query)&&Object.keys(this.query).length&&(n=pr.stringify(this.query));var a=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||ze[t])&&r!==!1?(r="//"+(r||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):r||(r=""),s&&s.charAt(0)!=="#"&&(s="#"+s),a&&a.charAt(0)!=="?"&&(a="?"+a),e=e.replace(/[?#]/g,function(o){return encodeURIComponent(o)}),a=a.replace("#","%23"),t+r+e+a+s};function Ml(i,t){return Ss(i,!1,!0).resolve(t)}Ct.prototype.resolve=function(i){return this.resolveObject(Ss(i,!1,!0)).format()};function Dl(i,t){return i?Ss(i,!1,!0).resolveObject(t):t}Ct.prototype.resolveObject=function(i){if(jt.isString(i)){var t=new Ct;t.parse(i,!1,!0),i=t}for(var e=new Ct,s=Object.keys(this),r=0;r<s.length;r++){var n=s[r];e[n]=this[n]}if(e.hash=i.hash,i.href==="")return e.href=e.format(),e;if(i.slashes&&!i.protocol){for(var a=Object.keys(i),o=0;o<a.length;o++){var h=a[o];h!=="protocol"&&(e[h]=i[h])}return ze[e.protocol]&&e.hostname&&!e.pathname&&(e.path=e.pathname="/"),e.href=e.format(),e}if(i.protocol&&i.protocol!==e.protocol){if(!ze[i.protocol]){for(var l=Object.keys(i),u=0;u<l.length;u++){var c=l[u];e[c]=i[c]}return e.href=e.format(),e}if(e.protocol=i.protocol,!i.host&&!fr[i.protocol]){for(var _=(i.pathname||"").split("/");_.length&&!(i.host=_.shift()););i.host||(i.host=""),i.hostname||(i.hostname=""),_[0]!==""&&_.unshift(""),_.length<2&&_.unshift(""),e.pathname=_.join("/")}else e.pathname=i.pathname;if(e.search=i.search,e.query=i.query,e.host=i.host||"",e.auth=i.auth,e.hostname=i.hostname||i.host,e.port=i.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||i.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",m=i.host||i.pathname&&i.pathname.charAt(0)==="/",g=m||p||e.host&&i.pathname,v=g,x=e.pathname&&e.pathname.split("/")||[],_=i.pathname&&i.pathname.split("/")||[],y=e.protocol&&!ze[e.protocol];if(y&&(e.hostname="",e.port=null,e.host&&(x[0]===""?x[0]=e.host:x.unshift(e.host)),e.host="",i.protocol&&(i.hostname=null,i.port=null,i.host&&(_[0]===""?_[0]=i.host:_.unshift(i.host)),i.host=null),g=g&&(_[0]===""||x[0]==="")),m)e.host=i.host||i.host===""?i.host:e.host,e.hostname=i.hostname||i.hostname===""?i.hostname:e.hostname,e.search=i.search,e.query=i.query,x=_;else if(_.length)x||(x=[]),x.pop(),x=x.concat(_),e.search=i.search,e.query=i.query;else if(!jt.isNullOrUndefined(i.search)){if(y){e.hostname=e.host=x.shift();var T=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;T&&(e.auth=T.shift(),e.host=e.hostname=T.shift())}return e.search=i.search,e.query=i.query,(!jt.isNull(e.pathname)||!jt.isNull(e.search))&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!x.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var P=x.slice(-1)[0],w=(e.host||i.host||x.length>1)&&(P==="."||P==="..")||P==="",A=0,B=x.length;B>=0;B--)P=x[B],P==="."?x.splice(B,1):P===".."?(x.splice(B,1),A++):A&&(x.splice(B,1),A--);if(!g&&!v)for(;A--;A)x.unshift("..");g&&x[0]!==""&&(!x[0]||x[0].charAt(0)!=="/")&&x.unshift(""),w&&x.join("/").substr(-1)!=="/"&&x.push("");var k=x[0]===""||x[0]&&x[0].charAt(0)==="/";if(y){e.hostname=e.host=k?"":x.length?x.shift():"";var T=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;T&&(e.auth=T.shift(),e.host=e.hostname=T.shift())}return g=g||e.host&&x.length,g&&!k&&x.unshift(""),x.length?e.pathname=x.join("/"):(e.pathname=null,e.path=null),(!jt.isNull(e.pathname)||!jt.isNull(e.search))&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=i.auth||e.auth,e.slashes=e.slashes||i.slashes,e.href=e.format(),e};Ct.prototype.parseHost=function(){var i=this.host,t=El.exec(i);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),i=i.substr(0,i.length-t.length)),i&&(this.hostname=i)};const Fn={};function uo(i,t,e=3){if(Fn[t])return;let s=new Error().stack;typeof s=="undefined"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
9
9
|
Deprecated since v${i}`):(s=s.split(`
|
|
10
10
|
`).splice(e).join(`
|
|
11
11
|
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
|
|
12
12
|
Deprecated since v${i}`),console.warn(s),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
13
|
-
Deprecated since v${i}`),console.warn(s))),Fn[t]=!0}const Dl={get parse(){return vl},get format(){return xl},get resolve(){return yl}};function Dt(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function ts(i){return i.split("?")[0].split("#")[0]}function Ol(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Bl(i,t,e){return i.replace(new RegExp(Ol(t),"g"),e)}function Fl(i,t){let e="",s=0,r=-1,n=0,a=-1;for(let o=0;o<=i.length;++o){if(o<i.length)a=i.charCodeAt(o);else{if(a===47)break;a=47}if(a===47){if(!(r===o-1||n===1))if(r!==o-1&&n===2){if(e.length<2||s!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",s=0):(e=e.slice(0,h),s=e.length-1-e.lastIndexOf("/")),r=o,n=0;continue}}else if(e.length===2||e.length===1){e="",s=0,r=o,n=0;continue}}t&&(e.length>0?e+="/..":e="..",s=2)}else e.length>0?e+=`/${i.slice(r+1,o)}`:e=i.slice(r+1,o),s=o-r-1;r=o,n=0}else a===46&&n!==-1?++n:n=-1}return e}const vt={toPosix(i){return Bl(i,"\\","/")},isUrl(i){return/^https?:/.test(this.toPosix(i))},isDataUrl(i){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return/^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){Dt(i),i=this.toPosix(i);const t=/^file:\/\/\//.exec(i);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(Dt(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;const s=ts(this.toPosix(t!=null?t:O.ADAPTER.getBaseUrl())),r=ts(this.toPosix(e!=null?e:this.rootname(s)));return i=this.toPosix(i),i.startsWith("/")?vt.join(r,i.slice(1)):this.isAbsolute(i)?i:this.join(s,i)},normalize(i){if(Dt(i),i.length===0)return".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="";const e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));const s=i.endsWith("/");return i=Fl(i,!1),i.length>0&&s&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return Dt(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){var t;if(i.length===0)return".";let e;for(let s=0;s<i.length;++s){const r=i[s];if(Dt(r),r.length>0)if(e===void 0)e=r;else{const n=(t=i[s-1])!=null?t:"";this.extname(n)?e+=`/../${r}`:e+=`/${r}`}}return e===void 0?".":this.normalize(e)},dirname(i){if(Dt(i),i.length===0)return".";i=this.toPosix(i);let t=i.charCodeAt(0);const e=t===47;let s=-1,r=!0;const n=this.getProtocol(i),a=i;i=i.slice(n.length);for(let o=i.length-1;o>=1;--o)if(t=i.charCodeAt(o),t===47){if(!r){s=o;break}}else r=!1;return s===-1?e?"/":this.isUrl(a)?n+i:n:e&&s===1?"//":n+i.slice(0,s)},rootname(i){Dt(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){const e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/")}return t},basename(i,t){Dt(i),t&&Dt(t),i=ts(this.toPosix(i));let e=0,s=-1,r=!0,n;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return"";let a=t.length-1,o=-1;for(n=i.length-1;n>=0;--n){const h=i.charCodeAt(n);if(h===47){if(!r){e=n+1;break}}else o===-1&&(r=!1,o=n+1),a>=0&&(h===t.charCodeAt(a)?--a===-1&&(s=n):(a=-1,s=o))}return e===s?s=o:s===-1&&(s=i.length),i.slice(e,s)}for(n=i.length-1;n>=0;--n)if(i.charCodeAt(n)===47){if(!r){e=n+1;break}}else s===-1&&(r=!1,s=n+1);return s===-1?"":i.slice(e,s)},extname(i){Dt(i),i=ts(this.toPosix(i));let t=-1,e=0,s=-1,r=!0,n=0;for(let a=i.length-1;a>=0;--a){const o=i.charCodeAt(a);if(o===47){if(!r){e=a+1;break}continue}s===-1&&(r=!1,s=a+1),o===46?t===-1?t=a:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||s===-1||n===0||n===1&&t===s-1&&t===e+1?"":i.slice(t,s)},parse(i){Dt(i);const t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=ts(this.toPosix(i));let e=i.charCodeAt(0);const s=this.isAbsolute(i);let r;const n="";t.root=this.rootname(i),s||this.hasProtocol(i)?r=1:r=0;let a=-1,o=0,h=-1,l=!0,u=i.length-1,c=0;for(;u>=r;--u){if(e=i.charCodeAt(u),e===47){if(!l){o=u+1;break}continue}h===-1&&(l=!1,h=u+1),e===46?a===-1?a=u:c!==1&&(c=1):a!==-1&&(c=-1)}return a===-1||h===-1||c===0||c===1&&a===h-1&&a===o+1?h!==-1&&(o===0&&s?t.base=t.name=i.slice(1,h):t.base=t.name=i.slice(o,h)):(o===0&&s?(t.name=i.slice(1,a),t.base=i.slice(1,h)):(t.name=i.slice(o,a),t.base=i.slice(o,h)),t.ext=i.slice(a,h)),t.dir=this.dirname(i),n&&(t.dir=n+t.dir),t},sep:"/",delimiter:":"};let Ni;async function co(){return Ni!=null||(Ni=(async()=>{var i;const t=document.createElement("canvas").getContext("webgl");if(!t)return bt.UNPACK;const e=await new Promise(a=>{const o=document.createElement("video");o.onloadeddata=()=>a(o),o.onerror=()=>a(null),o.autoplay=!1,o.crossOrigin="anonymous",o.preload="auto",o.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",o.load()});if(!e)return bt.UNPACK;const s=t.createTexture();t.bindTexture(t.TEXTURE_2D,s);const r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,s,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(r),t.deleteTexture(s),(i=t.getExtension("WEBGL_lose_context"))==null||i.loseContext(),n[0]<=n[3]?bt.PMA:bt.UNPACK})()),Ni}function Nl(){}function Ll(){}let Li;function fo(){return typeof Li=="undefined"&&(Li=function(){var i;const t={stencil:!0,failIfMajorPerformanceCaveat:O.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!O.ADAPTER.getWebGLRenderingContext())return!1;const e=O.ADAPTER.createCanvas();let s=e.getContext("webgl",t)||e.getContext("experimental-webgl",t);const r=!!((i=s==null?void 0:s.getContextAttributes())!=null&&i.stencil);if(s){const n=s.getExtension("WEBGL_lose_context");n&&n.loseContext()}return s=null,r}catch(e){return!1}}()),Li}var Ul={grad:.9,turn:360,rad:360/(2*Math.PI)},Jt=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},ft=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},Rt=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},po=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},Nn=function(i){return{r:Rt(i.r,0,255),g:Rt(i.g,0,255),b:Rt(i.b,0,255),a:Rt(i.a)}},Ui=function(i){return{r:ft(i.r),g:ft(i.g),b:ft(i.b),a:ft(i.a,3)}},kl=/^#([0-9a-f]{3,8})$/i,Os=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},mo=function(i){var t=i.r,e=i.g,s=i.b,r=i.a,n=Math.max(t,e,s),a=n-Math.min(t,e,s),o=a?n===t?(e-s)/a:n===e?2+(s-t)/a:4+(t-e)/a:0;return{h:60*(o<0?o+6:o),s:n?a/n*100:0,v:n/255*100,a:r}},go=function(i){var t=i.h,e=i.s,s=i.v,r=i.a;t=t/360*6,e/=100,s/=100;var n=Math.floor(t),a=s*(1-e),o=s*(1-(t-n)*e),h=s*(1-(1-t+n)*e),l=n%6;return{r:255*[s,o,a,a,h,s][l],g:255*[h,s,s,o,a,a][l],b:255*[a,a,h,s,s,o][l],a:r}},Ln=function(i){return{h:po(i.h),s:Rt(i.s,0,100),l:Rt(i.l,0,100),a:Rt(i.a)}},Un=function(i){return{h:ft(i.h),s:ft(i.s),l:ft(i.l),a:ft(i.a,3)}},kn=function(i){return go((e=(t=i).s,{h:t.h,s:(e*=((s=t.l)<50?s:100-s)/100)>0?2*e/(s+e)*100:0,v:s+e,a:t.a}));var t,e,s},ms=function(i){return{h:(t=mo(i)).h,s:(r=(200-(e=t.s))*(s=t.v)/100)>0&&r<200?e*s/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,e,s,r},Gl=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,$l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Hl=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Vl=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,mr={string:[[function(i){var t=kl.exec(i);return t?(i=t[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?ft(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?ft(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=Hl.exec(i)||Vl.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:Nn({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(i){var t=Gl.exec(i)||$l.exec(i);if(!t)return null;var e,s,r=Ln({h:(e=t[1],s=t[2],s===void 0&&(s="deg"),Number(e)*(Ul[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return kn(r)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,s=i.b,r=i.a,n=r===void 0?1:r;return Jt(t)&&Jt(e)&&Jt(s)?Nn({r:Number(t),g:Number(e),b:Number(s),a:Number(n)}):null},"rgb"],[function(i){var t=i.h,e=i.s,s=i.l,r=i.a,n=r===void 0?1:r;if(!Jt(t)||!Jt(e)||!Jt(s))return null;var a=Ln({h:Number(t),s:Number(e),l:Number(s),a:Number(n)});return kn(a)},"hsl"],[function(i){var t=i.h,e=i.s,s=i.v,r=i.a,n=r===void 0?1:r;if(!Jt(t)||!Jt(e)||!Jt(s))return null;var a=function(o){return{h:po(o.h),s:Rt(o.s,0,100),v:Rt(o.v,0,100),a:Rt(o.a)}}({h:Number(t),s:Number(e),v:Number(s),a:Number(n)});return go(a)},"hsv"]]},Gn=function(i,t){for(var e=0;e<t.length;e++){var s=t[e][0](i);if(s)return[s,t[e][1]]}return[null,void 0]},Xl=function(i){return typeof i=="string"?Gn(i.trim(),mr.string):typeof i=="object"&&i!==null?Gn(i,mr.object):[null,void 0]};var ki=function(i,t){var e=ms(i);return{h:e.h,s:Rt(e.s+100*t,0,100),l:e.l,a:e.a}},Gi=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},$n=function(i,t){var e=ms(i);return{h:e.h,s:e.s,l:Rt(e.l+100*t,0,100),a:e.a}},gr=function(){function i(t){this.parsed=Xl(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return i.prototype.isValid=function(){return this.parsed!==null},i.prototype.brightness=function(){return ft(Gi(this.rgba),2)},i.prototype.isDark=function(){return Gi(this.rgba)<.5},i.prototype.isLight=function(){return Gi(this.rgba)>=.5},i.prototype.toHex=function(){return t=Ui(this.rgba),e=t.r,s=t.g,r=t.b,a=(n=t.a)<1?Os(ft(255*n)):"","#"+Os(e)+Os(s)+Os(r)+a;var t,e,s,r,n,a},i.prototype.toRgb=function(){return Ui(this.rgba)},i.prototype.toRgbString=function(){return t=Ui(this.rgba),e=t.r,s=t.g,r=t.b,(n=t.a)<1?"rgba("+e+", "+s+", "+r+", "+n+")":"rgb("+e+", "+s+", "+r+")";var t,e,s,r,n},i.prototype.toHsl=function(){return Un(ms(this.rgba))},i.prototype.toHslString=function(){return t=Un(ms(this.rgba)),e=t.h,s=t.s,r=t.l,(n=t.a)<1?"hsla("+e+", "+s+"%, "+r+"%, "+n+")":"hsl("+e+", "+s+"%, "+r+"%)";var t,e,s,r,n},i.prototype.toHsv=function(){return t=mo(this.rgba),{h:ft(t.h),s:ft(t.s),v:ft(t.v),a:ft(t.a,3)};var t},i.prototype.invert=function(){return $t({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},i.prototype.saturate=function(t){return t===void 0&&(t=.1),$t(ki(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),$t(ki(this.rgba,-t))},i.prototype.grayscale=function(){return $t(ki(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),$t($n(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),$t($n(this.rgba,-t))},i.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},i.prototype.alpha=function(t){return typeof t=="number"?$t({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ft(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=ms(this.rgba);return typeof t=="number"?$t({h:t,s:e.s,l:e.l,a:e.a}):ft(e.h)},i.prototype.isEqual=function(t){return this.toHex()===$t(t).toHex()},i}(),$t=function(i){return i instanceof gr?i:new gr(i)},Hn=[],jl=function(i){i.forEach(function(t){Hn.indexOf(t)<0&&(t(gr,mr),Hn.push(t))})};function zl(i,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},s={};for(var r in e)s[e[r]]=r;var n={};i.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,h,l=s[this.toHex()];if(l)return l;if(a!=null&&a.closest){var u=this.toRgb(),c=1/0,d="black";if(!n.length)for(var f in e)n[f]=new i(e[f]).toRgb();for(var p in e){var m=(o=u,h=n[p],Math.pow(o.r-h.r,2)+Math.pow(o.g-h.g,2)+Math.pow(o.b-h.b,2));m<c&&(c=m,d=p)}return d}},t.string.push([function(a){var o=a.toLowerCase(),h=o==="transparent"?"#0000":e[o];return h?new i(h).toRgb():null},"name"])}var Wl=Object.defineProperty,Vn=Object.getOwnPropertySymbols,Yl=Object.prototype.hasOwnProperty,ql=Object.prototype.propertyIsEnumerable,Xn=(i,t,e)=>t in i?Wl(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Kl=(i,t)=>{for(var e in t||(t={}))Yl.call(t,e)&&Xn(i,e,t[e]);if(Vn)for(var e of Vn(t))ql.call(t,e)&&Xn(i,e,t[e]);return i};jl([zl]);const Le=class Qs{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 Qs)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?Kl({},t):t}isSourceEqual(t,e){const s=typeof t;if(s!==typeof e)return!1;if(s==="number"||s==="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((r,n)=>r===e[n]);if(t!==null&&e!==null){const r=Object.keys(t),n=Object.keys(e);return r.length!==n.length?!1:r.every(a=>t[a]===e[a])}return t===e}toRgba(){const[t,e,s,r]=this._components;return{r:t,g:e,b:s,a:r}}toRgb(){const[t,e,s]=this._components;return{r:t,g:e,b:s}}toRgbaString(){const[t,e,s]=this.toUint8RgbArray();return`rgba(${t},${e},${s},${this.alpha})`}toUint8RgbArray(t){const[e,s,r]=this._components;return t=t!=null?t:[],t[0]=Math.round(e*255),t[1]=Math.round(s*255),t[2]=Math.round(r*255),t}toRgbArray(t){t=t!=null?t:[];const[e,s,r]=this._components;return t[0]=e,t[1]=s,t[2]=r,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,s,r,n]=Qs.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=s,this._components[2]*=r,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 s=this._int>>16&255,r=this._int>>8&255,n=this._int&255;return e&&(s=s*t+.5|0,r=r*t+.5|0,n=n*t+.5|0),(t*255<<24)+(s<<16)+(r<<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}round(t){const[e,s,r]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(s*t)/t,this._components[2]=Math.round(r*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t!=null?t:[];const[e,s,r,n]=this._components;return t[0]=e,t[1]=s,t[2]=r,t[3]=n,t}normalize(t){let e,s,r,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const a=t;e=(a>>16&255)/255,s=(a>>8&255)/255,r=(a&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,s,r,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,s,r,n=255]=t,e/=255,s/=255,r/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const o=Qs.HEX_PATTERN.exec(t);o&&(t=`#${o[2]}`)}const a=$t(t);a.isValid()&&({r:e,g:s,b:r,a:n}=a.rgba,e/=255,s/=255,r/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=s,this._components[2]=r,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,s]=this._components;this._int=(t*255<<16)+(e*255<<8)+(s*255|0)}_clamp(t,e=0,s=1){return typeof t=="number"?Math.min(Math.max(t,e),s):(t.forEach((r,n)=>{t[n]=Math.min(Math.max(r,e),s)}),t)}};Le.shared=new Le,Le.temp=new Le,Le.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let K=Le;function Zl(i,t=[]){return K.shared.setValue(i).toRgbArray(t)}function _o(i){return K.shared.setValue(i).toHex()}function Ql(i){return K.shared.setValue(i).toNumber()}function vo(i){return K.shared.setValue(i).toNumber()}function Jl(){const i=[],t=[];for(let s=0;s<32;s++)i[s]=s,t[s]=s;i[H.NORMAL_NPM]=H.NORMAL,i[H.ADD_NPM]=H.ADD,i[H.SCREEN_NPM]=H.SCREEN,t[H.NORMAL]=H.NORMAL_NPM,t[H.ADD]=H.ADD_NPM,t[H.SCREEN]=H.SCREEN_NPM;const e=[];return e.push(t),e.push(i),e}const on=Jl();function hn(i,t){return on[t?1:0][i]}function tu(i,t,e,s=!0){return K.shared.setValue(i).premultiply(t,s).toArray(e!=null?e:new Float32Array(4))}function eu(i,t){return K.shared.setValue(i).toPremultiplied(t)}function su(i,t,e,s=!0){return K.shared.setValue(i).premultiply(t,s).toArray(e!=null?e:new Float32Array(4))}const yo=/^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i;function xo(i,t=null){const e=i*6;if(t=t||new Uint16Array(e),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let s=0,r=0;s<e;s+=6,r+=4)t[s+0]=r+0,t[s+1]=r+1,t[s+2]=r+2,t[s+3]=r+0,t[s+4]=r+2,t[s+5]=r+3;return t}function Ai(i){if(i.BYTES_PER_ELEMENT===4)return i instanceof Float32Array?"Float32Array":i instanceof Uint32Array?"Uint32Array":"Int32Array";if(i.BYTES_PER_ELEMENT===2){if(i instanceof Uint16Array)return"Uint16Array"}else if(i.BYTES_PER_ELEMENT===1&&i instanceof Uint8Array)return"Uint8Array";return null}const iu={Float32Array,Uint32Array,Int32Array,Uint8Array};function ru(i,t){let e=0,s=0;const r={};for(let h=0;h<i.length;h++)s+=t[h],e+=i[h].length;const n=new ArrayBuffer(e*4);let a=null,o=0;for(let h=0;h<i.length;h++){const l=t[h],u=i[h],c=Ai(u);r[c]||(r[c]=new iu[c](n)),a=r[c];for(let d=0;d<u.length;d++){const f=(d/l|0)*s+o,p=d%l;a[f+p]=u[d]}o+=l}return new Float32Array(n)}function xs(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function _r(i){return!(i&i-1)&&!!i}function vr(i){let t=(i>65535?1:0)<<4;i>>>=t;let e=(i>255?1:0)<<3;return i>>>=e,t|=e,e=(i>15?1:0)<<2,i>>>=e,t|=e,e=(i>3?1:0)<<1,i>>>=e,t|=e,t|i>>1}function Re(i,t,e){const s=i.length;let r;if(t>=s||e===0)return;e=t+e>s?s-t:e;const n=s-e;for(r=t;r<n;++r)i[r]=i[r+e];i.length=n}function se(i){return i===0?0:i<0?-1:1}let nu=0;function de(){return++nu}const yr=class{constructor(t,e,s,r){this.left=t,this.top=e,this.right=s,this.bottom=r}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};yr.EMPTY=new yr(0,0,0,0);let xr=yr;const br={},yt=Object.create(null),wt=Object.create(null);function au(){let i;for(i in yt)yt[i].destroy();for(i in wt)wt[i].destroy()}function ou(){let i;for(i in yt)delete yt[i];for(i in wt)delete wt[i]}class bo{constructor(t,e,s){this._canvas=O.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=s||O.RESOLUTION,this.resize(t,e)}clear(){this._checkDestroyed(),this._context.setTransform(1,0,0,1,0,0),this._context.clearRect(0,0,this._canvas.width,this._canvas.height)}resize(t,e){this._checkDestroyed(),this._canvas.width=Math.round(t*this.resolution),this._canvas.height=Math.round(e*this.resolution)}destroy(){this._context=null,this._canvas=null}get width(){return this._checkDestroyed(),this._canvas.width}set width(t){this._checkDestroyed(),this._canvas.width=Math.round(t)}get height(){return this._checkDestroyed(),this._canvas.height}set height(t){this._checkDestroyed(),this._canvas.height=Math.round(t)}get canvas(){return this._checkDestroyed(),this._canvas}get context(){return this._checkDestroyed(),this._context}_checkDestroyed(){this._canvas}}function jn(i,t,e){for(let s=0,r=4*e*t;s<t;++s,r+=4)if(i[r+3]!==0)return!1;return!0}function zn(i,t,e,s,r){const n=4*t;for(let a=s,o=s*n+4*e;a<=r;++a,o+=n)if(i[o+3]!==0)return!1;return!0}function To(i){const{width:t,height:e}=i,s=i.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");const r=s.getImageData(0,0,t,e).data;let n=0,a=0,o=t-1,h=e-1;for(;a<e&&jn(r,t,a);)++a;if(a===e)return xr.EMPTY;for(;jn(r,t,h);)--h;for(;zn(r,t,n,a,h);)++n;for(;zn(r,t,o,a,h);)--o;return++o,++h,new xr(n,a,o,h)}function Eo(i){const t=To(i),{width:e,height:s}=t;let r=null;if(!t.isEmpty()){const n=i.getContext("2d");if(n===null)throw new TypeError("Failed to get canvas 2D context");r=n.getImageData(t.left,t.top,e,s)}return{width:e,height:s,data:r}}function hu(i){const t=yo.exec(i);if(t)return{mediaType:t[1]?t[1].toLowerCase():void 0,subType:t[2]?t[2].toLowerCase():void 0,charset:t[3]?t[3].toLowerCase():void 0,encoding:t[4]?t[4].toLowerCase():void 0,data:t[5]}}function Ao(i,t=globalThis.location){if(i.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function Zt(i,t=1){var e;const s=(e=O.RETINA_PREFIX)==null?void 0:e.exec(i);return s?parseFloat(s[1]):t}var Dm={__proto__:null,BaseTextureCache:wt,BoundingBox:xr,CanvasRenderTarget:bo,DATA_URI:yo,EventEmitter:Ke,ProgramCache:br,TextureCache:yt,clearTextureCache:ou,correctBlendMode:hn,createIndicesForQuads:xo,decomposeDataUri:hu,deprecation:uo,destroyTextureCache:au,detectVideoAlphaMode:co,determineCrossOrigin:Ao,earcut:lo,getBufferType:Ai,getCanvasBoundingBox:To,getResolutionOfUrl:Zt,hex2rgb:Zl,hex2string:_o,interleaveTypedArrays:ru,isMobile:Wt,isPow2:_r,isWebGLSupported:fo,log2:vr,nextPow2:xs,path:vt,premultiplyBlendMode:on,premultiplyRgba:tu,premultiplyTint:eu,premultiplyTintToRgba:su,removeItems:Re,rgb2hex:vo,sayHello:Ll,sign:se,skipHello:Nl,string2hex:Ql,trimCanvas:Eo,uid:de,url:Dl},lu=Object.defineProperty,uu=Object.defineProperties,cu=Object.getOwnPropertyDescriptors,Wn=Object.getOwnPropertySymbols,du=Object.prototype.hasOwnProperty,fu=Object.prototype.propertyIsEnumerable,Yn=(i,t,e)=>t in i?lu(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,qn=(i,t)=>{for(var e in t||(t={}))du.call(t,e)&&Yn(i,e,t[e]);if(Wn)for(var e of Wn(t))fu.call(t,e)&&Yn(i,e,t[e]);return i},pu=(i,t)=>uu(i,cu(t)),C=(i=>(i.Renderer="renderer",i.Application="application",i.RendererSystem="renderer-webgl-system",i.RendererPlugin="renderer-webgl-plugin",i.CanvasRendererSystem="renderer-canvas-system",i.CanvasRendererPlugin="renderer-canvas-plugin",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i))(C||{});const Tr=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){const t=typeof i.extension!="object"?{type:i.extension}:i.extension;i=pu(qn({},t),{ref:i})}if(typeof i=="object")i=qn({},i);else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},Kn=(i,t)=>{var e;return(e=Tr(i).priority)!=null?e:t},N={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Tr).forEach(t=>{t.type.forEach(e=>{var s,r;return(r=(s=this._removeHandlers)[e])==null?void 0:r.call(s,t)})}),this},add(...i){return i.map(Tr).forEach(t=>{t.type.forEach(e=>{const s=this._addHandlers,r=this._queue;s[e]?s[e](t):(r[e]=r[e]||[],r[e].push(t))})}),this},handle(i,t,e){const s=this._addHandlers,r=this._removeHandlers;s[i]=t,r[i]=e;const n=this._queue;return n[i]&&(n[i].forEach(a=>t(a)),delete n[i]),this},handleByMap(i,t){return this.handle(i,e=>{t[e.name]=e.ref},e=>{delete t[e.name]})},handleByList(i,t,e=-1){return this.handle(i,s=>{t.includes(s.ref)||(t.push(s.ref),t.sort((r,n)=>Kn(n,e)-Kn(r,e)))},s=>{const r=t.indexOf(s.ref);r!==-1&&t.splice(r,1)})}};class Er{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}const mu=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
14
|
-
`);function
|
|
15
|
-
else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function _u(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);for(;;){const s=mu.replace(/%forloop%/gi,gu(i));if(t.shaderSource(e,s),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}return i}const $i=0,Hi=1,Vi=2,Xi=3,ji=4,zi=5;class ne{constructor(){this.data=0,this.blendMode=H.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<$i)}set blend(t){!!(this.data&1<<$i)!==t&&(this.data^=1<<$i)}get offsets(){return!!(this.data&1<<Hi)}set offsets(t){!!(this.data&1<<Hi)!==t&&(this.data^=1<<Hi)}get culling(){return!!(this.data&1<<Vi)}set culling(t){!!(this.data&1<<Vi)!==t&&(this.data^=1<<Vi)}get depthTest(){return!!(this.data&1<<Xi)}set depthTest(t){!!(this.data&1<<Xi)!==t&&(this.data^=1<<Xi)}get depthMask(){return!!(this.data&1<<zi)}set depthMask(t){!!(this.data&1<<zi)!==t&&(this.data^=1<<zi)}get clockwiseFrontFace(){return!!(this.data&1<<ji)}set clockwiseFrontFace(t){!!(this.data&1<<ji)!==t&&(this.data^=1<<ji)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==H.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new ne;return t.depthTest=!1,t.blend=!0,t}}const Ar=[];function wo(i,t){if(!i)return null;let e="";if(typeof i=="string"){const s=/\.(\w{3,4})(?:$|\?|#)/i.exec(i);s&&(e=s[1].toLowerCase())}for(let s=Ar.length-1;s>=0;--s){const r=Ar[s];if(r.test&&r.test(i,e))return new r(i,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class Pt{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,s,r,n,a,o,h){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:u}=this;this._aliasCount++;for(let c=0,d=u.length;c<d;c++)u[c][l](t,e,s,r,n,a,o,h);return u===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(Pt.prototype,{dispatch:{value:Pt.prototype.emit},run:{value:Pt.prototype.emit}});class bs{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new Pt("setRealSize"),this.onUpdate=new Pt("update"),this.onError=new Pt("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,s){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}}class wi extends bs{constructor(t,e){var s;const{width:r,height:n}=e||{};if(!r||!n)throw new Error("BufferResource width or height invalid");super(r,n),this.data=t,this.unpackAlignment=(s=e.unpackAlignment)!=null?s:4}upload(t,e,s){const r=t.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,this.unpackAlignment),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===bt.UNPACK);const n=e.realWidth,a=e.realHeight;return s.width===n&&s.height===a?r.texSubImage2D(e.target,0,0,0,n,a,e.format,s.type,this.data):(s.width=n,s.height=a,r.texImage2D(e.target,0,s.internalFormat,n,a,0,e.format,s.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}var vu=Object.defineProperty,Zn=Object.getOwnPropertySymbols,yu=Object.prototype.hasOwnProperty,xu=Object.prototype.propertyIsEnumerable,Qn=(i,t,e)=>t in i?vu(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,bu=(i,t)=>{for(var e in t||(t={}))yu.call(t,e)&&Qn(i,e,t[e]);if(Zn)for(var e of Zn(t))xu.call(t,e)&&Qn(i,e,t[e]);return i};const Tu={scaleMode:ee.NEAREST,alphaMode:bt.NPM},wr=class Ue extends Ke{constructor(t=null,e=null){super(),e=Object.assign({},Ue.defaultOptions,e);const{alphaMode:s,mipmap:r,anisotropicLevel:n,scaleMode:a,width:o,height:h,wrapMode:l,format:u,type:c,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof bs)&&(t=wo(t,p),t.internal=!0),this.resolution=f||O.RESOLUTION,this.width=Math.round((o||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=r,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=a,this.format=u,this.type=c,this.target=d,this.alphaMode=s,this.uid=de(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=o>0&&h>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let s;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,s=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,s=!0),s&&this.dirtyStyleId++,this}setSize(t,e,s){return s=s||this.resolution,this.setRealSize(t*s,e*s,s)}setRealSize(t,e,s){return this.resolution=s||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=_r(this.realWidth)&&_r(this.realHeight)}setResolution(t){const e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete wt[this.cacheId],delete yt[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Ue.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,s=O.STRICT_TEXTURE_CACHE){const r=typeof t=="string";let n=null;if(r)n=t;else{if(!t._pixiId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${o}_${de()}`}n=t._pixiId}let a=wt[n];if(r&&s&&!a)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return a||(a=new Ue(t,e),a.cacheId=n,Ue.addToCache(a,n)),a}static fromBuffer(t,e,s,r){t=t||new Float32Array(e*s*4);const n=new wi(t,bu({width:e,height:s},r==null?void 0:r.resourceOptions));let a,o;return t instanceof Float32Array?(a=A.RGBA,o=k.FLOAT):t instanceof Int32Array?(a=A.RGBA_INTEGER,o=k.INT):t instanceof Uint32Array?(a=A.RGBA_INTEGER,o=k.UNSIGNED_INT):t instanceof Int16Array?(a=A.RGBA_INTEGER,o=k.SHORT):t instanceof Uint16Array?(a=A.RGBA_INTEGER,o=k.UNSIGNED_SHORT):t instanceof Int8Array?(a=A.RGBA,o=k.BYTE):(a=A.RGBA,o=k.UNSIGNED_BYTE),n.internal=!0,new Ue(n,Object.assign({},Tu,{type:o,format:a},r))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),wt[e]&&wt[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),wt[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=wt[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete wt[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete wt[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};wr.defaultOptions={mipmap:Kt.POW2,anisotropicLevel:0,scaleMode:ee.LINEAR,wrapMode:re.CLAMP,alphaMode:bt.UNPACK,target:je.TEXTURE_2D,format:A.RGBA,type:k.UNSIGNED_BYTE},wr._globalBatch=0;let X=wr;class Sr{constructor(){this.texArray=null,this.blend=0,this.type=zt.TRIANGLES,this.start=0,this.size=0,this.data=null}}let Eu=0;class nt{constructor(t,e=!0,s=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=s,this.static=e,this.id=Eu++,this.disposeRunner=new Pt("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?Yt.ELEMENT_ARRAY_BUFFER:Yt.ARRAY_BUFFER}get index(){return this.type===Yt.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new nt(t)}}class hi{constructor(t,e=0,s=!1,r=k.FLOAT,n,a,o,h=1){this.buffer=t,this.size=e,this.normalized=s,this.type=r,this.stride=n,this.start=a,this.instance=o,this.divisor=h}destroy(){this.buffer=null}static from(t,e,s,r,n){return new hi(t,e,s,r,n)}}const Au={Float32Array,Uint32Array,Int32Array,Uint8Array};function wu(i,t){let e=0,s=0;const r={};for(let h=0;h<i.length;h++)s+=t[h],e+=i[h].length;const n=new ArrayBuffer(e*4);let a=null,o=0;for(let h=0;h<i.length;h++){const l=t[h],u=i[h],c=Ai(u);r[c]||(r[c]=new Au[c](n)),a=r[c];for(let d=0;d<u.length;d++){const f=(d/l|0)*s+o,p=d%l;a[f+p]=u[d]}o+=l}return new Float32Array(n)}const Jn={5126:4,5123:2,5121:1};let Su=0;const Iu={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class fe{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=Su++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new Pt("disposeGeometry"),this.refCount=0}addAttribute(t,e,s=0,r=!1,n,a,o,h=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof nt||(e instanceof Array&&(e=new Float32Array(e)),e=new nt(e));const l=t.split("|");if(l.length>1){for(let c=0;c<l.length;c++)this.addAttribute(l[c],e,s,r,n);return this}let u=this.buffers.indexOf(e);return u===-1&&(this.buffers.push(e),u=this.buffers.length-1),this.attributes[t]=new hi(u,s,r,n,a,o,h),this.instanced=this.instanced||h,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof nt||(t instanceof Array&&(t=new Uint16Array(t)),t=new nt(t)),t.type=Yt.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;const t=[],e=[],s=new nt;let r;for(r in this.attributes){const n=this.attributes[r],a=this.buffers[n.buffer];t.push(a.data),e.push(n.size*Jn[n.type]/4),n.buffer=0}for(s.data=wu(t,e),r=0;r<this.buffers.length;r++)this.buffers[r]!==this.indexBuffer&&this.buffers[r].destroy();return this.buffers=[s],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(const t in this.attributes){const e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){const t=new fe;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new nt(this.buffers[e].data.slice(0));for(const e in this.attributes){const s=this.attributes[e];t.attributes[e]=new hi(s.buffer,s.size,s.normalized,s.type,s.stride,s.start,s.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=Yt.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new fe,s=[],r=[],n=[];let a;for(let o=0;o<t.length;o++){a=t[o];for(let h=0;h<a.buffers.length;h++)r[h]=r[h]||0,r[h]+=a.buffers[h].data.length,n[h]=0}for(let o=0;o<a.buffers.length;o++)s[o]=new Iu[Ai(a.buffers[o].data)](r[o]),e.buffers[o]=new nt(s[o]);for(let o=0;o<t.length;o++){a=t[o];for(let h=0;h<a.buffers.length;h++)s[h].set(a.buffers[h].data,n[h]),n[h]+=a.buffers[h].data.length}if(e.attributes=a.attributes,a.indexBuffer){e.indexBuffer=e.buffers[a.buffers.indexOf(a.indexBuffer)],e.indexBuffer.type=Yt.ELEMENT_ARRAY_BUFFER;let o=0,h=0,l=0,u=0;for(let c=0;c<a.buffers.length;c++)if(a.buffers[c]!==a.indexBuffer){u=c;break}for(const c in a.attributes){const d=a.attributes[c];(d.buffer|0)===u&&(h+=d.size*Jn[d.type]/4)}for(let c=0;c<t.length;c++){const d=t[c].indexBuffer.data;for(let f=0;f<d.length;f++)e.indexBuffer.data[f+l]+=o;o+=t[c].buffers[u].data.length/h,l+=d.length}}return e}}class So extends fe{constructor(t=!1){super(),this._buffer=new nt(null,t,!1),this._indexBuffer=new nt(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,k.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,k.FLOAT).addAttribute("aColor",this._buffer,4,!0,k.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,k.FLOAT).addIndex(this._indexBuffer)}}const li=Math.PI*2,Ru=180/Math.PI,Cu=Math.PI/180;var mt=(i=>(i[i.POLY=0]="POLY",i[i.RECT=1]="RECT",i[i.CIRC=2]="CIRC",i[i.ELIP=3]="ELIP",i[i.RREC=4]="RREC",i))(mt||{});class q{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new q(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}}const Bs=[new q,new q,new q,new q];class j{constructor(t=0,e=0,s=0,r=0){this.x=Number(t),this.y=Number(e),this.width=Number(s),this.height=Number(r),this.type=mt.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new j(0,0,0,0)}clone(){return new j(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){const E=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=E)return!1;const M=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>M}const s=this.left,r=this.right,n=this.top,a=this.bottom;if(r<=s||a<=n)return!1;const o=Bs[0].set(t.left,t.top),h=Bs[1].set(t.left,t.bottom),l=Bs[2].set(t.right,t.top),u=Bs[3].set(t.right,t.bottom);if(l.x<=o.x||h.y<=o.y)return!1;const c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(o,o),e.apply(h,h),e.apply(l,l),e.apply(u,u),Math.max(o.x,h.x,l.x,u.x)<=s||Math.min(o.x,h.x,l.x,u.x)>=r||Math.max(o.y,h.y,l.y,u.y)<=n||Math.min(o.y,h.y,l.y,u.y)>=a))return!1;const d=c*(h.y-o.y),f=c*(o.x-h.x),p=d*s+f*n,m=d*r+f*n,g=d*s+f*a,y=d*r+f*a;if(Math.max(p,m,g,y)<=d*o.x+f*o.y||Math.min(p,m,g,y)>=d*u.x+f*u.y)return!1;const x=c*(o.y-l.y),_=c*(l.x-o.x),v=x*s+_*n,T=x*r+_*n,B=x*s+_*a,w=x*r+_*a;return!(Math.max(v,T,B,w)<=x*o.x+_*o.y||Math.min(v,T,B,w)>=x*u.x+_*u.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),s=Math.min(this.x+this.width,t.x+t.width),r=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(s-e,0),this.y=r,this.height=Math.max(n-r,0),this}ceil(t=1,e=.001){const s=Math.ceil((this.x+this.width-e)*t)/t,r=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=s-this.x,this.height=r-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),s=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=s-e,this.y=r,this.height=n-r,this}}class ln{constructor(t=0,e=0,s=0){this.x=t,this.y=e,this.radius=s,this.type=mt.CIRC}clone(){return new ln(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const s=this.radius*this.radius;let r=this.x-t,n=this.y-e;return r*=r,n*=n,r+n<=s}getBounds(){return new j(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}class un{constructor(t=0,e=0,s=0,r=0){this.x=t,this.y=e,this.width=s,this.height=r,this.type=mt.ELIP}clone(){return new un(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let s=(t-this.x)/this.width,r=(e-this.y)/this.height;return s*=s,r*=r,s+r<=1}getBounds(){return new j(this.x-this.width,this.y-this.height,this.width,this.height)}}class We{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const s=[];for(let r=0,n=e.length;r<n;r++)s.push(e[r].x,e[r].y);e=s}this.points=e,this.type=mt.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new We(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let s=!1;const r=this.points.length/2;for(let n=0,a=r-1;n<r;a=n++){const o=this.points[n*2],h=this.points[n*2+1],l=this.points[a*2],u=this.points[a*2+1];h>e!=u>e&&t<(l-o)*((e-h)/(u-h))+o&&(s=!s)}return s}}class cn{constructor(t=0,e=0,s=0,r=0,n=20){this.x=t,this.y=e,this.width=s,this.height=r,this.radius=n,this.type=mt.RREC}clone(){return new cn(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const s=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+s&&e<=this.y+this.height-s||t>=this.x+s&&t<=this.x+this.width-s)return!0;let r=t-(this.x+s),n=e-(this.y+s);const a=s*s;if(r*r+n*n<=a||(r=t-(this.x+this.width-s),r*r+n*n<=a)||(n=e-(this.y+this.height-s),r*r+n*n<=a)||(r=t-(this.x+s),r*r+n*n<=a))return!0}return!1}}class tt{constructor(t=1,e=0,s=0,r=1,n=0,a=0){this.array=null,this.a=t,this.b=e,this.c=s,this.d=r,this.tx=n,this.ty=a}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,s,r,n,a){return this.a=t,this.b=e,this.c=s,this.d=r,this.tx=n,this.ty=a,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const s=e||this.array;return t?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s}apply(t,e){e=e||new q;const s=t.x,r=t.y;return e.x=this.a*s+this.c*r+this.tx,e.y=this.b*s+this.d*r+this.ty,e}applyInverse(t,e){e=e||new q;const s=1/(this.a*this.d+this.c*-this.b),r=t.x,n=t.y;return e.x=this.d*s*r+-this.c*s*n+(this.ty*this.c-this.tx*this.d)*s,e.y=this.a*s*n+-this.b*s*r+(-this.ty*this.a+this.tx*this.b)*s,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),s=Math.sin(t),r=this.a,n=this.c,a=this.tx;return this.a=r*e-this.b*s,this.b=r*s+this.b*e,this.c=n*e-this.d*s,this.d=n*s+this.d*e,this.tx=a*e-this.ty*s,this.ty=a*s+this.ty*e,this}append(t){const e=this.a,s=this.b,r=this.c,n=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*s+t.b*n,this.c=t.c*e+t.d*r,this.d=t.c*s+t.d*n,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*s+t.ty*n+this.ty,this}setTransform(t,e,s,r,n,a,o,h,l){return this.a=Math.cos(o+l)*n,this.b=Math.sin(o+l)*n,this.c=-Math.sin(o-h)*a,this.d=Math.cos(o-h)*a,this.tx=t-(s*this.a+r*this.c),this.ty=e-(s*this.b+r*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const s=this.a,r=this.c;this.a=s*t.a+this.b*t.c,this.b=s*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*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,s=this.b,r=this.c,n=this.d,a=t.pivot,o=-Math.atan2(-r,n),h=Math.atan2(s,e),l=Math.abs(o+h);return l<1e-5||Math.abs(li-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=h),t.scale.x=Math.sqrt(e*e+s*s),t.scale.y=Math.sqrt(r*r+n*n),t.position.x=this.tx+(a.x*e+a.y*r),t.position.y=this.ty+(a.x*s+a.y*n),t}invert(){const t=this.a,e=this.b,s=this.c,r=this.d,n=this.tx,a=t*r-e*s;return this.a=r/a,this.b=-e/a,this.c=-s/a,this.d=t/a,this.tx=(s*this.ty-r*n)/a,this.ty=-(t*this.ty-e*n)/a,this}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 tt;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}static get IDENTITY(){return new tt}static get TEMP_MATRIX(){return new tt}}const be=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Te=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Ee=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Ae=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ir=[],Io=[],Fs=Math.sign;function Pu(){for(let i=0;i<16;i++){const t=[];Ir.push(t);for(let e=0;e<16;e++){const s=Fs(be[i]*be[e]+Ee[i]*Te[e]),r=Fs(Te[i]*be[e]+Ae[i]*Te[e]),n=Fs(be[i]*Ee[e]+Ee[i]*Ae[e]),a=Fs(Te[i]*Ee[e]+Ae[i]*Ae[e]);for(let o=0;o<16;o++)if(be[o]===s&&Te[o]===r&&Ee[o]===n&&Ae[o]===a){t.push(o);break}}}for(let i=0;i<16;i++){const t=new tt;t.set(be[i],Te[i],Ee[i],Ae[i],0,0),Io.push(t)}}Pu();const et={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:i=>be[i],uY:i=>Te[i],vX:i=>Ee[i],vY:i=>Ae[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>Ir[i][t],sub:(i,t)=>Ir[i][et.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?et.S:et.N:Math.abs(t)*2<=Math.abs(i)?i>0?et.E:et.W:t>0?i>0?et.SE:et.SW:i>0?et.NE:et.NW,matrixAppendRotationInv:(i,t,e=0,s=0)=>{const r=Io[et.inv(t)];r.tx=e,r.ty=s,i.append(r)}};class ue{constructor(t,e,s=0,r=0){this._x=s,this._y=r,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new ue(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}}const Rr=class{constructor(){this.worldTransform=new tt,this.localTransform=new tt,this.position=new ue(this.onChange,this,0,0),this.scale=new ue(this.onChange,this,1,1),this.pivot=new ue(this.onChange,this,0,0),this.skew=new ue(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){const t=this.localTransform;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(t){const e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){const s=t.worldTransform,r=this.worldTransform;r.a=e.a*s.a+e.b*s.c,r.b=e.a*s.b+e.b*s.d,r.c=e.c*s.a+e.d*s.c,r.d=e.c*s.b+e.d*s.d,r.tx=e.tx*s.a+e.ty*s.c+s.tx,r.ty=e.tx*s.b+e.ty*s.d+s.ty,this._parentID=t._worldID,this._worldID++}}setFromMatrix(t){t.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())}};Rr.IDENTITY=new Rr;let dn=Rr;var Mu=`varying vec2 vTextureCoord;
|
|
13
|
+
Deprecated since v${i}`),console.warn(s))),Fn[t]=!0}const Ol={get parse(){return yl},get format(){return bl},get resolve(){return xl}};function Dt(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function ts(i){return i.split("?")[0].split("#")[0]}function Bl(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fl(i,t,e){return i.replace(new RegExp(Bl(t),"g"),e)}function Nl(i,t){let e="",s=0,r=-1,n=0,a=-1;for(let o=0;o<=i.length;++o){if(o<i.length)a=i.charCodeAt(o);else{if(a===47)break;a=47}if(a===47){if(!(r===o-1||n===1))if(r!==o-1&&n===2){if(e.length<2||s!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",s=0):(e=e.slice(0,h),s=e.length-1-e.lastIndexOf("/")),r=o,n=0;continue}}else if(e.length===2||e.length===1){e="",s=0,r=o,n=0;continue}}t&&(e.length>0?e+="/..":e="..",s=2)}else e.length>0?e+=`/${i.slice(r+1,o)}`:e=i.slice(r+1,o),s=o-r-1;r=o,n=0}else a===46&&n!==-1?++n:n=-1}return e}const lt={toPosix(i){return Fl(i,"\\","/")},isUrl(i){return/^https?:/.test(this.toPosix(i))},isDataUrl(i){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return/^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){Dt(i),i=this.toPosix(i);const t=/^file:\/\/\//.exec(i);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(Dt(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;const s=ts(this.toPosix(t!=null?t:D.ADAPTER.getBaseUrl())),r=ts(this.toPosix(e!=null?e:this.rootname(s)));return i=this.toPosix(i),i.startsWith("/")?lt.join(r,i.slice(1)):this.isAbsolute(i)?i:this.join(s,i)},normalize(i){if(Dt(i),i.length===0)return".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="";const e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));const s=i.endsWith("/");return i=Nl(i,!1),i.length>0&&s&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return Dt(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){var t;if(i.length===0)return".";let e;for(let s=0;s<i.length;++s){const r=i[s];if(Dt(r),r.length>0)if(e===void 0)e=r;else{const n=(t=i[s-1])!=null?t:"";this.extname(n)?e+=`/../${r}`:e+=`/${r}`}}return e===void 0?".":this.normalize(e)},dirname(i){if(Dt(i),i.length===0)return".";i=this.toPosix(i);let t=i.charCodeAt(0);const e=t===47;let s=-1,r=!0;const n=this.getProtocol(i),a=i;i=i.slice(n.length);for(let o=i.length-1;o>=1;--o)if(t=i.charCodeAt(o),t===47){if(!r){s=o;break}}else r=!1;return s===-1?e?"/":this.isUrl(a)?n+i:n:e&&s===1?"//":n+i.slice(0,s)},rootname(i){Dt(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){const e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/")}return t},basename(i,t){Dt(i),t&&Dt(t),i=ts(this.toPosix(i));let e=0,s=-1,r=!0,n;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return"";let a=t.length-1,o=-1;for(n=i.length-1;n>=0;--n){const h=i.charCodeAt(n);if(h===47){if(!r){e=n+1;break}}else o===-1&&(r=!1,o=n+1),a>=0&&(h===t.charCodeAt(a)?--a===-1&&(s=n):(a=-1,s=o))}return e===s?s=o:s===-1&&(s=i.length),i.slice(e,s)}for(n=i.length-1;n>=0;--n)if(i.charCodeAt(n)===47){if(!r){e=n+1;break}}else s===-1&&(r=!1,s=n+1);return s===-1?"":i.slice(e,s)},extname(i){Dt(i),i=ts(this.toPosix(i));let t=-1,e=0,s=-1,r=!0,n=0;for(let a=i.length-1;a>=0;--a){const o=i.charCodeAt(a);if(o===47){if(!r){e=a+1;break}continue}s===-1&&(r=!1,s=a+1),o===46?t===-1?t=a:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||s===-1||n===0||n===1&&t===s-1&&t===e+1?"":i.slice(t,s)},parse(i){Dt(i);const t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=ts(this.toPosix(i));let e=i.charCodeAt(0);const s=this.isAbsolute(i);let r;const n="";t.root=this.rootname(i),s||this.hasProtocol(i)?r=1:r=0;let a=-1,o=0,h=-1,l=!0,u=i.length-1,c=0;for(;u>=r;--u){if(e=i.charCodeAt(u),e===47){if(!l){o=u+1;break}continue}h===-1&&(l=!1,h=u+1),e===46?a===-1?a=u:c!==1&&(c=1):a!==-1&&(c=-1)}return a===-1||h===-1||c===0||c===1&&a===h-1&&a===o+1?h!==-1&&(o===0&&s?t.base=t.name=i.slice(1,h):t.base=t.name=i.slice(o,h)):(o===0&&s?(t.name=i.slice(1,a),t.base=i.slice(1,h)):(t.name=i.slice(o,a),t.base=i.slice(o,h)),t.ext=i.slice(a,h)),t.dir=this.dirname(i),n&&(t.dir=n+t.dir),t},sep:"/",delimiter:":"};let Ni;async function co(){return Ni!=null||(Ni=(async()=>{var i;const t=document.createElement("canvas").getContext("webgl");if(!t)return bt.UNPACK;const e=await new Promise(a=>{const o=document.createElement("video");o.onloadeddata=()=>a(o),o.onerror=()=>a(null),o.autoplay=!1,o.crossOrigin="anonymous",o.preload="auto",o.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",o.load()});if(!e)return bt.UNPACK;const s=t.createTexture();t.bindTexture(t.TEXTURE_2D,s);const r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,s,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(r),t.deleteTexture(s),(i=t.getExtension("WEBGL_lose_context"))==null||i.loseContext(),n[0]<=n[3]?bt.PMA:bt.UNPACK})()),Ni}function Ll(){}function Ul(){}let Li;function fo(){return typeof Li=="undefined"&&(Li=function(){var i;const t={stencil:!0,failIfMajorPerformanceCaveat:D.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!D.ADAPTER.getWebGLRenderingContext())return!1;const e=D.ADAPTER.createCanvas();let s=e.getContext("webgl",t)||e.getContext("experimental-webgl",t);const r=!!((i=s==null?void 0:s.getContextAttributes())!=null&&i.stencil);if(s){const n=s.getExtension("WEBGL_lose_context");n&&n.loseContext()}return s=null,r}catch(e){return!1}}()),Li}var kl={grad:.9,turn:360,rad:360/(2*Math.PI)},Jt=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},pt=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},Rt=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},po=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},Nn=function(i){return{r:Rt(i.r,0,255),g:Rt(i.g,0,255),b:Rt(i.b,0,255),a:Rt(i.a)}},Ui=function(i){return{r:pt(i.r),g:pt(i.g),b:pt(i.b),a:pt(i.a,3)}},Gl=/^#([0-9a-f]{3,8})$/i,Os=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},mo=function(i){var t=i.r,e=i.g,s=i.b,r=i.a,n=Math.max(t,e,s),a=n-Math.min(t,e,s),o=a?n===t?(e-s)/a:n===e?2+(s-t)/a:4+(t-e)/a:0;return{h:60*(o<0?o+6:o),s:n?a/n*100:0,v:n/255*100,a:r}},go=function(i){var t=i.h,e=i.s,s=i.v,r=i.a;t=t/360*6,e/=100,s/=100;var n=Math.floor(t),a=s*(1-e),o=s*(1-(t-n)*e),h=s*(1-(1-t+n)*e),l=n%6;return{r:255*[s,o,a,a,h,s][l],g:255*[h,s,s,o,a,a][l],b:255*[a,a,h,s,s,o][l],a:r}},Ln=function(i){return{h:po(i.h),s:Rt(i.s,0,100),l:Rt(i.l,0,100),a:Rt(i.a)}},Un=function(i){return{h:pt(i.h),s:pt(i.s),l:pt(i.l),a:pt(i.a,3)}},kn=function(i){return go((e=(t=i).s,{h:t.h,s:(e*=((s=t.l)<50?s:100-s)/100)>0?2*e/(s+e)*100:0,v:s+e,a:t.a}));var t,e,s},ms=function(i){return{h:(t=mo(i)).h,s:(r=(200-(e=t.s))*(s=t.v)/100)>0&&r<200?e*s/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,e,s,r},$l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Hl=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Vl=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Xl=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,mr={string:[[function(i){var t=Gl.exec(i);return t?(i=t[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?pt(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?pt(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=Vl.exec(i)||Xl.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:Nn({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(i){var t=$l.exec(i)||Hl.exec(i);if(!t)return null;var e,s,r=Ln({h:(e=t[1],s=t[2],s===void 0&&(s="deg"),Number(e)*(kl[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return kn(r)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,s=i.b,r=i.a,n=r===void 0?1:r;return Jt(t)&&Jt(e)&&Jt(s)?Nn({r:Number(t),g:Number(e),b:Number(s),a:Number(n)}):null},"rgb"],[function(i){var t=i.h,e=i.s,s=i.l,r=i.a,n=r===void 0?1:r;if(!Jt(t)||!Jt(e)||!Jt(s))return null;var a=Ln({h:Number(t),s:Number(e),l:Number(s),a:Number(n)});return kn(a)},"hsl"],[function(i){var t=i.h,e=i.s,s=i.v,r=i.a,n=r===void 0?1:r;if(!Jt(t)||!Jt(e)||!Jt(s))return null;var a=function(o){return{h:po(o.h),s:Rt(o.s,0,100),v:Rt(o.v,0,100),a:Rt(o.a)}}({h:Number(t),s:Number(e),v:Number(s),a:Number(n)});return go(a)},"hsv"]]},Gn=function(i,t){for(var e=0;e<t.length;e++){var s=t[e][0](i);if(s)return[s,t[e][1]]}return[null,void 0]},jl=function(i){return typeof i=="string"?Gn(i.trim(),mr.string):typeof i=="object"&&i!==null?Gn(i,mr.object):[null,void 0]};var ki=function(i,t){var e=ms(i);return{h:e.h,s:Rt(e.s+100*t,0,100),l:e.l,a:e.a}},Gi=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},$n=function(i,t){var e=ms(i);return{h:e.h,s:e.s,l:Rt(e.l+100*t,0,100),a:e.a}},gr=function(){function i(t){this.parsed=jl(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return i.prototype.isValid=function(){return this.parsed!==null},i.prototype.brightness=function(){return pt(Gi(this.rgba),2)},i.prototype.isDark=function(){return Gi(this.rgba)<.5},i.prototype.isLight=function(){return Gi(this.rgba)>=.5},i.prototype.toHex=function(){return t=Ui(this.rgba),e=t.r,s=t.g,r=t.b,a=(n=t.a)<1?Os(pt(255*n)):"","#"+Os(e)+Os(s)+Os(r)+a;var t,e,s,r,n,a},i.prototype.toRgb=function(){return Ui(this.rgba)},i.prototype.toRgbString=function(){return t=Ui(this.rgba),e=t.r,s=t.g,r=t.b,(n=t.a)<1?"rgba("+e+", "+s+", "+r+", "+n+")":"rgb("+e+", "+s+", "+r+")";var t,e,s,r,n},i.prototype.toHsl=function(){return Un(ms(this.rgba))},i.prototype.toHslString=function(){return t=Un(ms(this.rgba)),e=t.h,s=t.s,r=t.l,(n=t.a)<1?"hsla("+e+", "+s+"%, "+r+"%, "+n+")":"hsl("+e+", "+s+"%, "+r+"%)";var t,e,s,r,n},i.prototype.toHsv=function(){return t=mo(this.rgba),{h:pt(t.h),s:pt(t.s),v:pt(t.v),a:pt(t.a,3)};var t},i.prototype.invert=function(){return $t({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},i.prototype.saturate=function(t){return t===void 0&&(t=.1),$t(ki(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),$t(ki(this.rgba,-t))},i.prototype.grayscale=function(){return $t(ki(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),$t($n(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),$t($n(this.rgba,-t))},i.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},i.prototype.alpha=function(t){return typeof t=="number"?$t({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):pt(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=ms(this.rgba);return typeof t=="number"?$t({h:t,s:e.s,l:e.l,a:e.a}):pt(e.h)},i.prototype.isEqual=function(t){return this.toHex()===$t(t).toHex()},i}(),$t=function(i){return i instanceof gr?i:new gr(i)},Hn=[],zl=function(i){i.forEach(function(t){Hn.indexOf(t)<0&&(t(gr,mr),Hn.push(t))})};function Wl(i,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},s={};for(var r in e)s[e[r]]=r;var n={};i.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,h,l=s[this.toHex()];if(l)return l;if(a!=null&&a.closest){var u=this.toRgb(),c=1/0,d="black";if(!n.length)for(var f in e)n[f]=new i(e[f]).toRgb();for(var p in e){var m=(o=u,h=n[p],Math.pow(o.r-h.r,2)+Math.pow(o.g-h.g,2)+Math.pow(o.b-h.b,2));m<c&&(c=m,d=p)}return d}},t.string.push([function(a){var o=a.toLowerCase(),h=o==="transparent"?"#0000":e[o];return h?new i(h).toRgb():null},"name"])}var Yl=Object.defineProperty,Vn=Object.getOwnPropertySymbols,ql=Object.prototype.hasOwnProperty,Kl=Object.prototype.propertyIsEnumerable,Xn=(i,t,e)=>t in i?Yl(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Zl=(i,t)=>{for(var e in t||(t={}))ql.call(t,e)&&Xn(i,e,t[e]);if(Vn)for(var e of Vn(t))Kl.call(t,e)&&Xn(i,e,t[e]);return i};zl([Wl]);const Le=class Qs{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 Qs)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?Zl({},t):t}isSourceEqual(t,e){const s=typeof t;if(s!==typeof e)return!1;if(s==="number"||s==="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((r,n)=>r===e[n]);if(t!==null&&e!==null){const r=Object.keys(t),n=Object.keys(e);return r.length!==n.length?!1:r.every(a=>t[a]===e[a])}return t===e}toRgba(){const[t,e,s,r]=this._components;return{r:t,g:e,b:s,a:r}}toRgb(){const[t,e,s]=this._components;return{r:t,g:e,b:s}}toRgbaString(){const[t,e,s]=this.toUint8RgbArray();return`rgba(${t},${e},${s},${this.alpha})`}toUint8RgbArray(t){const[e,s,r]=this._components;return t=t!=null?t:[],t[0]=Math.round(e*255),t[1]=Math.round(s*255),t[2]=Math.round(r*255),t}toRgbArray(t){t=t!=null?t:[];const[e,s,r]=this._components;return t[0]=e,t[1]=s,t[2]=r,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,s,r,n]=Qs.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=s,this._components[2]*=r,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 s=this._int>>16&255,r=this._int>>8&255,n=this._int&255;return e&&(s=s*t+.5|0,r=r*t+.5|0,n=n*t+.5|0),(t*255<<24)+(s<<16)+(r<<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}round(t){const[e,s,r]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(s*t)/t,this._components[2]=Math.round(r*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t!=null?t:[];const[e,s,r,n]=this._components;return t[0]=e,t[1]=s,t[2]=r,t[3]=n,t}normalize(t){let e,s,r,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const a=t;e=(a>>16&255)/255,s=(a>>8&255)/255,r=(a&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,s,r,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,s,r,n=255]=t,e/=255,s/=255,r/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const o=Qs.HEX_PATTERN.exec(t);o&&(t=`#${o[2]}`)}const a=$t(t);a.isValid()&&({r:e,g:s,b:r,a:n}=a.rgba,e/=255,s/=255,r/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=s,this._components[2]=r,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,s]=this._components;this._int=(t*255<<16)+(e*255<<8)+(s*255|0)}_clamp(t,e=0,s=1){return typeof t=="number"?Math.min(Math.max(t,e),s):(t.forEach((r,n)=>{t[n]=Math.min(Math.max(r,e),s)}),t)}};Le.shared=new Le,Le.temp=new Le,Le.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let K=Le;function Ql(i,t=[]){return K.shared.setValue(i).toRgbArray(t)}function _o(i){return K.shared.setValue(i).toHex()}function Jl(i){return K.shared.setValue(i).toNumber()}function vo(i){return K.shared.setValue(i).toNumber()}function tu(){const i=[],t=[];for(let s=0;s<32;s++)i[s]=s,t[s]=s;i[H.NORMAL_NPM]=H.NORMAL,i[H.ADD_NPM]=H.ADD,i[H.SCREEN_NPM]=H.SCREEN,t[H.NORMAL]=H.NORMAL_NPM,t[H.ADD]=H.ADD_NPM,t[H.SCREEN]=H.SCREEN_NPM;const e=[];return e.push(t),e.push(i),e}const on=tu();function hn(i,t){return on[t?1:0][i]}function eu(i,t,e,s=!0){return K.shared.setValue(i).premultiply(t,s).toArray(e!=null?e:new Float32Array(4))}function su(i,t){return K.shared.setValue(i).toPremultiplied(t)}function iu(i,t,e,s=!0){return K.shared.setValue(i).premultiply(t,s).toArray(e!=null?e:new Float32Array(4))}const yo=/^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i;function xo(i,t=null){const e=i*6;if(t=t||new Uint16Array(e),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let s=0,r=0;s<e;s+=6,r+=4)t[s+0]=r+0,t[s+1]=r+1,t[s+2]=r+2,t[s+3]=r+0,t[s+4]=r+2,t[s+5]=r+3;return t}function Ai(i){if(i.BYTES_PER_ELEMENT===4)return i instanceof Float32Array?"Float32Array":i instanceof Uint32Array?"Uint32Array":"Int32Array";if(i.BYTES_PER_ELEMENT===2){if(i instanceof Uint16Array)return"Uint16Array"}else if(i.BYTES_PER_ELEMENT===1&&i instanceof Uint8Array)return"Uint8Array";return null}const ru={Float32Array,Uint32Array,Int32Array,Uint8Array};function nu(i,t){let e=0,s=0;const r={};for(let h=0;h<i.length;h++)s+=t[h],e+=i[h].length;const n=new ArrayBuffer(e*4);let a=null,o=0;for(let h=0;h<i.length;h++){const l=t[h],u=i[h],c=Ai(u);r[c]||(r[c]=new ru[c](n)),a=r[c];for(let d=0;d<u.length;d++){const f=(d/l|0)*s+o,p=d%l;a[f+p]=u[d]}o+=l}return new Float32Array(n)}function xs(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function _r(i){return!(i&i-1)&&!!i}function vr(i){let t=(i>65535?1:0)<<4;i>>>=t;let e=(i>255?1:0)<<3;return i>>>=e,t|=e,e=(i>15?1:0)<<2,i>>>=e,t|=e,e=(i>3?1:0)<<1,i>>>=e,t|=e,t|i>>1}function Re(i,t,e){const s=i.length;let r;if(t>=s||e===0)return;e=t+e>s?s-t:e;const n=s-e;for(r=t;r<n;++r)i[r]=i[r+e];i.length=n}function se(i){return i===0?0:i<0?-1:1}let au=0;function de(){return++au}const yr=class{constructor(t,e,s,r){this.left=t,this.top=e,this.right=s,this.bottom=r}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};yr.EMPTY=new yr(0,0,0,0);let xr=yr;const br={},yt=Object.create(null),wt=Object.create(null);function ou(){let i;for(i in yt)yt[i].destroy();for(i in wt)wt[i].destroy()}function hu(){let i;for(i in yt)delete yt[i];for(i in wt)delete wt[i]}class bo{constructor(t,e,s){this._canvas=D.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=s||D.RESOLUTION,this.resize(t,e)}clear(){this._checkDestroyed(),this._context.setTransform(1,0,0,1,0,0),this._context.clearRect(0,0,this._canvas.width,this._canvas.height)}resize(t,e){this._checkDestroyed(),this._canvas.width=Math.round(t*this.resolution),this._canvas.height=Math.round(e*this.resolution)}destroy(){this._context=null,this._canvas=null}get width(){return this._checkDestroyed(),this._canvas.width}set width(t){this._checkDestroyed(),this._canvas.width=Math.round(t)}get height(){return this._checkDestroyed(),this._canvas.height}set height(t){this._checkDestroyed(),this._canvas.height=Math.round(t)}get canvas(){return this._checkDestroyed(),this._canvas}get context(){return this._checkDestroyed(),this._context}_checkDestroyed(){this._canvas}}function jn(i,t,e){for(let s=0,r=4*e*t;s<t;++s,r+=4)if(i[r+3]!==0)return!1;return!0}function zn(i,t,e,s,r){const n=4*t;for(let a=s,o=s*n+4*e;a<=r;++a,o+=n)if(i[o+3]!==0)return!1;return!0}function To(i){const{width:t,height:e}=i,s=i.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");const r=s.getImageData(0,0,t,e).data;let n=0,a=0,o=t-1,h=e-1;for(;a<e&&jn(r,t,a);)++a;if(a===e)return xr.EMPTY;for(;jn(r,t,h);)--h;for(;zn(r,t,n,a,h);)++n;for(;zn(r,t,o,a,h);)--o;return++o,++h,new xr(n,a,o,h)}function Eo(i){const t=To(i),{width:e,height:s}=t;let r=null;if(!t.isEmpty()){const n=i.getContext("2d");if(n===null)throw new TypeError("Failed to get canvas 2D context");r=n.getImageData(t.left,t.top,e,s)}return{width:e,height:s,data:r}}function lu(i){const t=yo.exec(i);if(t)return{mediaType:t[1]?t[1].toLowerCase():void 0,subType:t[2]?t[2].toLowerCase():void 0,charset:t[3]?t[3].toLowerCase():void 0,encoding:t[4]?t[4].toLowerCase():void 0,data:t[5]}}function Ao(i,t=globalThis.location){if(i.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function Zt(i,t=1){var e;const s=(e=D.RETINA_PREFIX)==null?void 0:e.exec(i);return s?parseFloat(s[1]):t}var Fm={__proto__:null,BaseTextureCache:wt,BoundingBox:xr,CanvasRenderTarget:bo,DATA_URI:yo,EventEmitter:Ke,ProgramCache:br,TextureCache:yt,clearTextureCache:hu,correctBlendMode:hn,createIndicesForQuads:xo,decomposeDataUri:lu,deprecation:uo,destroyTextureCache:ou,detectVideoAlphaMode:co,determineCrossOrigin:Ao,earcut:lo,getBufferType:Ai,getCanvasBoundingBox:To,getResolutionOfUrl:Zt,hex2rgb:Ql,hex2string:_o,interleaveTypedArrays:nu,isMobile:Wt,isPow2:_r,isWebGLSupported:fo,log2:vr,nextPow2:xs,path:lt,premultiplyBlendMode:on,premultiplyRgba:eu,premultiplyTint:su,premultiplyTintToRgba:iu,removeItems:Re,rgb2hex:vo,sayHello:Ul,sign:se,skipHello:Ll,string2hex:Jl,trimCanvas:Eo,uid:de,url:Ol},uu=Object.defineProperty,cu=Object.defineProperties,du=Object.getOwnPropertyDescriptors,Wn=Object.getOwnPropertySymbols,fu=Object.prototype.hasOwnProperty,pu=Object.prototype.propertyIsEnumerable,Yn=(i,t,e)=>t in i?uu(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,qn=(i,t)=>{for(var e in t||(t={}))fu.call(t,e)&&Yn(i,e,t[e]);if(Wn)for(var e of Wn(t))pu.call(t,e)&&Yn(i,e,t[e]);return i},mu=(i,t)=>cu(i,du(t)),C=(i=>(i.Renderer="renderer",i.Application="application",i.RendererSystem="renderer-webgl-system",i.RendererPlugin="renderer-webgl-plugin",i.CanvasRendererSystem="renderer-canvas-system",i.CanvasRendererPlugin="renderer-canvas-plugin",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i))(C||{});const Tr=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){const t=typeof i.extension!="object"?{type:i.extension}:i.extension;i=mu(qn({},t),{ref:i})}if(typeof i=="object")i=qn({},i);else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},Kn=(i,t)=>{var e;return(e=Tr(i).priority)!=null?e:t},N={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Tr).forEach(t=>{t.type.forEach(e=>{var s,r;return(r=(s=this._removeHandlers)[e])==null?void 0:r.call(s,t)})}),this},add(...i){return i.map(Tr).forEach(t=>{t.type.forEach(e=>{const s=this._addHandlers,r=this._queue;s[e]?s[e](t):(r[e]=r[e]||[],r[e].push(t))})}),this},handle(i,t,e){const s=this._addHandlers,r=this._removeHandlers;s[i]=t,r[i]=e;const n=this._queue;return n[i]&&(n[i].forEach(a=>t(a)),delete n[i]),this},handleByMap(i,t){return this.handle(i,e=>{t[e.name]=e.ref},e=>{delete t[e.name]})},handleByList(i,t,e=-1){return this.handle(i,s=>{t.includes(s.ref)||(t.push(s.ref),t.sort((r,n)=>Kn(n,e)-Kn(r,e)))},s=>{const r=t.indexOf(s.ref);r!==-1&&t.splice(r,1)})}};class Er{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}const gu=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
14
|
+
`);function _u(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
|
|
15
|
+
else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function vu(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);for(;;){const s=gu.replace(/%forloop%/gi,_u(i));if(t.shaderSource(e,s),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}return i}const $i=0,Hi=1,Vi=2,Xi=3,ji=4,zi=5;class ne{constructor(){this.data=0,this.blendMode=H.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<$i)}set blend(t){!!(this.data&1<<$i)!==t&&(this.data^=1<<$i)}get offsets(){return!!(this.data&1<<Hi)}set offsets(t){!!(this.data&1<<Hi)!==t&&(this.data^=1<<Hi)}get culling(){return!!(this.data&1<<Vi)}set culling(t){!!(this.data&1<<Vi)!==t&&(this.data^=1<<Vi)}get depthTest(){return!!(this.data&1<<Xi)}set depthTest(t){!!(this.data&1<<Xi)!==t&&(this.data^=1<<Xi)}get depthMask(){return!!(this.data&1<<zi)}set depthMask(t){!!(this.data&1<<zi)!==t&&(this.data^=1<<zi)}get clockwiseFrontFace(){return!!(this.data&1<<ji)}set clockwiseFrontFace(t){!!(this.data&1<<ji)!==t&&(this.data^=1<<ji)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==H.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new ne;return t.depthTest=!1,t.blend=!0,t}}const Ar=[];function wo(i,t){if(!i)return null;let e="";if(typeof i=="string"){const s=/\.(\w{3,4})(?:$|\?|#)/i.exec(i);s&&(e=s[1].toLowerCase())}for(let s=Ar.length-1;s>=0;--s){const r=Ar[s];if(r.test&&r.test(i,e))return new r(i,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class Pt{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,s,r,n,a,o,h){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:u}=this;this._aliasCount++;for(let c=0,d=u.length;c<d;c++)u[c][l](t,e,s,r,n,a,o,h);return u===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(Pt.prototype,{dispatch:{value:Pt.prototype.emit},run:{value:Pt.prototype.emit}});class bs{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new Pt("setRealSize"),this.onUpdate=new Pt("update"),this.onError=new Pt("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,s){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}}class wi extends bs{constructor(t,e){var s;const{width:r,height:n}=e||{};if(!r||!n)throw new Error("BufferResource width or height invalid");super(r,n),this.data=t,this.unpackAlignment=(s=e.unpackAlignment)!=null?s:4}upload(t,e,s){const r=t.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,this.unpackAlignment),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===bt.UNPACK);const n=e.realWidth,a=e.realHeight;return s.width===n&&s.height===a?r.texSubImage2D(e.target,0,0,0,n,a,e.format,s.type,this.data):(s.width=n,s.height=a,r.texImage2D(e.target,0,s.internalFormat,n,a,0,e.format,s.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}var yu=Object.defineProperty,Zn=Object.getOwnPropertySymbols,xu=Object.prototype.hasOwnProperty,bu=Object.prototype.propertyIsEnumerable,Qn=(i,t,e)=>t in i?yu(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Tu=(i,t)=>{for(var e in t||(t={}))xu.call(t,e)&&Qn(i,e,t[e]);if(Zn)for(var e of Zn(t))bu.call(t,e)&&Qn(i,e,t[e]);return i};const Eu={scaleMode:ee.NEAREST,alphaMode:bt.NPM},wr=class Ue extends Ke{constructor(t=null,e=null){super(),e=Object.assign({},Ue.defaultOptions,e);const{alphaMode:s,mipmap:r,anisotropicLevel:n,scaleMode:a,width:o,height:h,wrapMode:l,format:u,type:c,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof bs)&&(t=wo(t,p),t.internal=!0),this.resolution=f||D.RESOLUTION,this.width=Math.round((o||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=r,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=a,this.format=u,this.type=c,this.target=d,this.alphaMode=s,this.uid=de(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=o>0&&h>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let s;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,s=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,s=!0),s&&this.dirtyStyleId++,this}setSize(t,e,s){return s=s||this.resolution,this.setRealSize(t*s,e*s,s)}setRealSize(t,e,s){return this.resolution=s||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=_r(this.realWidth)&&_r(this.realHeight)}setResolution(t){const e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete wt[this.cacheId],delete yt[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Ue.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,s=D.STRICT_TEXTURE_CACHE){const r=typeof t=="string";let n=null;if(r)n=t;else{if(!t._pixiId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${o}_${de()}`}n=t._pixiId}let a=wt[n];if(r&&s&&!a)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return a||(a=new Ue(t,e),a.cacheId=n,Ue.addToCache(a,n)),a}static fromBuffer(t,e,s,r){t=t||new Float32Array(e*s*4);const n=new wi(t,Tu({width:e,height:s},r==null?void 0:r.resourceOptions));let a,o;return t instanceof Float32Array?(a=E.RGBA,o=U.FLOAT):t instanceof Int32Array?(a=E.RGBA_INTEGER,o=U.INT):t instanceof Uint32Array?(a=E.RGBA_INTEGER,o=U.UNSIGNED_INT):t instanceof Int16Array?(a=E.RGBA_INTEGER,o=U.SHORT):t instanceof Uint16Array?(a=E.RGBA_INTEGER,o=U.UNSIGNED_SHORT):t instanceof Int8Array?(a=E.RGBA,o=U.BYTE):(a=E.RGBA,o=U.UNSIGNED_BYTE),n.internal=!0,new Ue(n,Object.assign({},Eu,{type:o,format:a},r))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),wt[e]&&wt[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),wt[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=wt[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete wt[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete wt[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};wr.defaultOptions={mipmap:Kt.POW2,anisotropicLevel:0,scaleMode:ee.LINEAR,wrapMode:re.CLAMP,alphaMode:bt.UNPACK,target:je.TEXTURE_2D,format:E.RGBA,type:U.UNSIGNED_BYTE},wr._globalBatch=0;let X=wr;class Sr{constructor(){this.texArray=null,this.blend=0,this.type=zt.TRIANGLES,this.start=0,this.size=0,this.data=null}}let Au=0;class nt{constructor(t,e=!0,s=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=s,this.static=e,this.id=Au++,this.disposeRunner=new Pt("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?Yt.ELEMENT_ARRAY_BUFFER:Yt.ARRAY_BUFFER}get index(){return this.type===Yt.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new nt(t)}}class hi{constructor(t,e=0,s=!1,r=U.FLOAT,n,a,o,h=1){this.buffer=t,this.size=e,this.normalized=s,this.type=r,this.stride=n,this.start=a,this.instance=o,this.divisor=h}destroy(){this.buffer=null}static from(t,e,s,r,n){return new hi(t,e,s,r,n)}}const wu={Float32Array,Uint32Array,Int32Array,Uint8Array};function Su(i,t){let e=0,s=0;const r={};for(let h=0;h<i.length;h++)s+=t[h],e+=i[h].length;const n=new ArrayBuffer(e*4);let a=null,o=0;for(let h=0;h<i.length;h++){const l=t[h],u=i[h],c=Ai(u);r[c]||(r[c]=new wu[c](n)),a=r[c];for(let d=0;d<u.length;d++){const f=(d/l|0)*s+o,p=d%l;a[f+p]=u[d]}o+=l}return new Float32Array(n)}const Jn={5126:4,5123:2,5121:1};let Iu=0;const Ru={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class fe{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=Iu++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new Pt("disposeGeometry"),this.refCount=0}addAttribute(t,e,s=0,r=!1,n,a,o,h=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof nt||(e instanceof Array&&(e=new Float32Array(e)),e=new nt(e));const l=t.split("|");if(l.length>1){for(let c=0;c<l.length;c++)this.addAttribute(l[c],e,s,r,n);return this}let u=this.buffers.indexOf(e);return u===-1&&(this.buffers.push(e),u=this.buffers.length-1),this.attributes[t]=new hi(u,s,r,n,a,o,h),this.instanced=this.instanced||h,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof nt||(t instanceof Array&&(t=new Uint16Array(t)),t=new nt(t)),t.type=Yt.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;const t=[],e=[],s=new nt;let r;for(r in this.attributes){const n=this.attributes[r],a=this.buffers[n.buffer];t.push(a.data),e.push(n.size*Jn[n.type]/4),n.buffer=0}for(s.data=Su(t,e),r=0;r<this.buffers.length;r++)this.buffers[r]!==this.indexBuffer&&this.buffers[r].destroy();return this.buffers=[s],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(const t in this.attributes){const e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){const t=new fe;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new nt(this.buffers[e].data.slice(0));for(const e in this.attributes){const s=this.attributes[e];t.attributes[e]=new hi(s.buffer,s.size,s.normalized,s.type,s.stride,s.start,s.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=Yt.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new fe,s=[],r=[],n=[];let a;for(let o=0;o<t.length;o++){a=t[o];for(let h=0;h<a.buffers.length;h++)r[h]=r[h]||0,r[h]+=a.buffers[h].data.length,n[h]=0}for(let o=0;o<a.buffers.length;o++)s[o]=new Ru[Ai(a.buffers[o].data)](r[o]),e.buffers[o]=new nt(s[o]);for(let o=0;o<t.length;o++){a=t[o];for(let h=0;h<a.buffers.length;h++)s[h].set(a.buffers[h].data,n[h]),n[h]+=a.buffers[h].data.length}if(e.attributes=a.attributes,a.indexBuffer){e.indexBuffer=e.buffers[a.buffers.indexOf(a.indexBuffer)],e.indexBuffer.type=Yt.ELEMENT_ARRAY_BUFFER;let o=0,h=0,l=0,u=0;for(let c=0;c<a.buffers.length;c++)if(a.buffers[c]!==a.indexBuffer){u=c;break}for(const c in a.attributes){const d=a.attributes[c];(d.buffer|0)===u&&(h+=d.size*Jn[d.type]/4)}for(let c=0;c<t.length;c++){const d=t[c].indexBuffer.data;for(let f=0;f<d.length;f++)e.indexBuffer.data[f+l]+=o;o+=t[c].buffers[u].data.length/h,l+=d.length}}return e}}class So extends fe{constructor(t=!1){super(),this._buffer=new nt(null,t,!1),this._indexBuffer=new nt(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,U.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,U.FLOAT).addAttribute("aColor",this._buffer,4,!0,U.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,U.FLOAT).addIndex(this._indexBuffer)}}const li=Math.PI*2,Cu=180/Math.PI,Pu=Math.PI/180;var gt=(i=>(i[i.POLY=0]="POLY",i[i.RECT=1]="RECT",i[i.CIRC=2]="CIRC",i[i.ELIP=3]="ELIP",i[i.RREC=4]="RREC",i))(gt||{});class q{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new q(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}}const Bs=[new q,new q,new q,new q];class j{constructor(t=0,e=0,s=0,r=0){this.x=Number(t),this.y=Number(e),this.width=Number(s),this.height=Number(r),this.type=gt.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new j(0,0,0,0)}clone(){return new j(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){const A=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=A)return!1;const B=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>B}const s=this.left,r=this.right,n=this.top,a=this.bottom;if(r<=s||a<=n)return!1;const o=Bs[0].set(t.left,t.top),h=Bs[1].set(t.left,t.bottom),l=Bs[2].set(t.right,t.top),u=Bs[3].set(t.right,t.bottom);if(l.x<=o.x||h.y<=o.y)return!1;const c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(o,o),e.apply(h,h),e.apply(l,l),e.apply(u,u),Math.max(o.x,h.x,l.x,u.x)<=s||Math.min(o.x,h.x,l.x,u.x)>=r||Math.max(o.y,h.y,l.y,u.y)<=n||Math.min(o.y,h.y,l.y,u.y)>=a))return!1;const d=c*(h.y-o.y),f=c*(o.x-h.x),p=d*s+f*n,m=d*r+f*n,g=d*s+f*a,v=d*r+f*a;if(Math.max(p,m,g,v)<=d*o.x+f*o.y||Math.min(p,m,g,v)>=d*u.x+f*u.y)return!1;const x=c*(o.y-l.y),_=c*(l.x-o.x),y=x*s+_*n,T=x*r+_*n,P=x*s+_*a,w=x*r+_*a;return!(Math.max(y,T,P,w)<=x*o.x+_*o.y||Math.min(y,T,P,w)>=x*u.x+_*u.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),s=Math.min(this.x+this.width,t.x+t.width),r=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(s-e,0),this.y=r,this.height=Math.max(n-r,0),this}ceil(t=1,e=.001){const s=Math.ceil((this.x+this.width-e)*t)/t,r=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=s-this.x,this.height=r-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),s=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=s-e,this.y=r,this.height=n-r,this}}class ln{constructor(t=0,e=0,s=0){this.x=t,this.y=e,this.radius=s,this.type=gt.CIRC}clone(){return new ln(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const s=this.radius*this.radius;let r=this.x-t,n=this.y-e;return r*=r,n*=n,r+n<=s}getBounds(){return new j(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}class un{constructor(t=0,e=0,s=0,r=0){this.x=t,this.y=e,this.width=s,this.height=r,this.type=gt.ELIP}clone(){return new un(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let s=(t-this.x)/this.width,r=(e-this.y)/this.height;return s*=s,r*=r,s+r<=1}getBounds(){return new j(this.x-this.width,this.y-this.height,this.width,this.height)}}class We{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const s=[];for(let r=0,n=e.length;r<n;r++)s.push(e[r].x,e[r].y);e=s}this.points=e,this.type=gt.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new We(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let s=!1;const r=this.points.length/2;for(let n=0,a=r-1;n<r;a=n++){const o=this.points[n*2],h=this.points[n*2+1],l=this.points[a*2],u=this.points[a*2+1];h>e!=u>e&&t<(l-o)*((e-h)/(u-h))+o&&(s=!s)}return s}}class cn{constructor(t=0,e=0,s=0,r=0,n=20){this.x=t,this.y=e,this.width=s,this.height=r,this.radius=n,this.type=gt.RREC}clone(){return new cn(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const s=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+s&&e<=this.y+this.height-s||t>=this.x+s&&t<=this.x+this.width-s)return!0;let r=t-(this.x+s),n=e-(this.y+s);const a=s*s;if(r*r+n*n<=a||(r=t-(this.x+this.width-s),r*r+n*n<=a)||(n=e-(this.y+this.height-s),r*r+n*n<=a)||(r=t-(this.x+s),r*r+n*n<=a))return!0}return!1}}class tt{constructor(t=1,e=0,s=0,r=1,n=0,a=0){this.array=null,this.a=t,this.b=e,this.c=s,this.d=r,this.tx=n,this.ty=a}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,s,r,n,a){return this.a=t,this.b=e,this.c=s,this.d=r,this.tx=n,this.ty=a,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const s=e||this.array;return t?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s}apply(t,e){e=e||new q;const s=t.x,r=t.y;return e.x=this.a*s+this.c*r+this.tx,e.y=this.b*s+this.d*r+this.ty,e}applyInverse(t,e){e=e||new q;const s=1/(this.a*this.d+this.c*-this.b),r=t.x,n=t.y;return e.x=this.d*s*r+-this.c*s*n+(this.ty*this.c-this.tx*this.d)*s,e.y=this.a*s*n+-this.b*s*r+(-this.ty*this.a+this.tx*this.b)*s,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),s=Math.sin(t),r=this.a,n=this.c,a=this.tx;return this.a=r*e-this.b*s,this.b=r*s+this.b*e,this.c=n*e-this.d*s,this.d=n*s+this.d*e,this.tx=a*e-this.ty*s,this.ty=a*s+this.ty*e,this}append(t){const e=this.a,s=this.b,r=this.c,n=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*s+t.b*n,this.c=t.c*e+t.d*r,this.d=t.c*s+t.d*n,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*s+t.ty*n+this.ty,this}setTransform(t,e,s,r,n,a,o,h,l){return this.a=Math.cos(o+l)*n,this.b=Math.sin(o+l)*n,this.c=-Math.sin(o-h)*a,this.d=Math.cos(o-h)*a,this.tx=t-(s*this.a+r*this.c),this.ty=e-(s*this.b+r*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const s=this.a,r=this.c;this.a=s*t.a+this.b*t.c,this.b=s*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*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,s=this.b,r=this.c,n=this.d,a=t.pivot,o=-Math.atan2(-r,n),h=Math.atan2(s,e),l=Math.abs(o+h);return l<1e-5||Math.abs(li-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=h),t.scale.x=Math.sqrt(e*e+s*s),t.scale.y=Math.sqrt(r*r+n*n),t.position.x=this.tx+(a.x*e+a.y*r),t.position.y=this.ty+(a.x*s+a.y*n),t}invert(){const t=this.a,e=this.b,s=this.c,r=this.d,n=this.tx,a=t*r-e*s;return this.a=r/a,this.b=-e/a,this.c=-s/a,this.d=t/a,this.tx=(s*this.ty-r*n)/a,this.ty=-(t*this.ty-e*n)/a,this}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 tt;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}static get IDENTITY(){return new tt}static get TEMP_MATRIX(){return new tt}}const be=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Te=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Ee=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Ae=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ir=[],Io=[],Fs=Math.sign;function Mu(){for(let i=0;i<16;i++){const t=[];Ir.push(t);for(let e=0;e<16;e++){const s=Fs(be[i]*be[e]+Ee[i]*Te[e]),r=Fs(Te[i]*be[e]+Ae[i]*Te[e]),n=Fs(be[i]*Ee[e]+Ee[i]*Ae[e]),a=Fs(Te[i]*Ee[e]+Ae[i]*Ae[e]);for(let o=0;o<16;o++)if(be[o]===s&&Te[o]===r&&Ee[o]===n&&Ae[o]===a){t.push(o);break}}}for(let i=0;i<16;i++){const t=new tt;t.set(be[i],Te[i],Ee[i],Ae[i],0,0),Io.push(t)}}Mu();const et={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:i=>be[i],uY:i=>Te[i],vX:i=>Ee[i],vY:i=>Ae[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>Ir[i][t],sub:(i,t)=>Ir[i][et.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?et.S:et.N:Math.abs(t)*2<=Math.abs(i)?i>0?et.E:et.W:t>0?i>0?et.SE:et.SW:i>0?et.NE:et.NW,matrixAppendRotationInv:(i,t,e=0,s=0)=>{const r=Io[et.inv(t)];r.tx=e,r.ty=s,i.append(r)}};class ue{constructor(t,e,s=0,r=0){this._x=s,this._y=r,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new ue(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}}const Rr=class{constructor(){this.worldTransform=new tt,this.localTransform=new tt,this.position=new ue(this.onChange,this,0,0),this.scale=new ue(this.onChange,this,1,1),this.pivot=new ue(this.onChange,this,0,0),this.skew=new ue(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){const t=this.localTransform;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(t){const e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){const s=t.worldTransform,r=this.worldTransform;r.a=e.a*s.a+e.b*s.c,r.b=e.a*s.b+e.b*s.d,r.c=e.c*s.a+e.d*s.c,r.d=e.c*s.b+e.d*s.d,r.tx=e.tx*s.a+e.ty*s.c+s.tx,r.ty=e.tx*s.b+e.ty*s.d+s.ty,this._parentID=t._worldID,this._worldID++}}setFromMatrix(t){t.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())}};Rr.IDENTITY=new Rr;let dn=Rr;var Du=`varying vec2 vTextureCoord;
|
|
16
16
|
|
|
17
17
|
uniform sampler2D uSampler;
|
|
18
18
|
|
|
19
19
|
void main(void){
|
|
20
20
|
gl_FragColor *= texture2D(uSampler, vTextureCoord);
|
|
21
|
-
}`,
|
|
21
|
+
}`,Ou=`attribute vec2 aVertexPosition;
|
|
22
22
|
attribute vec2 aTextureCoord;
|
|
23
23
|
|
|
24
24
|
uniform mat3 projectionMatrix;
|
|
@@ -149,7 +149,7 @@ void main(void){
|
|
|
149
149
|
cv[3] = v[3];
|
|
150
150
|
|
|
151
151
|
gl.uniform4f(ud["${i}"].location, v[0], v[1], v[2], v[3])
|
|
152
|
-
}`}],
|
|
152
|
+
}`}],Bu={float:`
|
|
153
153
|
if (cv !== v)
|
|
154
154
|
{
|
|
155
155
|
cu.value = v;
|
|
@@ -285,7 +285,7 @@ void main(void){
|
|
|
285
285
|
cu.value = v;
|
|
286
286
|
|
|
287
287
|
gl.uniform1i(location, v);
|
|
288
|
-
}`},
|
|
288
|
+
}`},Fu={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function Nu(i,t){var e;const s=[`
|
|
289
289
|
var v = null;
|
|
290
290
|
var cv = null;
|
|
291
291
|
var cu = null;
|
|
@@ -295,18 +295,18 @@ void main(void){
|
|
|
295
295
|
renderer.shader.syncUniformBufferGroup(uv.${r}, '${r}');
|
|
296
296
|
`):s.push(`
|
|
297
297
|
renderer.shader.syncUniformGroup(uv.${r}, syncData);
|
|
298
|
-
`));continue}const a=i.uniforms[r];let o=!1;for(let h=0;h<Ye.length;h++)if(Ye[h].test(n,a)){s.push(Ye[h].code(r,a)),o=!0;break}if(!o){const h=(n.size===1&&!n.isArray?
|
|
298
|
+
`));continue}const a=i.uniforms[r];let o=!1;for(let h=0;h<Ye.length;h++)if(Ye[h].test(n,a)){s.push(Ye[h].code(r,a)),o=!0;break}if(!o){const h=(n.size===1&&!n.isArray?Bu:Fu)[n.type].replace("location",`ud["${r}"].location`);s.push(`
|
|
299
299
|
cu = ud["${r}"];
|
|
300
300
|
cv = cu.value;
|
|
301
301
|
v = uv["${r}"];
|
|
302
302
|
${h};`)}}return new Function("ud","uv","renderer","syncData",s.join(`
|
|
303
|
-
`))}const Co={};let es=Co;function
|
|
303
|
+
`))}const Co={};let es=Co;function Lu(){if(es===Co||es!=null&&es.isContextLost()){const i=D.ADAPTER.createCanvas();let t;D.PREFER_ENV>=De.WEBGL2&&(t=i.getContext("webgl2",{})),t||(t=i.getContext("webgl",{})||i.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),es=t}return es}let Ns;function Uu(){if(!Ns){Ns=It.MEDIUM;const i=Lu();if(i&&i.getShaderPrecisionFormat){const t=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT);t&&(Ns=t.precision?It.HIGH:It.MEDIUM)}}return Ns}function ea(i,t){const e=i.getShaderSource(t).split(`
|
|
304
304
|
`).map((l,u)=>`${u}: ${l}`),s=i.getShaderInfoLog(t),r=s.split(`
|
|
305
305
|
`),n={},a=r.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!n[l]?(n[l]=!0,!0):!1),o=[""];a.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const h=e.join(`
|
|
306
|
-
`);o[0]=h,console.error(s),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}function
|
|
307
|
-
${i}`}else if(e!==It.HIGH&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}let ss;function
|
|
306
|
+
`);o[0]=h,console.error(s),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}function ku(i,t,e,s){i.getProgramParameter(t,i.LINK_STATUS)||(i.getShaderParameter(e,i.COMPILE_STATUS)||ea(i,e),i.getShaderParameter(s,i.COMPILE_STATUS)||ea(i,s),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(t)))}const Gu={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 Po(i){return Gu[i]}let Ls=null;const sa={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function Mo(i,t){if(!Ls){const e=Object.keys(sa);Ls={};for(let s=0;s<e.length;++s){const r=e[s];Ls[i[r]]=sa[r]}}return Ls[t]}function ia(i,t,e){if(i.substring(0,9)!=="precision"){let s=t;return t===It.HIGH&&e!==It.HIGH&&(s=It.MEDIUM),`precision ${s} float;
|
|
307
|
+
${i}`}else if(e!==It.HIGH&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}let ss;function $u(){if(typeof ss=="boolean")return ss;try{ss=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch(i){ss=!1}return ss}let Hu=0;const Us={},Cr=class ke{constructor(t,e,s="pixi-shader",r={}){this.extra={},this.id=Hu++,this.vertexSrc=t||ke.defaultVertexSrc,this.fragmentSrc=e||ke.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=r,this.vertexSrc.substring(0,8)!=="#version"&&(s=s.replace(/\s+/g,"-"),Us[s]?(Us[s]++,s+=`-${Us[s]}`):Us[s]=1,this.vertexSrc=`#define SHADER_NAME ${s}
|
|
308
308
|
${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${s}
|
|
309
|
-
${this.fragmentSrc}`,this.vertexSrc=ia(this.vertexSrc,ke.defaultVertexPrecision,It.HIGH),this.fragmentSrc=ia(this.fragmentSrc,ke.defaultFragmentPrecision,
|
|
309
|
+
${this.fragmentSrc}`,this.vertexSrc=ia(this.vertexSrc,ke.defaultVertexPrecision,It.HIGH),this.fragmentSrc=ia(this.fragmentSrc,ke.defaultFragmentPrecision,Uu())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return Ou}static get defaultFragmentSrc(){return Du}static from(t,e,s){const r=t+e;let n=br[r];return n||(br[r]=n=new ke(t,e,s)),n}};Cr.defaultVertexPrecision=It.HIGH,Cr.defaultFragmentPrecision=Wt.apple.device?It.HIGH:It.MEDIUM;let ie=Cr,Vu=0;class Lt{constructor(t,e,s){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=Vu++,this.static=!!e,this.ubo=!!s,t instanceof nt?(this.buffer=t,this.buffer.type=Yt.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new nt(new Float32Array(1)),this.buffer.type=Yt.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,s){if(!this.ubo)this.uniforms[t]=new Lt(e,s);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(t,e,s){return new Lt(t,e,s)}static uboFrom(t,e){return new Lt(t,e!=null?e:!0,!0)}}class qt{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof Lt?this.uniformGroup=e:this.uniformGroup=new Lt(e):this.uniformGroup=new Lt({}),this.disposeRunner=new Pt("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(const s in e.uniforms){const r=e.uniforms[s];if(r.group===!0&&this.checkUniformExists(t,r))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(t,e,s){const r=ie.from(t,e);return new qt(r,s)}}class Xu{constructor(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},!e.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!e.includes("%forloop%"))throw new Error('Fragment template must contain "%forloop%".')}generateShader(t){if(!this.programCache[t]){const s=new Int32Array(t);for(let n=0;n<t;n++)s[n]=n;this.defaultGroupCache[t]=Lt.from({uSamplers:s},!0);let r=this.fragTemplate;r=r.replace(/%count%/gi,`${t}`),r=r.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new ie(this.vertexSrc,r)}const e={tint:new Float32Array([1,1,1,1]),translationMatrix:new tt,default:this.defaultGroupCache[t]};return new qt(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
|
|
310
310
|
`,e+=`
|
|
311
311
|
`;for(let s=0;s<t;s++)s>0&&(e+=`
|
|
312
312
|
else `),s<t-1&&(e+=`if(vTextureId < ${s}.5)`),e+=`
|
|
@@ -314,7 +314,7 @@ else `),s<t-1&&(e+=`if(vTextureId < ${s}.5)`),e+=`
|
|
|
314
314
|
color = texture2D(uSamplers[${s}], vTextureCoord);`,e+=`
|
|
315
315
|
}`;return e+=`
|
|
316
316
|
`,e+=`
|
|
317
|
-
`,e}}class Pr{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let t=0;t<this.count;t++)this.elements[t]=null;this.count=0}}function
|
|
317
|
+
`,e}}class Pr{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let t=0;t<this.count;t++)this.elements[t]=null;this.count=0}}function ju(){return!Wt.apple.device}function zu(i){let t=!0;const e=D.ADAPTER.getNavigator();if(Wt.tablet||Wt.phone){if(Wt.apple.device){const s=e.userAgent.match(/OS (\d+)_(\d+)?/);s&&parseInt(s[1],10)<11&&(t=!1)}if(Wt.android.device){const s=e.userAgent.match(/Android\s([0-9.]*)/);s&&parseInt(s[1],10)<7&&(t=!1)}}return t?i:4}class Si{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}var Wu=`varying vec2 vTextureCoord;
|
|
318
318
|
varying vec4 vColor;
|
|
319
319
|
varying float vTextureId;
|
|
320
320
|
uniform sampler2D uSamplers[%count%];
|
|
@@ -324,7 +324,7 @@ void main(void){
|
|
|
324
324
|
%forloop%
|
|
325
325
|
gl_FragColor = color * vColor;
|
|
326
326
|
}
|
|
327
|
-
`,
|
|
327
|
+
`,Yu=`precision highp float;
|
|
328
328
|
attribute vec2 aVertexPosition;
|
|
329
329
|
attribute vec2 aTextureCoord;
|
|
330
330
|
attribute vec4 aColor;
|
|
@@ -345,14 +345,14 @@ void main(void){
|
|
|
345
345
|
vTextureId = aTextureId;
|
|
346
346
|
vColor = aColor * tint;
|
|
347
347
|
}
|
|
348
|
-
`;const as=class Bt extends Si{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=So,this.vertexSize=6,this.state=ne.for2d(),this.size=Bt.defaultBatchSize*4,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),t.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){var t;return this._defaultMaxTextures=(t=this._defaultMaxTextures)!=null?t:
|
|
348
|
+
`;const as=class Bt extends Si{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=So,this.vertexSize=6,this.state=ne.for2d(),this.size=Bt.defaultBatchSize*4,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),t.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){var t;return this._defaultMaxTextures=(t=this._defaultMaxTextures)!=null?t:zu(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){var t;return this._canUploadSameBuffer=(t=this._canUploadSameBuffer)!=null?t:ju(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return this.maxTextures}static get defaultVertexSrc(){return Yu}static get defaultFragmentTemplate(){return Wu}setShaderGenerator({vertex:t=Bt.defaultVertexSrc,fragment:e=Bt.defaultFragmentTemplate}={}){this.shaderGenerator=new Xu(t,e)}contextChange(){const t=this.renderer.gl;D.PREFER_ENV===De.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),Bt.defaultMaxTextures),this.maxTextures=vu(this.maxTextures,t)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){const{_drawCallPool:t,_textureArrayPool:e}=Bt,s=this.size/4,r=Math.floor(s/this.maxTextures)+1;for(;t.length<s;)t.push(new Sr);for(;e.length<r;)e.push(new Pr);for(let n=0;n<this.maxTextures;n++)this._tempBoundTextures[n]=null}onPrerender(){this._flushId=0}render(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){const{_bufferedTextures:t,maxTextures:e}=this,s=Bt._textureArrayPool,r=this.renderer.batch,n=this._tempBoundTextures,a=this.renderer.textureGC.count;let o=++X._globalBatch,h=0,l=s[0],u=0;r.copyBoundTextures(n,e);for(let c=0;c<this._bufferSize;++c){const d=t[c];t[c]=null,d._batchEnabled!==o&&(l.count>=e&&(r.boundArray(l,n,o,e),this.buildDrawCalls(l,u,c),u=c,l=s[++h],++o),d._batchEnabled=o,d.touched=a,l.elements[l.count++]=d)}l.count>0&&(r.boundArray(l,n,o,e),this.buildDrawCalls(l,u,this._bufferSize),++h,++o);for(let c=0;c<n.length;c++)n[c]=null;X._globalBatch=o}buildDrawCalls(t,e,s){const{_bufferedElements:r,_attributeBuffer:n,_indexBuffer:a,vertexSize:o}=this,h=Bt._drawCallPool;let l=this._dcIndex,u=this._aIndex,c=this._iIndex,d=h[l];d.start=this._iIndex,d.texArray=t;for(let f=e;f<s;++f){const p=r[f],m=p._texture.baseTexture,g=on[m.alphaMode?1:0][p.blendMode];r[f]=null,e<f&&d.blend!==g&&(d.size=c-d.start,e=f,d=h[++l],d.texArray=t,d.start=c),this.packInterleavedGeometry(p,n,a,u,c),u+=p.vertexData.length/2*o,c+=p.indices.length,d.blend=g}e<s&&(d.size=c-d.start,++l),this._dcIndex=l,this._aIndex=u,this._iIndex=c}bindAndClearTexArray(t){const e=this.renderer.texture;for(let s=0;s<t.count;s++)e.bind(t.elements[s],t.ids[s]),t.elements[s]=null;t.count=0}updateGeometry(){const{_packedGeometries:t,_attributeBuffer:e,_indexBuffer:s}=this;Bt.canUploadSameBuffer?(t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(s),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,t[this._flushId]=new this.geometryClass),t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(s),this.renderer.geometry.bind(t[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){const t=this._dcIndex,{gl:e,state:s}=this.renderer,r=Bt._drawCallPool;let n=null;for(let a=0;a<t;a++){const{texArray:o,type:h,size:l,start:u,blend:c}=r[a];n!==o&&(n=o,this.bindAndClearTexArray(o)),this.state.blendMode=c,s.set(this.state),e.drawElements(h,l,e.UNSIGNED_SHORT,u*2)}}flush(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),Bt.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(t){const e=xs(Math.ceil(t/8)),s=vr(e),r=e*8;this._aBuffers.length<=s&&(this._iBuffers.length=s+1);let n=this._aBuffers[r];return n||(this._aBuffers[r]=n=new Er(r*this.vertexSize*4)),n}getIndexBuffer(t){const e=xs(Math.ceil(t/12)),s=vr(e),r=e*12;this._iBuffers.length<=s&&(this._iBuffers.length=s+1);let n=this._iBuffers[s];return n||(this._iBuffers[s]=n=new Uint16Array(r)),n}packInterleavedGeometry(t,e,s,r,n){const{uint32View:a,float32View:o}=e,h=r/this.vertexSize,l=t.uvs,u=t.indices,c=t.vertexData,d=t._texture.baseTexture._batchLocation,f=Math.min(t.worldAlpha,1),p=K.shared.setValue(t._tintRGB).toPremultiplied(f,t._texture.baseTexture.alphaMode>0);for(let m=0;m<c.length;m+=2)o[r++]=c[m],o[r++]=c[m+1],o[r++]=l[m],o[r++]=l[m+1],a[r++]=p,o[r++]=d;for(let m=0;m<u.length;m++)s[n++]=h+u[m]}};as.defaultBatchSize=4096,as.extension={name:"batch",type:C.RendererPlugin},as._drawCallPool=[],as._textureArrayPool=[];let we=as;N.add(we);var qu=`varying vec2 vTextureCoord;
|
|
349
349
|
|
|
350
350
|
uniform sampler2D uSampler;
|
|
351
351
|
|
|
352
352
|
void main(void){
|
|
353
353
|
gl_FragColor = texture2D(uSampler, vTextureCoord);
|
|
354
354
|
}
|
|
355
|
-
`,
|
|
355
|
+
`,Ku=`attribute vec2 aVertexPosition;
|
|
356
356
|
|
|
357
357
|
uniform mat3 projectionMatrix;
|
|
358
358
|
|
|
@@ -378,7 +378,7 @@ void main(void)
|
|
|
378
378
|
gl_Position = filterVertexPosition();
|
|
379
379
|
vTextureCoord = filterTextureCoord();
|
|
380
380
|
}
|
|
381
|
-
`;const Mr=class os extends qt{constructor(t,e,s){const r=ie.from(t||os.defaultVertexSrc,e||os.defaultFragmentSrc);super(r,s),this.padding=0,this.resolution=os.defaultResolution,this.multisample=os.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new ne}apply(t,e,s,r,n){t.applyFilter(this,e,s,r)}get blendMode(){return this.state.blendMode}set blendMode(t){this.state.blendMode=t}get resolution(){return this._resolution}set resolution(t){this._resolution=t}static get defaultVertexSrc(){return qu}static get defaultFragmentSrc(){return Yu}};Mr.defaultResolution=1,Mr.defaultMultisample=ht.NONE;let xt=Mr;class ui{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new K(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;const{backgroundColor:e,background:s,backgroundAlpha:r}=t,n=s!=null?s:e;n!==void 0&&(this.color=n),this.alpha=r}get color(){return this._backgroundColor.value}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get backgroundColor(){return this._backgroundColor}destroy(){}}ui.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},ui.extension={type:[C.RendererSystem,C.CanvasRendererSystem],name:"background"};N.add(ui);class Do{constructor(t){this.renderer=t,this.emptyRenderer=new Si(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){const{boundTextures:s}=this.renderer.texture;for(let r=e-1;r>=0;--r)t[r]=s[r]||null,t[r]&&(t[r]._batchLocation=r)}boundArray(t,e,s,r){const{elements:n,ids:a,count:o}=t;let h=0;for(let l=0;l<o;l++){const u=n[l],c=u._batchLocation;if(c>=0&&c<r&&e[c]===u){a[l]=c;continue}for(;h<r;){const d=e[h];if(d&&d._batchEnabled===s&&d._batchLocation===h){h++;continue}a[l]=h,u._batchLocation=h,e[h]=u;break}}}destroy(){this.renderer=null}}Do.extension={type:C.RendererSystem,name:"batch"};N.add(Do);let ra=0;class ci{constructor(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},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,this.renderer.CONTEXT_UID=ra++}init(t){if(t.context)this.initFromContext(t.context);else{const e=this.renderer.background.alpha<1,s=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:s,antialias:t.antialias,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference})}}initFromContext(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=ra++,this.renderer.runners.contextChange.emit(t);const e=this.renderer.view;e.addEventListener!==void 0&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){const e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let s;if(O.PREFER_ENV>=De.WEBGL2&&(s=t.getContext("webgl2",e)),s)this.webGLVersion=2;else if(this.webGLVersion=1,s=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!s)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=s,this.getExtensions(),this.gl}getExtensions(){const{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){const t=this.renderer.view;this.renderer=null,t.removeEventListener!==void 0&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){const e=t.getContextAttributes(),s="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;s&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const r=s||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=r,r||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}ci.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},ci.extension={type:C.RendererSystem,name:"context"};N.add(ci);class Dr{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new Pt("disposeFramebuffer"),this.multisample=ht.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new X(null,{scaleMode:ee.NEAREST,resolution:1,mipmap:Kt.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new X(null,{scaleMode:ee.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Kt.OFF,format:A.DEPTH_COMPONENT,type:k.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let s=0;s<this.colorTextures.length;s++){const r=this.colorTextures[s],n=r.resolution;r.setSize(t/n,e/n)}if(this.depthTexture){const s=this.depthTexture.resolution;this.depthTexture.setSize(t/s,e/s)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}}class Oo extends X{constructor(t={}){var e,s,r;if(typeof t=="number"){const n=arguments[0],a=arguments[1],o=arguments[2],h=arguments[3];t={width:n,height:a,scaleMode:o,resolution:h}}t.width=(e=t.width)!=null?e:100,t.height=(s=t.height)!=null?s:100,(r=t.multisample)!=null||(t.multisample=ht.NONE),super(null,t),this.mipmap=Kt.OFF,this.valid=!0,this._clear=new K([0,0,0,0]),this.framebuffer=new Dr(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}}class pe extends bs{constructor(t){const e=t,s=e.naturalWidth||e.videoWidth||e.width,r=e.naturalHeight||e.videoHeight||e.height;super(s,r),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,s){s===void 0&&!e.startsWith("data:")?t.crossOrigin=Ao(e):s!==!1&&(t.crossOrigin=typeof s=="string"?s:"anonymous")}upload(t,e,s,r){const n=t.gl,a=e.realWidth,o=e.realHeight;if(r=r||this.source,typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement){if(!r.complete||r.naturalWidth===0)return!1}else if(typeof HTMLVideoElement!="undefined"&&r instanceof HTMLVideoElement&&r.readyState<=1)return!1;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===bt.UNPACK),!this.noSubImage&&e.target===n.TEXTURE_2D&&s.width===a&&s.height===o?n.texSubImage2D(n.TEXTURE_2D,0,0,0,e.format,s.type,r):(s.width=a,s.height=o,n.texImage2D(e.target,0,s.internalFormat,e.format,s.type,r)),!0}update(){if(this.destroyed)return;const t=this.source,e=t.naturalWidth||t.videoWidth||t.width,s=t.naturalHeight||t.videoHeight||t.height;this.resize(e,s),super.update()}dispose(){this.source=null}}class Bo extends pe{constructor(t,e){var s;if(e=e||{},typeof t=="string"){const r=new Image;pe.crossOrigin(r,t,e.crossorigin),r.src=t,t=r}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=((s=e.createBitmap)!=null?s:O.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.bitmap=null,this._load=null,e.autoLoad!==!1&&this.load()}load(t){return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise((e,s)=>{const r=this.source;this.url=r.src;const n=()=>{this.destroyed||(r.onload=null,r.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};r.complete&&r.src?n():(r.onload=n,r.onerror=a=>{s(a),this.onError.emit(a)})}),this._load)}process(){const t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);const e=globalThis.createImageBitmap,s=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:s?"cors":"no-cors"}).then(r=>r.blob()).then(r=>e(r,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===bt.UNPACK?"premultiply":"none"})).then(r=>this.destroyed?Promise.reject():(this.bitmap=r,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,s){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,s);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,s,this.bitmap),!this.preserveBitmap){let r=!0;const n=e._glTextures;for(const a in n){const o=n[a];if(o!==s&&o.dirtyId!==e.dirtyId){r=!1;break}}r&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement!="undefined"&&(typeof t=="string"||t instanceof HTMLImageElement)}}class Fo{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,s){const r=e.width,n=e.height;if(s){const a=t.width/2/r,o=t.height/2/n,h=t.x/r+a,l=t.y/n+o;s=et.add(s,et.NW),this.x0=h+a*et.uX(s),this.y0=l+o*et.uY(s),s=et.add(s,2),this.x1=h+a*et.uX(s),this.y1=l+o*et.uY(s),s=et.add(s,2),this.x2=h+a*et.uX(s),this.y2=l+o*et.uY(s),s=et.add(s,2),this.x3=h+a*et.uX(s),this.y3=l+o*et.uY(s)}else this.x0=t.x/r,this.y0=t.y/n,this.x1=(t.x+t.width)/r,this.y1=t.y/n,this.x2=(t.x+t.width)/r,this.y2=(t.y+t.height)/n,this.x3=t.x/r,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}}const na=new Fo;function ks(i){i.destroy=function(){},i.on=function(){},i.once=function(){},i.emit=function(){}}class D extends Ke{constructor(t,e,s,r,n,a,o){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new j(0,0,1,1)),t instanceof D&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=r,this.valid=!1,this.destroyed=!1,this._uvs=na,this.uvMatrix=null,this.orig=s||e,this._rotate=Number(n||0),n===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=a?new q(a.x,a.y):new q(0,0),this.defaultBorders=o,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){const{resource:e}=this.baseTexture;e!=null&&e.url&&yt[e.url]&&D.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,D.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var t;const e=this._frame.clone(),s=this._frame===this.orig?e:this.orig.clone(),r=new D(this.baseTexture,!this.noFrame&&e,s,(t=this.trim)==null?void 0:t.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(r._frame=e),r}updateUvs(){this._uvs===na&&(this._uvs=new Fo),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},s=O.STRICT_TEXTURE_CACHE){const r=typeof t=="string";let n=null;if(r)n=t;else if(t instanceof X){if(!t.cacheId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${o}-${de()}`,X.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${o}_${de()}`}n=t._pixiId}let a=yt[n];if(r&&s&&!a)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!a&&!(t instanceof X)?(e.resolution||(e.resolution=Zt(t)),a=new D(new X(t,e)),a.baseTexture.cacheId=n,X.addToCache(a.baseTexture,n),D.addToCache(a,n)):!a&&t instanceof X&&(a=new D(t),D.addToCache(a,n)),a}static fromURL(t,e){const s=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),r=D.from(t,Object.assign({resourceOptions:s},e),!1),n=r.baseTexture.resource;return r.baseTexture.valid?Promise.resolve(r):n.load().then(()=>Promise.resolve(r))}static fromBuffer(t,e,s,r){return new D(X.fromBuffer(t,e,s,r))}static fromLoader(t,e,s,r){const n=new X(t,Object.assign({scaleMode:X.defaultOptions.scaleMode,resolution:Zt(e)},r)),{resource:a}=n;a instanceof Bo&&(a.url=e);const o=new D(n);return s||(s=e),X.addToCache(o.baseTexture,s),D.addToCache(o,s),s!==e&&(X.addToCache(o.baseTexture,e),D.addToCache(o,e)),o.baseTexture.valid?Promise.resolve(o):new Promise(h=>{o.baseTexture.once("loaded",()=>h(o))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),yt[e]&&yt[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),yt[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=yt[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete yt[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)yt[t.textureCacheIds[e]]===t&&delete yt[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;const{x:e,y:s,width:r,height:n}=t,a=e+r>this.baseTexture.width,o=s+n>this.baseTexture.height;if(a||o){const h=a&&o?"and":"or",l=`X: ${e} + ${r} = ${e+r} > ${this.baseTexture.width}`,u=`Y: ${s} + ${n} = ${s+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${u}`)}this.valid=r&&n&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return D._EMPTY||(D._EMPTY=new D(new X),ks(D._EMPTY),ks(D._EMPTY.baseTexture)),D._EMPTY}static get WHITE(){if(!D._WHITE){const t=O.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),D._WHITE=new D(X.from(t)),ks(D._WHITE),ks(D._WHITE.baseTexture)}return D._WHITE}}class Oe extends D{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,s=!0){const r=this.baseTexture.resolution,n=Math.round(t*r)/r,a=Math.round(e*r)/r;this.valid=n>0&&a>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=a,s&&this.baseTexture.resize(n,a),this.updateUvs()}setResolution(t){const{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new Oe(new Oo(t))}}class No{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,s=ht.NONE){const r=new Oo(Object.assign({width:t,height:e,resolution:1,multisample:s},this.textureOptions));return new Oe(r)}getOptimalTexture(t,e,s=1,r=ht.NONE){let n;t=Math.max(Math.ceil(t*s-1e-6),1),e=Math.max(Math.ceil(e*s-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=xs(t),e=xs(e),n=((t&65535)<<16|e&65535)>>>0,r>1&&(n+=r*4294967296)):n=r>1?-r:-1,this.texturePool[n]||(this.texturePool[n]=[]);let a=this.texturePool[n].pop();return a||(a=this.createTexture(t,e,r)),a.filterPoolKey=n,a.setResolution(s),a}getFilterTexture(t,e,s){const r=this.getOptimalTexture(t.width,t.height,e||t.resolution,s||ht.NONE);return r.filterFrame=t.filterFrame,r}returnTexture(t){const e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(const e in this.texturePool){const s=this.texturePool[e];if(s)for(let r=0;r<s.length;r++)s[r].destroy(!0)}this.texturePool={}}setScreenSize(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){this.enableFullScreen=t.width>0&&t.height>0;for(const e in this.texturePool){if(!(Number(e)<0))continue;const s=this.texturePool[e];if(s)for(let r=0;r<s.length;r++)s[r].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}}No.SCREEN_KEY=-1;class Ku extends fe{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class Lo extends fe{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new nt(this.vertices),this.uvBuffer=new nt(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let s=0,r=0;return this.uvs[0]=s,this.uvs[1]=r,this.uvs[2]=s+e.width/t.width,this.uvs[3]=r,this.uvs[4]=s+e.width/t.width,this.uvs[5]=r+e.height/t.height,this.uvs[6]=s,this.uvs[7]=r+e.height/t.height,s=e.x,r=e.y,this.vertices[0]=s,this.vertices[1]=r,this.vertices[2]=s+e.width,this.vertices[3]=r,this.vertices[4]=s+e.width,this.vertices[5]=r+e.height,this.vertices[6]=s,this.vertices[7]=r+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class Zu{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=ht.NONE,this.sourceFrame=new j,this.destinationFrame=new j,this.bindingSourceFrame=new j,this.bindingDestinationFrame=new j,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const Gs=[new q,new q,new q,new q],Yi=new tt;class Uo{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new No,this.statePool=[],this.quad=new Ku,this.quadUv=new Lo,this.tempRect=new j,this.activeState={},this.globalUniforms=new Lt({outputFrame:new j,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){var s,r,n,a;const o=this.renderer,h=this.defaultFilterStack,l=this.statePool.pop()||new Zu,u=o.renderTexture;let c,d;if(u.current){const v=u.current;c=v.resolution,d=v.multisample}else c=o.resolution,d=o.multisample;let f=e[0].resolution||c,p=(s=e[0].multisample)!=null?s:d,m=e[0].padding,g=e[0].autoFit,y=(r=e[0].legacy)!=null?r:!0;for(let v=1;v<e.length;v++){const T=e[v];f=Math.min(f,T.resolution||c),p=Math.min(p,(n=T.multisample)!=null?n:d),m=this.useMaxPadding?Math.max(m,T.padding):m+T.padding,g=g&&T.autoFit,y=y||((a=T.legacy)!=null?a:!0)}h.length===1&&(this.defaultFilterStack[0].renderTexture=u.current),h.push(l),l.resolution=f,l.multisample=p,l.legacy=y,l.target=t,l.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),l.sourceFrame.pad(m);const x=this.tempRect.copyFrom(u.sourceFrame);o.projection.transform&&this.transformAABB(Yi.copyFrom(o.projection.transform).invert(),x),g?(l.sourceFrame.fit(x),(l.sourceFrame.width<=0||l.sourceFrame.height<=0)&&(l.sourceFrame.width=0,l.sourceFrame.height=0)):l.sourceFrame.intersects(x)||(l.sourceFrame.width=0,l.sourceFrame.height=0),this.roundFrame(l.sourceFrame,u.current?u.current.resolution:o.resolution,u.sourceFrame,u.destinationFrame,o.projection.transform),l.renderTexture=this.getOptimalFilterTexture(l.sourceFrame.width,l.sourceFrame.height,f,p),l.filters=e,l.destinationFrame.width=l.renderTexture.width,l.destinationFrame.height=l.renderTexture.height;const _=this.tempRect;_.x=0,_.y=0,_.width=l.sourceFrame.width,_.height=l.sourceFrame.height,l.renderTexture.filterFrame=l.sourceFrame,l.bindingSourceFrame.copyFrom(u.sourceFrame),l.bindingDestinationFrame.copyFrom(u.destinationFrame),l.transform=o.projection.transform,o.projection.transform=null,u.bind(l.renderTexture,l.sourceFrame,_),o.framebuffer.clear(0,0,0,0)}pop(){const t=this.defaultFilterStack,e=t.pop(),s=e.filters;this.activeState=e;const r=this.globalUniforms.uniforms;r.outputFrame=e.sourceFrame,r.resolution=e.resolution;const n=r.inputSize,a=r.inputPixel,o=r.inputClamp;if(n[0]=e.destinationFrame.width,n[1]=e.destinationFrame.height,n[2]=1/n[0],n[3]=1/n[1],a[0]=Math.round(n[0]*e.resolution),a[1]=Math.round(n[1]*e.resolution),a[2]=1/a[0],a[3]=1/a[1],o[0]=.5*a[2],o[1]=.5*a[3],o[2]=e.sourceFrame.width*n[2]-.5*a[2],o[3]=e.sourceFrame.height*n[3]-.5*a[3],e.legacy){const l=r.filterArea;l[0]=e.destinationFrame.width,l[1]=e.destinationFrame.height,l[2]=e.sourceFrame.x,l[3]=e.sourceFrame.y,r.filterClamp=r.inputClamp}this.globalUniforms.update();const h=t[t.length-1];if(this.renderer.framebuffer.blit(),s.length===1)s[0].apply(this,e.renderTexture,h.renderTexture,Xt.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let l=e.renderTexture,u=this.getOptimalFilterTexture(l.width,l.height,e.resolution);u.filterFrame=l.filterFrame;let c=0;for(c=0;c<s.length-1;++c){c===1&&e.multisample>1&&(u=this.getOptimalFilterTexture(l.width,l.height,e.resolution),u.filterFrame=l.filterFrame),s[c].apply(this,l,u,Xt.CLEAR,e);const d=l;l=u,u=d}s[c].apply(this,l,h.renderTexture,Xt.BLEND,e),c>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(u)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Xt.CLEAR){const{renderTexture:s,state:r}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t!=null&&t.filterFrame){const a=this.tempRect;a.x=0,a.y=0,a.width=t.filterFrame.width,a.height=t.filterFrame.height,s.bind(t,t.filterFrame,a)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?s.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const n=r.stateId&1||this.forceClear;(e===Xt.CLEAR||e===Xt.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,s,r){const n=this.renderer;n.state.set(t.state),this.bindAndClear(s,r),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,n.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),n.geometry.bind(this.quadUv),n.geometry.draw(zt.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(zt.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:s,destinationFrame:r}=this.activeState,{orig:n}=e._texture,a=t.set(r.width,0,0,r.height,s.x,s.y),o=e.worldTransform.copyTo(tt.TEMP_MATRIX);return o.invert(),a.prepend(o),a.scale(1/n.width,1/n.height),a.translate(e.anchor.x,e.anchor.y),a}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,s=1,r=ht.NONE){return this.texturePool.getOptimalTexture(t,e,s,r)}getFilterTexture(t,e,s){if(typeof t=="number"){const n=t;t=e,e=n}t=t||this.activeState.renderTexture;const r=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,s||ht.NONE);return r.filterFrame=t.filterFrame,r}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const s=Gs[0],r=Gs[1],n=Gs[2],a=Gs[3];s.set(e.left,e.top),r.set(e.left,e.bottom),n.set(e.right,e.top),a.set(e.right,e.bottom),t.apply(s,s),t.apply(r,r),t.apply(n,n),t.apply(a,a);const o=Math.min(s.x,r.x,n.x,a.x),h=Math.min(s.y,r.y,n.y,a.y),l=Math.max(s.x,r.x,n.x,a.x),u=Math.max(s.y,r.y,n.y,a.y);e.x=o,e.y=h,e.width=l-o,e.height=u-h}roundFrame(t,e,s,r,n){if(!(t.width<=0||t.height<=0||s.width<=0||s.height<=0)){if(n){const{a,b:o,c:h,d:l}=n;if((Math.abs(o)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(a)>1e-4||Math.abs(l)>1e-4))return}n=n?Yi.copyFrom(n):Yi.identity(),n.translate(-s.x,-s.y).scale(r.width/s.width,r.height/s.height).translate(r.x,r.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}}}Uo.extension={type:C.RendererSystem,name:"filter"};N.add(Uo);class Qu{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=ht.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const Ju=new j;class ko{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Dr(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new j,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,s=this.renderer.context.extensions.depthTexture;O.PREFER_ENV===De.WEBGL_LEGACY&&(e=null,s=null),e?t.drawBuffers=r=>e.drawBuffersWEBGL(r):(this.hasMRT=!1,t.drawBuffers=()=>{}),s||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,s=0){const{gl:r}=this;if(t){const n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,r.bindFramebuffer(r.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==s&&(t.dirtyId++,t.dirtyFormat++,n.mipLevel=s),n.dirtyId!==t.dirtyId&&(n.dirtyId=t.dirtyId,n.dirtyFormat!==t.dirtyFormat?(n.dirtyFormat=t.dirtyFormat,n.dirtySize=t.dirtySize,this.updateFramebuffer(t,s)):n.dirtySize!==t.dirtySize&&(n.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let a=0;a<t.colorTextures.length;a++){const o=t.colorTextures[a];this.renderer.texture.unbind(o.parentTextureArray||o)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){const a=e.width>>s,o=e.height>>s,h=a/e.width;this.setViewport(e.x*h,e.y*h,a,o)}else{const a=t.width>>s,o=t.height>>s;this.setViewport(0,0,a,o)}}else this.current&&(this.current=null,r.bindFramebuffer(r.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,s,r){const n=this.viewport;t=Math.round(t),e=Math.round(e),s=Math.round(s),r=Math.round(r),(n.width!==s||n.height!==r||n.x!==t||n.y!==e)&&(n.x=t,n.y=e,n.width=s,n.height=r,this.gl.viewport(t,e,s,r))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,s,r,n=hr.COLOR|hr.DEPTH){const{gl:a}=this;a.clearColor(t,e,s,r),a.clear(n)}initFramebuffer(t){const{gl:e}=this,s=new Qu(e.createFramebuffer());return s.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=s,this.managedFramebuffers.push(t),t.disposeRunner.add(this),s}resizeFramebuffer(t){const{gl:e}=this,s=t.glFramebuffers[this.CONTEXT_UID];if(s.stencil){e.bindRenderbuffer(e.RENDERBUFFER,s.stencil);let a;this.renderer.context.webGLVersion===1?a=e.DEPTH_STENCIL:t.depth&&t.stencil?a=e.DEPTH24_STENCIL8:t.depth?a=e.DEPTH_COMPONENT24:a=e.STENCIL_INDEX8,s.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,s.multisample,a,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,a,t.width,t.height)}const r=t.colorTextures;let n=r.length;e.drawBuffers||(n=Math.min(n,1));for(let a=0;a<n;a++){const o=r[a],h=o.parentTextureArray||o;this.renderer.texture.bind(h,0),a===0&&s.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,s.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,s.multisample,h._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){const{gl:s}=this,r=t.glFramebuffers[this.CONTEXT_UID],n=t.colorTextures;let a=n.length;s.drawBuffers||(a=Math.min(a,1)),r.multisample>1&&this.canMultisampleFramebuffer(t)?r.msaaBuffer=r.msaaBuffer||s.createRenderbuffer():r.msaaBuffer&&(s.deleteRenderbuffer(r.msaaBuffer),r.msaaBuffer=null,r.blitFramebuffer&&(r.blitFramebuffer.dispose(),r.blitFramebuffer=null));const o=[];for(let h=0;h<a;h++){const l=n[h],u=l.parentTextureArray||l;this.renderer.texture.bind(u,0),h===0&&r.msaaBuffer?(s.bindRenderbuffer(s.RENDERBUFFER,r.msaaBuffer),s.renderbufferStorageMultisample(s.RENDERBUFFER,r.multisample,u._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.RENDERBUFFER,r.msaaBuffer)):(s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+h,l.target,u._glTextures[this.CONTEXT_UID].texture,e),o.push(s.COLOR_ATTACHMENT0+h))}if(o.length>1&&s.drawBuffers(o),t.depthTexture&&this.writeDepthTexture){const h=t.depthTexture;this.renderer.texture.bind(h,0),s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){r.stencil=r.stencil||s.createRenderbuffer();let h,l;this.renderer.context.webGLVersion===1?(h=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH_STENCIL):t.depth&&t.stencil?(h=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH24_STENCIL8):t.depth?(h=s.DEPTH_ATTACHMENT,l=s.DEPTH_COMPONENT24):(h=s.STENCIL_ATTACHMENT,l=s.STENCIL_INDEX8),s.bindRenderbuffer(s.RENDERBUFFER,r.stencil),r.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,r.multisample,l,t.width,t.height):s.renderbufferStorage(s.RENDERBUFFER,l,t.width,t.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,h,s.RENDERBUFFER,r.stencil)}else r.stencil&&(s.deleteRenderbuffer(r.stencil),r.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let s=ht.NONE;if(t<=1||e===null)return s;for(let r=0;r<e.length;r++)if(e[r]<=t){s=e[r];break}return s===1&&(s=ht.NONE),s}blit(t,e,s){const{current:r,renderer:n,gl:a,CONTEXT_UID:o}=this;if(n.context.webGLVersion!==2||!r)return;const h=r.glFramebuffers[o];if(!h)return;if(!t){if(!h.msaaBuffer)return;const u=r.colorTextures[0];if(!u)return;h.blitFramebuffer||(h.blitFramebuffer=new Dr(r.width,r.height),h.blitFramebuffer.addColorTexture(0,u)),t=h.blitFramebuffer,t.colorTextures[0]!==u&&(t.colorTextures[0]=u,t.dirtyId++,t.dirtyFormat++),(t.width!==r.width||t.height!==r.height)&&(t.width=r.width,t.height=r.height,t.dirtyId++,t.dirtySize++)}e||(e=Ju,e.width=r.width,e.height=r.height),s||(s=e);const l=e.width===s.width&&e.height===s.height;this.bind(t),a.bindFramebuffer(a.READ_FRAMEBUFFER,h.framebuffer),a.blitFramebuffer(e.left,e.top,e.right,e.bottom,s.left,s.top,s.right,s.bottom,a.COLOR_BUFFER_BIT,l?a.NEAREST:a.LINEAR),a.bindFramebuffer(a.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){const s=t.glFramebuffers[this.CONTEXT_UID],r=this.gl;if(!s)return;delete t.glFramebuffers[this.CONTEXT_UID];const n=this.managedFramebuffers.indexOf(t);n>=0&&this.managedFramebuffers.splice(n,1),t.disposeRunner.remove(this),e||(r.deleteFramebuffer(s.framebuffer),s.msaaBuffer&&r.deleteRenderbuffer(s.msaaBuffer),s.stencil&&r.deleteRenderbuffer(s.stencil)),s.blitFramebuffer&&this.disposeFramebuffer(s.blitFramebuffer,e)}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let s=0;s<e.length;s++)this.disposeFramebuffer(e[s],t)}forceStencil(){const t=this.current;if(!t)return;const e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;const s=t.width,r=t.height,n=this.gl,a=e.stencil=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,a);let o,h;this.renderer.context.webGLVersion===1?(o=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH_STENCIL):t.depth?(o=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH24_STENCIL8):(o=n.STENCIL_ATTACHMENT,h=n.STENCIL_INDEX8),e.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,e.multisample,h,s,r):n.renderbufferStorage(n.RENDERBUFFER,h,s,r),n.framebufferRenderbuffer(n.FRAMEBUFFER,o,n.RENDERBUFFER,a)}reset(){this.current=this.unknownFramebuffer,this.viewport=new j}destroy(){this.renderer=null}}ko.extension={type:C.RendererSystem,name:"framebuffer"};N.add(ko);const qi={5126:4,5123:2,5121:1};class Go{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,e.webGLVersion!==2){let s=this.renderer.context.extensions.vertexArrayObject;O.PREFER_ENV===De.WEBGL_LEGACY&&(s=null),s?(t.createVertexArray=()=>s.createVertexArrayOES(),t.bindVertexArray=r=>s.bindVertexArrayOES(r),t.deleteVertexArray=r=>s.deleteVertexArrayOES(r)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){const s=t.getExtension("ANGLE_instanced_arrays");s?(t.vertexAttribDivisor=(r,n)=>s.vertexAttribDivisorANGLE(r,n),t.drawElementsInstanced=(r,n,a,o,h)=>s.drawElementsInstancedANGLE(r,n,a,o,h),t.drawArraysInstanced=(r,n,a,o)=>s.drawArraysInstancedANGLE(r,n,a,o)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;const{gl:s}=this;let r=t.glVertexArrayObjects[this.CONTEXT_UID],n=!1;r||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=r={},n=!0);const a=r[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==a&&(this._activeVao=a,this.hasVao?s.bindVertexArray(a):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let s=0;s<t.buffers.length;s++){const r=t.buffers[s];e.update(r)}}checkCompatibility(t,e){const s=t.attributes,r=e.attributeData;for(const n in r)if(!s[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(t,e){const s=t.attributes,r=e.attributeData,n=["g",t.id];for(const a in s)r[a]&&n.push(a,r[a].location);return n.join("-")}initGeometryVao(t,e,s=!0){const r=this.gl,n=this.CONTEXT_UID,a=this.renderer.buffer,o=e.program;o.glPrograms[n]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,o);const h=this.getSignature(t,o),l=t.glVertexArrayObjects[this.CONTEXT_UID];let u=l[h];if(u)return l[o.id]=u,u;const c=t.buffers,d=t.attributes,f={},p={};for(const m in c)f[m]=0,p[m]=0;for(const m in d)!d[m].size&&o.attributeData[m]?d[m].size=o.attributeData[m].size:d[m].size||console.warn(`PIXI Geometry attribute '${m}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[m].buffer]+=d[m].size*qi[d[m].type];for(const m in d){const g=d[m],y=g.size;g.stride===void 0&&(f[g.buffer]===y*qi[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=p[g.buffer],p[g.buffer]+=y*qi[g.type])}u=r.createVertexArray(),r.bindVertexArray(u);for(let m=0;m<c.length;m++){const g=c[m];a.bind(g),s&&g._glBuffers[n].refCount++}return this.activateVao(t,o),l[o.id]=u,l[h]=u,r.bindVertexArray(null),a.unbind(Yt.ARRAY_BUFFER),u}disposeGeometry(t,e){var s;if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];const r=t.glVertexArrayObjects[this.CONTEXT_UID],n=this.gl,a=t.buffers,o=(s=this.renderer)==null?void 0:s.buffer;if(t.disposeRunner.remove(this),!!r){if(o)for(let h=0;h<a.length;h++){const l=a[h]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&o.dispose(a[h],e))}if(!e){for(const h in r)if(h[0]==="g"){const l=r[h];this._activeVao===l&&this.unbind(),n.deleteVertexArray(l)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){const e=Object.keys(this.managedGeometries);for(let s=0;s<e.length;s++)this.disposeGeometry(this.managedGeometries[e[s]],t)}activateVao(t,e){const s=this.gl,r=this.CONTEXT_UID,n=this.renderer.buffer,a=t.buffers,o=t.attributes;t.indexBuffer&&n.bind(t.indexBuffer);let h=null;for(const l in o){const u=o[l],c=a[u.buffer],d=c._glBuffers[r];if(e.attributeData[l]){h!==d&&(n.bind(c),h=d);const f=e.attributeData[l].location;if(s.enableVertexAttribArray(f),s.vertexAttribPointer(f,u.size,u.type||s.FLOAT,u.normalized,u.stride,u.start),u.instance)if(this.hasInstance)s.vertexAttribDivisor(f,u.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,s,r){const{gl:n}=this,a=this._activeGeometry;if(a.indexBuffer){const o=a.indexBuffer.data.BYTES_PER_ELEMENT,h=o===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;o===2||o===4&&this.canUseUInt32ElementIndex?a.instanced?n.drawElementsInstanced(t,e||a.indexBuffer.data.length,h,(s||0)*o,r||1):n.drawElements(t,e||a.indexBuffer.data.length,h,(s||0)*o):console.warn("unsupported index buffer type: uint32")}else a.instanced?n.drawArraysInstanced(t,s,e||a.getSize(),r||1):n.drawArrays(t,s,e||a.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}Go.extension={type:C.RendererSystem,name:"geometry"};N.add(Go);const aa=new tt;class fn{constructor(t,e){this._texture=t,this.mapCoord=new tt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e=="undefined"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);const s=this.mapCoord;for(let r=0;r<t.length;r+=2){const n=t[r],a=t[r+1];e[r]=n*s.a+a*s.c+s.tx,e[r+1]=n*s.b+a*s.d+s.ty}return e}update(t){const e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;const s=e._uvs;this.mapCoord.set(s.x1-s.x0,s.y1-s.y0,s.x3-s.x0,s.y3-s.y0,s.x0,s.y0);const r=e.orig,n=e.trim;n&&(aa.set(r.width/n.width,0,0,r.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(aa));const a=e.baseTexture,o=this.uClampFrame,h=this.clampMargin/a.resolution,l=this.clampOffset;return o[0]=(e._frame.x+h+l)/a.width,o[1]=(e._frame.y+h+l)/a.height,o[2]=(e._frame.x+e._frame.width-h+l)/a.width,o[3]=(e._frame.y+e._frame.height-h+l)/a.height,this.uClampOffset[0]=l/a.realWidth,this.uClampOffset[1]=l/a.realHeight,this.isSimple=e._frame.width===a.width&&e._frame.height===a.height&&e.rotate===0,!0}}var tc=`varying vec2 vMaskCoord;
|
|
381
|
+
`;const Mr=class os extends qt{constructor(t,e,s){const r=ie.from(t||os.defaultVertexSrc,e||os.defaultFragmentSrc);super(r,s),this.padding=0,this.resolution=os.defaultResolution,this.multisample=os.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new ne}apply(t,e,s,r,n){t.applyFilter(this,e,s,r)}get blendMode(){return this.state.blendMode}set blendMode(t){this.state.blendMode=t}get resolution(){return this._resolution}set resolution(t){this._resolution=t}static get defaultVertexSrc(){return Ku}static get defaultFragmentSrc(){return qu}};Mr.defaultResolution=1,Mr.defaultMultisample=ht.NONE;let xt=Mr;class ui{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new K(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;const{backgroundColor:e,background:s,backgroundAlpha:r}=t,n=s!=null?s:e;n!==void 0&&(this.color=n),this.alpha=r}get color(){return this._backgroundColor.value}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get backgroundColor(){return this._backgroundColor}destroy(){}}ui.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},ui.extension={type:[C.RendererSystem,C.CanvasRendererSystem],name:"background"};N.add(ui);class Do{constructor(t){this.renderer=t,this.emptyRenderer=new Si(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){const{boundTextures:s}=this.renderer.texture;for(let r=e-1;r>=0;--r)t[r]=s[r]||null,t[r]&&(t[r]._batchLocation=r)}boundArray(t,e,s,r){const{elements:n,ids:a,count:o}=t;let h=0;for(let l=0;l<o;l++){const u=n[l],c=u._batchLocation;if(c>=0&&c<r&&e[c]===u){a[l]=c;continue}for(;h<r;){const d=e[h];if(d&&d._batchEnabled===s&&d._batchLocation===h){h++;continue}a[l]=h,u._batchLocation=h,e[h]=u;break}}}destroy(){this.renderer=null}}Do.extension={type:C.RendererSystem,name:"batch"};N.add(Do);let ra=0;class ci{constructor(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},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,this.renderer.CONTEXT_UID=ra++}init(t){if(t.context)this.initFromContext(t.context);else{const e=this.renderer.background.alpha<1,s=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:s,antialias:t.antialias,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference})}}initFromContext(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=ra++,this.renderer.runners.contextChange.emit(t);const e=this.renderer.view;e.addEventListener!==void 0&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){const e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let s;if(D.PREFER_ENV>=De.WEBGL2&&(s=t.getContext("webgl2",e)),s)this.webGLVersion=2;else if(this.webGLVersion=1,s=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!s)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=s,this.getExtensions(),this.gl}getExtensions(){const{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){const t=this.renderer.view;this.renderer=null,t.removeEventListener!==void 0&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){const e=t.getContextAttributes(),s="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;s&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const r=s||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=r,r||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}ci.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},ci.extension={type:C.RendererSystem,name:"context"};N.add(ci);class Dr{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new Pt("disposeFramebuffer"),this.multisample=ht.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new X(null,{scaleMode:ee.NEAREST,resolution:1,mipmap:Kt.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new X(null,{scaleMode:ee.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Kt.OFF,format:E.DEPTH_COMPONENT,type:U.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let s=0;s<this.colorTextures.length;s++){const r=this.colorTextures[s],n=r.resolution;r.setSize(t/n,e/n)}if(this.depthTexture){const s=this.depthTexture.resolution;this.depthTexture.setSize(t/s,e/s)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}}class Oo extends X{constructor(t={}){var e,s,r;if(typeof t=="number"){const n=arguments[0],a=arguments[1],o=arguments[2],h=arguments[3];t={width:n,height:a,scaleMode:o,resolution:h}}t.width=(e=t.width)!=null?e:100,t.height=(s=t.height)!=null?s:100,(r=t.multisample)!=null||(t.multisample=ht.NONE),super(null,t),this.mipmap=Kt.OFF,this.valid=!0,this._clear=new K([0,0,0,0]),this.framebuffer=new Dr(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}}class pe extends bs{constructor(t){const e=t,s=e.naturalWidth||e.videoWidth||e.width,r=e.naturalHeight||e.videoHeight||e.height;super(s,r),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,s){s===void 0&&!e.startsWith("data:")?t.crossOrigin=Ao(e):s!==!1&&(t.crossOrigin=typeof s=="string"?s:"anonymous")}upload(t,e,s,r){const n=t.gl,a=e.realWidth,o=e.realHeight;if(r=r||this.source,typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement){if(!r.complete||r.naturalWidth===0)return!1}else if(typeof HTMLVideoElement!="undefined"&&r instanceof HTMLVideoElement&&r.readyState<=1)return!1;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===bt.UNPACK),!this.noSubImage&&e.target===n.TEXTURE_2D&&s.width===a&&s.height===o?n.texSubImage2D(n.TEXTURE_2D,0,0,0,e.format,s.type,r):(s.width=a,s.height=o,n.texImage2D(e.target,0,s.internalFormat,e.format,s.type,r)),!0}update(){if(this.destroyed)return;const t=this.source,e=t.naturalWidth||t.videoWidth||t.width,s=t.naturalHeight||t.videoHeight||t.height;this.resize(e,s),super.update()}dispose(){this.source=null}}class Bo extends pe{constructor(t,e){var s;if(e=e||{},typeof t=="string"){const r=new Image;pe.crossOrigin(r,t,e.crossorigin),r.src=t,t=r}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=((s=e.createBitmap)!=null?s:D.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.bitmap=null,this._load=null,e.autoLoad!==!1&&this.load()}load(t){return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise((e,s)=>{const r=this.source;this.url=r.src;const n=()=>{this.destroyed||(r.onload=null,r.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};r.complete&&r.src?n():(r.onload=n,r.onerror=a=>{s(a),this.onError.emit(a)})}),this._load)}process(){const t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);const e=globalThis.createImageBitmap,s=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:s?"cors":"no-cors"}).then(r=>r.blob()).then(r=>e(r,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===bt.UNPACK?"premultiply":"none"})).then(r=>this.destroyed?Promise.reject():(this.bitmap=r,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,s){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,s);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,s,this.bitmap),!this.preserveBitmap){let r=!0;const n=e._glTextures;for(const a in n){const o=n[a];if(o!==s&&o.dirtyId!==e.dirtyId){r=!1;break}}r&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement!="undefined"&&(typeof t=="string"||t instanceof HTMLImageElement)}}class Fo{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,s){const r=e.width,n=e.height;if(s){const a=t.width/2/r,o=t.height/2/n,h=t.x/r+a,l=t.y/n+o;s=et.add(s,et.NW),this.x0=h+a*et.uX(s),this.y0=l+o*et.uY(s),s=et.add(s,2),this.x1=h+a*et.uX(s),this.y1=l+o*et.uY(s),s=et.add(s,2),this.x2=h+a*et.uX(s),this.y2=l+o*et.uY(s),s=et.add(s,2),this.x3=h+a*et.uX(s),this.y3=l+o*et.uY(s)}else this.x0=t.x/r,this.y0=t.y/n,this.x1=(t.x+t.width)/r,this.y1=t.y/n,this.x2=(t.x+t.width)/r,this.y2=(t.y+t.height)/n,this.x3=t.x/r,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}}const na=new Fo;function ks(i){i.destroy=function(){},i.on=function(){},i.once=function(){},i.emit=function(){}}class O extends Ke{constructor(t,e,s,r,n,a,o){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new j(0,0,1,1)),t instanceof O&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=r,this.valid=!1,this.destroyed=!1,this._uvs=na,this.uvMatrix=null,this.orig=s||e,this._rotate=Number(n||0),n===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=a?new q(a.x,a.y):new q(0,0),this.defaultBorders=o,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){const{resource:e}=this.baseTexture;e!=null&&e.url&&yt[e.url]&&O.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,O.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var t;const e=this._frame.clone(),s=this._frame===this.orig?e:this.orig.clone(),r=new O(this.baseTexture,!this.noFrame&&e,s,(t=this.trim)==null?void 0:t.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(r._frame=e),r}updateUvs(){this._uvs===na&&(this._uvs=new Fo),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},s=D.STRICT_TEXTURE_CACHE){const r=typeof t=="string";let n=null;if(r)n=t;else if(t instanceof X){if(!t.cacheId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${o}-${de()}`,X.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${o}_${de()}`}n=t._pixiId}let a=yt[n];if(r&&s&&!a)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!a&&!(t instanceof X)?(e.resolution||(e.resolution=Zt(t)),a=new O(new X(t,e)),a.baseTexture.cacheId=n,X.addToCache(a.baseTexture,n),O.addToCache(a,n)):!a&&t instanceof X&&(a=new O(t),O.addToCache(a,n)),a}static fromURL(t,e){const s=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),r=O.from(t,Object.assign({resourceOptions:s},e),!1),n=r.baseTexture.resource;return r.baseTexture.valid?Promise.resolve(r):n.load().then(()=>Promise.resolve(r))}static fromBuffer(t,e,s,r){return new O(X.fromBuffer(t,e,s,r))}static fromLoader(t,e,s,r){const n=new X(t,Object.assign({scaleMode:X.defaultOptions.scaleMode,resolution:Zt(e)},r)),{resource:a}=n;a instanceof Bo&&(a.url=e);const o=new O(n);return s||(s=e),X.addToCache(o.baseTexture,s),O.addToCache(o,s),s!==e&&(X.addToCache(o.baseTexture,e),O.addToCache(o,e)),o.baseTexture.valid?Promise.resolve(o):new Promise(h=>{o.baseTexture.once("loaded",()=>h(o))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),yt[e]&&yt[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),yt[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=yt[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete yt[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)yt[t.textureCacheIds[e]]===t&&delete yt[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;const{x:e,y:s,width:r,height:n}=t,a=e+r>this.baseTexture.width,o=s+n>this.baseTexture.height;if(a||o){const h=a&&o?"and":"or",l=`X: ${e} + ${r} = ${e+r} > ${this.baseTexture.width}`,u=`Y: ${s} + ${n} = ${s+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${u}`)}this.valid=r&&n&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return O._EMPTY||(O._EMPTY=new O(new X),ks(O._EMPTY),ks(O._EMPTY.baseTexture)),O._EMPTY}static get WHITE(){if(!O._WHITE){const t=D.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),O._WHITE=new O(X.from(t)),ks(O._WHITE),ks(O._WHITE.baseTexture)}return O._WHITE}}class Oe extends O{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,s=!0){const r=this.baseTexture.resolution,n=Math.round(t*r)/r,a=Math.round(e*r)/r;this.valid=n>0&&a>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=a,s&&this.baseTexture.resize(n,a),this.updateUvs()}setResolution(t){const{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new Oe(new Oo(t))}}class No{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,s=ht.NONE){const r=new Oo(Object.assign({width:t,height:e,resolution:1,multisample:s},this.textureOptions));return new Oe(r)}getOptimalTexture(t,e,s=1,r=ht.NONE){let n;t=Math.max(Math.ceil(t*s-1e-6),1),e=Math.max(Math.ceil(e*s-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=xs(t),e=xs(e),n=((t&65535)<<16|e&65535)>>>0,r>1&&(n+=r*4294967296)):n=r>1?-r:-1,this.texturePool[n]||(this.texturePool[n]=[]);let a=this.texturePool[n].pop();return a||(a=this.createTexture(t,e,r)),a.filterPoolKey=n,a.setResolution(s),a}getFilterTexture(t,e,s){const r=this.getOptimalTexture(t.width,t.height,e||t.resolution,s||ht.NONE);return r.filterFrame=t.filterFrame,r}returnTexture(t){const e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(const e in this.texturePool){const s=this.texturePool[e];if(s)for(let r=0;r<s.length;r++)s[r].destroy(!0)}this.texturePool={}}setScreenSize(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){this.enableFullScreen=t.width>0&&t.height>0;for(const e in this.texturePool){if(!(Number(e)<0))continue;const s=this.texturePool[e];if(s)for(let r=0;r<s.length;r++)s[r].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}}No.SCREEN_KEY=-1;class Zu extends fe{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class Lo extends fe{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new nt(this.vertices),this.uvBuffer=new nt(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let s=0,r=0;return this.uvs[0]=s,this.uvs[1]=r,this.uvs[2]=s+e.width/t.width,this.uvs[3]=r,this.uvs[4]=s+e.width/t.width,this.uvs[5]=r+e.height/t.height,this.uvs[6]=s,this.uvs[7]=r+e.height/t.height,s=e.x,r=e.y,this.vertices[0]=s,this.vertices[1]=r,this.vertices[2]=s+e.width,this.vertices[3]=r,this.vertices[4]=s+e.width,this.vertices[5]=r+e.height,this.vertices[6]=s,this.vertices[7]=r+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class Qu{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=ht.NONE,this.sourceFrame=new j,this.destinationFrame=new j,this.bindingSourceFrame=new j,this.bindingDestinationFrame=new j,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const Gs=[new q,new q,new q,new q],Yi=new tt;class Uo{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new No,this.statePool=[],this.quad=new Zu,this.quadUv=new Lo,this.tempRect=new j,this.activeState={},this.globalUniforms=new Lt({outputFrame:new j,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){var s,r,n,a;const o=this.renderer,h=this.defaultFilterStack,l=this.statePool.pop()||new Qu,u=o.renderTexture;let c,d;if(u.current){const y=u.current;c=y.resolution,d=y.multisample}else c=o.resolution,d=o.multisample;let f=e[0].resolution||c,p=(s=e[0].multisample)!=null?s:d,m=e[0].padding,g=e[0].autoFit,v=(r=e[0].legacy)!=null?r:!0;for(let y=1;y<e.length;y++){const T=e[y];f=Math.min(f,T.resolution||c),p=Math.min(p,(n=T.multisample)!=null?n:d),m=this.useMaxPadding?Math.max(m,T.padding):m+T.padding,g=g&&T.autoFit,v=v||((a=T.legacy)!=null?a:!0)}h.length===1&&(this.defaultFilterStack[0].renderTexture=u.current),h.push(l),l.resolution=f,l.multisample=p,l.legacy=v,l.target=t,l.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),l.sourceFrame.pad(m);const x=this.tempRect.copyFrom(u.sourceFrame);o.projection.transform&&this.transformAABB(Yi.copyFrom(o.projection.transform).invert(),x),g?(l.sourceFrame.fit(x),(l.sourceFrame.width<=0||l.sourceFrame.height<=0)&&(l.sourceFrame.width=0,l.sourceFrame.height=0)):l.sourceFrame.intersects(x)||(l.sourceFrame.width=0,l.sourceFrame.height=0),this.roundFrame(l.sourceFrame,u.current?u.current.resolution:o.resolution,u.sourceFrame,u.destinationFrame,o.projection.transform),l.renderTexture=this.getOptimalFilterTexture(l.sourceFrame.width,l.sourceFrame.height,f,p),l.filters=e,l.destinationFrame.width=l.renderTexture.width,l.destinationFrame.height=l.renderTexture.height;const _=this.tempRect;_.x=0,_.y=0,_.width=l.sourceFrame.width,_.height=l.sourceFrame.height,l.renderTexture.filterFrame=l.sourceFrame,l.bindingSourceFrame.copyFrom(u.sourceFrame),l.bindingDestinationFrame.copyFrom(u.destinationFrame),l.transform=o.projection.transform,o.projection.transform=null,u.bind(l.renderTexture,l.sourceFrame,_),o.framebuffer.clear(0,0,0,0)}pop(){const t=this.defaultFilterStack,e=t.pop(),s=e.filters;this.activeState=e;const r=this.globalUniforms.uniforms;r.outputFrame=e.sourceFrame,r.resolution=e.resolution;const n=r.inputSize,a=r.inputPixel,o=r.inputClamp;if(n[0]=e.destinationFrame.width,n[1]=e.destinationFrame.height,n[2]=1/n[0],n[3]=1/n[1],a[0]=Math.round(n[0]*e.resolution),a[1]=Math.round(n[1]*e.resolution),a[2]=1/a[0],a[3]=1/a[1],o[0]=.5*a[2],o[1]=.5*a[3],o[2]=e.sourceFrame.width*n[2]-.5*a[2],o[3]=e.sourceFrame.height*n[3]-.5*a[3],e.legacy){const l=r.filterArea;l[0]=e.destinationFrame.width,l[1]=e.destinationFrame.height,l[2]=e.sourceFrame.x,l[3]=e.sourceFrame.y,r.filterClamp=r.inputClamp}this.globalUniforms.update();const h=t[t.length-1];if(this.renderer.framebuffer.blit(),s.length===1)s[0].apply(this,e.renderTexture,h.renderTexture,Xt.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let l=e.renderTexture,u=this.getOptimalFilterTexture(l.width,l.height,e.resolution);u.filterFrame=l.filterFrame;let c=0;for(c=0;c<s.length-1;++c){c===1&&e.multisample>1&&(u=this.getOptimalFilterTexture(l.width,l.height,e.resolution),u.filterFrame=l.filterFrame),s[c].apply(this,l,u,Xt.CLEAR,e);const d=l;l=u,u=d}s[c].apply(this,l,h.renderTexture,Xt.BLEND,e),c>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(u)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Xt.CLEAR){const{renderTexture:s,state:r}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t!=null&&t.filterFrame){const a=this.tempRect;a.x=0,a.y=0,a.width=t.filterFrame.width,a.height=t.filterFrame.height,s.bind(t,t.filterFrame,a)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?s.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const n=r.stateId&1||this.forceClear;(e===Xt.CLEAR||e===Xt.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,s,r){const n=this.renderer;n.state.set(t.state),this.bindAndClear(s,r),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,n.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),n.geometry.bind(this.quadUv),n.geometry.draw(zt.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(zt.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:s,destinationFrame:r}=this.activeState,{orig:n}=e._texture,a=t.set(r.width,0,0,r.height,s.x,s.y),o=e.worldTransform.copyTo(tt.TEMP_MATRIX);return o.invert(),a.prepend(o),a.scale(1/n.width,1/n.height),a.translate(e.anchor.x,e.anchor.y),a}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,s=1,r=ht.NONE){return this.texturePool.getOptimalTexture(t,e,s,r)}getFilterTexture(t,e,s){if(typeof t=="number"){const n=t;t=e,e=n}t=t||this.activeState.renderTexture;const r=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,s||ht.NONE);return r.filterFrame=t.filterFrame,r}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const s=Gs[0],r=Gs[1],n=Gs[2],a=Gs[3];s.set(e.left,e.top),r.set(e.left,e.bottom),n.set(e.right,e.top),a.set(e.right,e.bottom),t.apply(s,s),t.apply(r,r),t.apply(n,n),t.apply(a,a);const o=Math.min(s.x,r.x,n.x,a.x),h=Math.min(s.y,r.y,n.y,a.y),l=Math.max(s.x,r.x,n.x,a.x),u=Math.max(s.y,r.y,n.y,a.y);e.x=o,e.y=h,e.width=l-o,e.height=u-h}roundFrame(t,e,s,r,n){if(!(t.width<=0||t.height<=0||s.width<=0||s.height<=0)){if(n){const{a,b:o,c:h,d:l}=n;if((Math.abs(o)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(a)>1e-4||Math.abs(l)>1e-4))return}n=n?Yi.copyFrom(n):Yi.identity(),n.translate(-s.x,-s.y).scale(r.width/s.width,r.height/s.height).translate(r.x,r.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}}}Uo.extension={type:C.RendererSystem,name:"filter"};N.add(Uo);class Ju{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=ht.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const tc=new j;class ko{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Dr(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new j,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,s=this.renderer.context.extensions.depthTexture;D.PREFER_ENV===De.WEBGL_LEGACY&&(e=null,s=null),e?t.drawBuffers=r=>e.drawBuffersWEBGL(r):(this.hasMRT=!1,t.drawBuffers=()=>{}),s||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,s=0){const{gl:r}=this;if(t){const n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,r.bindFramebuffer(r.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==s&&(t.dirtyId++,t.dirtyFormat++,n.mipLevel=s),n.dirtyId!==t.dirtyId&&(n.dirtyId=t.dirtyId,n.dirtyFormat!==t.dirtyFormat?(n.dirtyFormat=t.dirtyFormat,n.dirtySize=t.dirtySize,this.updateFramebuffer(t,s)):n.dirtySize!==t.dirtySize&&(n.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let a=0;a<t.colorTextures.length;a++){const o=t.colorTextures[a];this.renderer.texture.unbind(o.parentTextureArray||o)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){const a=e.width>>s,o=e.height>>s,h=a/e.width;this.setViewport(e.x*h,e.y*h,a,o)}else{const a=t.width>>s,o=t.height>>s;this.setViewport(0,0,a,o)}}else this.current&&(this.current=null,r.bindFramebuffer(r.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,s,r){const n=this.viewport;t=Math.round(t),e=Math.round(e),s=Math.round(s),r=Math.round(r),(n.width!==s||n.height!==r||n.x!==t||n.y!==e)&&(n.x=t,n.y=e,n.width=s,n.height=r,this.gl.viewport(t,e,s,r))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,s,r,n=hr.COLOR|hr.DEPTH){const{gl:a}=this;a.clearColor(t,e,s,r),a.clear(n)}initFramebuffer(t){const{gl:e}=this,s=new Ju(e.createFramebuffer());return s.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=s,this.managedFramebuffers.push(t),t.disposeRunner.add(this),s}resizeFramebuffer(t){const{gl:e}=this,s=t.glFramebuffers[this.CONTEXT_UID];if(s.stencil){e.bindRenderbuffer(e.RENDERBUFFER,s.stencil);let a;this.renderer.context.webGLVersion===1?a=e.DEPTH_STENCIL:t.depth&&t.stencil?a=e.DEPTH24_STENCIL8:t.depth?a=e.DEPTH_COMPONENT24:a=e.STENCIL_INDEX8,s.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,s.multisample,a,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,a,t.width,t.height)}const r=t.colorTextures;let n=r.length;e.drawBuffers||(n=Math.min(n,1));for(let a=0;a<n;a++){const o=r[a],h=o.parentTextureArray||o;this.renderer.texture.bind(h,0),a===0&&s.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,s.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,s.multisample,h._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){const{gl:s}=this,r=t.glFramebuffers[this.CONTEXT_UID],n=t.colorTextures;let a=n.length;s.drawBuffers||(a=Math.min(a,1)),r.multisample>1&&this.canMultisampleFramebuffer(t)?r.msaaBuffer=r.msaaBuffer||s.createRenderbuffer():r.msaaBuffer&&(s.deleteRenderbuffer(r.msaaBuffer),r.msaaBuffer=null,r.blitFramebuffer&&(r.blitFramebuffer.dispose(),r.blitFramebuffer=null));const o=[];for(let h=0;h<a;h++){const l=n[h],u=l.parentTextureArray||l;this.renderer.texture.bind(u,0),h===0&&r.msaaBuffer?(s.bindRenderbuffer(s.RENDERBUFFER,r.msaaBuffer),s.renderbufferStorageMultisample(s.RENDERBUFFER,r.multisample,u._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.RENDERBUFFER,r.msaaBuffer)):(s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+h,l.target,u._glTextures[this.CONTEXT_UID].texture,e),o.push(s.COLOR_ATTACHMENT0+h))}if(o.length>1&&s.drawBuffers(o),t.depthTexture&&this.writeDepthTexture){const h=t.depthTexture;this.renderer.texture.bind(h,0),s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){r.stencil=r.stencil||s.createRenderbuffer();let h,l;this.renderer.context.webGLVersion===1?(h=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH_STENCIL):t.depth&&t.stencil?(h=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH24_STENCIL8):t.depth?(h=s.DEPTH_ATTACHMENT,l=s.DEPTH_COMPONENT24):(h=s.STENCIL_ATTACHMENT,l=s.STENCIL_INDEX8),s.bindRenderbuffer(s.RENDERBUFFER,r.stencil),r.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,r.multisample,l,t.width,t.height):s.renderbufferStorage(s.RENDERBUFFER,l,t.width,t.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,h,s.RENDERBUFFER,r.stencil)}else r.stencil&&(s.deleteRenderbuffer(r.stencil),r.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let s=ht.NONE;if(t<=1||e===null)return s;for(let r=0;r<e.length;r++)if(e[r]<=t){s=e[r];break}return s===1&&(s=ht.NONE),s}blit(t,e,s){const{current:r,renderer:n,gl:a,CONTEXT_UID:o}=this;if(n.context.webGLVersion!==2||!r)return;const h=r.glFramebuffers[o];if(!h)return;if(!t){if(!h.msaaBuffer)return;const u=r.colorTextures[0];if(!u)return;h.blitFramebuffer||(h.blitFramebuffer=new Dr(r.width,r.height),h.blitFramebuffer.addColorTexture(0,u)),t=h.blitFramebuffer,t.colorTextures[0]!==u&&(t.colorTextures[0]=u,t.dirtyId++,t.dirtyFormat++),(t.width!==r.width||t.height!==r.height)&&(t.width=r.width,t.height=r.height,t.dirtyId++,t.dirtySize++)}e||(e=tc,e.width=r.width,e.height=r.height),s||(s=e);const l=e.width===s.width&&e.height===s.height;this.bind(t),a.bindFramebuffer(a.READ_FRAMEBUFFER,h.framebuffer),a.blitFramebuffer(e.left,e.top,e.right,e.bottom,s.left,s.top,s.right,s.bottom,a.COLOR_BUFFER_BIT,l?a.NEAREST:a.LINEAR),a.bindFramebuffer(a.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){const s=t.glFramebuffers[this.CONTEXT_UID],r=this.gl;if(!s)return;delete t.glFramebuffers[this.CONTEXT_UID];const n=this.managedFramebuffers.indexOf(t);n>=0&&this.managedFramebuffers.splice(n,1),t.disposeRunner.remove(this),e||(r.deleteFramebuffer(s.framebuffer),s.msaaBuffer&&r.deleteRenderbuffer(s.msaaBuffer),s.stencil&&r.deleteRenderbuffer(s.stencil)),s.blitFramebuffer&&this.disposeFramebuffer(s.blitFramebuffer,e)}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let s=0;s<e.length;s++)this.disposeFramebuffer(e[s],t)}forceStencil(){const t=this.current;if(!t)return;const e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;const s=t.width,r=t.height,n=this.gl,a=e.stencil=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,a);let o,h;this.renderer.context.webGLVersion===1?(o=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH_STENCIL):t.depth?(o=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH24_STENCIL8):(o=n.STENCIL_ATTACHMENT,h=n.STENCIL_INDEX8),e.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,e.multisample,h,s,r):n.renderbufferStorage(n.RENDERBUFFER,h,s,r),n.framebufferRenderbuffer(n.FRAMEBUFFER,o,n.RENDERBUFFER,a)}reset(){this.current=this.unknownFramebuffer,this.viewport=new j}destroy(){this.renderer=null}}ko.extension={type:C.RendererSystem,name:"framebuffer"};N.add(ko);const qi={5126:4,5123:2,5121:1};class Go{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,e.webGLVersion!==2){let s=this.renderer.context.extensions.vertexArrayObject;D.PREFER_ENV===De.WEBGL_LEGACY&&(s=null),s?(t.createVertexArray=()=>s.createVertexArrayOES(),t.bindVertexArray=r=>s.bindVertexArrayOES(r),t.deleteVertexArray=r=>s.deleteVertexArrayOES(r)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){const s=t.getExtension("ANGLE_instanced_arrays");s?(t.vertexAttribDivisor=(r,n)=>s.vertexAttribDivisorANGLE(r,n),t.drawElementsInstanced=(r,n,a,o,h)=>s.drawElementsInstancedANGLE(r,n,a,o,h),t.drawArraysInstanced=(r,n,a,o)=>s.drawArraysInstancedANGLE(r,n,a,o)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;const{gl:s}=this;let r=t.glVertexArrayObjects[this.CONTEXT_UID],n=!1;r||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=r={},n=!0);const a=r[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==a&&(this._activeVao=a,this.hasVao?s.bindVertexArray(a):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let s=0;s<t.buffers.length;s++){const r=t.buffers[s];e.update(r)}}checkCompatibility(t,e){const s=t.attributes,r=e.attributeData;for(const n in r)if(!s[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(t,e){const s=t.attributes,r=e.attributeData,n=["g",t.id];for(const a in s)r[a]&&n.push(a,r[a].location);return n.join("-")}initGeometryVao(t,e,s=!0){const r=this.gl,n=this.CONTEXT_UID,a=this.renderer.buffer,o=e.program;o.glPrograms[n]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,o);const h=this.getSignature(t,o),l=t.glVertexArrayObjects[this.CONTEXT_UID];let u=l[h];if(u)return l[o.id]=u,u;const c=t.buffers,d=t.attributes,f={},p={};for(const m in c)f[m]=0,p[m]=0;for(const m in d)!d[m].size&&o.attributeData[m]?d[m].size=o.attributeData[m].size:d[m].size||console.warn(`PIXI Geometry attribute '${m}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[m].buffer]+=d[m].size*qi[d[m].type];for(const m in d){const g=d[m],v=g.size;g.stride===void 0&&(f[g.buffer]===v*qi[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=p[g.buffer],p[g.buffer]+=v*qi[g.type])}u=r.createVertexArray(),r.bindVertexArray(u);for(let m=0;m<c.length;m++){const g=c[m];a.bind(g),s&&g._glBuffers[n].refCount++}return this.activateVao(t,o),l[o.id]=u,l[h]=u,r.bindVertexArray(null),a.unbind(Yt.ARRAY_BUFFER),u}disposeGeometry(t,e){var s;if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];const r=t.glVertexArrayObjects[this.CONTEXT_UID],n=this.gl,a=t.buffers,o=(s=this.renderer)==null?void 0:s.buffer;if(t.disposeRunner.remove(this),!!r){if(o)for(let h=0;h<a.length;h++){const l=a[h]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&o.dispose(a[h],e))}if(!e){for(const h in r)if(h[0]==="g"){const l=r[h];this._activeVao===l&&this.unbind(),n.deleteVertexArray(l)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){const e=Object.keys(this.managedGeometries);for(let s=0;s<e.length;s++)this.disposeGeometry(this.managedGeometries[e[s]],t)}activateVao(t,e){const s=this.gl,r=this.CONTEXT_UID,n=this.renderer.buffer,a=t.buffers,o=t.attributes;t.indexBuffer&&n.bind(t.indexBuffer);let h=null;for(const l in o){const u=o[l],c=a[u.buffer],d=c._glBuffers[r];if(e.attributeData[l]){h!==d&&(n.bind(c),h=d);const f=e.attributeData[l].location;if(s.enableVertexAttribArray(f),s.vertexAttribPointer(f,u.size,u.type||s.FLOAT,u.normalized,u.stride,u.start),u.instance)if(this.hasInstance)s.vertexAttribDivisor(f,u.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,s,r){const{gl:n}=this,a=this._activeGeometry;if(a.indexBuffer){const o=a.indexBuffer.data.BYTES_PER_ELEMENT,h=o===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;o===2||o===4&&this.canUseUInt32ElementIndex?a.instanced?n.drawElementsInstanced(t,e||a.indexBuffer.data.length,h,(s||0)*o,r||1):n.drawElements(t,e||a.indexBuffer.data.length,h,(s||0)*o):console.warn("unsupported index buffer type: uint32")}else a.instanced?n.drawArraysInstanced(t,s,e||a.getSize(),r||1):n.drawArrays(t,s,e||a.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}Go.extension={type:C.RendererSystem,name:"geometry"};N.add(Go);const aa=new tt;class fn{constructor(t,e){this._texture=t,this.mapCoord=new tt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e=="undefined"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);const s=this.mapCoord;for(let r=0;r<t.length;r+=2){const n=t[r],a=t[r+1];e[r]=n*s.a+a*s.c+s.tx,e[r+1]=n*s.b+a*s.d+s.ty}return e}update(t){const e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;const s=e._uvs;this.mapCoord.set(s.x1-s.x0,s.y1-s.y0,s.x3-s.x0,s.y3-s.y0,s.x0,s.y0);const r=e.orig,n=e.trim;n&&(aa.set(r.width/n.width,0,0,r.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(aa));const a=e.baseTexture,o=this.uClampFrame,h=this.clampMargin/a.resolution,l=this.clampOffset;return o[0]=(e._frame.x+h+l)/a.width,o[1]=(e._frame.y+h+l)/a.height,o[2]=(e._frame.x+e._frame.width-h+l)/a.width,o[3]=(e._frame.y+e._frame.height-h+l)/a.height,this.uClampOffset[0]=l/a.realWidth,this.uClampOffset[1]=l/a.realHeight,this.isSimple=e._frame.width===a.width&&e._frame.height===a.height&&e.rotate===0,!0}}var ec=`varying vec2 vMaskCoord;
|
|
382
382
|
varying vec2 vTextureCoord;
|
|
383
383
|
|
|
384
384
|
uniform sampler2D uSampler;
|
|
@@ -403,7 +403,7 @@ void main(void)
|
|
|
403
403
|
|
|
404
404
|
gl_FragColor = original;
|
|
405
405
|
}
|
|
406
|
-
`,
|
|
406
|
+
`,sc=`attribute vec2 aVertexPosition;
|
|
407
407
|
attribute vec2 aTextureCoord;
|
|
408
408
|
|
|
409
409
|
uniform mat3 projectionMatrix;
|
|
@@ -419,7 +419,7 @@ void main(void)
|
|
|
419
419
|
vTextureCoord = aTextureCoord;
|
|
420
420
|
vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
|
|
421
421
|
}
|
|
422
|
-
`;class sc extends xt{constructor(t,e,s){let r=null;typeof t!="string"&&e===void 0&&s===void 0&&(r=t,t=void 0,e=void 0,s=void 0),super(t||ec,e||tc,s),this.maskSprite=r,this.maskMatrix=new tt}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,s,r){const n=this._maskSprite,a=n._texture;a.valid&&(a.uvMatrix||(a.uvMatrix=new fn(a,0)),a.uvMatrix.update(),this.uniforms.npmAlpha=a.baseTexture.alphaMode?0:1,this.uniforms.mask=a,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,n).prepend(a.uvMatrix.mapCoord),this.uniforms.alpha=n.worldAlpha,this.uniforms.maskClamp=a.uvMatrix.uClampFrame,t.applyFilter(this,e,s,r))}}class ic{constructor(t=null){this.type=ut.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=xt.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=ut.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}}class $o{constructor(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)}push(t,e){let s=e;if(!s.isMaskData){const n=this.maskDataPool.pop()||new ic;n.pooled=!0,n.maskObject=e,s=n}const r=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(s.copyCountersOrReset(r),s._colorMask=r?r._colorMask:15,s.autoDetect&&this.detect(s),s._target=t,s.type!==ut.SPRITE&&this.maskStack.push(s),s.enabled)switch(s.type){case ut.SCISSOR:this.renderer.scissor.push(s);break;case ut.STENCIL:this.renderer.stencil.push(s);break;case ut.SPRITE:s.copyCountersOrReset(null),this.pushSpriteMask(s);break;case ut.COLOR:this.pushColorMask(s);break;default:break}s.type===ut.SPRITE&&this.maskStack.push(s)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case ut.SCISSOR:this.renderer.scissor.pop(e);break;case ut.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case ut.SPRITE:this.popSpriteMask(e);break;case ut.COLOR:this.popColorMask(e);break;default:break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){const s=this.maskStack[this.maskStack.length-1];s.type===ut.SPRITE&&s._filters&&(s._filters[0].maskSprite=s.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=ut.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=ut.SCISSOR:t.type=ut.STENCIL:t.type=ut.COLOR}pushSpriteMask(t){const{maskObject:e}=t,s=t._target;let r=t._filters;r||(r=this.alphaMaskPool[this.alphaMaskIndex],r||(r=this.alphaMaskPool[this.alphaMaskIndex]=[new sc])),r[0].resolution=t.resolution,r[0].multisample=t.multisample,r[0].maskSprite=e;const n=s.filterArea;s.filterArea=e.getBounds(!0),this.renderer.filter.push(s,r),s.filterArea=n,t._filters||this.alphaMaskIndex++}popSpriteMask(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(t){const e=t._colorMask,s=t._colorMask=e&t.colorMask;s!==e&&this.renderer.gl.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)}popColorMask(t){const e=t._colorMask,s=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;s!==e&&this.renderer.gl.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)}destroy(){this.renderer=null}}$o.extension={type:C.RendererSystem,name:"mask"};N.add($o);class Ho{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,s=this.getStackLength();this.maskStack=t;const r=this.getStackLength();r!==s&&(r===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const oa=new tt,ha=[],Vo=class Js extends Ho{constructor(t){super(t),this.glConst=O.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){var e;if(t._scissorRectLocal)return;const s=t._scissorRect,{maskObject:r}=t,{renderer:n}=this,a=n.renderTexture,o=r.getBounds(!0,(e=ha.pop())!=null?e:new j);this.roundFrameToPixels(o,a.current?a.current.resolution:n.resolution,a.sourceFrame,a.destinationFrame,n.projection.transform),s&&o.fit(s),t._scissorRectLocal=o}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:s,c:r,d:n}=t;return(Math.abs(s)>1e-4||Math.abs(r)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||Js.isMatrixRotated(e.worldTransform)||Js.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);const s=t._scissorRectLocal;return s.width>0&&s.height>0}roundFrameToPixels(t,e,s,r,n){Js.isMatrixRotated(n)||(n=n?oa.copyFrom(n):oa.identity(),n.translate(-s.x,-s.y).scale(r.width/s.width,r.height/s.height).translate(r.x,r.y),this.renderer.filter.transformAABB(n,t),t.fit(r),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);const{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){const{gl:e}=this.renderer;t&&ha.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){const t=this.maskStack[this.maskStack.length-1]._scissorRect;let e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};Vo.extension={type:C.RendererSystem,name:"scissor"};let rc=Vo;N.add(rc);class Xo extends Ho{constructor(t){super(t),this.glConst=O.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){const e=t.maskObject,{gl:s}=this.renderer,r=t._stencilCounter;r===0&&(this.renderer.framebuffer.forceStencil(),s.clearStencil(0),s.clear(s.STENCIL_BUFFER_BIT),s.enable(s.STENCIL_TEST)),t._stencilCounter++;const n=t._colorMask;n!==0&&(t._colorMask=0,s.colorMask(!1,!1,!1,!1)),s.stencilFunc(s.EQUAL,r,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,n!==0&&(t._colorMask=n,s.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)),this._useCurrent()}pop(t){const e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{const s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,r=s?s._colorMask:15;r!==0&&(s._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,r!==0&&(s._colorMask=r,e.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}Xo.extension={type:C.RendererSystem,name:"stencil"};N.add(Xo);class jo{constructor(t){this.renderer=t,this.plugins={}}init(){const t=this.rendererPlugins;for(const e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(const t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}}jo.extension={type:[C.RendererSystem,C.CanvasRendererSystem],name:"_plugin"};N.add(jo);class zo{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new tt,this.transform=null}update(t,e,s,r){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,s,r),this.transform&&this.projectionMatrix.append(this.transform);const n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)}calculateProjection(t,e,s,r){const n=this.projectionMatrix,a=r?-1:1;n.identity(),n.a=1/e.width*2,n.d=a*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-a-e.y*n.d}setTransform(t){}destroy(){this.renderer=null}}zo.extension={type:C.RendererSystem,name:"projection"};N.add(zo);var la=Object.getOwnPropertySymbols,nc=Object.prototype.hasOwnProperty,ac=Object.prototype.propertyIsEnumerable,oc=(i,t)=>{var e={};for(var s in i)nc.call(i,s)&&t.indexOf(s)<0&&(e[s]=i[s]);if(i!=null&&la)for(var s of la(i))t.indexOf(s)<0&&ac.call(i,s)&&(e[s]=i[s]);return e};const hc=new dn,ua=new j;class Wo{constructor(t){this.renderer=t,this._tempMatrix=new tt}generateTexture(t,e){var s;const r=e||{},{region:n}=r,a=oc(r,["region"]),o=(n==null?void 0:n.copyTo(ua))||t.getLocalBounds(ua,!0),h=a.resolution||this.renderer.resolution;o.width=Math.max(o.width,1/h),o.height=Math.max(o.height,1/h),a.width=o.width,a.height=o.height,a.resolution=h,(s=a.multisample)!=null||(a.multisample=this.renderer.multisample);const l=Oe.create(a);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;const u=t.transform;return t.transform=hc,this.renderer.render(t,{renderTexture:l,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=u,l}destroy(){}}Wo.extension={type:[C.RendererSystem,C.CanvasRendererSystem],name:"textureGenerator"};N.add(Wo);const ye=new j,is=new j;class Yo{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new j,this.destinationFrame=new j,this.viewportFrame=new j}contextChange(){var t;const e=(t=this.renderer)==null?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}bind(t=null,e,s){const r=this.renderer;this.current=t;let n,a,o;t?(n=t.baseTexture,o=n.resolution,e||(ye.width=t.frame.width,ye.height=t.frame.height,e=ye),s||(is.x=t.frame.x,is.y=t.frame.y,is.width=e.width,is.height=e.height,s=is),a=n.framebuffer):(o=r.resolution,e||(ye.width=r._view.screen.width,ye.height=r._view.screen.height,e=ye),s||(s=ye,s.width=e.width,s.height=e.height));const h=this.viewportFrame;h.x=s.x*o,h.y=s.y*o,h.width=s.width*o,h.height=s.height*o,t||(h.y=r.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(a,h),this.renderer.projection.update(s,e,o,!a),t?this.renderer.mask.setMaskStack(n.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(s)}clear(t,e){const s=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,r=K.shared.setValue(t||s);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&r.premultiply(r.alpha);const n=this.destinationFrame,a=this.current?this.current.baseTexture:this.renderer._view.screen,o=n.width!==a.width||n.height!==a.height;if(o){let{x:h,y:l,width:u,height:c}=this.viewportFrame;h=Math.round(h),l=Math.round(l),u=Math.round(u),c=Math.round(c),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,u,c)}this.renderer.framebuffer.clear(r.red,r.green,r.blue,r.alpha,e),o&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}Yo.extension={type:C.RendererSystem,name:"renderTexture"};N.add(Yo);class Bm{}class lc{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}}function uc(i,t){const e={},s=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let r=0;r<s;r++){const n=t.getActiveAttrib(i,r);if(n.name.startsWith("gl_"))continue;const a=Mo(t,n.type),o={type:a,name:n.name,size:Po(a),location:t.getAttribLocation(i,n.name)};e[n.name]=o}return e}function cc(i,t){const e={},s=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let r=0;r<s;r++){const n=t.getActiveUniform(i,r),a=n.name.replace(/\[.*?\]$/,""),o=!!n.name.match(/\[.*?\]$/),h=Mo(t,n.type);e[a]={name:a,index:r,type:h,size:n.size,isArray:o,value:Ro(h,n.size)}}return e}function dc(i,t){var e;const s=ta(i,i.VERTEX_SHADER,t.vertexSrc),r=ta(i,i.FRAGMENT_SHADER,t.fragmentSrc),n=i.createProgram();i.attachShader(n,s),i.attachShader(n,r);const a=(e=t.extra)==null?void 0:e.transformFeedbackVaryings;if(a&&(typeof i.transformFeedbackVaryings!="function"||i.transformFeedbackVaryings(n,a.names,a.bufferMode==="separate"?i.SEPARATE_ATTRIBS:i.INTERLEAVED_ATTRIBS)),i.linkProgram(n),i.getProgramParameter(n,i.LINK_STATUS)||Uu(i,n,s,r),t.attributeData=uc(n,i),t.uniformData=cc(n,i),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){const h=Object.keys(t.attributeData);h.sort((l,u)=>l>u?1:-1);for(let l=0;l<h.length;l++)t.attributeData[h[l]].location=l,i.bindAttribLocation(n,l,h[l]);i.linkProgram(n)}i.deleteShader(s),i.deleteShader(r);const o={};for(const h in t.uniformData){const l=t.uniformData[h];o[h]={location:i.getUniformLocation(n,h),value:Ro(l.type,l.size)}}return new lc(n,o)}function fc(i,t,e,s,r){e.buffer.update(r)}const pc={float:`
|
|
422
|
+
`;class ic extends xt{constructor(t,e,s){let r=null;typeof t!="string"&&e===void 0&&s===void 0&&(r=t,t=void 0,e=void 0,s=void 0),super(t||sc,e||ec,s),this.maskSprite=r,this.maskMatrix=new tt}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,s,r){const n=this._maskSprite,a=n._texture;a.valid&&(a.uvMatrix||(a.uvMatrix=new fn(a,0)),a.uvMatrix.update(),this.uniforms.npmAlpha=a.baseTexture.alphaMode?0:1,this.uniforms.mask=a,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,n).prepend(a.uvMatrix.mapCoord),this.uniforms.alpha=n.worldAlpha,this.uniforms.maskClamp=a.uvMatrix.uClampFrame,t.applyFilter(this,e,s,r))}}class rc{constructor(t=null){this.type=ct.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=xt.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=ct.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}}class $o{constructor(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)}push(t,e){let s=e;if(!s.isMaskData){const n=this.maskDataPool.pop()||new rc;n.pooled=!0,n.maskObject=e,s=n}const r=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(s.copyCountersOrReset(r),s._colorMask=r?r._colorMask:15,s.autoDetect&&this.detect(s),s._target=t,s.type!==ct.SPRITE&&this.maskStack.push(s),s.enabled)switch(s.type){case ct.SCISSOR:this.renderer.scissor.push(s);break;case ct.STENCIL:this.renderer.stencil.push(s);break;case ct.SPRITE:s.copyCountersOrReset(null),this.pushSpriteMask(s);break;case ct.COLOR:this.pushColorMask(s);break;default:break}s.type===ct.SPRITE&&this.maskStack.push(s)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case ct.SCISSOR:this.renderer.scissor.pop(e);break;case ct.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case ct.SPRITE:this.popSpriteMask(e);break;case ct.COLOR:this.popColorMask(e);break;default:break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){const s=this.maskStack[this.maskStack.length-1];s.type===ct.SPRITE&&s._filters&&(s._filters[0].maskSprite=s.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=ct.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=ct.SCISSOR:t.type=ct.STENCIL:t.type=ct.COLOR}pushSpriteMask(t){const{maskObject:e}=t,s=t._target;let r=t._filters;r||(r=this.alphaMaskPool[this.alphaMaskIndex],r||(r=this.alphaMaskPool[this.alphaMaskIndex]=[new ic])),r[0].resolution=t.resolution,r[0].multisample=t.multisample,r[0].maskSprite=e;const n=s.filterArea;s.filterArea=e.getBounds(!0),this.renderer.filter.push(s,r),s.filterArea=n,t._filters||this.alphaMaskIndex++}popSpriteMask(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(t){const e=t._colorMask,s=t._colorMask=e&t.colorMask;s!==e&&this.renderer.gl.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)}popColorMask(t){const e=t._colorMask,s=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;s!==e&&this.renderer.gl.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)}destroy(){this.renderer=null}}$o.extension={type:C.RendererSystem,name:"mask"};N.add($o);class Ho{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,s=this.getStackLength();this.maskStack=t;const r=this.getStackLength();r!==s&&(r===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const oa=new tt,ha=[],Vo=class Js extends Ho{constructor(t){super(t),this.glConst=D.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){var e;if(t._scissorRectLocal)return;const s=t._scissorRect,{maskObject:r}=t,{renderer:n}=this,a=n.renderTexture,o=r.getBounds(!0,(e=ha.pop())!=null?e:new j);this.roundFrameToPixels(o,a.current?a.current.resolution:n.resolution,a.sourceFrame,a.destinationFrame,n.projection.transform),s&&o.fit(s),t._scissorRectLocal=o}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:s,c:r,d:n}=t;return(Math.abs(s)>1e-4||Math.abs(r)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||Js.isMatrixRotated(e.worldTransform)||Js.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);const s=t._scissorRectLocal;return s.width>0&&s.height>0}roundFrameToPixels(t,e,s,r,n){Js.isMatrixRotated(n)||(n=n?oa.copyFrom(n):oa.identity(),n.translate(-s.x,-s.y).scale(r.width/s.width,r.height/s.height).translate(r.x,r.y),this.renderer.filter.transformAABB(n,t),t.fit(r),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);const{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){const{gl:e}=this.renderer;t&&ha.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){const t=this.maskStack[this.maskStack.length-1]._scissorRect;let e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};Vo.extension={type:C.RendererSystem,name:"scissor"};let nc=Vo;N.add(nc);class Xo extends Ho{constructor(t){super(t),this.glConst=D.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){const e=t.maskObject,{gl:s}=this.renderer,r=t._stencilCounter;r===0&&(this.renderer.framebuffer.forceStencil(),s.clearStencil(0),s.clear(s.STENCIL_BUFFER_BIT),s.enable(s.STENCIL_TEST)),t._stencilCounter++;const n=t._colorMask;n!==0&&(t._colorMask=0,s.colorMask(!1,!1,!1,!1)),s.stencilFunc(s.EQUAL,r,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,n!==0&&(t._colorMask=n,s.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)),this._useCurrent()}pop(t){const e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{const s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,r=s?s._colorMask:15;r!==0&&(s._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,r!==0&&(s._colorMask=r,e.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}Xo.extension={type:C.RendererSystem,name:"stencil"};N.add(Xo);class jo{constructor(t){this.renderer=t,this.plugins={}}init(){const t=this.rendererPlugins;for(const e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(const t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}}jo.extension={type:[C.RendererSystem,C.CanvasRendererSystem],name:"_plugin"};N.add(jo);class zo{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new tt,this.transform=null}update(t,e,s,r){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,s,r),this.transform&&this.projectionMatrix.append(this.transform);const n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)}calculateProjection(t,e,s,r){const n=this.projectionMatrix,a=r?-1:1;n.identity(),n.a=1/e.width*2,n.d=a*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-a-e.y*n.d}setTransform(t){}destroy(){this.renderer=null}}zo.extension={type:C.RendererSystem,name:"projection"};N.add(zo);var la=Object.getOwnPropertySymbols,ac=Object.prototype.hasOwnProperty,oc=Object.prototype.propertyIsEnumerable,hc=(i,t)=>{var e={};for(var s in i)ac.call(i,s)&&t.indexOf(s)<0&&(e[s]=i[s]);if(i!=null&&la)for(var s of la(i))t.indexOf(s)<0&&oc.call(i,s)&&(e[s]=i[s]);return e};const lc=new dn,ua=new j;class Wo{constructor(t){this.renderer=t,this._tempMatrix=new tt}generateTexture(t,e){var s;const r=e||{},{region:n}=r,a=hc(r,["region"]),o=(n==null?void 0:n.copyTo(ua))||t.getLocalBounds(ua,!0),h=a.resolution||this.renderer.resolution;o.width=Math.max(o.width,1/h),o.height=Math.max(o.height,1/h),a.width=o.width,a.height=o.height,a.resolution=h,(s=a.multisample)!=null||(a.multisample=this.renderer.multisample);const l=Oe.create(a);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;const u=t.transform;return t.transform=lc,this.renderer.render(t,{renderTexture:l,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=u,l}destroy(){}}Wo.extension={type:[C.RendererSystem,C.CanvasRendererSystem],name:"textureGenerator"};N.add(Wo);const ye=new j,is=new j;class Yo{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new j,this.destinationFrame=new j,this.viewportFrame=new j}contextChange(){var t;const e=(t=this.renderer)==null?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}bind(t=null,e,s){const r=this.renderer;this.current=t;let n,a,o;t?(n=t.baseTexture,o=n.resolution,e||(ye.width=t.frame.width,ye.height=t.frame.height,e=ye),s||(is.x=t.frame.x,is.y=t.frame.y,is.width=e.width,is.height=e.height,s=is),a=n.framebuffer):(o=r.resolution,e||(ye.width=r._view.screen.width,ye.height=r._view.screen.height,e=ye),s||(s=ye,s.width=e.width,s.height=e.height));const h=this.viewportFrame;h.x=s.x*o,h.y=s.y*o,h.width=s.width*o,h.height=s.height*o,t||(h.y=r.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(a,h),this.renderer.projection.update(s,e,o,!a),t?this.renderer.mask.setMaskStack(n.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(s)}clear(t,e){const s=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,r=K.shared.setValue(t||s);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&r.premultiply(r.alpha);const n=this.destinationFrame,a=this.current?this.current.baseTexture:this.renderer._view.screen,o=n.width!==a.width||n.height!==a.height;if(o){let{x:h,y:l,width:u,height:c}=this.viewportFrame;h=Math.round(h),l=Math.round(l),u=Math.round(u),c=Math.round(c),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,u,c)}this.renderer.framebuffer.clear(r.red,r.green,r.blue,r.alpha,e),o&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}Yo.extension={type:C.RendererSystem,name:"renderTexture"};N.add(Yo);class Lm{}class uc{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}}function cc(i,t){const e={},s=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let r=0;r<s;r++){const n=t.getActiveAttrib(i,r);if(n.name.startsWith("gl_"))continue;const a=Mo(t,n.type),o={type:a,name:n.name,size:Po(a),location:t.getAttribLocation(i,n.name)};e[n.name]=o}return e}function dc(i,t){const e={},s=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let r=0;r<s;r++){const n=t.getActiveUniform(i,r),a=n.name.replace(/\[.*?\]$/,""),o=!!n.name.match(/\[.*?\]$/),h=Mo(t,n.type);e[a]={name:a,index:r,type:h,size:n.size,isArray:o,value:Ro(h,n.size)}}return e}function fc(i,t){var e;const s=ta(i,i.VERTEX_SHADER,t.vertexSrc),r=ta(i,i.FRAGMENT_SHADER,t.fragmentSrc),n=i.createProgram();i.attachShader(n,s),i.attachShader(n,r);const a=(e=t.extra)==null?void 0:e.transformFeedbackVaryings;if(a&&(typeof i.transformFeedbackVaryings!="function"||i.transformFeedbackVaryings(n,a.names,a.bufferMode==="separate"?i.SEPARATE_ATTRIBS:i.INTERLEAVED_ATTRIBS)),i.linkProgram(n),i.getProgramParameter(n,i.LINK_STATUS)||ku(i,n,s,r),t.attributeData=cc(n,i),t.uniformData=dc(n,i),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){const h=Object.keys(t.attributeData);h.sort((l,u)=>l>u?1:-1);for(let l=0;l<h.length;l++)t.attributeData[h[l]].location=l,i.bindAttribLocation(n,l,h[l]);i.linkProgram(n)}i.deleteShader(s),i.deleteShader(r);const o={};for(const h in t.uniformData){const l=t.uniformData[h];o[h]={location:i.getUniformLocation(n,h),value:Ro(l.type,l.size)}}return new uc(n,o)}function pc(i,t,e,s,r){e.buffer.update(r)}const mc={float:`
|
|
423
423
|
data[offset] = v;
|
|
424
424
|
`,vec2:`
|
|
425
425
|
data[offset] = v[0];
|
|
@@ -457,7 +457,7 @@ void main(void)
|
|
|
457
457
|
{
|
|
458
458
|
data[offset + i] = v[i];
|
|
459
459
|
}
|
|
460
|
-
`},qo={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function
|
|
460
|
+
`},qo={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function gc(i){const t=i.map(n=>({data:n,offset:0,dataLen:0,dirty:0}));let e=0,s=0,r=0;for(let n=0;n<t.length;n++){const a=t[n];if(e=qo[a.data.type],a.data.size>1&&(e=Math.max(e,16)*a.data.size),a.dataLen=e,s%e!==0&&s<16){const o=s%e%16;s+=o,r+=o}s+e>16?(r=Math.ceil(r/16)*16,a.offset=r,r+=e,s=e):(a.offset=r,s+=e,r+=e)}return r=Math.ceil(r/16)*16,{uboElements:t,size:r}}function _c(i,t){const e=[];for(const s in i)t[s]&&e.push(t[s]);return e.sort((s,r)=>s.index-r.index),e}function vc(i,t){if(!i.autoManage)return{size:0,syncFunc:pc};const e=_c(i.uniforms,t),{uboElements:s,size:r}=gc(e),n=[`
|
|
461
461
|
var v = null;
|
|
462
462
|
var v2 = null;
|
|
463
463
|
var cv = null;
|
|
@@ -481,7 +481,7 @@ void main(void)
|
|
|
481
481
|
offset += ${p};
|
|
482
482
|
}
|
|
483
483
|
|
|
484
|
-
`)}else{const c=
|
|
484
|
+
`)}else{const c=mc[o.data.type];n.push(`
|
|
485
485
|
cv = ud.${l}.value;
|
|
486
486
|
v = uv.${l};
|
|
487
487
|
offset = ${o.offset/4};
|
|
@@ -489,7 +489,7 @@ void main(void)
|
|
|
489
489
|
`)}}return n.push(`
|
|
490
490
|
renderer.buffer.update(buffer);
|
|
491
491
|
`),{size:r,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(`
|
|
492
|
-
`))}}let vc=0;const $s={textureCount:0,uboCount:0};class Ko{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=vc++}systemCheck(){if(!Gu())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;const s=t.program,r=s.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==s&&(this.program=s,this.gl.useProgram(r.program)),e||($s.textureCount=0,$s.uboCount=0,this.syncUniformGroup(t.uniformGroup,$s)),r}setUniforms(t){const e=this.shader.program,s=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(s.uniformData,t,this.renderer)}syncUniformGroup(t,e){const s=this.getGlProgram();(!t.static||t.dirtyId!==s.uniformDirtyGroups[t.id])&&(s.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,s,e))}syncUniforms(t,e,s){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,s)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Fu(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){const s=this.getGlProgram();if(!t.static||t.dirtyId!==0||!s.uniformGroups[t.id]){t.dirtyId=0;const r=s.uniformGroups[t.id]||this.createSyncBufferGroup(t,s,e);t.buffer.update(),r(s.uniformData,t.uniforms,this.renderer,$s,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,s.uniformBufferBindings[e])}createSyncBufferGroup(t,e,s){const{gl:r}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(e.program,s);e.uniformBufferBindings[s]=this.shader.uniformBindCount,r.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const a=this.getSignature(t,this.shader.program.uniformData,"ubo");let o=this._uboCache[a];if(o||(o=this._uboCache[a]=_c(t,this.shader.program.uniformData)),t.autoManage){const h=new Float32Array(o.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=o.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,s){const r=t.uniforms,n=[`${s}-`];for(const a in r)n.push(a),e[a]&&n.push(e[a].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,s=t.program,r=dc(e,s);return s.glPrograms[this.renderer.CONTEXT_UID]=r,r}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}Ko.extension={type:C.RendererSystem,name:"shader"};N.add(Ko);class di{constructor(t){this.renderer=t}run(t){const{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.3.0 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}di.defaultOptions={hello:!1},di.extension={type:[C.RendererSystem,C.CanvasRendererSystem],name:"startup"};N.add(di);function yc(i,t=[]){return t[H.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.ADD]=[i.ONE,i.ONE],t[H.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.SCREEN]=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.NONE]=[0,0],t[H.NORMAL_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.ADD_NPM]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t[H.SCREEN_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.SRC_IN]=[i.DST_ALPHA,i.ZERO],t[H.SRC_OUT]=[i.ONE_MINUS_DST_ALPHA,i.ZERO],t[H.SRC_ATOP]=[i.DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[H.DST_OVER]=[i.ONE_MINUS_DST_ALPHA,i.ONE],t[H.DST_IN]=[i.ZERO,i.SRC_ALPHA],t[H.DST_OUT]=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],t[H.DST_ATOP]=[i.ONE_MINUS_DST_ALPHA,i.SRC_ALPHA],t[H.XOR]=[i.ONE_MINUS_DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[H.SUBTRACT]=[i.ONE,i.ONE,i.ONE,i.ONE,i.FUNC_REVERSE_SUBTRACT,i.FUNC_ADD],t}const xc=0,bc=1,Tc=2,Ec=3,Ac=4,wc=5,Zo=class Or{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=H.NONE,this._blendEq=!1,this.map=[],this.map[xc]=this.setBlend,this.map[bc]=this.setOffset,this.map[Tc]=this.setCullFace,this.map[Ec]=this.setDepthTest,this.map[Ac]=this.setFrontFace,this.map[wc]=this.setDepthMask,this.checks=[],this.defaultState=new ne,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=yc(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,s=0;for(;e;)e&1&&this.map[s].call(this,!!(t.data&1<<s)),e=e>>1,s++;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(Or.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(Or.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(t===this.blendMode)return;this.blendMode=t;const e=this.blendModes[t],s=this.gl;e.length===2?s.blendFunc(e[0],e[1]):s.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,s.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,s.blendEquationSeparate(s.FUNC_ADD,s.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=-1,this.setBlendMode(0)}updateCheck(t,e){const s=this.checks.indexOf(t);e&&s===-1?this.checks.push(t):!e&&s!==-1&&this.checks.splice(s,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};Zo.extension={type:C.RendererSystem,name:"state"};let Sc=Zo;N.add(Sc);class Ic extends Ke{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){var e;this.addRunners(...t.runners);const s=((e=t.priority)!=null?e:[]).filter(n=>t.systems[n]),r=[...s,...Object.keys(t.systems).filter(n=>!s.includes(n))];for(const n of r)this.addSystem(t.systems[n],n)}addRunners(...t){t.forEach(e=>{this.runners[e]=new Pt(e)})}addSystem(t,e){const s=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=s,this._systemsHash[e]=s;for(const r in this.runners)this.runners[r].add(s);return this}emitWithCustomOptions(t,e){const s=Object.keys(this._systemsHash);t.items.forEach(r=>{const n=s.find(a=>this._systemsHash[a]===r);r[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const hs=class ti{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=ti.defaultMaxIdle,this.checkCountMax=ti.defaultCheckCountMax,this.mode=ti.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==nn.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let s=!1;for(let r=0;r<e.length;r++){const n=e[r];n.resource&&this.count-n.touched>this.maxIdle&&(t.destroyTexture(n,!0),e[r]=null,s=!0)}if(s){let r=0;for(let n=0;n<e.length;n++)e[n]!==null&&(e[r++]=e[n]);e.length=r}}unload(t){const e=this.renderer.texture,s=t._texture;s&&!s.framebuffer&&e.destroyTexture(s);for(let r=t.children.length-1;r>=0;r--)this.unload(t.children[r])}destroy(){this.renderer=null}};hs.defaultMode=nn.AUTO,hs.defaultMaxIdle=60*60,hs.defaultCheckCountMax=60*10,hs.extension={type:C.RendererSystem,name:"textureGC"};let Se=hs;N.add(Se);class Ki{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=k.UNSIGNED_BYTE,this.internalFormat=A.RGBA,this.samplerType=0}}function Rc(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[i.RGB]:P.FLOAT,[i.RGBA]:P.FLOAT,[i.ALPHA]:P.FLOAT,[i.LUMINANCE]:P.FLOAT,[i.LUMINANCE_ALPHA]:P.FLOAT,[i.R8]:P.FLOAT,[i.R8_SNORM]:P.FLOAT,[i.RG8]:P.FLOAT,[i.RG8_SNORM]:P.FLOAT,[i.RGB8]:P.FLOAT,[i.RGB8_SNORM]:P.FLOAT,[i.RGB565]:P.FLOAT,[i.RGBA4]:P.FLOAT,[i.RGB5_A1]:P.FLOAT,[i.RGBA8]:P.FLOAT,[i.RGBA8_SNORM]:P.FLOAT,[i.RGB10_A2]:P.FLOAT,[i.RGB10_A2UI]:P.FLOAT,[i.SRGB8]:P.FLOAT,[i.SRGB8_ALPHA8]:P.FLOAT,[i.R16F]:P.FLOAT,[i.RG16F]:P.FLOAT,[i.RGB16F]:P.FLOAT,[i.RGBA16F]:P.FLOAT,[i.R32F]:P.FLOAT,[i.RG32F]:P.FLOAT,[i.RGB32F]:P.FLOAT,[i.RGBA32F]:P.FLOAT,[i.R11F_G11F_B10F]:P.FLOAT,[i.RGB9_E5]:P.FLOAT,[i.R8I]:P.INT,[i.R8UI]:P.UINT,[i.R16I]:P.INT,[i.R16UI]:P.UINT,[i.R32I]:P.INT,[i.R32UI]:P.UINT,[i.RG8I]:P.INT,[i.RG8UI]:P.UINT,[i.RG16I]:P.INT,[i.RG16UI]:P.UINT,[i.RG32I]:P.INT,[i.RG32UI]:P.UINT,[i.RGB8I]:P.INT,[i.RGB8UI]:P.UINT,[i.RGB16I]:P.INT,[i.RGB16UI]:P.UINT,[i.RGB32I]:P.INT,[i.RGB32UI]:P.UINT,[i.RGBA8I]:P.INT,[i.RGBA8UI]:P.UINT,[i.RGBA16I]:P.INT,[i.RGBA16UI]:P.UINT,[i.RGBA32I]:P.INT,[i.RGBA32UI]:P.UINT,[i.DEPTH_COMPONENT16]:P.FLOAT,[i.DEPTH_COMPONENT24]:P.FLOAT,[i.DEPTH_COMPONENT32F]:P.FLOAT,[i.DEPTH_STENCIL]:P.FLOAT,[i.DEPTH24_STENCIL8]:P.FLOAT,[i.DEPTH32F_STENCIL8]:P.FLOAT}:t={[i.RGB]:P.FLOAT,[i.RGBA]:P.FLOAT,[i.ALPHA]:P.FLOAT,[i.LUMINANCE]:P.FLOAT,[i.LUMINANCE_ALPHA]:P.FLOAT,[i.DEPTH_STENCIL]:P.FLOAT},t}function Cc(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[k.UNSIGNED_BYTE]:{[A.RGBA]:i.RGBA8,[A.RGB]:i.RGB8,[A.RG]:i.RG8,[A.RED]:i.R8,[A.RGBA_INTEGER]:i.RGBA8UI,[A.RGB_INTEGER]:i.RGB8UI,[A.RG_INTEGER]:i.RG8UI,[A.RED_INTEGER]:i.R8UI,[A.ALPHA]:i.ALPHA,[A.LUMINANCE]:i.LUMINANCE,[A.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[k.BYTE]:{[A.RGBA]:i.RGBA8_SNORM,[A.RGB]:i.RGB8_SNORM,[A.RG]:i.RG8_SNORM,[A.RED]:i.R8_SNORM,[A.RGBA_INTEGER]:i.RGBA8I,[A.RGB_INTEGER]:i.RGB8I,[A.RG_INTEGER]:i.RG8I,[A.RED_INTEGER]:i.R8I},[k.UNSIGNED_SHORT]:{[A.RGBA_INTEGER]:i.RGBA16UI,[A.RGB_INTEGER]:i.RGB16UI,[A.RG_INTEGER]:i.RG16UI,[A.RED_INTEGER]:i.R16UI,[A.DEPTH_COMPONENT]:i.DEPTH_COMPONENT16},[k.SHORT]:{[A.RGBA_INTEGER]:i.RGBA16I,[A.RGB_INTEGER]:i.RGB16I,[A.RG_INTEGER]:i.RG16I,[A.RED_INTEGER]:i.R16I},[k.UNSIGNED_INT]:{[A.RGBA_INTEGER]:i.RGBA32UI,[A.RGB_INTEGER]:i.RGB32UI,[A.RG_INTEGER]:i.RG32UI,[A.RED_INTEGER]:i.R32UI,[A.DEPTH_COMPONENT]:i.DEPTH_COMPONENT24},[k.INT]:{[A.RGBA_INTEGER]:i.RGBA32I,[A.RGB_INTEGER]:i.RGB32I,[A.RG_INTEGER]:i.RG32I,[A.RED_INTEGER]:i.R32I},[k.FLOAT]:{[A.RGBA]:i.RGBA32F,[A.RGB]:i.RGB32F,[A.RG]:i.RG32F,[A.RED]:i.R32F,[A.DEPTH_COMPONENT]:i.DEPTH_COMPONENT32F},[k.HALF_FLOAT]:{[A.RGBA]:i.RGBA16F,[A.RGB]:i.RGB16F,[A.RG]:i.RG16F,[A.RED]:i.R16F},[k.UNSIGNED_SHORT_5_6_5]:{[A.RGB]:i.RGB565},[k.UNSIGNED_SHORT_4_4_4_4]:{[A.RGBA]:i.RGBA4},[k.UNSIGNED_SHORT_5_5_5_1]:{[A.RGBA]:i.RGB5_A1},[k.UNSIGNED_INT_2_10_10_10_REV]:{[A.RGBA]:i.RGB10_A2,[A.RGBA_INTEGER]:i.RGB10_A2UI},[k.UNSIGNED_INT_10F_11F_11F_REV]:{[A.RGB]:i.R11F_G11F_B10F},[k.UNSIGNED_INT_5_9_9_9_REV]:{[A.RGB]:i.RGB9_E5},[k.UNSIGNED_INT_24_8]:{[A.DEPTH_STENCIL]:i.DEPTH24_STENCIL8},[k.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[A.DEPTH_STENCIL]:i.DEPTH32F_STENCIL8}}:t={[k.UNSIGNED_BYTE]:{[A.RGBA]:i.RGBA,[A.RGB]:i.RGB,[A.ALPHA]:i.ALPHA,[A.LUMINANCE]:i.LUMINANCE,[A.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[k.UNSIGNED_SHORT_5_6_5]:{[A.RGB]:i.RGB},[k.UNSIGNED_SHORT_4_4_4_4]:{[A.RGBA]:i.RGBA},[k.UNSIGNED_SHORT_5_5_5_1]:{[A.RGBA]:i.RGBA}},t}class Qo{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new X,this.hasIntegerTextures=!1}contextChange(){const t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=Cc(t),this.samplerTypes=Rc(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let r=0;r<e;r++)this.boundTextures[r]=null;this.emptyTextures={};const s=new Ki(t.createTexture());t.bindTexture(t.TEXTURE_2D,s.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=s,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Ki(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let r=0;r<6;r++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let r=0;r<this.boundTextures.length;r++)this.bind(null,r)}bind(t,e=0){const{gl:s}=this;if(t=t==null?void 0:t.castToBaseTexture(),t!=null&&t.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;const r=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,s.activeTexture(s.TEXTURE0+e)),s.bindTexture(t.target,r.texture)),r.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,s.activeTexture(s.TEXTURE0+e)),this.updateTexture(t)):r.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,s.activeTexture(s.TEXTURE0+e)),s.bindTexture(s.TEXTURE_2D,this.emptyTextures[s.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){const{gl:e,boundTextures:s}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let r=0;r<s.length;r++)s[r]===this.unknownTexture&&this.bind(null,r)}for(let r=0;r<s.length;r++)s[r]===t&&(this.currentLocation!==r&&(e.activeTexture(e.TEXTURE0+r),this.currentLocation=r),e.bindTexture(t.target,this.emptyTextures[t.target].texture),s[r]=null)}ensureSamplerType(t){const{boundTextures:e,hasIntegerTextures:s,CONTEXT_UID:r}=this;if(s)for(let n=t-1;n>=0;--n){const a=e[n];a&&a._glTextures[r].samplerType!==P.FLOAT&&this.renderer.texture.unbind(a)}}initTexture(t){const e=new Ki(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){var s,r,n;e.internalFormat=(r=(s=this.internalFormats[t.type])==null?void 0:s[t.format])!=null?r:t.format,e.samplerType=(n=this.samplerTypes[e.internalFormat])!=null?n:P.FLOAT,this.webGLVersion===2&&t.type===k.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){var e;const s=t._glTextures[this.CONTEXT_UID];if(!s)return;const r=this.renderer;if(this.initTextureType(t,s),(e=t.resource)!=null&&e.upload(r,t,s))s.samplerType!==P.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,a=t.realHeight,o=r.gl;(s.width!==n||s.height!==a||s.dirtyId<0)&&(s.width=n,s.height=a,o.texImage2D(t.target,0,s.internalFormat,n,a,0,t.format,s.type,null))}t.dirtyStyleId!==s.dirtyStyleId&&this.updateTextureStyle(t),s.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:s}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),s.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){const r=this.managedTextures.indexOf(t);r!==-1&&Re(this.managedTextures,r,1)}}updateTextureStyle(t){var e;const s=t._glTextures[this.CONTEXT_UID];s&&((t.mipmap===Kt.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?s.mipmap=!1:s.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?s.wrapMode=re.CLAMP:s.wrapMode=t.wrapMode,(e=t.resource)!=null&&e.style(this.renderer,t,s)||this.setStyle(t,s),s.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const s=this.gl;if(e.mipmap&&t.mipmap!==Kt.ON_MANUAL&&s.generateMipmap(t.target),s.texParameteri(t.target,s.TEXTURE_WRAP_S,e.wrapMode),s.texParameteri(t.target,s.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){s.texParameteri(t.target,s.TEXTURE_MIN_FILTER,t.scaleMode===ee.LINEAR?s.LINEAR_MIPMAP_LINEAR:s.NEAREST_MIPMAP_NEAREST);const r=this.renderer.context.extensions.anisotropicFiltering;if(r&&t.anisotropicLevel>0&&t.scaleMode===ee.LINEAR){const n=Math.min(t.anisotropicLevel,s.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));s.texParameterf(t.target,r.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else s.texParameteri(t.target,s.TEXTURE_MIN_FILTER,t.scaleMode===ee.LINEAR?s.LINEAR:s.NEAREST);s.texParameteri(t.target,s.TEXTURE_MAG_FILTER,t.scaleMode===ee.LINEAR?s.LINEAR:s.NEAREST)}destroy(){this.renderer=null}}Qo.extension={type:C.RendererSystem,name:"texture"};N.add(Qo);class Jo{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:s}=this,r=t._glTransformFeedbacks[s]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,r)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:s,renderer:r}=this;e&&r.shader.bind(e),s.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:s,CONTEXT_UID:r}=this,n=e.createTransformFeedback();t._glTransformFeedbacks[r]=n,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n);for(let a=0;a<t.buffers.length;a++){const o=t.buffers[a];o&&(s.buffer.update(o),o._glBuffers[r].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,a,o._glBuffers[r].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),n}disposeTransformFeedback(t,e){const s=t._glTransformFeedbacks[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this);const n=this.renderer.buffer;if(n)for(let a=0;a<t.buffers.length;a++){const o=t.buffers[a];if(!o)continue;const h=o._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&n.dispose(o,e))}s&&(e||r.deleteTransformFeedback(s),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}Jo.extension={type:C.RendererSystem,name:"transformFeedback"};N.add(Jo);class fi{constructor(t){this.renderer=t}init(t){this.screen=new j(0,0,t.width,t.height),this.element=t.view||O.ADAPTER.createCanvas(),this.resolution=t.resolution||O.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);const s=this.element.width/this.resolution,r=this.element.height/this.resolution;this.screen.width=s,this.screen.height=r,this.autoDensity&&(this.element.style.width=`${s}px`,this.element.style.height=`${r}px`),this.renderer.emit("resize",s,r),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){var e;t&&((e=this.element.parentNode)==null||e.removeChild(this.element)),this.renderer=null,this.element=null,this.screen=null}}fi.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},fi.extension={type:[C.RendererSystem,C.CanvasRendererSystem],name:"_view"};N.add(fi);var Pc=Object.defineProperty,ca=Object.getOwnPropertySymbols,Mc=Object.prototype.hasOwnProperty,Dc=Object.prototype.propertyIsEnumerable,da=(i,t,e)=>t in i?Pc(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Hs=(i,t)=>{for(var e in t||(t={}))Mc.call(t,e)&&da(i,e,t[e]);if(ca)for(var e of ca(t))Dc.call(t,e)&&da(i,e,t[e]);return i};O.PREFER_ENV=De.WEBGL2;O.STRICT_TEXTURE_CACHE=!1;O.RENDER_OPTIONS=Hs(Hs(Hs(Hs({},ci.defaultOptions),ui.defaultOptions),fi.defaultOptions),di.defaultOptions);Object.defineProperties(O,{WRAP_MODE:{get(){return X.defaultOptions.wrapMode},set(i){X.defaultOptions.wrapMode=i}},SCALE_MODE:{get(){return X.defaultOptions.scaleMode},set(i){X.defaultOptions.scaleMode=i}},MIPMAP_TEXTURES:{get(){return X.defaultOptions.mipmap},set(i){X.defaultOptions.mipmap=i}},ANISOTROPIC_LEVEL:{get(){return X.defaultOptions.anisotropicLevel},set(i){X.defaultOptions.anisotropicLevel=i}},FILTER_RESOLUTION:{get(){return xt.defaultResolution},set(i){xt.defaultResolution=i}},FILTER_MULTISAMPLE:{get(){return xt.defaultMultisample},set(i){xt.defaultMultisample=i}},SPRITE_MAX_TEXTURES:{get(){return we.defaultMaxTextures},set(i){we.defaultMaxTextures=i}},SPRITE_BATCH_SIZE:{get(){return we.defaultBatchSize},set(i){we.defaultBatchSize=i}},CAN_UPLOAD_SAME_BUFFER:{get(){return we.canUploadSameBuffer},set(i){we.canUploadSameBuffer=i}},GC_MODE:{get(){return Se.defaultMode},set(i){Se.defaultMode=i}},GC_MAX_IDLE:{get(){return Se.defaultMaxIdle},set(i){Se.defaultMaxIdle=i}},GC_MAX_CHECK_COUNT:{get(){return Se.defaultCheckCountMax},set(i){Se.defaultCheckCountMax=i}},PRECISION_VERTEX:{get(){return ie.defaultVertexPrecision},set(i){ie.defaultVertexPrecision=i}},PRECISION_FRAGMENT:{get(){return ie.defaultFragmentPrecision},set(i){ie.defaultFragmentPrecision=i}}});var me=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(me||{});class Zi{constructor(t,e=null,s=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=s,this.once=r}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 th=class Et{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 Zi(null,null,1/0),this.deltaMS=1/Et.targetFPMS,this.elapsedMS=1/Et.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,s=me.NORMAL){return this._addListener(new Zi(t,e,s))}addOnce(t,e,s=me.NORMAL){return this._addListener(new Zi(t,e,s,!0))}_addListener(t){let e=this._head.next,s=this._head;if(!e)t.connect(s);else{for(;e;){if(t.priority>e.priority){t.connect(s);break}s=e,e=e.next}t.previous||t.connect(s)}return this._startIfPossible(),this}remove(t,e){let s=this._head.next;for(;s;)s.match(t,e)?s=s.destroy():s=s.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*Et.targetFPMS;const s=this._head;let r=s.next;for(;r;)r=r.emit(this.deltaTime);s.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),s=Math.min(Math.max(0,e)/1e3,Et.targetFPMS);this._maxElapsedMS=1/s}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(!Et._shared){const t=Et._shared=new Et;t.autoStart=!0,t._protected=!0}return Et._shared}static get system(){if(!Et._system){const t=Et._system=new Et;t.autoStart=!0,t._protected=!0}return Et._system}};th.targetFPMS=.06;let gt=th;Object.defineProperties(O,{TARGET_FPMS:{get(){return gt.targetFPMS},set(i){gt.targetFPMS=i}}});class eh{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,me.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?gt.shared:new gt,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}eh.extension=C.Application;N.add(eh);const sh=[];N.handleByList(C.Renderer,sh);function Oc(i){for(const t of sh)if(t.test(i))return new t(i);throw new Error("Unable to auto-detect a suitable renderer.")}var Bc=`attribute vec2 aVertexPosition;
|
|
492
|
+
`))}}let yc=0;const $s={textureCount:0,uboCount:0};class Ko{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=yc++}systemCheck(){if(!$u())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;const s=t.program,r=s.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==s&&(this.program=s,this.gl.useProgram(r.program)),e||($s.textureCount=0,$s.uboCount=0,this.syncUniformGroup(t.uniformGroup,$s)),r}setUniforms(t){const e=this.shader.program,s=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(s.uniformData,t,this.renderer)}syncUniformGroup(t,e){const s=this.getGlProgram();(!t.static||t.dirtyId!==s.uniformDirtyGroups[t.id])&&(s.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,s,e))}syncUniforms(t,e,s){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,s)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Nu(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){const s=this.getGlProgram();if(!t.static||t.dirtyId!==0||!s.uniformGroups[t.id]){t.dirtyId=0;const r=s.uniformGroups[t.id]||this.createSyncBufferGroup(t,s,e);t.buffer.update(),r(s.uniformData,t.uniforms,this.renderer,$s,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,s.uniformBufferBindings[e])}createSyncBufferGroup(t,e,s){const{gl:r}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(e.program,s);e.uniformBufferBindings[s]=this.shader.uniformBindCount,r.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const a=this.getSignature(t,this.shader.program.uniformData,"ubo");let o=this._uboCache[a];if(o||(o=this._uboCache[a]=vc(t,this.shader.program.uniformData)),t.autoManage){const h=new Float32Array(o.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=o.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,s){const r=t.uniforms,n=[`${s}-`];for(const a in r)n.push(a),e[a]&&n.push(e[a].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,s=t.program,r=fc(e,s);return s.glPrograms[this.renderer.CONTEXT_UID]=r,r}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}Ko.extension={type:C.RendererSystem,name:"shader"};N.add(Ko);class di{constructor(t){this.renderer=t}run(t){const{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.3.2 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}di.defaultOptions={hello:!1},di.extension={type:[C.RendererSystem,C.CanvasRendererSystem],name:"startup"};N.add(di);function xc(i,t=[]){return t[H.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.ADD]=[i.ONE,i.ONE],t[H.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.SCREEN]=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.NONE]=[0,0],t[H.NORMAL_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.ADD_NPM]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t[H.SCREEN_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.SRC_IN]=[i.DST_ALPHA,i.ZERO],t[H.SRC_OUT]=[i.ONE_MINUS_DST_ALPHA,i.ZERO],t[H.SRC_ATOP]=[i.DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[H.DST_OVER]=[i.ONE_MINUS_DST_ALPHA,i.ONE],t[H.DST_IN]=[i.ZERO,i.SRC_ALPHA],t[H.DST_OUT]=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],t[H.DST_ATOP]=[i.ONE_MINUS_DST_ALPHA,i.SRC_ALPHA],t[H.XOR]=[i.ONE_MINUS_DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[H.SUBTRACT]=[i.ONE,i.ONE,i.ONE,i.ONE,i.FUNC_REVERSE_SUBTRACT,i.FUNC_ADD],t}const bc=0,Tc=1,Ec=2,Ac=3,wc=4,Sc=5,Zo=class Or{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=H.NONE,this._blendEq=!1,this.map=[],this.map[bc]=this.setBlend,this.map[Tc]=this.setOffset,this.map[Ec]=this.setCullFace,this.map[Ac]=this.setDepthTest,this.map[wc]=this.setFrontFace,this.map[Sc]=this.setDepthMask,this.checks=[],this.defaultState=new ne,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=xc(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,s=0;for(;e;)e&1&&this.map[s].call(this,!!(t.data&1<<s)),e=e>>1,s++;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(Or.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(Or.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(t===this.blendMode)return;this.blendMode=t;const e=this.blendModes[t],s=this.gl;e.length===2?s.blendFunc(e[0],e[1]):s.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,s.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,s.blendEquationSeparate(s.FUNC_ADD,s.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=-1,this.setBlendMode(0)}updateCheck(t,e){const s=this.checks.indexOf(t);e&&s===-1?this.checks.push(t):!e&&s!==-1&&this.checks.splice(s,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};Zo.extension={type:C.RendererSystem,name:"state"};let Ic=Zo;N.add(Ic);class Rc extends Ke{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){var e;this.addRunners(...t.runners);const s=((e=t.priority)!=null?e:[]).filter(n=>t.systems[n]),r=[...s,...Object.keys(t.systems).filter(n=>!s.includes(n))];for(const n of r)this.addSystem(t.systems[n],n)}addRunners(...t){t.forEach(e=>{this.runners[e]=new Pt(e)})}addSystem(t,e){const s=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=s,this._systemsHash[e]=s;for(const r in this.runners)this.runners[r].add(s);return this}emitWithCustomOptions(t,e){const s=Object.keys(this._systemsHash);t.items.forEach(r=>{const n=s.find(a=>this._systemsHash[a]===r);r[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const hs=class ti{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=ti.defaultMaxIdle,this.checkCountMax=ti.defaultCheckCountMax,this.mode=ti.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==nn.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let s=!1;for(let r=0;r<e.length;r++){const n=e[r];n.resource&&this.count-n.touched>this.maxIdle&&(t.destroyTexture(n,!0),e[r]=null,s=!0)}if(s){let r=0;for(let n=0;n<e.length;n++)e[n]!==null&&(e[r++]=e[n]);e.length=r}}unload(t){const e=this.renderer.texture,s=t._texture;s&&!s.framebuffer&&e.destroyTexture(s);for(let r=t.children.length-1;r>=0;r--)this.unload(t.children[r])}destroy(){this.renderer=null}};hs.defaultMode=nn.AUTO,hs.defaultMaxIdle=60*60,hs.defaultCheckCountMax=60*10,hs.extension={type:C.RendererSystem,name:"textureGC"};let Se=hs;N.add(Se);class Ki{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=U.UNSIGNED_BYTE,this.internalFormat=E.RGBA,this.samplerType=0}}function Cc(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[i.RGB]:M.FLOAT,[i.RGBA]:M.FLOAT,[i.ALPHA]:M.FLOAT,[i.LUMINANCE]:M.FLOAT,[i.LUMINANCE_ALPHA]:M.FLOAT,[i.R8]:M.FLOAT,[i.R8_SNORM]:M.FLOAT,[i.RG8]:M.FLOAT,[i.RG8_SNORM]:M.FLOAT,[i.RGB8]:M.FLOAT,[i.RGB8_SNORM]:M.FLOAT,[i.RGB565]:M.FLOAT,[i.RGBA4]:M.FLOAT,[i.RGB5_A1]:M.FLOAT,[i.RGBA8]:M.FLOAT,[i.RGBA8_SNORM]:M.FLOAT,[i.RGB10_A2]:M.FLOAT,[i.RGB10_A2UI]:M.FLOAT,[i.SRGB8]:M.FLOAT,[i.SRGB8_ALPHA8]:M.FLOAT,[i.R16F]:M.FLOAT,[i.RG16F]:M.FLOAT,[i.RGB16F]:M.FLOAT,[i.RGBA16F]:M.FLOAT,[i.R32F]:M.FLOAT,[i.RG32F]:M.FLOAT,[i.RGB32F]:M.FLOAT,[i.RGBA32F]:M.FLOAT,[i.R11F_G11F_B10F]:M.FLOAT,[i.RGB9_E5]:M.FLOAT,[i.R8I]:M.INT,[i.R8UI]:M.UINT,[i.R16I]:M.INT,[i.R16UI]:M.UINT,[i.R32I]:M.INT,[i.R32UI]:M.UINT,[i.RG8I]:M.INT,[i.RG8UI]:M.UINT,[i.RG16I]:M.INT,[i.RG16UI]:M.UINT,[i.RG32I]:M.INT,[i.RG32UI]:M.UINT,[i.RGB8I]:M.INT,[i.RGB8UI]:M.UINT,[i.RGB16I]:M.INT,[i.RGB16UI]:M.UINT,[i.RGB32I]:M.INT,[i.RGB32UI]:M.UINT,[i.RGBA8I]:M.INT,[i.RGBA8UI]:M.UINT,[i.RGBA16I]:M.INT,[i.RGBA16UI]:M.UINT,[i.RGBA32I]:M.INT,[i.RGBA32UI]:M.UINT,[i.DEPTH_COMPONENT16]:M.FLOAT,[i.DEPTH_COMPONENT24]:M.FLOAT,[i.DEPTH_COMPONENT32F]:M.FLOAT,[i.DEPTH_STENCIL]:M.FLOAT,[i.DEPTH24_STENCIL8]:M.FLOAT,[i.DEPTH32F_STENCIL8]:M.FLOAT}:t={[i.RGB]:M.FLOAT,[i.RGBA]:M.FLOAT,[i.ALPHA]:M.FLOAT,[i.LUMINANCE]:M.FLOAT,[i.LUMINANCE_ALPHA]:M.FLOAT,[i.DEPTH_STENCIL]:M.FLOAT},t}function Pc(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[U.UNSIGNED_BYTE]:{[E.RGBA]:i.RGBA8,[E.RGB]:i.RGB8,[E.RG]:i.RG8,[E.RED]:i.R8,[E.RGBA_INTEGER]:i.RGBA8UI,[E.RGB_INTEGER]:i.RGB8UI,[E.RG_INTEGER]:i.RG8UI,[E.RED_INTEGER]:i.R8UI,[E.ALPHA]:i.ALPHA,[E.LUMINANCE]:i.LUMINANCE,[E.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[U.BYTE]:{[E.RGBA]:i.RGBA8_SNORM,[E.RGB]:i.RGB8_SNORM,[E.RG]:i.RG8_SNORM,[E.RED]:i.R8_SNORM,[E.RGBA_INTEGER]:i.RGBA8I,[E.RGB_INTEGER]:i.RGB8I,[E.RG_INTEGER]:i.RG8I,[E.RED_INTEGER]:i.R8I},[U.UNSIGNED_SHORT]:{[E.RGBA_INTEGER]:i.RGBA16UI,[E.RGB_INTEGER]:i.RGB16UI,[E.RG_INTEGER]:i.RG16UI,[E.RED_INTEGER]:i.R16UI,[E.DEPTH_COMPONENT]:i.DEPTH_COMPONENT16},[U.SHORT]:{[E.RGBA_INTEGER]:i.RGBA16I,[E.RGB_INTEGER]:i.RGB16I,[E.RG_INTEGER]:i.RG16I,[E.RED_INTEGER]:i.R16I},[U.UNSIGNED_INT]:{[E.RGBA_INTEGER]:i.RGBA32UI,[E.RGB_INTEGER]:i.RGB32UI,[E.RG_INTEGER]:i.RG32UI,[E.RED_INTEGER]:i.R32UI,[E.DEPTH_COMPONENT]:i.DEPTH_COMPONENT24},[U.INT]:{[E.RGBA_INTEGER]:i.RGBA32I,[E.RGB_INTEGER]:i.RGB32I,[E.RG_INTEGER]:i.RG32I,[E.RED_INTEGER]:i.R32I},[U.FLOAT]:{[E.RGBA]:i.RGBA32F,[E.RGB]:i.RGB32F,[E.RG]:i.RG32F,[E.RED]:i.R32F,[E.DEPTH_COMPONENT]:i.DEPTH_COMPONENT32F},[U.HALF_FLOAT]:{[E.RGBA]:i.RGBA16F,[E.RGB]:i.RGB16F,[E.RG]:i.RG16F,[E.RED]:i.R16F},[U.UNSIGNED_SHORT_5_6_5]:{[E.RGB]:i.RGB565},[U.UNSIGNED_SHORT_4_4_4_4]:{[E.RGBA]:i.RGBA4},[U.UNSIGNED_SHORT_5_5_5_1]:{[E.RGBA]:i.RGB5_A1},[U.UNSIGNED_INT_2_10_10_10_REV]:{[E.RGBA]:i.RGB10_A2,[E.RGBA_INTEGER]:i.RGB10_A2UI},[U.UNSIGNED_INT_10F_11F_11F_REV]:{[E.RGB]:i.R11F_G11F_B10F},[U.UNSIGNED_INT_5_9_9_9_REV]:{[E.RGB]:i.RGB9_E5},[U.UNSIGNED_INT_24_8]:{[E.DEPTH_STENCIL]:i.DEPTH24_STENCIL8},[U.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[E.DEPTH_STENCIL]:i.DEPTH32F_STENCIL8}}:t={[U.UNSIGNED_BYTE]:{[E.RGBA]:i.RGBA,[E.RGB]:i.RGB,[E.ALPHA]:i.ALPHA,[E.LUMINANCE]:i.LUMINANCE,[E.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[U.UNSIGNED_SHORT_5_6_5]:{[E.RGB]:i.RGB},[U.UNSIGNED_SHORT_4_4_4_4]:{[E.RGBA]:i.RGBA},[U.UNSIGNED_SHORT_5_5_5_1]:{[E.RGBA]:i.RGBA}},t}class Qo{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new X,this.hasIntegerTextures=!1}contextChange(){const t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=Pc(t),this.samplerTypes=Cc(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let r=0;r<e;r++)this.boundTextures[r]=null;this.emptyTextures={};const s=new Ki(t.createTexture());t.bindTexture(t.TEXTURE_2D,s.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=s,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Ki(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let r=0;r<6;r++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let r=0;r<this.boundTextures.length;r++)this.bind(null,r)}bind(t,e=0){const{gl:s}=this;if(t=t==null?void 0:t.castToBaseTexture(),t!=null&&t.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;const r=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,s.activeTexture(s.TEXTURE0+e)),s.bindTexture(t.target,r.texture)),r.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,s.activeTexture(s.TEXTURE0+e)),this.updateTexture(t)):r.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,s.activeTexture(s.TEXTURE0+e)),s.bindTexture(s.TEXTURE_2D,this.emptyTextures[s.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){const{gl:e,boundTextures:s}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let r=0;r<s.length;r++)s[r]===this.unknownTexture&&this.bind(null,r)}for(let r=0;r<s.length;r++)s[r]===t&&(this.currentLocation!==r&&(e.activeTexture(e.TEXTURE0+r),this.currentLocation=r),e.bindTexture(t.target,this.emptyTextures[t.target].texture),s[r]=null)}ensureSamplerType(t){const{boundTextures:e,hasIntegerTextures:s,CONTEXT_UID:r}=this;if(s)for(let n=t-1;n>=0;--n){const a=e[n];a&&a._glTextures[r].samplerType!==M.FLOAT&&this.renderer.texture.unbind(a)}}initTexture(t){const e=new Ki(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){var s,r,n;e.internalFormat=(r=(s=this.internalFormats[t.type])==null?void 0:s[t.format])!=null?r:t.format,e.samplerType=(n=this.samplerTypes[e.internalFormat])!=null?n:M.FLOAT,this.webGLVersion===2&&t.type===U.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){var e;const s=t._glTextures[this.CONTEXT_UID];if(!s)return;const r=this.renderer;if(this.initTextureType(t,s),(e=t.resource)!=null&&e.upload(r,t,s))s.samplerType!==M.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,a=t.realHeight,o=r.gl;(s.width!==n||s.height!==a||s.dirtyId<0)&&(s.width=n,s.height=a,o.texImage2D(t.target,0,s.internalFormat,n,a,0,t.format,s.type,null))}t.dirtyStyleId!==s.dirtyStyleId&&this.updateTextureStyle(t),s.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:s}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),s.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){const r=this.managedTextures.indexOf(t);r!==-1&&Re(this.managedTextures,r,1)}}updateTextureStyle(t){var e;const s=t._glTextures[this.CONTEXT_UID];s&&((t.mipmap===Kt.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?s.mipmap=!1:s.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?s.wrapMode=re.CLAMP:s.wrapMode=t.wrapMode,(e=t.resource)!=null&&e.style(this.renderer,t,s)||this.setStyle(t,s),s.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const s=this.gl;if(e.mipmap&&t.mipmap!==Kt.ON_MANUAL&&s.generateMipmap(t.target),s.texParameteri(t.target,s.TEXTURE_WRAP_S,e.wrapMode),s.texParameteri(t.target,s.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){s.texParameteri(t.target,s.TEXTURE_MIN_FILTER,t.scaleMode===ee.LINEAR?s.LINEAR_MIPMAP_LINEAR:s.NEAREST_MIPMAP_NEAREST);const r=this.renderer.context.extensions.anisotropicFiltering;if(r&&t.anisotropicLevel>0&&t.scaleMode===ee.LINEAR){const n=Math.min(t.anisotropicLevel,s.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));s.texParameterf(t.target,r.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else s.texParameteri(t.target,s.TEXTURE_MIN_FILTER,t.scaleMode===ee.LINEAR?s.LINEAR:s.NEAREST);s.texParameteri(t.target,s.TEXTURE_MAG_FILTER,t.scaleMode===ee.LINEAR?s.LINEAR:s.NEAREST)}destroy(){this.renderer=null}}Qo.extension={type:C.RendererSystem,name:"texture"};N.add(Qo);class Jo{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:s}=this,r=t._glTransformFeedbacks[s]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,r)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:s,renderer:r}=this;e&&r.shader.bind(e),s.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:s,CONTEXT_UID:r}=this,n=e.createTransformFeedback();t._glTransformFeedbacks[r]=n,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n);for(let a=0;a<t.buffers.length;a++){const o=t.buffers[a];o&&(s.buffer.update(o),o._glBuffers[r].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,a,o._glBuffers[r].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),n}disposeTransformFeedback(t,e){const s=t._glTransformFeedbacks[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this);const n=this.renderer.buffer;if(n)for(let a=0;a<t.buffers.length;a++){const o=t.buffers[a];if(!o)continue;const h=o._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&n.dispose(o,e))}s&&(e||r.deleteTransformFeedback(s),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}Jo.extension={type:C.RendererSystem,name:"transformFeedback"};N.add(Jo);class fi{constructor(t){this.renderer=t}init(t){this.screen=new j(0,0,t.width,t.height),this.element=t.view||D.ADAPTER.createCanvas(),this.resolution=t.resolution||D.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);const s=this.element.width/this.resolution,r=this.element.height/this.resolution;this.screen.width=s,this.screen.height=r,this.autoDensity&&(this.element.style.width=`${s}px`,this.element.style.height=`${r}px`),this.renderer.emit("resize",s,r),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){var e;t&&((e=this.element.parentNode)==null||e.removeChild(this.element)),this.renderer=null,this.element=null,this.screen=null}}fi.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},fi.extension={type:[C.RendererSystem,C.CanvasRendererSystem],name:"_view"};N.add(fi);var Mc=Object.defineProperty,ca=Object.getOwnPropertySymbols,Dc=Object.prototype.hasOwnProperty,Oc=Object.prototype.propertyIsEnumerable,da=(i,t,e)=>t in i?Mc(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Hs=(i,t)=>{for(var e in t||(t={}))Dc.call(t,e)&&da(i,e,t[e]);if(ca)for(var e of ca(t))Oc.call(t,e)&&da(i,e,t[e]);return i};D.PREFER_ENV=De.WEBGL2;D.STRICT_TEXTURE_CACHE=!1;D.RENDER_OPTIONS=Hs(Hs(Hs(Hs({},ci.defaultOptions),ui.defaultOptions),fi.defaultOptions),di.defaultOptions);Object.defineProperties(D,{WRAP_MODE:{get(){return X.defaultOptions.wrapMode},set(i){X.defaultOptions.wrapMode=i}},SCALE_MODE:{get(){return X.defaultOptions.scaleMode},set(i){X.defaultOptions.scaleMode=i}},MIPMAP_TEXTURES:{get(){return X.defaultOptions.mipmap},set(i){X.defaultOptions.mipmap=i}},ANISOTROPIC_LEVEL:{get(){return X.defaultOptions.anisotropicLevel},set(i){X.defaultOptions.anisotropicLevel=i}},FILTER_RESOLUTION:{get(){return xt.defaultResolution},set(i){xt.defaultResolution=i}},FILTER_MULTISAMPLE:{get(){return xt.defaultMultisample},set(i){xt.defaultMultisample=i}},SPRITE_MAX_TEXTURES:{get(){return we.defaultMaxTextures},set(i){we.defaultMaxTextures=i}},SPRITE_BATCH_SIZE:{get(){return we.defaultBatchSize},set(i){we.defaultBatchSize=i}},CAN_UPLOAD_SAME_BUFFER:{get(){return we.canUploadSameBuffer},set(i){we.canUploadSameBuffer=i}},GC_MODE:{get(){return Se.defaultMode},set(i){Se.defaultMode=i}},GC_MAX_IDLE:{get(){return Se.defaultMaxIdle},set(i){Se.defaultMaxIdle=i}},GC_MAX_CHECK_COUNT:{get(){return Se.defaultCheckCountMax},set(i){Se.defaultCheckCountMax=i}},PRECISION_VERTEX:{get(){return ie.defaultVertexPrecision},set(i){ie.defaultVertexPrecision=i}},PRECISION_FRAGMENT:{get(){return ie.defaultFragmentPrecision},set(i){ie.defaultFragmentPrecision=i}}});var me=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(me||{});class Zi{constructor(t,e=null,s=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=s,this.once=r}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 th=class Et{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 Zi(null,null,1/0),this.deltaMS=1/Et.targetFPMS,this.elapsedMS=1/Et.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,s=me.NORMAL){return this._addListener(new Zi(t,e,s))}addOnce(t,e,s=me.NORMAL){return this._addListener(new Zi(t,e,s,!0))}_addListener(t){let e=this._head.next,s=this._head;if(!e)t.connect(s);else{for(;e;){if(t.priority>e.priority){t.connect(s);break}s=e,e=e.next}t.previous||t.connect(s)}return this._startIfPossible(),this}remove(t,e){let s=this._head.next;for(;s;)s.match(t,e)?s=s.destroy():s=s.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*Et.targetFPMS;const s=this._head;let r=s.next;for(;r;)r=r.emit(this.deltaTime);s.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),s=Math.min(Math.max(0,e)/1e3,Et.targetFPMS);this._maxElapsedMS=1/s}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(!Et._shared){const t=Et._shared=new Et;t.autoStart=!0,t._protected=!0}return Et._shared}static get system(){if(!Et._system){const t=Et._system=new Et;t.autoStart=!0,t._protected=!0}return Et._system}};th.targetFPMS=.06;let _t=th;Object.defineProperties(D,{TARGET_FPMS:{get(){return _t.targetFPMS},set(i){_t.targetFPMS=i}}});class eh{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,me.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?_t.shared:new _t,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}eh.extension=C.Application;N.add(eh);const sh=[];N.handleByList(C.Renderer,sh);function Bc(i){for(const t of sh)if(t.test(i))return new t(i);throw new Error("Unable to auto-detect a suitable renderer.")}var Fc=`attribute vec2 aVertexPosition;
|
|
493
493
|
attribute vec2 aTextureCoord;
|
|
494
494
|
|
|
495
495
|
uniform mat3 projectionMatrix;
|
|
@@ -500,7 +500,7 @@ void main(void)
|
|
|
500
500
|
{
|
|
501
501
|
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
502
502
|
vTextureCoord = aTextureCoord;
|
|
503
|
-
}`,
|
|
503
|
+
}`,Nc=`attribute vec2 aVertexPosition;
|
|
504
504
|
|
|
505
505
|
uniform mat3 projectionMatrix;
|
|
506
506
|
|
|
@@ -526,7 +526,7 @@ void main(void)
|
|
|
526
526
|
gl_Position = filterVertexPosition();
|
|
527
527
|
vTextureCoord = filterTextureCoord();
|
|
528
528
|
}
|
|
529
|
-
`;const Nc=Bc,ih=Fc;class rh{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){const s=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,s)}else{const s=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,s)}e>=ht.HIGH?this.multisample=ht.HIGH:e>=ht.MEDIUM?this.multisample=ht.MEDIUM:e>=ht.LOW?this.multisample=ht.LOW:this.multisample=ht.NONE}destroy(){}}rh.extension={type:C.RendererSystem,name:"_multisample"};N.add(rh);class Lc{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class nh{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:s}=this,r=t._glBuffers[s]||this.createGLBuffer(t);e.bindBuffer(t.type,r.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:s,CONTEXT_UID:r}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[r]||this.createGLBuffer(t);this.boundBufferBases[e]=t,s.bindBufferBase(s.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,s){const{gl:r,CONTEXT_UID:n}=this;s=s||0;const a=t._glBuffers[n]||this.createGLBuffer(t);r.bindBufferRange(r.UNIFORM_BUFFER,e||0,a.buffer,s*256,256)}update(t){const{gl:e,CONTEXT_UID:s}=this,r=t._glBuffers[s]||this.createGLBuffer(t);if(t._updateID!==r.updateID)if(r.updateID=t._updateID,e.bindBuffer(t.type,r.buffer),r.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;r.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,n)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const s=t._glBuffers[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this),s&&(e||r.deleteBuffer(s.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let s=0;s<e.length;s++)this.dispose(this.managedBuffers[e[s]],t)}createGLBuffer(t){const{CONTEXT_UID:e,gl:s}=this;return t._glBuffers[e]=new Lc(s.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}nh.extension={type:C.RendererSystem,name:"buffer"};N.add(nh);class ah{constructor(t){this.renderer=t}render(t,e){const s=this.renderer;let r,n,a,o;if(e&&(r=e.renderTexture,n=e.clear,a=e.transform,o=e.skipUpdateTransform),this.renderingToScreen=!r,s.runners.prerender.emit(),s.emit("prerender"),s.projection.transform=a,!s.context.isLost){if(r||(this.lastObjectRendered=t),!o){const h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}s.renderTexture.bind(r),s.batch.currentRenderer.start(),(n!=null?n:s.background.clearBeforeRender)&&s.renderTexture.clear(),t.render(s),s.batch.currentRenderer.flush(),r&&(e.blit&&s.framebuffer.blit(),r.baseTexture.update()),s.runners.postrender.emit(),s.projection.transform=null,s.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}ah.extension={type:C.RendererSystem,name:"objectRenderer"};N.add(ah);const ei=class Br extends Ic{constructor(t){super(),this.type=ro.WEBGL,t=Object.assign({},O.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new Lt({projectionMatrix:new tt},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:Br.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=Br.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:fo()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return this.background.clearBeforeRender}get useContextAlpha(){return this.context.useContextAlpha}get preserveDrawingBuffer(){return this.context.preserveDrawingBuffer}get backgroundColor(){return this.background.color}set backgroundColor(t){this.background.color=t}get backgroundAlpha(){return this.background.alpha}set backgroundAlpha(t){this.background.alpha=t}get powerPreference(){return this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};ei.extension={type:C.Renderer,priority:1},ei.__plugins={},ei.__systems={};let pn=ei;N.handleByMap(C.RendererPlugin,pn.__plugins);N.handleByMap(C.RendererSystem,pn.__systems);N.add(pn);class oh extends bs{constructor(t,e){const{width:s,height:r}=e||{};super(s,r),this.items=[],this.itemDirtyIds=[];for(let n=0;n<t;n++){const a=new X;this.items.push(a),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let s=0;s<this.length;s++)t[s]&&(t[s].castToBaseTexture?this.addBaseTextureAt(t[s].castToBaseTexture(),s):t[s]instanceof bs?this.addResourceAt(t[s],s):this.addResourceAt(wo(t[s],e),s))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;const t=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{const{realWidth:e,realHeight:s}=this.items[0];return this.resize(e,s),this.update(),Promise.resolve(this)}),this._load}}class Uc extends oh{constructor(t,e){const{width:s,height:r}=e||{};let n,a;Array.isArray(t)?(n=t,a=t.length):a=t,super(a,{width:s,height:r}),n&&this.initFromArray(n,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=je.TEXTURE_2D_ARRAY}upload(t,e,s){const{length:r,itemDirtyIds:n,items:a}=this,{gl:o}=t;s.dirtyId<0&&o.texImage3D(o.TEXTURE_2D_ARRAY,0,s.internalFormat,this._width,this._height,r,0,e.format,s.type,null);for(let h=0;h<r;h++){const l=a[h];n[h]<l.dirtyId&&(n[h]=l.dirtyId,l.valid&&o.texSubImage3D(o.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,e.format,s.type,l.resource.source))}return!0}}class kc extends pe{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const hh=class ls extends oh{constructor(t,e){const{width:s,height:r,autoLoad:n,linkBaseTexture:a}=e||{};if(t&&t.length!==ls.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:s,height:r});for(let o=0;o<ls.SIDES;o++)this.items[o].target=je.TEXTURE_CUBE_MAP_POSITIVE_X+o;this.linkBaseTexture=a!==!1,t&&this.initFromArray(t,e),n!==!1&&this.load()}bind(t){super.bind(t),t.target=je.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,s){if(s===void 0&&(s=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=je.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,s){const r=this.itemDirtyIds;for(let n=0;n<ls.SIDES;n++){const a=this.items[n];(r[n]<a.dirtyId||s.dirtyId<e.dirtyId)&&(a.valid&&a.resource?(a.resource.upload(t,a,s),r[n]=a.dirtyId):r[n]<-1&&(t.gl.texImage2D(a.target,0,s.internalFormat,e.realWidth,e.realHeight,0,e.format,s.type,null),r[n]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===ls.SIDES}};hh.SIDES=6;let Gc=hh;class Xe extends pe{constructor(t,e){var s,r;e=e||{};let n,a,o;typeof t=="string"?(n=Xe.EMPTY,a=t,o=!0):(n=t,a=null,o=!1),super(n),this.url=a,this.crossOrigin=(s=e.crossOrigin)!=null?s:!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=(r=e.ownsImageBitmap)!=null?r:o,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{const s=await O.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const r=await s.blob();if(this.destroyed)return;const n=await createImageBitmap(r,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===bt.UNPACK?"premultiply":"none"});if(this.destroyed){n.close();return}this.source=n,this.update(),t(this)}catch(s){if(this.destroyed)return;e(s),this.onError.emit(s)}}),this._load)}upload(t,e,s){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,s)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap!="undefined"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){var t;return Xe._EMPTY=(t=Xe._EMPTY)!=null?t:O.ADAPTER.createCanvas(0,0),Xe._EMPTY}}const Fr=class si extends pe{constructor(t,e){e=e||{},super(O.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},si.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){const t=new Image;pe.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;const e=t.width,s=t.height;if(!e||!s)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let r=e*this.scale,n=s*this.scale;(this._overrideWidth||this._overrideHeight)&&(r=this._overrideWidth||this._overrideHeight/s*e,n=this._overrideHeight||this._overrideWidth/e*s),r=Math.round(r),n=Math.round(n);const a=this.source;a.width=r,a.height=n,a._pixiId=`canvas_${de()}`,a.getContext("2d").drawImage(t,0,0,e,s,0,0,r,n),this._resolve(),this._resolve=null}}static getSize(t){const e=si.SVG_SIZE.exec(t),s={};return e&&(s[e[1]]=Math.round(parseFloat(e[3])),s[e[5]]=Math.round(parseFloat(e[7]))),s}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&si.SVG_XML.test(t)}};Fr.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Fr.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Nr=Fr;const Lr=class Ur extends pe{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){const s=document.createElement("video");e.autoLoad!==!1&&s.setAttribute("preload","auto"),e.playsinline!==!1&&(s.setAttribute("webkit-playsinline",""),s.setAttribute("playsinline","")),e.muted===!0&&(s.setAttribute("muted",""),s.muted=!0),e.loop===!0&&s.setAttribute("loop",""),e.autoPlay!==!1&&s.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);const r=t[0].src||t[0];pe.crossOrigin(s,r,e.crossorigin);for(let n=0;n<t.length;++n){const a=document.createElement("source");let{src:o,mime:h}=t[n];if(o=o||t[n],o.startsWith("data:"))h=o.slice(5,o.indexOf(";"));else if(!o.startsWith("blob:")){const l=o.split("?").shift().toLowerCase(),u=l.slice(l.lastIndexOf(".")+1);h=h||Ur.MIME_TYPES[u]||`video/${u}`}a.src=o,h&&(a.type=h),s.appendChild(a)}t=s}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,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._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){const e=gt.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;const t=this.source;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._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,s)=>{this.valid?e(this):(this._resolve=e,this._reject=s,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.source;return!t.paused&&!t.ended&&this._isSourceReady()}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){const t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);const e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();const t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(gt.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(gt.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(gt.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||Ur.TYPES.includes(e)}};Lr.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Lr.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let lh=Lr;Ar.push(Xe,Bo,kc,lh,Nr,wi,Gc,Uc);class Fm{constructor(){this._glTransformFeedbacks={},this.buffers=[],this.disposeRunner=new Pt("disposeTransformFeedback")}bindBuffer(t,e){this.buffers[t]=e}destroy(){this.disposeRunner.emit(this,!1)}}const Nm="7.3.0";class pi{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}clear(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}getRectangle(t){return this.minX>this.maxX||this.minY>this.maxY?j.EMPTY:(t=t||new j(0,0,1,1),t.x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)}addPoint(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)}addPointMatrix(t,e){const{a:s,b:r,c:n,d:a,tx:o,ty:h}=t,l=s*e.x+n*e.y+o,u=r*e.x+a*e.y+h;this.minX=Math.min(this.minX,l),this.maxX=Math.max(this.maxX,l),this.minY=Math.min(this.minY,u),this.maxY=Math.max(this.maxY,u)}addQuad(t){let e=this.minX,s=this.minY,r=this.maxX,n=this.maxY,a=t[0],o=t[1];e=a<e?a:e,s=o<s?o:s,r=a>r?a:r,n=o>n?o:n,a=t[2],o=t[3],e=a<e?a:e,s=o<s?o:s,r=a>r?a:r,n=o>n?o:n,a=t[4],o=t[5],e=a<e?a:e,s=o<s?o:s,r=a>r?a:r,n=o>n?o:n,a=t[6],o=t[7],e=a<e?a:e,s=o<s?o:s,r=a>r?a:r,n=o>n?o:n,this.minX=e,this.minY=s,this.maxX=r,this.maxY=n}addFrame(t,e,s,r,n){this.addFrameMatrix(t.worldTransform,e,s,r,n)}addFrameMatrix(t,e,s,r,n){const a=t.a,o=t.b,h=t.c,l=t.d,u=t.tx,c=t.ty;let d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,g=a*e+h*s+u,y=o*e+l*s+c;d=g<d?g:d,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,g=a*r+h*s+u,y=o*r+l*s+c,d=g<d?g:d,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,g=a*e+h*n+u,y=o*e+l*n+c,d=g<d?g:d,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,g=a*r+h*n+u,y=o*r+l*n+c,d=g<d?g:d,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addVertexData(t,e,s){let r=this.minX,n=this.minY,a=this.maxX,o=this.maxY;for(let h=e;h<s;h+=2){const l=t[h],u=t[h+1];r=l<r?l:r,n=u<n?u:n,a=l>a?l:a,o=u>o?u:o}this.minX=r,this.minY=n,this.maxX=a,this.maxY=o}addVertices(t,e,s,r){this.addVerticesMatrix(t.worldTransform,e,s,r)}addVerticesMatrix(t,e,s,r,n=0,a=n){const o=t.a,h=t.b,l=t.c,u=t.d,c=t.tx,d=t.ty;let f=this.minX,p=this.minY,m=this.maxX,g=this.maxY;for(let y=s;y<r;y+=2){const x=e[y],_=e[y+1],v=o*x+l*_+c,T=u*_+h*x+d;f=Math.min(f,v-n),m=Math.max(m,v+n),p=Math.min(p,T-a),g=Math.max(g,T+a)}this.minX=f,this.minY=p,this.maxX=m,this.maxY=g}addBounds(t){const e=this.minX,s=this.minY,r=this.maxX,n=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<s?t.minY:s,this.maxX=t.maxX>r?t.maxX:r,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,e){const s=t.minX>e.minX?t.minX:e.minX,r=t.minY>e.minY?t.minY:e.minY,n=t.maxX<e.maxX?t.maxX:e.maxX,a=t.maxY<e.maxY?t.maxY:e.maxY;if(s<=n&&r<=a){const o=this.minX,h=this.minY,l=this.maxX,u=this.maxY;this.minX=s<o?s:o,this.minY=r<h?r:h,this.maxX=n>l?n:l,this.maxY=a>u?a:u}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const s=t.minX>e.x?t.minX:e.x,r=t.minY>e.y?t.minY:e.y,n=t.maxX<e.x+e.width?t.maxX:e.x+e.width,a=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(s<=n&&r<=a){const o=this.minX,h=this.minY,l=this.maxX,u=this.maxY;this.minX=s<o?s:o,this.minY=r<h?r:h,this.maxX=n>l?n:l,this.maxY=a>u?a:u}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,s,r,n,a){t-=n,e-=a,s+=n,r+=a,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>s?this.maxX:s,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>r?this.maxY:r}}class it extends Ke{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new dn,this.alpha=1,this.visible=!0,this.renderable=!0,this.cullable=!1,this.cullArea=null,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new pi,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(t){const e=Object.keys(t);for(let s=0;s<e.length;++s){const r=e[s];Object.defineProperty(it.prototype,r,Object.getOwnPropertyDescriptor(t,r))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(t,e){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),e||(this._boundsRect||(this._boundsRect=new j),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){var e;t||(this._localBoundsRect||(this._localBoundsRect=new j),t=this._localBoundsRect),this._localBounds||(this._localBounds=new pi);const s=this.transform,r=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=(e=r==null?void 0:r.worldAlpha)!=null?e:1,this.transform=this._tempDisplayObjectParent.transform;const n=this._bounds,a=this._boundsID;this._bounds=this._localBounds;const o=this.getBounds(!1,t);return this.parent=r,this.transform=s,this._bounds=n,this._bounds.updateID+=this._boundsID-a,o}toGlobal(t,e,s=!1){return s||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)}toLocal(t,e,s,r){return e&&(t=e.toGlobal(t,s,r)),r||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,s)}setParent(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t}removeFromParent(){var t;(t=this.parent)==null||t.removeChild(this)}setTransform(t=0,e=0,s=1,r=1,n=0,a=0,o=0,h=0,l=0){return this.position.x=t,this.position.y=e,this.scale.x=s||1,this.scale.y=r||1,this.rotation=n,this.skew.x=a,this.skew.y=o,this.pivot.x=h,this.pivot.y=l,this}destroy(t){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.eventMode="auto",this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new $c),this.tempDisplayObjectParent}enableTempParent(){const t=this.parent;return this.parent=this._tempDisplayObjectParent,t}disableTempParent(t){this.parent=t}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(t){this.transform.position.copyFrom(t)}get scale(){return this.transform.scale}set scale(t){this.transform.scale.copyFrom(t)}get pivot(){return this.transform.pivot}set pivot(t){this.transform.pivot.copyFrom(t)}get skew(){return this.transform.skew}set skew(t){this.transform.skew.copyFrom(t)}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*Ru}set angle(t){this.transform.rotation=t*Cu}get zIndex(){return this._zIndex}set zIndex(t){this._zIndex=t,this.parent&&(this.parent.sortDirty=!0)}get worldVisible(){let t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}get mask(){return this._mask}set mask(t){if(this._mask!==t){if(this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount--,e._maskRefCount===0&&(e.renderable=!0,e.isMask=!1))}if(this._mask=t,this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount===0&&(e.renderable=!1,e.isMask=!0),e._maskRefCount++)}}}}class $c extends it{constructor(){super(...arguments),this.sortDirty=null}}it.prototype.displayObjectUpdateTransform=it.prototype.updateTransform;const Hc=new tt;function Vc(i,t){return i.zIndex===t.zIndex?i._lastSortedIndex-t._lastSortedIndex:i.zIndex-t.zIndex}const uh=class kr extends it{constructor(){super(),this.children=[],this.sortableChildren=kr.defaultSortableChildren,this.sortDirty=!1}onChildrenChange(t){}addChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.addChild(t[e]);else{const e=t[0];e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.push(e),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this)}return t[0]}addChildAt(t,e){if(e<0||e>this.children.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${this.children.length}`);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t}swapChildren(t,e){if(t===e)return;const s=this.getChildIndex(t),r=this.getChildIndex(e);this.children[s]=e,this.children[r]=t,this.onChildrenChange(s<r?s:r)}getChildIndex(t){const e=this.children.indexOf(t);if(e===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return e}setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);const s=this.getChildIndex(t);Re(this.children,s,1),this.children.splice(e,0,t),this.onChildrenChange(e)}getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]}removeChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.removeChild(t[e]);else{const e=t[0],s=this.children.indexOf(e);if(s===-1)return null;e.parent=null,e.transform._parentID=-1,Re(this.children,s,1),this._boundsID++,this.onChildrenChange(s),e.emit("removed",this),this.emit("childRemoved",e,this,s)}return t[0]}removeChildAt(t){const e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,Re(this.children,t,1),this._boundsID++,this.onChildrenChange(t),e.emit("removed",this),this.emit("childRemoved",e,this,t),e}removeChildren(t=0,e=this.children.length){const s=t,r=e,n=r-s;let a;if(n>0&&n<=r){a=this.children.splice(s,n);for(let o=0;o<a.length;++o)a[o].parent=null,a[o].transform&&(a[o].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let o=0;o<a.length;++o)a[o].emit("removed",this),this.emit("childRemoved",a[o],this,o);return a}else if(n===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let t=!1;for(let e=0,s=this.children.length;e<s;++e){const r=this.children[e];r._lastSortedIndex=e,!t&&r.zIndex!==0&&(t=!0)}t&&this.children.length>1&&this.children.sort(Vc),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t<e;++t){const s=this.children[t];s.visible&&s.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let t=0;t<this.children.length;t++){const e=this.children[t];if(!(!e.visible||!e.renderable))if(e.calculateBounds(),e._mask){const s=e._mask.isMaskData?e._mask.maskObject:e._mask;s?(s.calculateBounds(),this._bounds.addBoundsMask(e._bounds,s._bounds)):this._bounds.addBounds(e._bounds)}else e.filterArea?this._bounds.addBoundsArea(e._bounds,e.filterArea):this._bounds.addBounds(e._bounds)}this._bounds.updateID=this._boundsID}getLocalBounds(t,e=!1){const s=super.getLocalBounds(t);if(!e)for(let r=0,n=this.children.length;r<n;++r){const a=this.children[r];a.visible&&a.updateTransform()}return s}_calculateBounds(){}_renderWithCulling(t){const e=t.renderTexture.sourceFrame;if(!(e.width>0&&e.height>0))return;let s,r;this.cullArea?(s=this.cullArea,r=this.worldTransform):this._render!==kr.prototype._render&&(s=this.getBounds(!0));const n=t.projection.transform;if(n&&(r?(r=Hc.copyFrom(r),r.prepend(n)):r=n),s&&e.intersects(s,r))this._render(t);else if(this.cullArea)return;for(let a=0,o=this.children.length;a<o;++a){const h=this.children[a],l=h.cullable;h.cullable=l||!this.cullArea,h.render(t),h.cullable=l}}render(t){var e;if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||(e=this.filters)!=null&&e.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(let s=0,r=this.children.length;s<r;++s)this.children[s].render(t)}}renderAdvanced(t){var e,s,r;const n=this.filters,a=this._mask;if(n){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let h=0;h<n.length;h++)n[h].enabled&&this._enabledFilters.push(n[h])}const o=n&&((e=this._enabledFilters)==null?void 0:e.length)||a&&(!a.isMaskData||a.enabled&&(a.autoDetect||a.type!==ut.NONE));if(o&&t.batch.flush(),n&&(s=this._enabledFilters)!=null&&s.length&&t.filter.push(this,this._enabledFilters),a&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let h=0,l=this.children.length;h<l;++h)this.children[h].render(t)}o&&t.batch.flush(),a&&t.mask.pop(this),n&&(r=this._enabledFilters)!=null&&r.length&&t.filter.pop()}_render(t){}destroy(t){super.destroy(),this.sortDirty=!1;const e=typeof t=="boolean"?t:t==null?void 0:t.children,s=this.removeChildren(0,this.children.length);if(e)for(let r=0;r<s.length;++r)s[r].destroy(t)}get width(){return this.scale.x*this.getLocalBounds().width}set width(t){const e=this.getLocalBounds().width;e!==0?this.scale.x=t/e:this.scale.x=1,this._width=t}get height(){return this.scale.y*this.getLocalBounds().height}set height(t){const e=this.getLocalBounds().height;e!==0?this.scale.y=t/e:this.scale.y=1,this._height=t}};uh.defaultSortableChildren=!1;let Mt=uh;Mt.prototype.containerUpdateTransform=Mt.prototype.updateTransform;Object.defineProperties(O,{SORTABLE_CHILDREN:{get(){return Mt.defaultSortableChildren},set(i){Mt.defaultSortableChildren=i}}});const rs=new q,Xc=new Uint16Array([0,1,2,0,2,3]);class _e extends Mt{constructor(t){super(),this._anchor=new ue(this._onAnchorUpdate,this,t?t.defaultAnchor.x:0,t?t.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new K(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=H.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||D.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=Xc,this.pluginName="batch",this.isSprite=!0,this._roundPixels=O.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=se(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=se(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){const t=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===t._updateID)return;this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;const e=this.transform.worldTransform,s=e.a,r=e.b,n=e.c,a=e.d,o=e.tx,h=e.ty,l=this.vertexData,u=t.trim,c=t.orig,d=this._anchor;let f=0,p=0,m=0,g=0;if(u?(p=u.x-d._x*c.width,f=p+u.width,g=u.y-d._y*c.height,m=g+u.height):(p=-d._x*c.width,f=p+c.width,g=-d._y*c.height,m=g+c.height),l[0]=s*p+n*g+o,l[1]=a*g+r*p+h,l[2]=s*f+n*g+o,l[3]=a*g+r*f+h,l[4]=s*f+n*m+o,l[5]=a*m+r*f+h,l[6]=s*p+n*m+o,l[7]=a*m+r*p+h,this._roundPixels){const y=O.RESOLUTION;for(let x=0;x<l.length;++x)l[x]=Math.round(l[x]*y)/y}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const t=this._texture,e=this.vertexTrimmedData,s=t.orig,r=this._anchor,n=this.transform.worldTransform,a=n.a,o=n.b,h=n.c,l=n.d,u=n.tx,c=n.ty,d=-r._x*s.width,f=d+s.width,p=-r._y*s.height,m=p+s.height;e[0]=a*d+h*p+u,e[1]=l*p+o*d+c,e[2]=a*f+h*p+u,e[3]=l*p+o*f+c,e[4]=a*f+h*m+u,e[5]=l*m+o*f+c,e[6]=a*d+h*m+u,e[7]=l*m+o*d+c}_render(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)}_calculateBounds(){const t=this._texture.trim,e=this._texture.orig;!t||t.width===e.width&&t.height===e.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))}getLocalBounds(t){return this.children.length===0?(this._localBounds||(this._localBounds=new pi),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new j),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,rs);const e=this._texture.orig.width,s=this._texture.orig.height,r=-e*this.anchor.x;let n=0;return rs.x>=r&&rs.x<r+e&&(n=-s*this.anchor.y,rs.y>=n&&rs.y<n+s)}destroy(t){if(super.destroy(t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.baseTexture;this._texture.destroy(!!e)}this._texture=null}static from(t,e){const s=t instanceof D?t:D.from(t,e);return new _e(s)}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){const e=se(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){const e=se(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get anchor(){return this._anchor}set anchor(t){this._anchor.copyFrom(t)}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||D.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const ch=new tt;it.prototype._cacheAsBitmap=!1;it.prototype._cacheData=null;it.prototype._cacheAsBitmapResolution=null;it.prototype._cacheAsBitmapMultisample=null;class jc{constructor(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}Object.defineProperties(it.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(i){i!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=i,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(i){i!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=i,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(i){if(this._cacheAsBitmap===i)return;this._cacheAsBitmap=i;let t;i?(this._cacheData||(this._cacheData=new jc),t=this._cacheData,t.originalRender=this.render,t.originalRenderCanvas=this.renderCanvas,t.originalUpdateTransform=this.updateTransform,t.originalCalculateBounds=this.calculateBounds,t.originalGetLocalBounds=this.getLocalBounds,t.originalDestroy=this.destroy,t.originalContainsPoint=this.containsPoint,t.originalMask=this._mask,t.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(t=this._cacheData,t.sprite&&this._destroyCachedDisplayObject(),this.render=t.originalRender,this.renderCanvas=t.originalRenderCanvas,this.calculateBounds=t.originalCalculateBounds,this.getLocalBounds=t.originalGetLocalBounds,this.destroy=t.originalDestroy,this.updateTransform=t.originalUpdateTransform,this.containsPoint=t.originalContainsPoint,this._mask=t.originalMask,this.filterArea=t.originalFilterArea)}}});it.prototype._renderCached=function(i){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(i),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(i))};it.prototype._initCachedDisplayObject=function(i){var t,e,s;if((t=this._cacheData)!=null&&t.sprite)return;const r=this.alpha;this.alpha=1,i.batch.flush();const n=this.getLocalBounds(new j,!0);if((e=this.filters)!=null&&e.length){const m=this.filters[0].padding;n.pad(m)}const a=this.cacheAsBitmapResolution||i.resolution;n.ceil(a),n.width=Math.max(n.width,1/a),n.height=Math.max(n.height,1/a);const o=i.renderTexture.current,h=i.renderTexture.sourceFrame.clone(),l=i.renderTexture.destinationFrame.clone(),u=i.projection.transform,c=Oe.create({width:n.width,height:n.height,resolution:a,multisample:(s=this.cacheAsBitmapMultisample)!=null?s:i.multisample}),d=`cacheAsBitmap_${de()}`;this._cacheData.textureCacheId=d,X.addToCache(c.baseTexture,d),D.addToCache(c,d);const f=this.transform.localTransform.copyTo(ch).invert().translate(-n.x,-n.y);this.render=this._cacheData.originalRender,i.render(this,{renderTexture:c,clear:!0,transform:f,skipUpdateTransform:!1}),i.framebuffer.blit(),i.projection.transform=u,i.renderTexture.bind(o,h,l),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=r;const p=new _e(c);p.transform.worldTransform=this.transform.worldTransform,p.anchor.x=-(n.x/n.width),p.anchor.y=-(n.y/n.height),p.alpha=r,p._bounds=this._bounds,this._cacheData.sprite=p,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=p.containsPoint.bind(p)};it.prototype._renderCachedCanvas=function(i){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(i),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(i))};it.prototype._initCachedDisplayObjectCanvas=function(i){var t;if((t=this._cacheData)!=null&&t.sprite)return;const e=this.getLocalBounds(new j,!0),s=this.alpha;this.alpha=1;const r=i.canvasContext.activeContext,n=i._projTransform,a=this.cacheAsBitmapResolution||i.resolution;e.ceil(a),e.width=Math.max(e.width,1/a),e.height=Math.max(e.height,1/a);const o=Oe.create({width:e.width,height:e.height,resolution:a}),h=`cacheAsBitmap_${de()}`;this._cacheData.textureCacheId=h,X.addToCache(o.baseTexture,h),D.addToCache(o,h);const l=ch;this.transform.localTransform.copyTo(l),l.invert(),l.tx-=e.x,l.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,i.render(this,{renderTexture:o,clear:!0,transform:l,skipUpdateTransform:!1}),i.canvasContext.activeContext=r,i._projTransform=n,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=s;const u=new _e(o);u.transform.worldTransform=this.transform.worldTransform,u.anchor.x=-(e.x/e.width),u.anchor.y=-(e.y/e.height),u.alpha=s,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=i._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=u.containsPoint.bind(u)};it.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID};it.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)};it.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,X.removeFromCache(this._cacheData.textureCacheId),D.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null};it.prototype._cacheAsBitmapDestroy=function(i){this.cacheAsBitmap=!1,this.destroy(i)};it.prototype.name=null;Mt.prototype.getChildByName=function(i,t){for(let e=0,s=this.children.length;e<s;e++)if(this.children[e].name===i)return this.children[e];if(t)for(let e=0,s=this.children.length;e<s;e++){const r=this.children[e];if(!r.getChildByName)continue;const n=r.getChildByName(i,!0);if(n)return n}return null};it.prototype.getGlobalPosition=function(i=new q,t=!1){return this.parent?this.parent.toGlobal(this.position,i,t):(i.x=this.position.x,i.y=this.position.y),i};var zc=`varying vec2 vTextureCoord;
|
|
529
|
+
`;const Lc=Fc,ih=Nc;class rh{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){const s=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,s)}else{const s=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,s)}e>=ht.HIGH?this.multisample=ht.HIGH:e>=ht.MEDIUM?this.multisample=ht.MEDIUM:e>=ht.LOW?this.multisample=ht.LOW:this.multisample=ht.NONE}destroy(){}}rh.extension={type:C.RendererSystem,name:"_multisample"};N.add(rh);class Uc{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class nh{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:s}=this,r=t._glBuffers[s]||this.createGLBuffer(t);e.bindBuffer(t.type,r.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:s,CONTEXT_UID:r}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[r]||this.createGLBuffer(t);this.boundBufferBases[e]=t,s.bindBufferBase(s.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,s){const{gl:r,CONTEXT_UID:n}=this;s=s||0;const a=t._glBuffers[n]||this.createGLBuffer(t);r.bindBufferRange(r.UNIFORM_BUFFER,e||0,a.buffer,s*256,256)}update(t){const{gl:e,CONTEXT_UID:s}=this,r=t._glBuffers[s]||this.createGLBuffer(t);if(t._updateID!==r.updateID)if(r.updateID=t._updateID,e.bindBuffer(t.type,r.buffer),r.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;r.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,n)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const s=t._glBuffers[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this),s&&(e||r.deleteBuffer(s.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let s=0;s<e.length;s++)this.dispose(this.managedBuffers[e[s]],t)}createGLBuffer(t){const{CONTEXT_UID:e,gl:s}=this;return t._glBuffers[e]=new Uc(s.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}nh.extension={type:C.RendererSystem,name:"buffer"};N.add(nh);class ah{constructor(t){this.renderer=t}render(t,e){const s=this.renderer;let r,n,a,o;if(e&&(r=e.renderTexture,n=e.clear,a=e.transform,o=e.skipUpdateTransform),this.renderingToScreen=!r,s.runners.prerender.emit(),s.emit("prerender"),s.projection.transform=a,!s.context.isLost){if(r||(this.lastObjectRendered=t),!o){const h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}s.renderTexture.bind(r),s.batch.currentRenderer.start(),(n!=null?n:s.background.clearBeforeRender)&&s.renderTexture.clear(),t.render(s),s.batch.currentRenderer.flush(),r&&(e.blit&&s.framebuffer.blit(),r.baseTexture.update()),s.runners.postrender.emit(),s.projection.transform=null,s.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}ah.extension={type:C.RendererSystem,name:"objectRenderer"};N.add(ah);const ei=class Br extends Rc{constructor(t){super(),this.type=ro.WEBGL,t=Object.assign({},D.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new Lt({projectionMatrix:new tt},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:Br.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=Br.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:fo()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return this.background.clearBeforeRender}get useContextAlpha(){return this.context.useContextAlpha}get preserveDrawingBuffer(){return this.context.preserveDrawingBuffer}get backgroundColor(){return this.background.color}set backgroundColor(t){this.background.color=t}get backgroundAlpha(){return this.background.alpha}set backgroundAlpha(t){this.background.alpha=t}get powerPreference(){return this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};ei.extension={type:C.Renderer,priority:1},ei.__plugins={},ei.__systems={};let pn=ei;N.handleByMap(C.RendererPlugin,pn.__plugins);N.handleByMap(C.RendererSystem,pn.__systems);N.add(pn);class oh extends bs{constructor(t,e){const{width:s,height:r}=e||{};super(s,r),this.items=[],this.itemDirtyIds=[];for(let n=0;n<t;n++){const a=new X;this.items.push(a),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let s=0;s<this.length;s++)t[s]&&(t[s].castToBaseTexture?this.addBaseTextureAt(t[s].castToBaseTexture(),s):t[s]instanceof bs?this.addResourceAt(t[s],s):this.addResourceAt(wo(t[s],e),s))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;const t=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{const{realWidth:e,realHeight:s}=this.items[0];return this.resize(e,s),this.update(),Promise.resolve(this)}),this._load}}class kc extends oh{constructor(t,e){const{width:s,height:r}=e||{};let n,a;Array.isArray(t)?(n=t,a=t.length):a=t,super(a,{width:s,height:r}),n&&this.initFromArray(n,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=je.TEXTURE_2D_ARRAY}upload(t,e,s){const{length:r,itemDirtyIds:n,items:a}=this,{gl:o}=t;s.dirtyId<0&&o.texImage3D(o.TEXTURE_2D_ARRAY,0,s.internalFormat,this._width,this._height,r,0,e.format,s.type,null);for(let h=0;h<r;h++){const l=a[h];n[h]<l.dirtyId&&(n[h]=l.dirtyId,l.valid&&o.texSubImage3D(o.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,e.format,s.type,l.resource.source))}return!0}}class Gc extends pe{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const hh=class ls extends oh{constructor(t,e){const{width:s,height:r,autoLoad:n,linkBaseTexture:a}=e||{};if(t&&t.length!==ls.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:s,height:r});for(let o=0;o<ls.SIDES;o++)this.items[o].target=je.TEXTURE_CUBE_MAP_POSITIVE_X+o;this.linkBaseTexture=a!==!1,t&&this.initFromArray(t,e),n!==!1&&this.load()}bind(t){super.bind(t),t.target=je.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,s){if(s===void 0&&(s=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=je.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,s){const r=this.itemDirtyIds;for(let n=0;n<ls.SIDES;n++){const a=this.items[n];(r[n]<a.dirtyId||s.dirtyId<e.dirtyId)&&(a.valid&&a.resource?(a.resource.upload(t,a,s),r[n]=a.dirtyId):r[n]<-1&&(t.gl.texImage2D(a.target,0,s.internalFormat,e.realWidth,e.realHeight,0,e.format,s.type,null),r[n]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===ls.SIDES}};hh.SIDES=6;let $c=hh;class Xe extends pe{constructor(t,e){var s,r;e=e||{};let n,a,o;typeof t=="string"?(n=Xe.EMPTY,a=t,o=!0):(n=t,a=null,o=!1),super(n),this.url=a,this.crossOrigin=(s=e.crossOrigin)!=null?s:!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=(r=e.ownsImageBitmap)!=null?r:o,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{const s=await D.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const r=await s.blob();if(this.destroyed)return;const n=await createImageBitmap(r,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===bt.UNPACK?"premultiply":"none"});if(this.destroyed){n.close();return}this.source=n,this.update(),t(this)}catch(s){if(this.destroyed)return;e(s),this.onError.emit(s)}}),this._load)}upload(t,e,s){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,s)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap!="undefined"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){var t;return Xe._EMPTY=(t=Xe._EMPTY)!=null?t:D.ADAPTER.createCanvas(0,0),Xe._EMPTY}}const Fr=class si extends pe{constructor(t,e){e=e||{},super(D.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},si.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){const t=new Image;pe.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;const e=t.width,s=t.height;if(!e||!s)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let r=e*this.scale,n=s*this.scale;(this._overrideWidth||this._overrideHeight)&&(r=this._overrideWidth||this._overrideHeight/s*e,n=this._overrideHeight||this._overrideWidth/e*s),r=Math.round(r),n=Math.round(n);const a=this.source;a.width=r,a.height=n,a._pixiId=`canvas_${de()}`,a.getContext("2d").drawImage(t,0,0,e,s,0,0,r,n),this._resolve(),this._resolve=null}}static getSize(t){const e=si.SVG_SIZE.exec(t),s={};return e&&(s[e[1]]=Math.round(parseFloat(e[3])),s[e[5]]=Math.round(parseFloat(e[7]))),s}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&si.SVG_XML.test(t)}};Fr.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Fr.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Nr=Fr;const Lr=class Ur extends pe{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){const s=document.createElement("video");e.autoLoad!==!1&&s.setAttribute("preload","auto"),e.playsinline!==!1&&(s.setAttribute("webkit-playsinline",""),s.setAttribute("playsinline","")),e.muted===!0&&(s.setAttribute("muted",""),s.muted=!0),e.loop===!0&&s.setAttribute("loop",""),e.autoPlay!==!1&&s.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);const r=t[0].src||t[0];pe.crossOrigin(s,r,e.crossorigin);for(let n=0;n<t.length;++n){const a=document.createElement("source");let{src:o,mime:h}=t[n];if(o=o||t[n],o.startsWith("data:"))h=o.slice(5,o.indexOf(";"));else if(!o.startsWith("blob:")){const l=o.split("?").shift().toLowerCase(),u=l.slice(l.lastIndexOf(".")+1);h=h||Ur.MIME_TYPES[u]||`video/${u}`}a.src=o,h&&(a.type=h),s.appendChild(a)}t=s}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,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._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){const e=_t.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;const t=this.source;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._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,s)=>{this.valid?e(this):(this._resolve=e,this._reject=s,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){const t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);const e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();const t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(_t.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(_t.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(_t.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||Ur.TYPES.includes(e)}};Lr.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Lr.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let lh=Lr;Ar.push(Xe,Bo,Gc,lh,Nr,wi,$c,kc);class Um{constructor(){this._glTransformFeedbacks={},this.buffers=[],this.disposeRunner=new Pt("disposeTransformFeedback")}bindBuffer(t,e){this.buffers[t]=e}destroy(){this.disposeRunner.emit(this,!1)}}const km="7.3.2";class pi{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}clear(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}getRectangle(t){return this.minX>this.maxX||this.minY>this.maxY?j.EMPTY:(t=t||new j(0,0,1,1),t.x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)}addPoint(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)}addPointMatrix(t,e){const{a:s,b:r,c:n,d:a,tx:o,ty:h}=t,l=s*e.x+n*e.y+o,u=r*e.x+a*e.y+h;this.minX=Math.min(this.minX,l),this.maxX=Math.max(this.maxX,l),this.minY=Math.min(this.minY,u),this.maxY=Math.max(this.maxY,u)}addQuad(t){let e=this.minX,s=this.minY,r=this.maxX,n=this.maxY,a=t[0],o=t[1];e=a<e?a:e,s=o<s?o:s,r=a>r?a:r,n=o>n?o:n,a=t[2],o=t[3],e=a<e?a:e,s=o<s?o:s,r=a>r?a:r,n=o>n?o:n,a=t[4],o=t[5],e=a<e?a:e,s=o<s?o:s,r=a>r?a:r,n=o>n?o:n,a=t[6],o=t[7],e=a<e?a:e,s=o<s?o:s,r=a>r?a:r,n=o>n?o:n,this.minX=e,this.minY=s,this.maxX=r,this.maxY=n}addFrame(t,e,s,r,n){this.addFrameMatrix(t.worldTransform,e,s,r,n)}addFrameMatrix(t,e,s,r,n){const a=t.a,o=t.b,h=t.c,l=t.d,u=t.tx,c=t.ty;let d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,g=a*e+h*s+u,v=o*e+l*s+c;d=g<d?g:d,f=v<f?v:f,p=g>p?g:p,m=v>m?v:m,g=a*r+h*s+u,v=o*r+l*s+c,d=g<d?g:d,f=v<f?v:f,p=g>p?g:p,m=v>m?v:m,g=a*e+h*n+u,v=o*e+l*n+c,d=g<d?g:d,f=v<f?v:f,p=g>p?g:p,m=v>m?v:m,g=a*r+h*n+u,v=o*r+l*n+c,d=g<d?g:d,f=v<f?v:f,p=g>p?g:p,m=v>m?v:m,this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addVertexData(t,e,s){let r=this.minX,n=this.minY,a=this.maxX,o=this.maxY;for(let h=e;h<s;h+=2){const l=t[h],u=t[h+1];r=l<r?l:r,n=u<n?u:n,a=l>a?l:a,o=u>o?u:o}this.minX=r,this.minY=n,this.maxX=a,this.maxY=o}addVertices(t,e,s,r){this.addVerticesMatrix(t.worldTransform,e,s,r)}addVerticesMatrix(t,e,s,r,n=0,a=n){const o=t.a,h=t.b,l=t.c,u=t.d,c=t.tx,d=t.ty;let f=this.minX,p=this.minY,m=this.maxX,g=this.maxY;for(let v=s;v<r;v+=2){const x=e[v],_=e[v+1],y=o*x+l*_+c,T=u*_+h*x+d;f=Math.min(f,y-n),m=Math.max(m,y+n),p=Math.min(p,T-a),g=Math.max(g,T+a)}this.minX=f,this.minY=p,this.maxX=m,this.maxY=g}addBounds(t){const e=this.minX,s=this.minY,r=this.maxX,n=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<s?t.minY:s,this.maxX=t.maxX>r?t.maxX:r,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,e){const s=t.minX>e.minX?t.minX:e.minX,r=t.minY>e.minY?t.minY:e.minY,n=t.maxX<e.maxX?t.maxX:e.maxX,a=t.maxY<e.maxY?t.maxY:e.maxY;if(s<=n&&r<=a){const o=this.minX,h=this.minY,l=this.maxX,u=this.maxY;this.minX=s<o?s:o,this.minY=r<h?r:h,this.maxX=n>l?n:l,this.maxY=a>u?a:u}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const s=t.minX>e.x?t.minX:e.x,r=t.minY>e.y?t.minY:e.y,n=t.maxX<e.x+e.width?t.maxX:e.x+e.width,a=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(s<=n&&r<=a){const o=this.minX,h=this.minY,l=this.maxX,u=this.maxY;this.minX=s<o?s:o,this.minY=r<h?r:h,this.maxX=n>l?n:l,this.maxY=a>u?a:u}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,s,r,n,a){t-=n,e-=a,s+=n,r+=a,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>s?this.maxX:s,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>r?this.maxY:r}}class it extends Ke{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new dn,this.alpha=1,this.visible=!0,this.renderable=!0,this.cullable=!1,this.cullArea=null,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new pi,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(t){const e=Object.keys(t);for(let s=0;s<e.length;++s){const r=e[s];Object.defineProperty(it.prototype,r,Object.getOwnPropertyDescriptor(t,r))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(t,e){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),e||(this._boundsRect||(this._boundsRect=new j),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){var e;t||(this._localBoundsRect||(this._localBoundsRect=new j),t=this._localBoundsRect),this._localBounds||(this._localBounds=new pi);const s=this.transform,r=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=(e=r==null?void 0:r.worldAlpha)!=null?e:1,this.transform=this._tempDisplayObjectParent.transform;const n=this._bounds,a=this._boundsID;this._bounds=this._localBounds;const o=this.getBounds(!1,t);return this.parent=r,this.transform=s,this._bounds=n,this._bounds.updateID+=this._boundsID-a,o}toGlobal(t,e,s=!1){return s||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)}toLocal(t,e,s,r){return e&&(t=e.toGlobal(t,s,r)),r||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,s)}setParent(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t}removeFromParent(){var t;(t=this.parent)==null||t.removeChild(this)}setTransform(t=0,e=0,s=1,r=1,n=0,a=0,o=0,h=0,l=0){return this.position.x=t,this.position.y=e,this.scale.x=s||1,this.scale.y=r||1,this.rotation=n,this.skew.x=a,this.skew.y=o,this.pivot.x=h,this.pivot.y=l,this}destroy(t){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.eventMode="auto",this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new Hc),this.tempDisplayObjectParent}enableTempParent(){const t=this.parent;return this.parent=this._tempDisplayObjectParent,t}disableTempParent(t){this.parent=t}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(t){this.transform.position.copyFrom(t)}get scale(){return this.transform.scale}set scale(t){this.transform.scale.copyFrom(t)}get pivot(){return this.transform.pivot}set pivot(t){this.transform.pivot.copyFrom(t)}get skew(){return this.transform.skew}set skew(t){this.transform.skew.copyFrom(t)}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*Cu}set angle(t){this.transform.rotation=t*Pu}get zIndex(){return this._zIndex}set zIndex(t){this._zIndex=t,this.parent&&(this.parent.sortDirty=!0)}get worldVisible(){let t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}get mask(){return this._mask}set mask(t){if(this._mask!==t){if(this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount--,e._maskRefCount===0&&(e.renderable=!0,e.isMask=!1))}if(this._mask=t,this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount===0&&(e.renderable=!1,e.isMask=!0),e._maskRefCount++)}}}}class Hc extends it{constructor(){super(...arguments),this.sortDirty=null}}it.prototype.displayObjectUpdateTransform=it.prototype.updateTransform;const Vc=new tt;function Xc(i,t){return i.zIndex===t.zIndex?i._lastSortedIndex-t._lastSortedIndex:i.zIndex-t.zIndex}const uh=class kr extends it{constructor(){super(),this.children=[],this.sortableChildren=kr.defaultSortableChildren,this.sortDirty=!1}onChildrenChange(t){}addChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.addChild(t[e]);else{const e=t[0];e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.push(e),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this)}return t[0]}addChildAt(t,e){if(e<0||e>this.children.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${this.children.length}`);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t}swapChildren(t,e){if(t===e)return;const s=this.getChildIndex(t),r=this.getChildIndex(e);this.children[s]=e,this.children[r]=t,this.onChildrenChange(s<r?s:r)}getChildIndex(t){const e=this.children.indexOf(t);if(e===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return e}setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);const s=this.getChildIndex(t);Re(this.children,s,1),this.children.splice(e,0,t),this.onChildrenChange(e)}getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]}removeChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.removeChild(t[e]);else{const e=t[0],s=this.children.indexOf(e);if(s===-1)return null;e.parent=null,e.transform._parentID=-1,Re(this.children,s,1),this._boundsID++,this.onChildrenChange(s),e.emit("removed",this),this.emit("childRemoved",e,this,s)}return t[0]}removeChildAt(t){const e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,Re(this.children,t,1),this._boundsID++,this.onChildrenChange(t),e.emit("removed",this),this.emit("childRemoved",e,this,t),e}removeChildren(t=0,e=this.children.length){const s=t,r=e,n=r-s;let a;if(n>0&&n<=r){a=this.children.splice(s,n);for(let o=0;o<a.length;++o)a[o].parent=null,a[o].transform&&(a[o].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let o=0;o<a.length;++o)a[o].emit("removed",this),this.emit("childRemoved",a[o],this,o);return a}else if(n===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let t=!1;for(let e=0,s=this.children.length;e<s;++e){const r=this.children[e];r._lastSortedIndex=e,!t&&r.zIndex!==0&&(t=!0)}t&&this.children.length>1&&this.children.sort(Xc),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t<e;++t){const s=this.children[t];s.visible&&s.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let t=0;t<this.children.length;t++){const e=this.children[t];if(!(!e.visible||!e.renderable))if(e.calculateBounds(),e._mask){const s=e._mask.isMaskData?e._mask.maskObject:e._mask;s?(s.calculateBounds(),this._bounds.addBoundsMask(e._bounds,s._bounds)):this._bounds.addBounds(e._bounds)}else e.filterArea?this._bounds.addBoundsArea(e._bounds,e.filterArea):this._bounds.addBounds(e._bounds)}this._bounds.updateID=this._boundsID}getLocalBounds(t,e=!1){const s=super.getLocalBounds(t);if(!e)for(let r=0,n=this.children.length;r<n;++r){const a=this.children[r];a.visible&&a.updateTransform()}return s}_calculateBounds(){}_renderWithCulling(t){const e=t.renderTexture.sourceFrame;if(!(e.width>0&&e.height>0))return;let s,r;this.cullArea?(s=this.cullArea,r=this.worldTransform):this._render!==kr.prototype._render&&(s=this.getBounds(!0));const n=t.projection.transform;if(n&&(r?(r=Vc.copyFrom(r),r.prepend(n)):r=n),s&&e.intersects(s,r))this._render(t);else if(this.cullArea)return;for(let a=0,o=this.children.length;a<o;++a){const h=this.children[a],l=h.cullable;h.cullable=l||!this.cullArea,h.render(t),h.cullable=l}}render(t){var e;if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||(e=this.filters)!=null&&e.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(let s=0,r=this.children.length;s<r;++s)this.children[s].render(t)}}renderAdvanced(t){var e,s,r;const n=this.filters,a=this._mask;if(n){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let h=0;h<n.length;h++)n[h].enabled&&this._enabledFilters.push(n[h])}const o=n&&((e=this._enabledFilters)==null?void 0:e.length)||a&&(!a.isMaskData||a.enabled&&(a.autoDetect||a.type!==ct.NONE));if(o&&t.batch.flush(),n&&(s=this._enabledFilters)!=null&&s.length&&t.filter.push(this,this._enabledFilters),a&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let h=0,l=this.children.length;h<l;++h)this.children[h].render(t)}o&&t.batch.flush(),a&&t.mask.pop(this),n&&(r=this._enabledFilters)!=null&&r.length&&t.filter.pop()}_render(t){}destroy(t){super.destroy(),this.sortDirty=!1;const e=typeof t=="boolean"?t:t==null?void 0:t.children,s=this.removeChildren(0,this.children.length);if(e)for(let r=0;r<s.length;++r)s[r].destroy(t)}get width(){return this.scale.x*this.getLocalBounds().width}set width(t){const e=this.getLocalBounds().width;e!==0?this.scale.x=t/e:this.scale.x=1,this._width=t}get height(){return this.scale.y*this.getLocalBounds().height}set height(t){const e=this.getLocalBounds().height;e!==0?this.scale.y=t/e:this.scale.y=1,this._height=t}};uh.defaultSortableChildren=!1;let Mt=uh;Mt.prototype.containerUpdateTransform=Mt.prototype.updateTransform;Object.defineProperties(D,{SORTABLE_CHILDREN:{get(){return Mt.defaultSortableChildren},set(i){Mt.defaultSortableChildren=i}}});const rs=new q,jc=new Uint16Array([0,1,2,0,2,3]);class _e extends Mt{constructor(t){super(),this._anchor=new ue(this._onAnchorUpdate,this,t?t.defaultAnchor.x:0,t?t.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new K(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=H.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||O.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=jc,this.pluginName="batch",this.isSprite=!0,this._roundPixels=D.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=se(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=se(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){const t=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===t._updateID)return;this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;const e=this.transform.worldTransform,s=e.a,r=e.b,n=e.c,a=e.d,o=e.tx,h=e.ty,l=this.vertexData,u=t.trim,c=t.orig,d=this._anchor;let f=0,p=0,m=0,g=0;if(u?(p=u.x-d._x*c.width,f=p+u.width,g=u.y-d._y*c.height,m=g+u.height):(p=-d._x*c.width,f=p+c.width,g=-d._y*c.height,m=g+c.height),l[0]=s*p+n*g+o,l[1]=a*g+r*p+h,l[2]=s*f+n*g+o,l[3]=a*g+r*f+h,l[4]=s*f+n*m+o,l[5]=a*m+r*f+h,l[6]=s*p+n*m+o,l[7]=a*m+r*p+h,this._roundPixels){const v=D.RESOLUTION;for(let x=0;x<l.length;++x)l[x]=Math.round(l[x]*v)/v}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const t=this._texture,e=this.vertexTrimmedData,s=t.orig,r=this._anchor,n=this.transform.worldTransform,a=n.a,o=n.b,h=n.c,l=n.d,u=n.tx,c=n.ty,d=-r._x*s.width,f=d+s.width,p=-r._y*s.height,m=p+s.height;if(e[0]=a*d+h*p+u,e[1]=l*p+o*d+c,e[2]=a*f+h*p+u,e[3]=l*p+o*f+c,e[4]=a*f+h*m+u,e[5]=l*m+o*f+c,e[6]=a*d+h*m+u,e[7]=l*m+o*d+c,this._roundPixels){const g=D.RESOLUTION;for(let v=0;v<e.length;++v)e[v]=Math.round(e[v]*g)/g}}_render(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)}_calculateBounds(){const t=this._texture.trim,e=this._texture.orig;!t||t.width===e.width&&t.height===e.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))}getLocalBounds(t){return this.children.length===0?(this._localBounds||(this._localBounds=new pi),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new j),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,rs);const e=this._texture.orig.width,s=this._texture.orig.height,r=-e*this.anchor.x;let n=0;return rs.x>=r&&rs.x<r+e&&(n=-s*this.anchor.y,rs.y>=n&&rs.y<n+s)}destroy(t){if(super.destroy(t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.baseTexture;this._texture.destroy(!!e)}this._texture=null}static from(t,e){const s=t instanceof O?t:O.from(t,e);return new _e(s)}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1,this._transformTrimmedID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){const e=se(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){const e=se(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get anchor(){return this._anchor}set anchor(t){this._anchor.copyFrom(t)}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||O.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const ch=new tt;it.prototype._cacheAsBitmap=!1;it.prototype._cacheData=null;it.prototype._cacheAsBitmapResolution=null;it.prototype._cacheAsBitmapMultisample=null;class zc{constructor(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}Object.defineProperties(it.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(i){i!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=i,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(i){i!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=i,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(i){if(this._cacheAsBitmap===i)return;this._cacheAsBitmap=i;let t;i?(this._cacheData||(this._cacheData=new zc),t=this._cacheData,t.originalRender=this.render,t.originalRenderCanvas=this.renderCanvas,t.originalUpdateTransform=this.updateTransform,t.originalCalculateBounds=this.calculateBounds,t.originalGetLocalBounds=this.getLocalBounds,t.originalDestroy=this.destroy,t.originalContainsPoint=this.containsPoint,t.originalMask=this._mask,t.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(t=this._cacheData,t.sprite&&this._destroyCachedDisplayObject(),this.render=t.originalRender,this.renderCanvas=t.originalRenderCanvas,this.calculateBounds=t.originalCalculateBounds,this.getLocalBounds=t.originalGetLocalBounds,this.destroy=t.originalDestroy,this.updateTransform=t.originalUpdateTransform,this.containsPoint=t.originalContainsPoint,this._mask=t.originalMask,this.filterArea=t.originalFilterArea)}}});it.prototype._renderCached=function(i){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(i),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(i))};it.prototype._initCachedDisplayObject=function(i){var t,e,s;if((t=this._cacheData)!=null&&t.sprite)return;const r=this.alpha;this.alpha=1,i.batch.flush();const n=this.getLocalBounds(new j,!0);if((e=this.filters)!=null&&e.length){const m=this.filters[0].padding;n.pad(m)}const a=this.cacheAsBitmapResolution||i.resolution;n.ceil(a),n.width=Math.max(n.width,1/a),n.height=Math.max(n.height,1/a);const o=i.renderTexture.current,h=i.renderTexture.sourceFrame.clone(),l=i.renderTexture.destinationFrame.clone(),u=i.projection.transform,c=Oe.create({width:n.width,height:n.height,resolution:a,multisample:(s=this.cacheAsBitmapMultisample)!=null?s:i.multisample}),d=`cacheAsBitmap_${de()}`;this._cacheData.textureCacheId=d,X.addToCache(c.baseTexture,d),O.addToCache(c,d);const f=this.transform.localTransform.copyTo(ch).invert().translate(-n.x,-n.y);this.render=this._cacheData.originalRender,i.render(this,{renderTexture:c,clear:!0,transform:f,skipUpdateTransform:!1}),i.framebuffer.blit(),i.projection.transform=u,i.renderTexture.bind(o,h,l),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=r;const p=new _e(c);p.transform.worldTransform=this.transform.worldTransform,p.anchor.x=-(n.x/n.width),p.anchor.y=-(n.y/n.height),p.alpha=r,p._bounds=this._bounds,this._cacheData.sprite=p,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=p.containsPoint.bind(p)};it.prototype._renderCachedCanvas=function(i){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(i),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(i))};it.prototype._initCachedDisplayObjectCanvas=function(i){var t;if((t=this._cacheData)!=null&&t.sprite)return;const e=this.getLocalBounds(new j,!0),s=this.alpha;this.alpha=1;const r=i.canvasContext.activeContext,n=i._projTransform,a=this.cacheAsBitmapResolution||i.resolution;e.ceil(a),e.width=Math.max(e.width,1/a),e.height=Math.max(e.height,1/a);const o=Oe.create({width:e.width,height:e.height,resolution:a}),h=`cacheAsBitmap_${de()}`;this._cacheData.textureCacheId=h,X.addToCache(o.baseTexture,h),O.addToCache(o,h);const l=ch;this.transform.localTransform.copyTo(l),l.invert(),l.tx-=e.x,l.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,i.render(this,{renderTexture:o,clear:!0,transform:l,skipUpdateTransform:!1}),i.canvasContext.activeContext=r,i._projTransform=n,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=s;const u=new _e(o);u.transform.worldTransform=this.transform.worldTransform,u.anchor.x=-(e.x/e.width),u.anchor.y=-(e.y/e.height),u.alpha=s,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=i._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=u.containsPoint.bind(u)};it.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID};it.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)};it.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,X.removeFromCache(this._cacheData.textureCacheId),O.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null};it.prototype._cacheAsBitmapDestroy=function(i){this.cacheAsBitmap=!1,this.destroy(i)};it.prototype.name=null;Mt.prototype.getChildByName=function(i,t){for(let e=0,s=this.children.length;e<s;e++)if(this.children[e].name===i)return this.children[e];if(t)for(let e=0,s=this.children.length;e<s;e++){const r=this.children[e];if(!r.getChildByName)continue;const n=r.getChildByName(i,!0);if(n)return n}return null};it.prototype.getGlobalPosition=function(i=new q,t=!1){return this.parent?this.parent.toGlobal(this.position,i,t):(i.x=this.position.x,i.y=this.position.y),i};var Wc=`varying vec2 vTextureCoord;
|
|
530
530
|
|
|
531
531
|
uniform sampler2D uSampler;
|
|
532
532
|
uniform float uAlpha;
|
|
@@ -535,9 +535,9 @@ void main(void)
|
|
|
535
535
|
{
|
|
536
536
|
gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;
|
|
537
537
|
}
|
|
538
|
-
`;class
|
|
539
|
-
`);function
|
|
540
|
-
`}return s=s.replace("%blur%",r),s=s.replace("%size%",i.toString()),s}const
|
|
538
|
+
`;class Yc extends xt{constructor(t=1){super(Lc,Wc,{uAlpha:1}),this.alpha=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}const qc={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]},Kc=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
|
|
539
|
+
`);function Zc(i){const t=qc[i],e=t.length;let s=Kc,r="";const n="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;";let a;for(let o=0;o<i;o++){let h=n.replace("%index%",o.toString());a=o,o>=e&&(a=i-o-1),h=h.replace("%value%",t[a].toString()),r+=h,r+=`
|
|
540
|
+
`}return s=s.replace("%blur%",r),s=s.replace("%size%",i.toString()),s}const Qc=`
|
|
541
541
|
attribute vec2 aVertexPosition;
|
|
542
542
|
|
|
543
543
|
uniform mat3 projectionMatrix;
|
|
@@ -567,8 +567,8 @@ void main(void)
|
|
|
567
567
|
|
|
568
568
|
vec2 textureCoord = filterTextureCoord();
|
|
569
569
|
%blur%
|
|
570
|
-
}`;function
|
|
571
|
-
`}return s=s.replace("%blur%",r),s=s.replace("%size%",i.toString()),s}class Gr extends xt{constructor(t,e=8,s=4,r=xt.defaultResolution,n=5){const a=
|
|
570
|
+
}`;function Jc(i,t){const e=Math.ceil(i/2);let s=Qc,r="",n;t?n="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":n="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let a=0;a<i;a++){let o=n.replace("%index%",a.toString());o=o.replace("%sampleIndex%",`${a-(e-1)}.0`),r+=o,r+=`
|
|
571
|
+
`}return s=s.replace("%blur%",r),s=s.replace("%size%",i.toString()),s}class Gr extends xt{constructor(t,e=8,s=4,r=xt.defaultResolution,n=5){const a=Jc(n,t),o=Zc(n);super(a,o),this.horizontal=t,this.resolution=r,this._quality=0,this.quality=s,this.blur=e}apply(t,e,s,r){if(s?this.horizontal?this.uniforms.strength=1/s.width*(s.width/e.width):this.uniforms.strength=1/s.height*(s.height/e.height):this.horizontal?this.uniforms.strength=1/t.renderer.width*(t.renderer.width/e.width):this.uniforms.strength=1/t.renderer.height*(t.renderer.height/e.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,this.passes===1)t.applyFilter(this,e,s,r);else{const n=t.getFilterTexture(),a=t.renderer;let o=e,h=n;this.state.blend=!1,t.applyFilter(this,o,h,Xt.CLEAR);for(let l=1;l<this.passes-1;l++){t.bindAndClear(o,Xt.BLIT),this.uniforms.uSampler=h;const u=h;h=o,o=u,a.shader.bind(this),a.geometry.draw(5)}this.state.blend=!0,t.applyFilter(this,h,s,r),t.returnFilterTexture(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}}class td extends xt{constructor(t=8,e=4,s=xt.defaultResolution,r=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new Gr(!0,t,e,s,r),this.blurYFilter=new Gr(!1,t,e,s,r),this.resolution=s,this.quality=e,this.blur=t,this.repeatEdgePixels=!1}apply(t,e,s,r){const n=Math.abs(this.blurXFilter.strength),a=Math.abs(this.blurYFilter.strength);if(n&&a){const o=t.getFilterTexture();this.blurXFilter.apply(t,e,o,Xt.CLEAR),this.blurYFilter.apply(t,o,s,r),t.returnFilterTexture(o)}else a?this.blurYFilter.apply(t,e,s,r):this.blurXFilter.apply(t,e,s,r)}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))*2}get blur(){return this.blurXFilter.blur}set blur(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 blurX(){return this.blurXFilter.blur}set blurX(t){this.blurXFilter.blur=t,this.updatePadding()}get blurY(){return this.blurYFilter.blur}set blurY(t){this.blurYFilter.blur=t,this.updatePadding()}get blendMode(){return this.blurYFilter.blendMode}set blendMode(t){this.blurYFilter.blendMode=t}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(t){this._repeatEdgePixels=t,this.updatePadding()}}var ed=`varying vec2 vTextureCoord;
|
|
572
572
|
uniform sampler2D uSampler;
|
|
573
573
|
uniform float m[20];
|
|
574
574
|
uniform float uAlpha;
|
|
@@ -620,7 +620,7 @@ void main(void)
|
|
|
620
620
|
|
|
621
621
|
gl_FragColor = vec4(rgb, result.a);
|
|
622
622
|
}
|
|
623
|
-
`;class $r extends xt{constructor(){const t={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};super(ih,
|
|
623
|
+
`;class $r extends xt{constructor(){const t={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};super(ih,ed,t),this.alpha=1}_loadMatrix(t,e=!1){let s=t;e&&(this._multiply(s,this.uniforms.m,t),s=this._colorMatrix(s)),this.uniforms.m=s}_multiply(t,e,s){return t[0]=e[0]*s[0]+e[1]*s[5]+e[2]*s[10]+e[3]*s[15],t[1]=e[0]*s[1]+e[1]*s[6]+e[2]*s[11]+e[3]*s[16],t[2]=e[0]*s[2]+e[1]*s[7]+e[2]*s[12]+e[3]*s[17],t[3]=e[0]*s[3]+e[1]*s[8]+e[2]*s[13]+e[3]*s[18],t[4]=e[0]*s[4]+e[1]*s[9]+e[2]*s[14]+e[3]*s[19]+e[4],t[5]=e[5]*s[0]+e[6]*s[5]+e[7]*s[10]+e[8]*s[15],t[6]=e[5]*s[1]+e[6]*s[6]+e[7]*s[11]+e[8]*s[16],t[7]=e[5]*s[2]+e[6]*s[7]+e[7]*s[12]+e[8]*s[17],t[8]=e[5]*s[3]+e[6]*s[8]+e[7]*s[13]+e[8]*s[18],t[9]=e[5]*s[4]+e[6]*s[9]+e[7]*s[14]+e[8]*s[19]+e[9],t[10]=e[10]*s[0]+e[11]*s[5]+e[12]*s[10]+e[13]*s[15],t[11]=e[10]*s[1]+e[11]*s[6]+e[12]*s[11]+e[13]*s[16],t[12]=e[10]*s[2]+e[11]*s[7]+e[12]*s[12]+e[13]*s[17],t[13]=e[10]*s[3]+e[11]*s[8]+e[12]*s[13]+e[13]*s[18],t[14]=e[10]*s[4]+e[11]*s[9]+e[12]*s[14]+e[13]*s[19]+e[14],t[15]=e[15]*s[0]+e[16]*s[5]+e[17]*s[10]+e[18]*s[15],t[16]=e[15]*s[1]+e[16]*s[6]+e[17]*s[11]+e[18]*s[16],t[17]=e[15]*s[2]+e[16]*s[7]+e[17]*s[12]+e[18]*s[17],t[18]=e[15]*s[3]+e[16]*s[8]+e[17]*s[13]+e[18]*s[18],t[19]=e[15]*s[4]+e[16]*s[9]+e[17]*s[14]+e[18]*s[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 s=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}tint(t,e){const[s,r,n]=K.shared.setValue(t).toArray(),a=[s,0,0,0,0,0,r,0,0,0,0,0,n,0,0,0,0,0,1,0];this._loadMatrix(a,e)}greyscale(t,e){const s=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(s,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 s=Math.cos(t),r=Math.sin(t),n=Math.sqrt,a=1/3,o=n(a),h=s+(1-s)*a,l=a*(1-s)-o*r,u=a*(1-s)+o*r,c=a*(1-s)+o*r,d=s+a*(1-s),f=a*(1-s)-o*r,p=a*(1-s)-o*r,m=a*(1-s)+o*r,g=s+a*(1-s),v=[h,l,u,0,0,c,d,f,0,0,p,m,g,0,0,0,0,0,1,0];this._loadMatrix(v,e)}contrast(t,e){const s=(t||0)+1,r=-.5*(s-1),n=[s,0,0,0,r,0,s,0,0,r,0,0,s,0,r,0,0,0,1,0];this._loadMatrix(n,e)}saturate(t=0,e){const s=t*2/3+1,r=(s-1)*-.5,n=[s,r,r,0,0,r,s,r,0,0,r,r,s,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,s,r,n){t=t||.2,e=e||.15,s=s||16770432,r=r||3375104;const a=K.shared,[o,h,l]=a.setValue(s).toArray(),[u,c,d]=a.setValue(r).toArray(),f=[.3,.59,.11,0,0,o,h,l,t,0,u,c,d,e,0,o-u,h-c,l-d,0,0];this._loadMatrix(f,n)}night(t,e){t=t||.1;const s=[t*-2,-t,0,0,0,-t,0,t,0,0,0,t,t*2,0,0,0,0,0,1,0];this._loadMatrix(s,e)}predator(t,e){const s=[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(s,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.uniforms.m}set matrix(t){this.uniforms.m=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}$r.prototype.grayscale=$r.prototype.greyscale;var sd=`varying vec2 vFilterCoord;
|
|
624
624
|
varying vec2 vTextureCoord;
|
|
625
625
|
|
|
626
626
|
uniform vec2 scale;
|
|
@@ -640,7 +640,7 @@ void main(void)
|
|
|
640
640
|
|
|
641
641
|
gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));
|
|
642
642
|
}
|
|
643
|
-
`,
|
|
643
|
+
`,id=`attribute vec2 aVertexPosition;
|
|
644
644
|
|
|
645
645
|
uniform mat3 projectionMatrix;
|
|
646
646
|
uniform mat3 filterMatrix;
|
|
@@ -669,7 +669,7 @@ void main(void)
|
|
|
669
669
|
vTextureCoord = filterTextureCoord();
|
|
670
670
|
vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;
|
|
671
671
|
}
|
|
672
|
-
`;class
|
|
672
|
+
`;class rd extends xt{constructor(t,e){const s=new tt;t.renderable=!1,super(id,sd,{mapSampler:t._texture,filterMatrix:s,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=t,this.maskMatrix=s,e==null&&(e=20),this.scale=new q(e,e)}apply(t,e,s,r){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;const n=this.maskSprite.worldTransform,a=Math.sqrt(n.a*n.a+n.b*n.b),o=Math.sqrt(n.c*n.c+n.d*n.d);a!==0&&o!==0&&(this.uniforms.rotation[0]=n.a/a,this.uniforms.rotation[1]=n.b/a,this.uniforms.rotation[2]=n.c/o,this.uniforms.rotation[3]=n.d/o),t.applyFilter(this,e,s,r)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}}var nd=`varying vec2 v_rgbNW;
|
|
673
673
|
varying vec2 v_rgbNE;
|
|
674
674
|
varying vec2 v_rgbSW;
|
|
675
675
|
varying vec2 v_rgbSE;
|
|
@@ -790,7 +790,7 @@ void main() {
|
|
|
790
790
|
|
|
791
791
|
gl_FragColor = color;
|
|
792
792
|
}
|
|
793
|
-
`,
|
|
793
|
+
`,ad=`
|
|
794
794
|
attribute vec2 aVertexPosition;
|
|
795
795
|
|
|
796
796
|
uniform mat3 projectionMatrix;
|
|
@@ -832,7 +832,7 @@ void main(void) {
|
|
|
832
832
|
|
|
833
833
|
texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
|
|
834
834
|
}
|
|
835
|
-
`;class
|
|
835
|
+
`;class od extends xt{constructor(){super(ad,nd)}}var hd=`precision highp float;
|
|
836
836
|
|
|
837
837
|
varying vec2 vTextureCoord;
|
|
838
838
|
varying vec4 vColor;
|
|
@@ -866,15 +866,15 @@ void main()
|
|
|
866
866
|
|
|
867
867
|
gl_FragColor = color;
|
|
868
868
|
}
|
|
869
|
-
`;class hd extends xt{constructor(t=.5,e=Math.random()){super(ih,od,{uNoise:0,uSeed:0}),this.noise=t,this.seed=e}get noise(){return this.uniforms.uNoise}set noise(t){this.uniforms.uNoise=t}get seed(){return this.uniforms.uSeed}set seed(t){this.uniforms.uSeed=t}}const fa={AlphaFilter:Wc,BlurFilter:Jc,BlurFilterPass:Gr,ColorMatrixFilter:$r,DisplacementFilter:id,FXAAFilter:ad,NoiseFilter:hd};Object.entries(fa).forEach(([i,t])=>{Object.defineProperty(fa,i,{get(){return uo("7.1.0",`filters.${i} has moved to ${i}`),t}})});let ld=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||(gt.system.add(this.tickerUpdate,this,me.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(gt.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}))}tickerUpdate(t){this._deltaTime+=t,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())}};const le=new ld;class Is{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Is.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new q,this.page=new q,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,s){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,s,r,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}}class mi extends Is{constructor(){super(...arguments),this.client=new q,this.movement=new q,this.offset=new q,this.global=new q,this.screen=new q}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,s){return t.worldTransform.applyInverse(s||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,s,r,n,a,o,h,l,u,c,d,f,p,m){throw new Error("Method not implemented.")}}class Ft extends mi{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 qe extends mi{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}qe.DOM_DELTA_PIXEL=0,qe.DOM_DELTA_LINE=1,qe.DOM_DELTA_PAGE=2;const ud=2048,cd=new q,Qi=new q;class dd{constructor(t){this.dispatch=new Ke,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((s,r)=>s.priority-r.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 s=0,r=e.length;s<r;s++)e[s].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){le.pauseUpdate=!0;const s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",r=this[s](this.rootTarget,this.rootTarget.eventMode,cd.set(t,e),this.hitTestFn,this.hitPruneFn);return r&&r[0]}propagate(t,e){if(!t.target)return;const s=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let r=0,n=s.length-1;r<n;r++)if(t.currentTarget=s[r],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 r=s.length-2;r>=0;r--)if(t.currentTarget=s[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,s=this._allInteractiveElements){if(s.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const r=Array.isArray(e)?e:[e];for(let n=s.length-1;n>=0;n--)r.forEach(a=>{t.currentTarget=s[n],this.notifyTarget(t,a)})}propagationPath(t){const e=[t];for(let s=0;s<ud&&t!==this.rootTarget;s++){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,s,r,n,a=!1){let o=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(le.pauseUpdate=!1),t.interactiveChildren&&t.children){const u=t.children;for(let c=u.length-1;c>=0;c--){const d=u[c],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,s,r,n,a||n(t,s));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),o=!0}}}const h=this._isInteractive(e),l=t.isInteractive();return l&&l&&this._allInteractiveElements.push(t),a||this._hitElements.length>0?null:o?this._hitElements:h&&!n(t,s)&&r(t,s)?l?[t]:[]:null}hitTestRecursive(t,e,s,r,n){if(this._interactivePrune(t)||n(t,s))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(le.pauseUpdate=!1),t.interactiveChildren&&t.children){const h=t.children;for(let l=h.length-1;l>=0;l--){const u=h[l],c=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,s,r,n);if(c){if(c.length>0&&!c[c.length-1].parent)continue;const d=t.isInteractive();return(c.length>0||d)&&c.push(t),c}}}const a=this._isInteractive(e),o=t.isInteractive();return a&&r(t,s)?o?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!!(!t||t.isMask||!t.visible||!t.renderable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren||t.isMask)}hitPruneFn(t,e){var s;if(t.hitArea&&(t.worldTransform.applyInverse(e,Qi),!t.hitArea.contains(Qi.x,Qi.y)))return!0;if(t._mask){const r=t._mask.isMaskData?t._mask.maskObject:t._mask;if(r&&!((s=r.containsPoint)!=null&&s.call(r,e)))return!0}return!1}hitTestFn(t,e){return t.eventMode==="passive"?!1:t.hitArea?!0:t.containsPoint?t.containsPoint(e):!1}notifyTarget(t,e){var s,r;e=e!=null?e:t.type;const n=`on${e}`;(r=(s=t.currentTarget)[n])==null||r.call(s,t);const a=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,a),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Ft)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");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 r=e.button===2;this.dispatchEvent(e,r?"rightdown":"mousedown")}const s=this.trackingData(t.pointerId);s.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var e,s,r;if(!(t instanceof Ft)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const n=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const a=n.pointerType==="mouse"||n.pointerType==="pen",o=this.trackingData(t.pointerId),h=this.findMountedTarget(o.overTargets);if(((e=o.overTargets)==null?void 0:e.length)>0&&h!==n.target){const c=t.type==="mousemove"?"mouseout":"pointerout",d=this.createPointerEvent(t,c,h);if(this.dispatchEvent(d,"pointerout"),a&&this.dispatchEvent(d,"mouseout"),!n.composedPath().includes(h)){const f=this.createPointerEvent(t,"pointerleave",h);for(f.eventPhase=f.AT_TARGET;f.target&&!n.composedPath().includes(f.target);)f.currentTarget=f.target,this.notifyTarget(f),a&&this.notifyTarget(f,"mouseleave"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(d)}if(h!==n.target){const c=t.type==="mousemove"?"mouseover":"pointerover",d=this.clonePointerEvent(n,c);this.dispatchEvent(d,"pointerover"),a&&this.dispatchEvent(d,"mouseover");let f=h==null?void 0:h.parent;for(;f&&f!==this.rootTarget.parent&&f!==n.target;)f=f.parent;if(!f||f===this.rootTarget.parent){const p=this.clonePointerEvent(n,"pointerenter");for(p.eventPhase=p.AT_TARGET;p.target&&p.target!==h&&p.target!==this.rootTarget.parent;)p.currentTarget=p.target,this.notifyTarget(p),a&&this.notifyTarget(p,"mouseenter"),p.target=p.target.parent;this.freeEvent(p)}this.freeEvent(d)}const l=[],u=(s=this.enableGlobalMoveEvents)!=null?s:!0;this.moveOnAll?l.push("pointermove"):this.dispatchEvent(n,"pointermove"),u&&l.push("globalpointermove"),n.pointerType==="touch"&&(this.moveOnAll?l.splice(1,0,"touchmove"):this.dispatchEvent(n,"touchmove"),u&&l.push("globaltouchmove")),a&&(this.moveOnAll?l.splice(1,0,"mousemove"):this.dispatchEvent(n,"mousemove"),u&&l.push("globalmousemove"),this.cursor=(r=n.target)==null?void 0:r.cursor),l.length>0&&this.all(n,l),this._allInteractiveElements.length=0,this._hitElements.length=0,o.overTargets=n.composedPath(),this.freeEvent(n)}mapPointerOver(t){var e;if(!(t instanceof Ft)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const s=this.trackingData(t.pointerId),r=this.createPointerEvent(t),n=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),n&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=(e=r.target)==null?void 0:e.cursor);const a=this.clonePointerEvent(r,"pointerenter");for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),n&&this.notifyTarget(a,"mouseenter"),a.target=a.target.parent;s.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(a)}mapPointerOut(t){if(!(t instanceof Ft)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId);if(e.overTargets){const s=t.pointerType==="mouse"||t.pointerType==="pen",r=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",r);this.dispatchEvent(n),s&&this.dispatchEvent(n,"mouseout");const a=this.createPointerEvent(t,"pointerleave",r);for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),s&&this.notifyTarget(a,"mouseleave"),a.target=a.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(a)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Ft)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=performance.now(),s=this.createPointerEvent(t);if(this.dispatchEvent(s,"pointerup"),s.pointerType==="touch")this.dispatchEvent(s,"touchend");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const o=s.button===2;this.dispatchEvent(s,o?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.pressTargetsByButton[t.button]);let a=n;if(n&&!s.composedPath().includes(n)){let o=n;for(;o&&!s.composedPath().includes(o);){if(s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")this.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const h=s.button===2;this.notifyTarget(s,h?"rightupoutside":"mouseupoutside")}o=o.parent}delete r.pressTargetsByButton[t.button],a=o}if(a){const o=this.clonePointerEvent(s,"click");o.target=a,o.path=null,r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:o.target,timeStamp:e});const h=r.clicksByButton[t.button];if(h.target===o.target&&e-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=o.target,h.timeStamp=e,o.detail=h.clickCount,o.pointerType==="mouse"){const l=o.button===2;this.dispatchEvent(o,l?"rightclick":"click")}else o.pointerType==="touch"&&this.dispatchEvent(o,"tap");this.dispatchEvent(o,"pointertap"),this.freeEvent(o)}this.freeEvent(s)}mapPointerUpOutside(t){if(!(t instanceof Ft)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),s=this.findMountedTarget(e.pressTargetsByButton[t.button]),r=this.createPointerEvent(t);if(s){let n=s;for(;n;)r.currentTarget=n,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch"?this.notifyTarget(r,"touchendoutside"):(r.pointerType==="mouse"||r.pointerType==="pen")&&this.notifyTarget(r,r.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(r)}mapWheel(t){if(!(t instanceof qe)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}const e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let s=1;s<t.length&&t[s].parent===e;s++)e=t[s];return e}createPointerEvent(t,e,s){var r;const n=this.allocateEvent(Ft);return this.copyPointerData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.nativeEvent=t.nativeEvent,n.originalEvent=t,n.target=(r=s!=null?s:this.hitTest(n.global.x,n.global.y))!=null?r:this._hitElements[0],typeof e=="string"&&(n.type=e),n}createWheelEvent(t){const e=this.allocateEvent(qe);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 s=this.allocateEvent(Ft);return s.nativeEvent=t.nativeEvent,s.originalEvent=t.originalEvent,this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.target=t.target,s.path=t.composedPath().slice(),s.type=e!=null?e:s.type,s}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Ft&&e instanceof Ft&&(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 mi&&e instanceof mi&&(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.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 s=t.currentTarget._events[e];if(s&&t.currentTarget.isInteractive())if("fn"in s)s.once&&t.currentTarget.removeListener(e,s.fn,void 0,!0),s.fn.call(s.context,t);else for(let r=0,n=s.length;r<n&&!t.propagationImmediatelyStopped;r++)s[r].once&&t.currentTarget.removeListener(e,s[r].fn,void 0,!0),s[r].fn.call(s[r].context,t)}}var fd=Object.defineProperty,pa=Object.getOwnPropertySymbols,pd=Object.prototype.hasOwnProperty,md=Object.prototype.propertyIsEnumerable,ma=(i,t,e)=>t in i?fd(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,gd=(i,t)=>{for(var e in t||(t={}))pd.call(t,e)&&ma(i,e,t[e]);if(pa)for(var e of pa(t))md.call(t,e)&&ma(i,e,t[e]);return i};const _d=1,vd={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Hr=class Vr{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new dd(null),le.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new Ft(null),this.rootWheelEvent=new qe(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy(gd({},Vr.defaultEventFeatures),{set:(e,s,r)=>(s==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=r),e[s]=r,!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,s;const{view:r,resolution:n}=this.renderer;this.setTargetElement(r),this.resolution=n,Vr._defaultEventMode=(e=t.eventMode)!=null?e:"auto",Object.assign(this.features,(s=t.eventFeatures)!=null?s:{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=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 s=this.cursorStyles[t];if(s)switch(typeof s){case"string":e&&(this.domElement.style.cursor=s);break;case"function":s(t);break;case"object":e&&Object.assign(this.domElement.style,s);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 s=0,r=e.length;s<r;s++){const n=e[s],a=this.bootstrapEvent(this.rootPointerEvent,n);this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,le.pointerMoved();const e=this.normalizeToPointerData(t);for(let s=0,r=e.length;s<r;s++){const n=this.bootstrapEvent(this.rootPointerEvent,e[s]);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 s=e!==this.domElement?"outside":"",r=this.normalizeToPointerData(t);for(let n=0,a=r.length;n<a;n++){const o=this.bootstrapEvent(this.rootPointerEvent,r[n]);o.type+=s,this.rootBoundary.mapEvent(o)}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 s=0,r=e.length;s<r;s++){const n=this.bootstrapEvent(this.rootPointerEvent,e[s]);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,le.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;le.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;le.removeTickerListener();const t=this.domElement.style;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,s){const r=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-r.left)*(this.domElement.width/r.width)*n,t.y=(s-r.top)*(this.domElement.height/r.height)*n}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let s=0,r=t.changedTouches.length;s<r;s++){const n=t.changedTouches[s];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 s=t;typeof s.isPrimary=="undefined"&&(s.isPrimary=!0),typeof s.width=="undefined"&&(s.width=1),typeof s.height=="undefined"&&(s.height=1),typeof s.tiltX=="undefined"&&(s.tiltX=0),typeof s.tiltY=="undefined"&&(s.tiltY=0),typeof s.pointerType=="undefined"&&(s.pointerType="mouse"),typeof s.pointerId=="undefined"&&(s.pointerId=_d),typeof s.pressure=="undefined"&&(s.pressure=.5),typeof s.twist=="undefined"&&(s.twist=0),typeof s.tangentialPressure=="undefined"&&(s.tangentialPressure=0),s.isNormalized=!0,e.push(s)}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=vd[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}};Hr.extension={name:"events",type:[C.RendererSystem,C.CanvasRendererSystem]},Hr.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let Xr=Hr;N.add(Xr);function ga(i){return i==="dynamic"||i==="static"}const yd={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,_internalInteractive:void 0,get interactive(){var i;return(i=this._internalInteractive)!=null?i:ga(Xr.defaultEventMode)},set interactive(i){this._internalInteractive=i,this.eventMode=i?"static":"auto"},_internalEventMode:void 0,get eventMode(){var i;return(i=this._internalEventMode)!=null?i:Xr.defaultEventMode},set eventMode(i){this._internalInteractive=ga(i),this._internalEventMode=i},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(i,t,e){const s=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,r=typeof t=="function"?void 0:t;i=s?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.on(i,t,r)},removeEventListener(i,t,e){const s=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,r=typeof t=="function"?void 0:t;i=s?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.off(i,t,r)},dispatchEvent(i){if(!(i instanceof Is))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return i.defaultPrevented=!1,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}};it.mixin(yd);const xd={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};it.mixin(xd);const bd=9,Vs=100,Td=0,Ed=0,_a=2,va=1,Ad=-1e3,wd=-1e3,Sd=2;class dh{constructor(t){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,(Wt.tablet||Wt.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${Vs}px`,e.style.height=`${Vs}px`,e.style.position="absolute",e.style.top=`${Td}px`,e.style.left=`${Ed}px`,e.style.zIndex=_a.toString(),this.div=e,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}createTouchHook(){const t=document.createElement("button");t.style.width=`${va}px`,t.style.height=`${va}px`,t.style.position="absolute",t.style.top=`${Ad}px`,t.style.left=`${wd}px`,t.style.zIndex=Sd.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.on("postrender",this.update,this),(t=this.renderer.view.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.off("postrender",this.update),(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 s=0;s<e.length;s++)this.updateAccessibleObjects(e[s])}update(){const t=performance.now();if(Wt.android.device&&t<this.androidUpdateCount||(this.androidUpdateCount=t+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);const{x:e,y:s,width:r,height:n}=this.renderer.view.getBoundingClientRect(),{width:a,height:o,resolution:h}=this.renderer,l=r/a*h,u=n/o*h;let c=this.div;c.style.left=`${e}px`,c.style.top=`${s}px`,c.style.width=`${a}px`,c.style.height=`${o}px`;for(let d=0;d<this.children.length;d++){const f=this.children[d];if(f.renderId!==this.renderId)f._accessibleActive=!1,Re(this.children,d,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,d--;else{c=f._accessibleDiv;let p=f.hitArea;const m=f.worldTransform;f.hitArea?(c.style.left=`${(m.tx+p.x*m.a)*l}px`,c.style.top=`${(m.ty+p.y*m.d)*u}px`,c.style.width=`${p.width*m.a*l}px`,c.style.height=`${p.height*m.d*u}px`):(p=f.getBounds(),this.capHitArea(p),c.style.left=`${p.x*l}px`,c.style.top=`${p.y*u}px`,c.style.width=`${p.width*l}px`,c.style.height=`${p.height*u}px`,c.title!==f.accessibleTitle&&f.accessibleTitle!==null&&(c.title=f.accessibleTitle),c.getAttribute("aria-label")!==f.accessibleHint&&f.accessibleHint!==null&&c.setAttribute("aria-label",f.accessibleHint)),(f.accessibleTitle!==c.title||f.tabIndex!==c.tabIndex)&&(c.title=f.accessibleTitle,c.tabIndex=f.tabIndex,this.debug&&this.updateDebugHTML(c))}}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:s}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>s&&(t.height=s-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width=`${Vs}px`,e.style.height=`${Vs}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=_a.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=`displayObject ${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.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){const{displayObject:s}=t.target,r=this.renderer.events.rootBoundary,n=Object.assign(new Is(r),{target:s});r.rootTarget=this.renderer.lastObjectRendered,e.forEach(a=>r.dispatchEvent(n,a))}_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===bd&&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}}dh.extension={name:"accessibility",type:[C.RendererPlugin,C.CanvasRendererPlugin]};N.add(dh);const fh=class jr{constructor(t){this.stage=new Mt,t=Object.assign({forceCanvas:!1},t),this.renderer=Oc(t),jr._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render(this.stage)}get view(){var t;return(t=this.renderer)==null?void 0:t.view}get screen(){var t;return(t=this.renderer)==null?void 0:t.screen}destroy(t,e){const s=jr._plugins.slice(0);s.reverse(),s.forEach(r=>{r.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};fh._plugins=[];let Id=fh;N.handleByList(C.Application,Id._plugins);class ph{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,s;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,s=globalThis.innerHeight;else{const{clientWidth:r,clientHeight:n}=this._resizeTo;e=r,s=n}this.renderer.resize(e,s),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}}ph.extension=C.Application;N.add(ph);const ya={loader:C.LoadParser,resolver:C.ResolveParser,cache:C.CacheParser,detection:C.DetectionParser};N.handle(C.Asset,i=>{const t=i.ref;Object.entries(ya).filter(([e])=>!!t[e]).forEach(([e,s])=>{var r;return N.add(Object.assign(t[e],{extension:(r=t[e].extension)!=null?r:s}))})},i=>{const t=i.ref;Object.keys(ya).filter(e=>!!t[e]).forEach(e=>N.remove(t[e]))});class Rd{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 s=0;s<e;s++)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())}}function Ze(i,t){if(Array.isArray(t)){for(const e of t)if(i.startsWith(`data:${e}`))return!0;return!1}return i.startsWith(`data:${t}`)}function ve(i,t){const e=i.split("?")[0],s=vt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(s):s===t}const Nt=(i,t)=>(Array.isArray(i)||(i=[i]),t?i.map(e=>typeof e=="string"?t(e):e):i),zr=(i,t)=>{const e=t.split("?")[1];return e&&(i+=`?${e}`),i};function mh(i,t,e,s,r){const n=t[e];for(let a=0;a<n.length;a++){const o=n[a];e<t.length-1?mh(i.replace(s[e],o),t,e+1,s,r):r.push(i.replace(s[e],o))}}function Cd(i){const t=/\{(.*?)\}/g,e=i.match(t),s=[];if(e){const r=[];e.forEach(n=>{const a=n.substring(1,n.length-1).split(",");r.push(a)}),mh(i,r,0,e,s)}else s.push(i);return s}const gi=i=>!Array.isArray(i);let Pd=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 s=Nt(t);let r;for(let o=0;o<this.parsers.length;o++){const h=this.parsers[o];if(h.test(e)){r=h.getCacheableAssets(s,e);break}}r||(r={},s.forEach(o=>{r[o]=e}));const n=Object.keys(r),a={cacheKeys:n,keys:s};if(s.forEach(o=>{this._cacheMap.set(o,a)}),n.forEach(o=>{this._cache.has(o)&&this._cache.get(o),this._cache.set(o,r[o])}),e instanceof D){const o=e;s.forEach(h=>{o.baseTexture!==D.EMPTY.baseTexture&&X.addToCache(o.baseTexture,h),D.addToCache(o,h)})}}remove(t){if(!this._cacheMap.has(t))return;const e=this._cacheMap.get(t);e.cacheKeys.forEach(s=>{this._cache.delete(s)}),e.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}};const Ie=new Pd;var Md=Object.defineProperty,Dd=Object.defineProperties,Od=Object.getOwnPropertyDescriptors,xa=Object.getOwnPropertySymbols,Bd=Object.prototype.hasOwnProperty,Fd=Object.prototype.propertyIsEnumerable,ba=(i,t,e)=>t in i?Md(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Nd=(i,t)=>{for(var e in t||(t={}))Bd.call(t,e)&&ba(i,e,t[e]);if(xa)for(var e of xa(t))Fd.call(t,e)&&ba(i,e,t[e]);return i},Ld=(i,t)=>Dd(i,Od(t));class Ud{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,s)=>(this._parsersValidated=!1,t[e]=s,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const s={promise:null,parser:null};return s.promise=(async()=>{var r,n;let a=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser]),!o){for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];if(l.load&&(r=l.test)!=null&&r.call(l,t,e,this)){o=l;break}}if(!o)return null}a=await o.load(t,e,this),s.parser=o;for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];l.parse&&l.parse&&await((n=l.testParse)==null?void 0:n.call(l,a,e,this))&&(a=await l.parse(a,e,this)||a,s.parser=l)}return a})(),s}async load(t,e){this._parsersValidated||this._validateParsers();let s=0;const r={},n=gi(t),a=Nt(t,l=>({alias:[l],src:l})),o=a.length,h=a.map(async l=>{const u=vt.toAbsolute(l.src);if(!r[l.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,l)),r[l.src]=await this.promiseCache[u].promise,e&&e(++s/o)}catch(c){throw delete this.promiseCache[u],delete r[l.src],new Error(`[Loader.load] Failed to load ${u}.
|
|
870
|
-
${c}`)}});return await Promise.all(h),n?r[a[0].src]:r}async unload(t){const e=Nt(t,s=>({alias:[s],src:s})).map(async s=>{var r,n;const a=
|
|
869
|
+
`;class ld extends xt{constructor(t=.5,e=Math.random()){super(ih,hd,{uNoise:0,uSeed:0}),this.noise=t,this.seed=e}get noise(){return this.uniforms.uNoise}set noise(t){this.uniforms.uNoise=t}get seed(){return this.uniforms.uSeed}set seed(t){this.uniforms.uSeed=t}}const fa={AlphaFilter:Yc,BlurFilter:td,BlurFilterPass:Gr,ColorMatrixFilter:$r,DisplacementFilter:rd,FXAAFilter:od,NoiseFilter:ld};Object.entries(fa).forEach(([i,t])=>{Object.defineProperty(fa,i,{get(){return uo("7.1.0",`filters.${i} has moved to ${i}`),t}})});let ud=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||(_t.system.add(this.tickerUpdate,this,me.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(_t.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}))}tickerUpdate(t){this._deltaTime+=t,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())}};const le=new ud;class Is{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Is.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new q,this.page=new q,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,s){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,s,r,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}}class mi extends Is{constructor(){super(...arguments),this.client=new q,this.movement=new q,this.offset=new q,this.global=new q,this.screen=new q}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,s){return t.worldTransform.applyInverse(s||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,s,r,n,a,o,h,l,u,c,d,f,p,m){throw new Error("Method not implemented.")}}class Ft extends mi{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 qe extends mi{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}qe.DOM_DELTA_PIXEL=0,qe.DOM_DELTA_LINE=1,qe.DOM_DELTA_PAGE=2;const cd=2048,dd=new q,Qi=new q;class fd{constructor(t){this.dispatch=new Ke,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((s,r)=>s.priority-r.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 s=0,r=e.length;s<r;s++)e[s].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){le.pauseUpdate=!0;const s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",r=this[s](this.rootTarget,this.rootTarget.eventMode,dd.set(t,e),this.hitTestFn,this.hitPruneFn);return r&&r[0]}propagate(t,e){if(!t.target)return;const s=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let r=0,n=s.length-1;r<n;r++)if(t.currentTarget=s[r],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 r=s.length-2;r>=0;r--)if(t.currentTarget=s[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,s=this._allInteractiveElements){if(s.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const r=Array.isArray(e)?e:[e];for(let n=s.length-1;n>=0;n--)r.forEach(a=>{t.currentTarget=s[n],this.notifyTarget(t,a)})}propagationPath(t){const e=[t];for(let s=0;s<cd&&t!==this.rootTarget;s++){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,s,r,n,a=!1){let o=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(le.pauseUpdate=!1),t.interactiveChildren&&t.children){const u=t.children;for(let c=u.length-1;c>=0;c--){const d=u[c],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,s,r,n,a||n(t,s));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),o=!0}}}const h=this._isInteractive(e),l=t.isInteractive();return h&&l&&this._allInteractiveElements.push(t),a||this._hitElements.length>0?null:o?this._hitElements:h&&!n(t,s)&&r(t,s)?l?[t]:[]:null}hitTestRecursive(t,e,s,r,n){if(this._interactivePrune(t)||n(t,s))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(le.pauseUpdate=!1),t.interactiveChildren&&t.children){const h=t.children;for(let l=h.length-1;l>=0;l--){const u=h[l],c=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,s,r,n);if(c){if(c.length>0&&!c[c.length-1].parent)continue;const d=t.isInteractive();return(c.length>0||d)&&c.push(t),c}}}const a=this._isInteractive(e),o=t.isInteractive();return a&&r(t,s)?o?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!!(!t||t.isMask||!t.visible||!t.renderable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren||t.isMask)}hitPruneFn(t,e){var s;if(t.hitArea&&(t.worldTransform.applyInverse(e,Qi),!t.hitArea.contains(Qi.x,Qi.y)))return!0;if(t._mask){const r=t._mask.isMaskData?t._mask.maskObject:t._mask;if(r&&!((s=r.containsPoint)!=null&&s.call(r,e)))return!0}return!1}hitTestFn(t,e){return t.eventMode==="passive"?!1:t.hitArea?!0:t.containsPoint?t.containsPoint(e):!1}notifyTarget(t,e){var s,r;e=e!=null?e:t.type;const n=`on${e}`;(r=(s=t.currentTarget)[n])==null||r.call(s,t);const a=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,a),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Ft)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");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 r=e.button===2;this.dispatchEvent(e,r?"rightdown":"mousedown")}const s=this.trackingData(t.pointerId);s.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var e,s,r;if(!(t instanceof Ft)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const n=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const a=n.pointerType==="mouse"||n.pointerType==="pen",o=this.trackingData(t.pointerId),h=this.findMountedTarget(o.overTargets);if(((e=o.overTargets)==null?void 0:e.length)>0&&h!==n.target){const c=t.type==="mousemove"?"mouseout":"pointerout",d=this.createPointerEvent(t,c,h);if(this.dispatchEvent(d,"pointerout"),a&&this.dispatchEvent(d,"mouseout"),!n.composedPath().includes(h)){const f=this.createPointerEvent(t,"pointerleave",h);for(f.eventPhase=f.AT_TARGET;f.target&&!n.composedPath().includes(f.target);)f.currentTarget=f.target,this.notifyTarget(f),a&&this.notifyTarget(f,"mouseleave"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(d)}if(h!==n.target){const c=t.type==="mousemove"?"mouseover":"pointerover",d=this.clonePointerEvent(n,c);this.dispatchEvent(d,"pointerover"),a&&this.dispatchEvent(d,"mouseover");let f=h==null?void 0:h.parent;for(;f&&f!==this.rootTarget.parent&&f!==n.target;)f=f.parent;if(!f||f===this.rootTarget.parent){const p=this.clonePointerEvent(n,"pointerenter");for(p.eventPhase=p.AT_TARGET;p.target&&p.target!==h&&p.target!==this.rootTarget.parent;)p.currentTarget=p.target,this.notifyTarget(p),a&&this.notifyTarget(p,"mouseenter"),p.target=p.target.parent;this.freeEvent(p)}this.freeEvent(d)}const l=[],u=(s=this.enableGlobalMoveEvents)!=null?s:!0;this.moveOnAll?l.push("pointermove"):this.dispatchEvent(n,"pointermove"),u&&l.push("globalpointermove"),n.pointerType==="touch"&&(this.moveOnAll?l.splice(1,0,"touchmove"):this.dispatchEvent(n,"touchmove"),u&&l.push("globaltouchmove")),a&&(this.moveOnAll?l.splice(1,0,"mousemove"):this.dispatchEvent(n,"mousemove"),u&&l.push("globalmousemove"),this.cursor=(r=n.target)==null?void 0:r.cursor),l.length>0&&this.all(n,l),this._allInteractiveElements.length=0,this._hitElements.length=0,o.overTargets=n.composedPath(),this.freeEvent(n)}mapPointerOver(t){var e;if(!(t instanceof Ft)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const s=this.trackingData(t.pointerId),r=this.createPointerEvent(t),n=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),n&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=(e=r.target)==null?void 0:e.cursor);const a=this.clonePointerEvent(r,"pointerenter");for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),n&&this.notifyTarget(a,"mouseenter"),a.target=a.target.parent;s.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(a)}mapPointerOut(t){if(!(t instanceof Ft)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId);if(e.overTargets){const s=t.pointerType==="mouse"||t.pointerType==="pen",r=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",r);this.dispatchEvent(n),s&&this.dispatchEvent(n,"mouseout");const a=this.createPointerEvent(t,"pointerleave",r);for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),s&&this.notifyTarget(a,"mouseleave"),a.target=a.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(a)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Ft)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=performance.now(),s=this.createPointerEvent(t);if(this.dispatchEvent(s,"pointerup"),s.pointerType==="touch")this.dispatchEvent(s,"touchend");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const o=s.button===2;this.dispatchEvent(s,o?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.pressTargetsByButton[t.button]);let a=n;if(n&&!s.composedPath().includes(n)){let o=n;for(;o&&!s.composedPath().includes(o);){if(s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")this.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const h=s.button===2;this.notifyTarget(s,h?"rightupoutside":"mouseupoutside")}o=o.parent}delete r.pressTargetsByButton[t.button],a=o}if(a){const o=this.clonePointerEvent(s,"click");o.target=a,o.path=null,r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:o.target,timeStamp:e});const h=r.clicksByButton[t.button];if(h.target===o.target&&e-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=o.target,h.timeStamp=e,o.detail=h.clickCount,o.pointerType==="mouse"){const l=o.button===2;this.dispatchEvent(o,l?"rightclick":"click")}else o.pointerType==="touch"&&this.dispatchEvent(o,"tap");this.dispatchEvent(o,"pointertap"),this.freeEvent(o)}this.freeEvent(s)}mapPointerUpOutside(t){if(!(t instanceof Ft)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),s=this.findMountedTarget(e.pressTargetsByButton[t.button]),r=this.createPointerEvent(t);if(s){let n=s;for(;n;)r.currentTarget=n,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch"?this.notifyTarget(r,"touchendoutside"):(r.pointerType==="mouse"||r.pointerType==="pen")&&this.notifyTarget(r,r.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(r)}mapWheel(t){if(!(t instanceof qe)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}const e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let s=1;s<t.length&&t[s].parent===e;s++)e=t[s];return e}createPointerEvent(t,e,s){var r;const n=this.allocateEvent(Ft);return this.copyPointerData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.nativeEvent=t.nativeEvent,n.originalEvent=t,n.target=(r=s!=null?s:this.hitTest(n.global.x,n.global.y))!=null?r:this._hitElements[0],typeof e=="string"&&(n.type=e),n}createWheelEvent(t){const e=this.allocateEvent(qe);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 s=this.allocateEvent(Ft);return s.nativeEvent=t.nativeEvent,s.originalEvent=t.originalEvent,this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.target=t.target,s.path=t.composedPath().slice(),s.type=e!=null?e:s.type,s}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Ft&&e instanceof Ft&&(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 mi&&e instanceof mi&&(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.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 s=t.currentTarget._events[e];if(s&&t.currentTarget.isInteractive())if("fn"in s)s.once&&t.currentTarget.removeListener(e,s.fn,void 0,!0),s.fn.call(s.context,t);else for(let r=0,n=s.length;r<n&&!t.propagationImmediatelyStopped;r++)s[r].once&&t.currentTarget.removeListener(e,s[r].fn,void 0,!0),s[r].fn.call(s[r].context,t)}}var pd=Object.defineProperty,pa=Object.getOwnPropertySymbols,md=Object.prototype.hasOwnProperty,gd=Object.prototype.propertyIsEnumerable,ma=(i,t,e)=>t in i?pd(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,_d=(i,t)=>{for(var e in t||(t={}))md.call(t,e)&&ma(i,e,t[e]);if(pa)for(var e of pa(t))gd.call(t,e)&&ma(i,e,t[e]);return i};const vd=1,yd={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Hr=class Vr{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new fd(null),le.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new Ft(null),this.rootWheelEvent=new qe(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy(_d({},Vr.defaultEventFeatures),{set:(e,s,r)=>(s==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=r),e[s]=r,!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,s;const{view:r,resolution:n}=this.renderer;this.setTargetElement(r),this.resolution=n,Vr._defaultEventMode=(e=t.eventMode)!=null?e:"auto",Object.assign(this.features,(s=t.eventFeatures)!=null?s:{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=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 s=this.cursorStyles[t];if(s)switch(typeof s){case"string":e&&(this.domElement.style.cursor=s);break;case"function":s(t);break;case"object":e&&Object.assign(this.domElement.style,s);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 s=0,r=e.length;s<r;s++){const n=e[s],a=this.bootstrapEvent(this.rootPointerEvent,n);this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,le.pointerMoved();const e=this.normalizeToPointerData(t);for(let s=0,r=e.length;s<r;s++){const n=this.bootstrapEvent(this.rootPointerEvent,e[s]);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 s=e!==this.domElement?"outside":"",r=this.normalizeToPointerData(t);for(let n=0,a=r.length;n<a;n++){const o=this.bootstrapEvent(this.rootPointerEvent,r[n]);o.type+=s,this.rootBoundary.mapEvent(o)}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 s=0,r=e.length;s<r;s++){const n=this.bootstrapEvent(this.rootPointerEvent,e[s]);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,le.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;le.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;le.removeTickerListener();const t=this.domElement.style;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,s){const r=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-r.left)*(this.domElement.width/r.width)*n,t.y=(s-r.top)*(this.domElement.height/r.height)*n}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let s=0,r=t.changedTouches.length;s<r;s++){const n=t.changedTouches[s];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 s=t;typeof s.isPrimary=="undefined"&&(s.isPrimary=!0),typeof s.width=="undefined"&&(s.width=1),typeof s.height=="undefined"&&(s.height=1),typeof s.tiltX=="undefined"&&(s.tiltX=0),typeof s.tiltY=="undefined"&&(s.tiltY=0),typeof s.pointerType=="undefined"&&(s.pointerType="mouse"),typeof s.pointerId=="undefined"&&(s.pointerId=vd),typeof s.pressure=="undefined"&&(s.pressure=.5),typeof s.twist=="undefined"&&(s.twist=0),typeof s.tangentialPressure=="undefined"&&(s.tangentialPressure=0),s.isNormalized=!0,e.push(s)}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=yd[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}};Hr.extension={name:"events",type:[C.RendererSystem,C.CanvasRendererSystem]},Hr.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let Xr=Hr;N.add(Xr);function ga(i){return i==="dynamic"||i==="static"}const xd={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,_internalInteractive:void 0,get interactive(){var i;return(i=this._internalInteractive)!=null?i:ga(Xr.defaultEventMode)},set interactive(i){this._internalInteractive=i,this.eventMode=i?"static":"auto"},_internalEventMode:void 0,get eventMode(){var i;return(i=this._internalEventMode)!=null?i:Xr.defaultEventMode},set eventMode(i){this._internalInteractive=ga(i),this._internalEventMode=i},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(i,t,e){const s=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,r=typeof t=="function"?void 0:t;i=s?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.on(i,t,r)},removeEventListener(i,t,e){const s=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,r=typeof t=="function"?void 0:t;i=s?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.off(i,t,r)},dispatchEvent(i){if(!(i instanceof Is))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return i.defaultPrevented=!1,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}};it.mixin(xd);const bd={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};it.mixin(bd);const Td=9,Vs=100,Ed=0,Ad=0,_a=2,va=1,wd=-1e3,Sd=-1e3,Id=2;class dh{constructor(t){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,(Wt.tablet||Wt.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${Vs}px`,e.style.height=`${Vs}px`,e.style.position="absolute",e.style.top=`${Ed}px`,e.style.left=`${Ad}px`,e.style.zIndex=_a.toString(),this.div=e,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}createTouchHook(){const t=document.createElement("button");t.style.width=`${va}px`,t.style.height=`${va}px`,t.style.position="absolute",t.style.top=`${wd}px`,t.style.left=`${Sd}px`,t.style.zIndex=Id.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.on("postrender",this.update,this),(t=this.renderer.view.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.off("postrender",this.update),(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 s=0;s<e.length;s++)this.updateAccessibleObjects(e[s])}update(){const t=performance.now();if(Wt.android.device&&t<this.androidUpdateCount||(this.androidUpdateCount=t+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);const{x:e,y:s,width:r,height:n}=this.renderer.view.getBoundingClientRect(),{width:a,height:o,resolution:h}=this.renderer,l=r/a*h,u=n/o*h;let c=this.div;c.style.left=`${e}px`,c.style.top=`${s}px`,c.style.width=`${a}px`,c.style.height=`${o}px`;for(let d=0;d<this.children.length;d++){const f=this.children[d];if(f.renderId!==this.renderId)f._accessibleActive=!1,Re(this.children,d,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,d--;else{c=f._accessibleDiv;let p=f.hitArea;const m=f.worldTransform;f.hitArea?(c.style.left=`${(m.tx+p.x*m.a)*l}px`,c.style.top=`${(m.ty+p.y*m.d)*u}px`,c.style.width=`${p.width*m.a*l}px`,c.style.height=`${p.height*m.d*u}px`):(p=f.getBounds(),this.capHitArea(p),c.style.left=`${p.x*l}px`,c.style.top=`${p.y*u}px`,c.style.width=`${p.width*l}px`,c.style.height=`${p.height*u}px`,c.title!==f.accessibleTitle&&f.accessibleTitle!==null&&(c.title=f.accessibleTitle),c.getAttribute("aria-label")!==f.accessibleHint&&f.accessibleHint!==null&&c.setAttribute("aria-label",f.accessibleHint)),(f.accessibleTitle!==c.title||f.tabIndex!==c.tabIndex)&&(c.title=f.accessibleTitle,c.tabIndex=f.tabIndex,this.debug&&this.updateDebugHTML(c))}}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:s}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>s&&(t.height=s-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width=`${Vs}px`,e.style.height=`${Vs}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=_a.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=`displayObject ${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.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){const{displayObject:s}=t.target,r=this.renderer.events.rootBoundary,n=Object.assign(new Is(r),{target:s});r.rootTarget=this.renderer.lastObjectRendered,e.forEach(a=>r.dispatchEvent(n,a))}_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===Td&&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}}dh.extension={name:"accessibility",type:[C.RendererPlugin,C.CanvasRendererPlugin]};N.add(dh);const fh=class jr{constructor(t){this.stage=new Mt,t=Object.assign({forceCanvas:!1},t),this.renderer=Bc(t),jr._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render(this.stage)}get view(){var t;return(t=this.renderer)==null?void 0:t.view}get screen(){var t;return(t=this.renderer)==null?void 0:t.screen}destroy(t,e){const s=jr._plugins.slice(0);s.reverse(),s.forEach(r=>{r.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};fh._plugins=[];let Rd=fh;N.handleByList(C.Application,Rd._plugins);class ph{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,s;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,s=globalThis.innerHeight;else{const{clientWidth:r,clientHeight:n}=this._resizeTo;e=r,s=n}this.renderer.resize(e,s),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}}ph.extension=C.Application;N.add(ph);const ya={loader:C.LoadParser,resolver:C.ResolveParser,cache:C.CacheParser,detection:C.DetectionParser};N.handle(C.Asset,i=>{const t=i.ref;Object.entries(ya).filter(([e])=>!!t[e]).forEach(([e,s])=>{var r;return N.add(Object.assign(t[e],{extension:(r=t[e].extension)!=null?r:s}))})},i=>{const t=i.ref;Object.keys(ya).filter(e=>!!t[e]).forEach(e=>N.remove(t[e]))});class Cd{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 s=0;s<e;s++)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())}}function Ze(i,t){if(Array.isArray(t)){for(const e of t)if(i.startsWith(`data:${e}`))return!0;return!1}return i.startsWith(`data:${t}`)}function ve(i,t){const e=i.split("?")[0],s=lt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(s):s===t}const Nt=(i,t,e=!1)=>(Array.isArray(i)||(i=[i]),t?i.map(s=>typeof s=="string"||e?t(s):s):i),zr=(i,t)=>{const e=t.split("?")[1];return e&&(i+=`?${e}`),i};function mh(i,t,e,s,r){const n=t[e];for(let a=0;a<n.length;a++){const o=n[a];e<t.length-1?mh(i.replace(s[e],o),t,e+1,s,r):r.push(i.replace(s[e],o))}}function Pd(i){const t=/\{(.*?)\}/g,e=i.match(t),s=[];if(e){const r=[];e.forEach(n=>{const a=n.substring(1,n.length-1).split(",");r.push(a)}),mh(i,r,0,e,s)}else s.push(i);return s}const gi=i=>!Array.isArray(i);let Md=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 s=Nt(t);let r;for(let o=0;o<this.parsers.length;o++){const h=this.parsers[o];if(h.test(e)){r=h.getCacheableAssets(s,e);break}}r||(r={},s.forEach(o=>{r[o]=e}));const n=Object.keys(r),a={cacheKeys:n,keys:s};if(s.forEach(o=>{this._cacheMap.set(o,a)}),n.forEach(o=>{this._cache.has(o)&&this._cache.get(o),this._cache.set(o,r[o])}),e instanceof O){const o=e;s.forEach(h=>{o.baseTexture!==O.EMPTY.baseTexture&&X.addToCache(o.baseTexture,h),O.addToCache(o,h)})}}remove(t){if(!this._cacheMap.has(t))return;const e=this._cacheMap.get(t);e.cacheKeys.forEach(s=>{this._cache.delete(s)}),e.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}};const Ie=new Md;var Dd=Object.defineProperty,Od=Object.defineProperties,Bd=Object.getOwnPropertyDescriptors,xa=Object.getOwnPropertySymbols,Fd=Object.prototype.hasOwnProperty,Nd=Object.prototype.propertyIsEnumerable,ba=(i,t,e)=>t in i?Dd(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ld=(i,t)=>{for(var e in t||(t={}))Fd.call(t,e)&&ba(i,e,t[e]);if(xa)for(var e of xa(t))Nd.call(t,e)&&ba(i,e,t[e]);return i},Ud=(i,t)=>Od(i,Bd(t));class kd{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,s)=>(this._parsersValidated=!1,t[e]=s,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const s={promise:null,parser:null};return s.promise=(async()=>{var r,n;let a=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser]),!o){for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];if(l.load&&(r=l.test)!=null&&r.call(l,t,e,this)){o=l;break}}if(!o)return null}a=await o.load(t,e,this),s.parser=o;for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];l.parse&&l.parse&&await((n=l.testParse)==null?void 0:n.call(l,a,e,this))&&(a=await l.parse(a,e,this)||a,s.parser=l)}return a})(),s}async load(t,e){this._parsersValidated||this._validateParsers();let s=0;const r={},n=gi(t),a=Nt(t,l=>({alias:[l],src:l})),o=a.length,h=a.map(async l=>{const u=lt.toAbsolute(l.src);if(!r[l.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,l)),r[l.src]=await this.promiseCache[u].promise,e&&e(++s/o)}catch(c){throw delete this.promiseCache[u],delete r[l.src],new Error(`[Loader.load] Failed to load ${u}.
|
|
870
|
+
${c}`)}});return await Promise.all(h),n?r[a[0].src]:r}async unload(t){const e=Nt(t,s=>({alias:[s],src:s})).map(async s=>{var r,n;const a=lt.toAbsolute(s.src),o=this.promiseCache[a];if(o){const h=await o.promise;delete this.promiseCache[a],(n=(r=o.parser)==null?void 0:r.unload)==null||n.call(r,h,s,this)}});await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(t[e.name],Ud(Ld({},t),{[e.name]:e})),{})}}var Ut=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Ut||{});const Gd=".json",$d="application/json",Hd={extension:{type:C.LoadParser,priority:Ut.Low},name:"loadJson",test(i){return Ze(i,$d)||ve(i,Gd)},async load(i){return await(await D.ADAPTER.fetch(i)).json()}};N.add(Hd);const Vd=".txt",Xd="text/plain",jd={name:"loadTxt",extension:{type:C.LoadParser,priority:Ut.Low},test(i){return Ze(i,Xd)||ve(i,Vd)},async load(i){return await(await D.ADAPTER.fetch(i)).text()}};N.add(jd);var zd=Object.defineProperty,Wd=Object.defineProperties,Yd=Object.getOwnPropertyDescriptors,Ta=Object.getOwnPropertySymbols,qd=Object.prototype.hasOwnProperty,Kd=Object.prototype.propertyIsEnumerable,Ea=(i,t,e)=>t in i?zd(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Zd=(i,t)=>{for(var e in t||(t={}))qd.call(t,e)&&Ea(i,e,t[e]);if(Ta)for(var e of Ta(t))Kd.call(t,e)&&Ea(i,e,t[e]);return i},Qd=(i,t)=>Wd(i,Yd(t));const Jd=["normal","bold","100","200","300","400","500","600","700","800","900"],tf=[".ttf",".otf",".woff",".woff2"],ef=["font/ttf","font/otf","font/woff","font/woff2"],sf=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function rf(i){const t=lt.extname(i),e=lt.basename(i,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let s=e.length>0;for(const n of e)if(!n.match(sf)){s=!1;break}let r=e.join(" ");return s||(r=`"${r.replace(/[\\"]/g,"\\$&")}"`),r}const nf=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function af(i){return nf.test(i)?i:encodeURI(i)}const of={extension:{type:C.LoadParser,priority:Ut.Low},name:"loadWebFont",test(i){return Ze(i,ef)||ve(i,tf)},async load(i,t){var e,s,r,n,a,o;const h=D.ADAPTER.getFontFaceSet();if(h){const l=[],u=(s=(e=t.data)==null?void 0:e.family)!=null?s:rf(i),c=(a=(n=(r=t.data)==null?void 0:r.weights)==null?void 0:n.filter(f=>Jd.includes(f)))!=null?a:["normal"],d=(o=t.data)!=null?o:{};for(let f=0;f<c.length;f++){const p=c[f],m=new FontFace(u,`url(${af(i)})`,Qd(Zd({},d),{weight:p}));await m.load(),h.add(m),l.push(m)}return l.length===1?l[0]:l}return null},unload(i){(Array.isArray(i)?i:[i]).forEach(t=>D.ADAPTER.getFontFaceSet().delete(t))}};N.add(of);let Aa=0,Ji;const hf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=",lf={id:"checkImageBitmap",code:`
|
|
871
871
|
async function checkImageBitmap()
|
|
872
872
|
{
|
|
873
873
|
try
|
|
874
874
|
{
|
|
875
875
|
if (typeof createImageBitmap !== 'function') return false;
|
|
876
876
|
|
|
877
|
-
const response = await fetch('${
|
|
877
|
+
const response = await fetch('${hf}');
|
|
878
878
|
const imageBlob = await response.blob();
|
|
879
879
|
const imageBitmap = await createImageBitmap(imageBlob);
|
|
880
880
|
|
|
@@ -886,7 +886,7 @@ ${c}`)}});return await Promise.all(h),n?r[a[0].src]:r}async unload(t){const e=Nt
|
|
|
886
886
|
}
|
|
887
887
|
}
|
|
888
888
|
checkImageBitmap().then((result) => { self.postMessage(result); });
|
|
889
|
-
`},
|
|
889
|
+
`},uf={id:"loadImageBitmap",code:`
|
|
890
890
|
async function loadImageBitmap(url)
|
|
891
891
|
{
|
|
892
892
|
const response = await fetch(url);
|
|
@@ -922,7 +922,7 @@ ${c}`)}});return await Promise.all(h),n?r[a[0].src]:r}async unload(t){const e=Nt
|
|
|
922
922
|
id: event.data.id,
|
|
923
923
|
});
|
|
924
924
|
}
|
|
925
|
-
};`};let tr,hf=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 e=URL.createObjectURL(new Blob([af.code],{type:"application/javascript"})),s=new Worker(e);s.addEventListener("message",r=>{s.terminate(),URL.revokeObjectURL(e),t(r.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){Ji===void 0&&(Ji=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<Ji&&(tr||(tr=URL.createObjectURL(new Blob([of.code],{type:"application/javascript"}))),this._createdWorkers++,t=new Worker(tr),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 s=new Promise((r,n)=>{this.queue.push({id:t,arguments:e,resolve:r,reject:n})});return this.next(),s}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),s=e.id;this.resolveHash[Aa]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Aa++,id:s})}};const wa=new hf;function Rs(i,t,e){i.resource.internal=!0;const s=new D(i),r=()=>{delete t.promiseCache[e],Ie.has(e)&&Ie.remove(e)};return s.baseTexture.once("destroyed",()=>{e in t.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),r())}),s.once("destroyed",()=>{i.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),r())}),s}var lf=Object.defineProperty,Sa=Object.getOwnPropertySymbols,uf=Object.prototype.hasOwnProperty,cf=Object.prototype.propertyIsEnumerable,Ia=(i,t,e)=>t in i?lf(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ra=(i,t)=>{for(var e in t||(t={}))uf.call(t,e)&&Ia(i,e,t[e]);if(Sa)for(var e of Sa(t))cf.call(t,e)&&Ia(i,e,t[e]);return i};const df=[".jpeg",".jpg",".png",".webp",".avif"],ff=["image/jpeg","image/png","image/webp","image/avif"];async function pf(i){const t=await O.ADAPTER.fetch(i);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${t.status} ${t.statusText}`);const e=await t.blob();return await createImageBitmap(e)}const Ii={name:"loadTextures",extension:{type:C.LoadParser,priority:Ut.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return Ze(i,ff)||ve(i,df)},async load(i,t,e){var s,r;const n=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let a;n?this.config.preferWorkers&&await wa.isImageBitmapSupported()?a=await wa.loadImageBitmap(i):a=await pf(i):a=await new Promise((l,u)=>{const c=new Image;c.crossOrigin=this.config.crossOrigin,c.src=i,c.complete?l(c):(c.onload=()=>l(c),c.onerror=d=>u(d))});const o=Ra({},t.data);(s=o.resolution)!=null||(o.resolution=Zt(i)),n&&((r=o.resourceOptions)==null?void 0:r.ownsImageBitmap)===void 0&&(o.resourceOptions=Ra({},o.resourceOptions),o.resourceOptions.ownsImageBitmap=!0);const h=new X(a,o);return h.resource.src=i,Rs(h,e,i)},unload(i){i.destroy(!0)}};N.add(Ii);var mf=Object.defineProperty,Ca=Object.getOwnPropertySymbols,gf=Object.prototype.hasOwnProperty,_f=Object.prototype.propertyIsEnumerable,Pa=(i,t,e)=>t in i?mf(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,vf=(i,t)=>{for(var e in t||(t={}))gf.call(t,e)&&Pa(i,e,t[e]);if(Ca)for(var e of Ca(t))_f.call(t,e)&&Pa(i,e,t[e]);return i};const yf=".svg",xf="image/svg+xml",bf={extension:{type:C.LoadParser,priority:Ut.High},name:"loadSVG",test(i){return Ze(i,xf)||ve(i,yf)},async testParse(i){return Nr.test(i)},async parse(i,t,e){var s;const r=new Nr(i,(s=t==null?void 0:t.data)==null?void 0:s.resourceOptions);await r.load();const n=new X(r,vf({resolution:Zt(i)},t==null?void 0:t.data));return n.resource.src=t.src,Rs(n,e,t.src)},async load(i,t){return(await O.ADAPTER.fetch(i)).text()},unload:Ii.unload};N.add(bf);var Tf=Object.defineProperty,Ma=Object.getOwnPropertySymbols,Ef=Object.prototype.hasOwnProperty,Af=Object.prototype.propertyIsEnumerable,Da=(i,t,e)=>t in i?Tf(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Oa=(i,t)=>{for(var e in t||(t={}))Ef.call(t,e)&&Da(i,e,t[e]);if(Ma)for(var e of Ma(t))Af.call(t,e)&&Da(i,e,t[e]);return i};const wf=[".mp4",".m4v",".webm",".ogv"],Sf=["video/mp4","video/webm","video/ogg"],If={name:"loadVideo",extension:{type:C.LoadParser,priority:Ut.High},config:{defaultAutoPlay:!0},test(i){return Ze(i,Sf)||ve(i,wf)},async load(i,t,e){var s;let r;const n=await(await O.ADAPTER.fetch(i)).blob(),a=URL.createObjectURL(n);try{const o=Oa({autoPlay:this.config.defaultAutoPlay},(s=t==null?void 0:t.data)==null?void 0:s.resourceOptions),h=new lh(a,o);await h.load();const l=new X(h,Oa({alphaMode:await co(),resolution:Zt(i)},t==null?void 0:t.data));l.resource.src=i,r=Rs(l,e,i),r.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(a)})}catch(o){throw URL.revokeObjectURL(a),o}return r},unload(i){i.destroy(!0)}};N.add(If);var Rf=Object.defineProperty,Cf=Object.defineProperties,Pf=Object.getOwnPropertyDescriptors,Ba=Object.getOwnPropertySymbols,Mf=Object.prototype.hasOwnProperty,Df=Object.prototype.propertyIsEnumerable,Fa=(i,t,e)=>t in i?Rf(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Fe=(i,t)=>{for(var e in t||(t={}))Mf.call(t,e)&&Fa(i,e,t[e]);if(Ba)for(var e of Ba(t))Df.call(t,e)&&Fa(i,e,t[e]);return i},Na=(i,t)=>Cf(i,Pf(t));class Of{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,s,r;if(this._bundleIdConnector=(e=t.connector)!=null?e:this._bundleIdConnector,this._createBundleAssetId=(s=t.createBundleAssetId)!=null?s:this._createBundleAssetId,this._extractAssetIdFromBundle=(r=t.extractAssetIdFromBundle)!=null?r: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(s=>`${encodeURIComponent(s)}=${encodeURIComponent(e[s])}`).join("&")}}addManifest(t){this._manifest,this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const s=[];Array.isArray(e)?e.forEach(r=>{var n,a;const o=(n=r.src)!=null?n:r.srcs,h=(a=r.alias)!=null?a:r.name;let l;if(typeof h=="string"){const u=this._createBundleAssetId(t,h);s.push(u),l=[h,u]}else{const u=h.map(c=>this._createBundleAssetId(t,c));s.push(...u),l=[...h,...u]}this.add(Na(Fe({},r),{alias:l,src:o}))}):Object.keys(e).forEach(r=>{var n;const a=[r,this._createBundleAssetId(t,r)];if(typeof e[r]=="string")this.add({alias:a,src:e[r]});else if(Array.isArray(e[r]))this.add({alias:a,src:e[r]});else{const o=e[r],h=(n=o.src)!=null?n:o.srcs;this.add(Na(Fe({},o),{alias:a,src:Array.isArray(h)?h:[h]}))}s.push(...a)}),this._bundles[t]=s}add(t,e,s,r,n){const a=[];typeof t=="string"||Array.isArray(t)&&typeof t[0]=="string"?a.push({alias:t,src:e,data:s,format:r,loadParser:n}):Array.isArray(t)?a.push(...t):a.push(t);let o;Nt(a).forEach(h=>{const{alias:l,name:u,src:c,srcs:d}=h;let{data:f,format:p,loadParser:m}=h;const g=Nt(c||d).map(_=>typeof _=="string"?Cd(_):Array.isArray(_)?_:[_]),y=Nt(l||u),x=[];g.forEach(_=>{_.forEach(v=>{var T,B,w;let E={};if(typeof v!="object"){E.src=v;for(let M=0;M<this._parsers.length;M++){const U=this._parsers[M];if(U.test(v)){E=U.parse(v);break}}}else f=(T=v.data)!=null?T:f,p=(B=v.format)!=null?B:p,m=(w=v.loadParser)!=null?w:m,E=Fe(Fe({},E),v);E=this.buildResolvedAsset(E,{aliases:y,data:f,format:p,loadParser:m}),x.push(E)})}),y.forEach(_=>{this._assetMap[_]=x})})}resolveBundle(t){const e=gi(t);t=Nt(t);const s={};return t.forEach(r=>{const n=this._bundles[r];if(n){const a=this.resolve(n),o={};for(const h in a){const l=a[h];o[this._extractAssetIdFromBundle(r,h)]=l}s[r]=o}}),e?s[t[0]]:s}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const s={};for(const r in e)s[r]=e[r].src;return s}return e.src}resolve(t){const e=gi(t);t=Nt(t);const s={};return t.forEach(r=>{var n;if(!this._resolverHash[r])if(this._assetMap[r]){let a=this._assetMap[r];const o=a[0],h=this._getPreferredOrder(a);h==null||h.priority.forEach(l=>{h.params[l].forEach(u=>{const c=a.filter(d=>d[l]?d[l]===u:!1);c.length&&(a=c)})}),this._resolverHash[r]=(n=a[0])!=null?n:o}else this._resolverHash[r]=this.buildResolvedAsset({alias:[r],src:r},{});s[r]=this._resolverHash[r]}),e?s[t[0]]:s}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const s=t[0],r=this._preferredOrder.find(n=>n.params.format.includes(s.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}buildResolvedAsset(t,e){var s;const{aliases:r,data:n,loadParser:a,format:o}=e;return(this._basePath||this._rootPath)&&(t.src=vt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=(s=r!=null?r:t.alias)!=null?s:[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data=Fe(Fe({},n||{}),t.data),t.loadParser=a!=null?a:t.loadParser,t.format=o!=null?o:t.src.split(".").pop(),t.srcs=t.src,t.name=t.alias,t}}class Bf{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Of,this.loader=new Ud,this.cache=Ie,this._backgroundLoader=new Rd(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var e,s,r;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 h=t.manifest;typeof h=="string"&&(h=await this.load(h)),this.resolver.addManifest(h)}const n=(s=(e=t.texturePreference)==null?void 0:e.resolution)!=null?s:1,a=typeof n=="number"?[n]:n,o=await this._detectFormats({preferredFormats:(r=t.texturePreference)==null?void 0:r.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:o,resolution:a}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,s,r,n){this.resolver.add(t,e,s,r,n)}async load(t,e){this._initialized||await this.init();const s=gi(t),r=Nt(t).map(o=>{if(typeof o!="string"){this.add(o);const h=o.src||o.srcs,l=o.alias||o.name;return l&&Array.isArray(l)?l[0]:h&&Array.isArray(h)?h[0]:l||h}return this.resolver.hasKey(o)||this.add({alias:o,src:o}),o}),n=this.resolver.resolve(r),a=await this._mapLoadToResolve(n,e);return s?a[r[0]]:a}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let s=!1;typeof t=="string"&&(s=!0,t=[t]);const r=this.resolver.resolveBundle(t),n={},a=Object.keys(r);let o=0,h=0;const l=()=>{e==null||e(++o/h)},u=a.map(c=>{const d=r[c];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{n[c]=f})});return await Promise.all(u),s?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(s=>{this._backgroundLoader.add(Object.values(s))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return Ie.get(t);const e={};for(let s=0;s<t.length;s++)e[s]=Ie.get(t[s]);return e}async _mapLoadToResolve(t,e){const s=Object.values(t),r=Object.keys(t);this._backgroundLoader.active=!1;const n=await this.loader.load(s,e);this._backgroundLoader.active=!0;const a={};return s.forEach((o,h)=>{const l=n[o.src],u=[o.src];o.alias&&u.push(...o.alias),a[r[h]]=l,Ie.set(u,l)}),a}async unload(t){this._initialized||await this.init();const e=Nt(t).map(r=>typeof r!="string"?r.src:r),s=this.resolver.resolve(e);await this._unloadFromResolved(s)}async unloadBundle(t){this._initialized||await this.init(),t=Nt(t);const e=this.resolver.resolveBundle(t),s=Object.keys(e).map(r=>this._unloadFromResolved(e[r]));await Promise.all(s)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(s=>{Ie.remove(s.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const s of t.detections)t.skipDetections||await s.test()?e=await s.add(e):t.skipDetections||(e=await s.remove(e));return e=e.filter((s,r)=>e.indexOf(s)===r),e}get detections(){return this._detections}get preferWorkers(){return Ii.config.preferWorkers}set preferWorkers(t){this.setPreferences({preferWorkers:t})}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(s=>s in t).forEach(s=>{e.config[s]=t[s]})})}}const Xs=new Bf;N.handleByList(C.LoadParser,Xs.loader.parsers).handleByList(C.ResolveParser,Xs.resolver.parsers).handleByList(C.CacheParser,Xs.cache.parsers).handleByList(C.DetectionParser,Xs.detections);const Ff={extension:C.CacheParser,test:i=>Array.isArray(i)&&i.every(t=>t instanceof D),getCacheableAssets:(i,t)=>{const e={};return i.forEach(s=>{t.forEach((r,n)=>{e[s+(n===0?"":n+1)]=r})}),e}};N.add(Ff);const Nf={extension:{type:C.DetectionParser,priority:1},test:async()=>{const i="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=";return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i})},add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};N.add(Nf);const Lf={extension:{type:C.DetectionParser,priority:0},test:async()=>{const i="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=";return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i})},add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};N.add(Lf);const La=["png","jpg","jpeg"],Uf={extension:{type:C.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...La],remove:async i=>i.filter(t=>!La.includes(t))};N.add(Uf);const kf="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function mn(i){return kf?!1:document.createElement("video").canPlayType(i)!==""}const Gf={extension:{type:C.DetectionParser,priority:0},test:async()=>mn("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};N.add(Gf);const $f={extension:{type:C.DetectionParser,priority:0},test:async()=>mn("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};N.add($f);const Hf={extension:{type:C.DetectionParser,priority:0},test:async()=>mn("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};N.add(Hf);const Vf={extension:C.ResolveParser,test:Ii.test,parse:i=>{var t,e;return{resolution:parseFloat((e=(t=O.RETINA_PREFIX.exec(i))==null?void 0:t[1])!=null?e:"1"),format:i.split(".").pop(),src:i}}};N.add(Vf);var At=(i=>(i[i.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",i[i.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",i[i.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",i[i.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",i[i.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",i[i.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",i[i.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",i[i.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",i[i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",i[i.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",i[i.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",i[i.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",i))(At||{});const _i={33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,35840:.5,35842:.5,35841:.25,35843:.25,36196:.5,35986:.5,35986:1,34798:1,37808:1};let te,Ge;function Ua(){Ge={s3tc:te.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:te.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:te.getExtension("WEBGL_compressed_texture_etc"),etc1:te.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:te.getExtension("WEBGL_compressed_texture_pvrtc")||te.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:te.getExtension("WEBGL_compressed_texture_atc"),astc:te.getExtension("WEBGL_compressed_texture_astc")}}const Xf={extension:{type:C.DetectionParser,priority:2},test:async()=>{const i=O.ADAPTER.createCanvas().getContext("webgl");return i?(te=i,!0):!1},add:async i=>{Ge||Ua();const t=[];for(const e in Ge)Ge[e]&&t.push(e);return[...t,...i]},remove:async i=>(Ge||Ua(),i.filter(t=>!(t in Ge)))};N.add(Xf);class jf extends wi{constructor(t,e={width:1,height:1,autoLoad:!0}){let s,r;typeof t=="string"?(s=t,r=new Uint8Array):(s=null,r=t),super(r,e),this.origin=s,this.buffer=r?new Er(r):null,this._load=null,this.loaded=!1,this.origin!==null&&e.autoLoad!==!1&&this.load(),this.origin===null&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}load(){return this._load?this._load:(this._load=fetch(this.origin).then(t=>t.blob()).then(t=>t.arrayBuffer()).then(t=>(this.data=new Uint32Array(t),this.buffer=new Er(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class Ce extends jf{constructor(t,e){super(t,e),this.format=e.format,this.levels=e.levels||1,this._width=e.width,this._height=e.height,this._extension=Ce._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||Ce._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,s){const r=t.gl;if(!t.context.extensions[this._extension])throw new Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;r.pixelStorei(r.UNPACK_ALIGNMENT,4);for(let n=0,a=this.levels;n<a;n++){const{levelID:o,levelWidth:h,levelHeight:l,levelBuffer:u}=this._levelBuffers[n];r.compressedTexImage2D(r.TEXTURE_2D,o,this.format,h,l,0,u)}return!0}onBlobLoaded(){this._levelBuffers=Ce._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(t){if(t>=33776&&t<=33779)return"s3tc";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(t>=36196)return"etc1";if(t>=35986&&t<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")}static _createLevelBuffers(t,e,s,r,n,a,o){const h=new Array(s);let l=t.byteOffset,u=a,c=o,d=u+r-1&~(r-1),f=c+n-1&~(n-1),p=d*f*_i[e];for(let m=0;m<s;m++)h[m]={levelID:m,levelWidth:s>1?u:d,levelHeight:s>1?c:f,levelBuffer:new Uint8Array(t.buffer,l,p)},l+=p,u=u>>1||1,c=c>>1||1,d=u+r-1&~(r-1),f=c+n-1&~(n-1),p=d*f*_i[e];return h}}const er=4,js=124,zf=32,ka=20,Wf=542327876,zs={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},Yf={SIZE:0,FLAGS:1,FOURCC:2,RGB_BITCOUNT:3,R_BIT_MASK:4,G_BIT_MASK:5,B_BIT_MASK:6,A_BIT_MASK:7},Ws={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},qf=1,Kf=2,Zf=4,Qf=64,Jf=512,tp=131072,ep=827611204,sp=861165636,ip=894720068,rp=808540228,np=4,ap={[ep]:At.COMPRESSED_RGBA_S3TC_DXT1_EXT,[sp]:At.COMPRESSED_RGBA_S3TC_DXT3_EXT,[ip]:At.COMPRESSED_RGBA_S3TC_DXT5_EXT},op={70:At.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:At.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:At.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:At.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:At.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:At.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:At.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:At.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:At.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT};function hp(i){const t=new Uint32Array(i);if(t[0]!==Wf)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(i,0,js/Uint32Array.BYTES_PER_ELEMENT),s=e[zs.HEIGHT],r=e[zs.WIDTH],n=e[zs.MIPMAP_COUNT],a=new Uint32Array(i,zs.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,zf/Uint32Array.BYTES_PER_ELEMENT),o=a[qf];if(o&Zf){const h=a[Yf.FOURCC];if(h!==rp){const x=ap[h],_=er+js,v=new Uint8Array(i,_);return[new Ce(v,{format:x,width:r,height:s,levels:n})]}const l=er+js,u=new Uint32Array(t.buffer,l,ka/Uint32Array.BYTES_PER_ELEMENT),c=u[Ws.DXGI_FORMAT],d=u[Ws.RESOURCE_DIMENSION],f=u[Ws.MISC_FLAG],p=u[Ws.ARRAY_SIZE],m=op[c];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${c}`);if(f===np)throw new Error("DDSParser does not support cubemap textures");if(d===6)throw new Error("DDSParser does not supported 3D texture data");const g=new Array,y=er+js+ka;if(p===1)g.push(new Uint8Array(i,y));else{const x=_i[m];let _=0,v=r,T=s;for(let w=0;w<n;w++){const E=Math.max(1,v+3&-4),M=Math.max(1,T+3&-4),U=E*M*x;_+=U,v=v>>>1,T=T>>>1}let B=y;for(let w=0;w<p;w++)g.push(new Uint8Array(i,B,_)),B+=_}return g.map(x=>new Ce(x,{format:m,width:r,height:s,levels:n}))}throw o&Qf?new Error("DDSParser does not support uncompressed texture data."):o&Jf?new Error("DDSParser does not supported YUV uncompressed texture data."):o&tp?new Error("DDSParser does not support single-channel (lumninance) texture data!"):o&Kf?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!")}const Ga=[171,75,84,88,32,49,49,187,13,10,26,10],lp=67305985,Ot={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},Wr=64,$a={[k.UNSIGNED_BYTE]:1,[k.UNSIGNED_SHORT]:2,[k.INT]:4,[k.UNSIGNED_INT]:4,[k.FLOAT]:4,[k.HALF_FLOAT]:8},up={[A.RGBA]:4,[A.RGB]:3,[A.RG]:2,[A.RED]:1,[A.LUMINANCE]:1,[A.LUMINANCE_ALPHA]:2,[A.ALPHA]:1},cp={[k.UNSIGNED_SHORT_4_4_4_4]:2,[k.UNSIGNED_SHORT_5_5_5_1]:2,[k.UNSIGNED_SHORT_5_6_5]:2};function dp(i,t,e=!1){const s=new DataView(t);if(!fp(i,s))return null;const r=s.getUint32(Ot.ENDIANNESS,!0)===lp,n=s.getUint32(Ot.GL_TYPE,r),a=s.getUint32(Ot.GL_FORMAT,r),o=s.getUint32(Ot.GL_INTERNAL_FORMAT,r),h=s.getUint32(Ot.PIXEL_WIDTH,r),l=s.getUint32(Ot.PIXEL_HEIGHT,r)||1,u=s.getUint32(Ot.PIXEL_DEPTH,r)||1,c=s.getUint32(Ot.NUMBER_OF_ARRAY_ELEMENTS,r)||1,d=s.getUint32(Ot.NUMBER_OF_FACES,r),f=s.getUint32(Ot.NUMBER_OF_MIPMAP_LEVELS,r),p=s.getUint32(Ot.BYTES_OF_KEY_VALUE_DATA,r);if(l===0||u!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(c!==1)throw new Error("WebGL does not support array textures");const m=4,g=4,y=h+3&-4,x=l+3&-4,_=new Array(c);let v=h*l;n===0&&(v=y*x);let T;if(n!==0?$a[n]?T=$a[n]*up[a]:T=cp[n]:T=_i[o],T===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const B=e?mp(s,p,r):null;let w=v*T,E=h,M=l,U=y,W=x,F=Wr+p;for(let b=0;b<f;b++){const S=s.getUint32(F,r);let G=F+4;for(let z=0;z<c;z++){let $=_[z];$||($=_[z]=new Array(f)),$[b]={levelID:b,levelWidth:f>1||n!==0?E:U,levelHeight:f>1||n!==0?M:W,levelBuffer:new Uint8Array(t,G,w)},G+=w}F+=S+4,F=F%4!==0?F+4-F%4:F,E=E>>1||1,M=M>>1||1,U=E+m-1&~(m-1),W=M+g-1&~(g-1),w=U*W*T}return n!==0?{uncompressed:_.map(b=>{let S=b[0].levelBuffer,G=!1;return n===k.FLOAT?S=new Float32Array(b[0].levelBuffer.buffer,b[0].levelBuffer.byteOffset,b[0].levelBuffer.byteLength/4):n===k.UNSIGNED_INT?(G=!0,S=new Uint32Array(b[0].levelBuffer.buffer,b[0].levelBuffer.byteOffset,b[0].levelBuffer.byteLength/4)):n===k.INT&&(G=!0,S=new Int32Array(b[0].levelBuffer.buffer,b[0].levelBuffer.byteOffset,b[0].levelBuffer.byteLength/4)),{resource:new wi(S,{width:b[0].levelWidth,height:b[0].levelHeight}),type:n,format:G?pp(a):a}}),kvData:B}:{compressed:_.map(b=>new Ce(null,{format:o,width:h,height:l,levels:f,levelBuffers:b})),kvData:B}}function fp(i,t){for(let e=0;e<Ga.length;e++)if(t.getUint8(e)!==Ga[e])return!1;return!0}function pp(i){switch(i){case A.RGBA:return A.RGBA_INTEGER;case A.RGB:return A.RGB_INTEGER;case A.RG:return A.RG_INTEGER;case A.RED:return A.RED_INTEGER;default:return i}}function mp(i,t,e){const s=new Map;let r=0;for(;r<t;){const n=i.getUint32(Wr+r,e),a=Wr+r+4,o=3-(n+3)%4;if(n===0||n>t-r){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h<n&&i.getUint8(a+h)!==0;h++);if(h===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const l=new TextDecoder().decode(new Uint8Array(i.buffer,a,h)),u=new DataView(i.buffer,a+h+1,n-h-1);s.set(l,u),r+=4+n+o}return s}var gp=Object.defineProperty,Ha=Object.getOwnPropertySymbols,_p=Object.prototype.hasOwnProperty,vp=Object.prototype.propertyIsEnumerable,Va=(i,t,e)=>t in i?gp(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,yp=(i,t)=>{for(var e in t||(t={}))_p.call(t,e)&&Va(i,e,t[e]);if(Ha)for(var e of Ha(t))vp.call(t,e)&&Va(i,e,t[e]);return i};const xp={extension:{type:C.LoadParser,priority:Ut.High},name:"loadDDS",test(i){return ve(i,".dds")},async load(i,t,e){const s=await(await O.ADAPTER.fetch(i)).arrayBuffer(),r=hp(s).map(n=>{const a=new X(n,yp({mipmap:Kt.OFF,alphaMode:bt.NO_PREMULTIPLIED_ALPHA,resolution:Zt(i)},t.data));return Rs(a,e,i)});return r.length===1?r[0]:r},unload(i){Array.isArray(i)?i.forEach(t=>t.destroy(!0)):i.destroy(!0)}};N.add(xp);var bp=Object.defineProperty,Xa=Object.getOwnPropertySymbols,Tp=Object.prototype.hasOwnProperty,Ep=Object.prototype.propertyIsEnumerable,ja=(i,t,e)=>t in i?bp(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ap=(i,t)=>{for(var e in t||(t={}))Tp.call(t,e)&&ja(i,e,t[e]);if(Xa)for(var e of Xa(t))Ep.call(t,e)&&ja(i,e,t[e]);return i};const wp={extension:{type:C.LoadParser,priority:Ut.High},name:"loadKTX",test(i){return ve(i,".ktx")},async load(i,t,e){const s=await(await O.ADAPTER.fetch(i)).arrayBuffer(),{compressed:r,uncompressed:n,kvData:a}=dp(i,s),o=r!=null?r:n,h=Ap({mipmap:Kt.OFF,alphaMode:bt.NO_PREMULTIPLIED_ALPHA,resolution:Zt(i)},t.data),l=o.map(u=>{var c;o===n&&Object.assign(h,{type:u.type,format:u.format});const d=(c=u.resource)!=null?c:u,f=new X(d,h);return f.ktxKeyValueData=a,Rs(f,e,i)});return l.length===1?l[0]:l},unload(i){Array.isArray(i)?i.forEach(t=>t.destroy(!0)):i.destroy(!0)}};N.add(wp);const Sp={extension:C.ResolveParser,test:i=>{const t=i.split("?")[0].split(".").pop();return["basis","ktx","dds"].includes(t)},parse:i=>{var t,e,s,r;if(i.split("?")[0].split(".").pop()==="ktx"){const n=[".s3tc.ktx",".s3tc_sRGB.ktx",".etc.ktx",".etc1.ktx",".pvrt.ktx",".atc.ktx",".astc.ktx"];if(n.some(a=>i.endsWith(a)))return{resolution:parseFloat((e=(t=O.RETINA_PREFIX.exec(i))==null?void 0:t[1])!=null?e:"1"),format:n.find(a=>i.endsWith(a)),src:i}}return{resolution:parseFloat((r=(s=O.RETINA_PREFIX.exec(i))==null?void 0:s[1])!=null?r:"1"),format:i.split(".").pop(),src:i}}};N.add(Sp);const Ys=new j,Ip=4,gh=class us{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){var t;const e=(t=this.renderer)==null?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}async image(t,e,s,r){const n=new Image;return n.src=await this.base64(t,e,s,r),n}async base64(t,e,s,r){const n=this.canvas(t,r);if(n.toBlob!==void 0)return new Promise((a,o)=>{n.toBlob(h=>{if(!h){o(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>a(l.result),l.onerror=o,l.readAsDataURL(h)},e,s)});if(n.toDataURL!==void 0)return n.toDataURL(e,s);if(n.convertToBlob!==void 0){const a=await n.convertToBlob({type:e,quality:s});return new Promise((o,h)=>{const l=new FileReader;l.onload=()=>o(l.result),l.onerror=h,l.readAsDataURL(a)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const{pixels:s,width:r,height:n,flipY:a,premultipliedAlpha:o}=this._rawPixels(t,e);a&&us._flipY(s,r,n),o&&us._unpremultiplyAlpha(s);const h=new bo(r,n,1),l=new ImageData(new Uint8ClampedArray(s.buffer),r,n);return h.context.putImageData(l,0,0),h.canvas}pixels(t,e){const{pixels:s,width:r,height:n,flipY:a,premultipliedAlpha:o}=this._rawPixels(t,e);return a&&us._flipY(s,r,n),o&&us._unpremultiplyAlpha(s),s}_rawPixels(t,e){const s=this.renderer;if(!s)throw new Error("The Extract has already been destroyed");let r,n=!1,a=!1,o,h=!1;t&&(t instanceof Oe?o=t:(o=s.generateTexture(t,{region:e,resolution:s.resolution,multisample:s.multisample}),h=!0,e&&(Ys.width=e.width,Ys.height=e.height,e=Ys)));const l=s.gl;if(o){if(r=o.baseTexture.resolution,e=e!=null?e:o.frame,n=!1,a=o.baseTexture.alphaMode>0&&o.baseTexture.format===A.RGBA,!h){s.renderTexture.bind(o);const f=o.framebuffer.glFramebuffers[s.CONTEXT_UID];f.blitFramebuffer&&s.framebuffer.bind(f.blitFramebuffer)}}else r=s.resolution,e||(e=Ys,e.width=s.width/r,e.height=s.height/r),n=!0,a=this._rendererPremultipliedAlpha,s.renderTexture.bind();const u=Math.max(Math.round(e.width*r),1),c=Math.max(Math.round(e.height*r),1),d=new Uint8Array(Ip*u*c);return l.readPixels(Math.round(e.x*r),Math.round(e.y*r),u,c,l.RGBA,l.UNSIGNED_BYTE,d),h&&(o==null||o.destroy(!0)),{pixels:d,width:u,height:c,flipY:n,premultipliedAlpha:a}}destroy(){this.renderer=null}static _flipY(t,e,s){const r=e<<2,n=s>>1,a=new Uint8Array(r);for(let o=0;o<n;o++){const h=o*r,l=(s-o-1)*r;a.set(t.subarray(h,h+r)),t.copyWithin(h,l,l+r),t.set(a,l)}}static _unpremultiplyAlpha(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));const e=t.length;for(let s=0;s<e;s+=4){const r=t[s+3];if(r!==0){const n=255.001/r;t[s]=t[s]*n+.5,t[s+1]=t[s+1]*n+.5,t[s+2]=t[s+2]*n+.5}}}};gh.extension={name:"extract",type:C.RendererSystem};let Rp=gh;N.add(Rp);const Ts={build(i){const t=i.points;let e,s,r,n,a,o;if(i.type===mt.CIRC){const p=i.shape;e=p.x,s=p.y,a=o=p.radius,r=n=0}else if(i.type===mt.ELIP){const p=i.shape;e=p.x,s=p.y,a=p.width,o=p.height,r=n=0}else{const p=i.shape,m=p.width/2,g=p.height/2;e=p.x+m,s=p.y+g,a=o=Math.max(0,Math.min(p.radius,Math.min(m,g))),r=m-a,n=g-o}if(!(a>=0&&o>=0&&r>=0&&n>=0)){t.length=0;return}const h=Math.ceil(2.3*Math.sqrt(a+o)),l=h*8+(r?4:0)+(n?4:0);if(t.length=l,l===0)return;if(h===0){t.length=8,t[0]=t[6]=e+r,t[1]=t[3]=s+n,t[2]=t[4]=e-r,t[5]=t[7]=s-n;return}let u=0,c=h*4+(r?2:0)+2,d=c,f=l;{const p=r+a,m=n,g=e+p,y=e-p,x=s+m;if(t[u++]=g,t[u++]=x,t[--c]=x,t[--c]=y,n){const _=s-m;t[d++]=y,t[d++]=_,t[--f]=_,t[--f]=g}}for(let p=1;p<h;p++){const m=Math.PI/2*(p/h),g=r+Math.cos(m)*a,y=n+Math.sin(m)*o,x=e+g,_=e-g,v=s+y,T=s-y;t[u++]=x,t[u++]=v,t[--c]=v,t[--c]=_,t[d++]=_,t[d++]=T,t[--f]=T,t[--f]=x}{const p=r,m=n+o,g=e+p,y=e-p,x=s+m,_=s-m;t[u++]=g,t[u++]=x,t[--f]=_,t[--f]=g,r&&(t[u++]=y,t[u++]=x,t[--f]=_,t[--f]=y)}},triangulate(i,t){const e=i.points,s=t.points,r=t.indices;if(e.length===0)return;let n=s.length/2;const a=n;let o,h;if(i.type!==mt.RREC){const u=i.shape;o=u.x,h=u.y}else{const u=i.shape;o=u.x+u.width/2,h=u.y+u.height/2}const l=i.matrix;s.push(i.matrix?l.a*o+l.c*h+l.tx:o,i.matrix?l.b*o+l.d*h+l.ty:h),n++,s.push(e[0],e[1]);for(let u=2;u<e.length;u+=2)s.push(e[u],e[u+1]),r.push(n++,a,n);r.push(a+1,a,n)}};function za(i,t=!1){const e=i.length;if(e<6)return;let s=0;for(let r=0,n=i[e-2],a=i[e-1];r<e;r+=2){const o=i[r],h=i[r+1];s+=(o-n)*(h+a),n=o,a=h}if(!t&&s>0||t&&s<=0){const r=e/2;for(let n=r+r%2;n<e;n+=2){const a=e-n-2,o=e-n-1,h=n,l=n+1;[i[a],i[h]]=[i[h],i[a]],[i[o],i[l]]=[i[l],i[o]]}}}const gn={build(i){i.points=i.shape.points.slice()},triangulate(i,t){let e=i.points;const s=i.holes,r=t.points,n=t.indices;if(e.length>=6){za(e,!1);const a=[];for(let l=0;l<s.length;l++){const u=s[l];za(u.points,!0),a.push(e.length/2),e=e.concat(u.points)}const o=lo(e,a,2);if(!o)return;const h=r.length/2;for(let l=0;l<o.length;l+=3)n.push(o[l]+h),n.push(o[l+1]+h),n.push(o[l+2]+h);for(let l=0;l<e.length;l++)r.push(e[l])}}},_h={build(i){const t=i.shape,e=t.x,s=t.y,r=t.width,n=t.height,a=i.points;a.length=0,r>=0&&n>=0&&a.push(e,s,e+r,s,e+r,s+n,e,s+n)},triangulate(i,t){const e=i.points,s=t.points;if(e.length===0)return;const r=s.length/2;s.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(r,r+1,r+2,r+1,r+2,r+3)}},vh={build(i){Ts.build(i)},triangulate(i,t){Ts.triangulate(i,t)}};var St=(i=>(i.MITER="miter",i.BEVEL="bevel",i.ROUND="round",i))(St||{}),ce=(i=>(i.BUTT="butt",i.ROUND="round",i.SQUARE="square",i))(ce||{});const Me={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(i,t=20){if(!this.adaptive||!i||isNaN(i))return t;let e=Math.ceil(i/this.maxLength);return e<this.minSegments?e=this.minSegments:e>this.maxSegments&&(e=this.maxSegments),e}},Gm=Me;class Yr{static curveTo(t,e,s,r,n,a){const o=a[a.length-2],h=a[a.length-1]-e,l=o-t,u=r-e,c=s-t,d=Math.abs(h*c-l*u);if(d<1e-8||n===0)return(a[a.length-2]!==t||a[a.length-1]!==e)&&a.push(t,e),null;const f=h*h+l*l,p=u*u+c*c,m=h*u+l*c,g=n*Math.sqrt(f)/d,y=n*Math.sqrt(p)/d,x=g*m/f,_=y*m/p,v=g*c+y*l,T=g*u+y*h,B=l*(y+x),w=h*(y+x),E=c*(g+_),M=u*(g+_),U=Math.atan2(w-T,B-v),W=Math.atan2(M-T,E-v);return{cx:v+t,cy:T+e,radius:n,startAngle:U,endAngle:W,anticlockwise:l*u>c*h}}static arc(t,e,s,r,n,a,o,h,l){const u=o-a,c=Me._segmentsCount(Math.abs(u)*n,Math.ceil(Math.abs(u)/li)*40),d=u/(c*2),f=d*2,p=Math.cos(d),m=Math.sin(d),g=c-1,y=g%1/g;for(let x=0;x<=g;++x){const _=x+y*x,v=d+a+f*_,T=Math.cos(v),B=-Math.sin(v);l.push((p*T+m*B)*n+s,(p*-B+m*T)*n+r)}}}class yh{constructor(){this.reset()}begin(t,e,s){this.reset(),this.style=t,this.start=e,this.attribStart=s}end(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}class Ri{static curveLength(t,e,s,r,n,a,o,h){let l=0,u=0,c=0,d=0,f=0,p=0,m=0,g=0,y=0,x=0,_=0,v=t,T=e;for(let B=1;B<=10;++B)u=B/10,c=u*u,d=c*u,f=1-u,p=f*f,m=p*f,g=m*t+3*p*u*s+3*f*c*n+d*o,y=m*e+3*p*u*r+3*f*c*a+d*h,x=v-g,_=T-y,v=g,T=y,l+=Math.sqrt(x*x+_*_);return l}static curveTo(t,e,s,r,n,a,o){const h=o[o.length-2],l=o[o.length-1];o.length-=2;const u=Me._segmentsCount(Ri.curveLength(h,l,t,e,s,r,n,a));let c=0,d=0,f=0,p=0,m=0;o.push(h,l);for(let g=1,y=0;g<=u;++g)y=g/u,c=1-y,d=c*c,f=d*c,p=y*y,m=p*y,o.push(f*h+3*d*y*t+3*c*p*s+m*n,f*l+3*d*y*e+3*c*p*r+m*a)}}function Wa(i,t,e,s,r,n,a,o){const h=i-e*r,l=t-s*r,u=i+e*n,c=t+s*n;let d,f;a?(d=s,f=-e):(d=-s,f=e);const p=h+d,m=l+f,g=u+d,y=c+f;return o.push(p,m,g,y),2}function xe(i,t,e,s,r,n,a,o){const h=e-i,l=s-t;let u=Math.atan2(h,l),c=Math.atan2(r-i,n-t);o&&u<c?u+=Math.PI*2:!o&&u>c&&(c+=Math.PI*2);let d=u;const f=c-u,p=Math.abs(f),m=Math.sqrt(h*h+l*l),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,y=f/g;if(d+=y,o){a.push(i,t,e,s);for(let x=1,_=d;x<g;x++,_+=y)a.push(i,t,i+Math.sin(_)*m,t+Math.cos(_)*m);a.push(i,t,r,n)}else{a.push(e,s,i,t);for(let x=1,_=d;x<g;x++,_+=y)a.push(i+Math.sin(_)*m,t+Math.cos(_)*m,i,t);a.push(r,n,i,t)}return g*2}function Cp(i,t){const e=i.shape;let s=i.points||e.points.slice();const r=t.closePointEps;if(s.length===0)return;const n=i.lineStyle,a=new q(s[0],s[1]),o=new q(s[s.length-2],s[s.length-1]),h=e.type!==mt.POLY||e.closeStroke,l=Math.abs(a.x-o.x)<r&&Math.abs(a.y-o.y)<r;if(h){s=s.slice(),l&&(s.pop(),s.pop(),o.set(s[s.length-2],s[s.length-1]));const $=(a.x+o.x)*.5,V=(o.y+a.y)*.5;s.unshift($,V),s.push($,V)}const u=t.points,c=s.length/2;let d=s.length;const f=u.length/2,p=n.width/2,m=p*p,g=n.miterLimit*n.miterLimit;let y=s[0],x=s[1],_=s[2],v=s[3],T=0,B=0,w=-(x-v),E=y-_,M=0,U=0,W=Math.sqrt(w*w+E*E);w/=W,E/=W,w*=p,E*=p;const F=n.alignment,b=(1-F)*2,S=F*2;h||(n.cap===ce.ROUND?d+=xe(y-w*(b-S)*.5,x-E*(b-S)*.5,y-w*b,x-E*b,y+w*S,x+E*S,u,!0)+2:n.cap===ce.SQUARE&&(d+=Wa(y,x,w,E,b,S,!0,u))),u.push(y-w*b,x-E*b,y+w*S,x+E*S);for(let $=1;$<c-1;++$){y=s[($-1)*2],x=s[($-1)*2+1],_=s[$*2],v=s[$*2+1],T=s[($+1)*2],B=s[($+1)*2+1],w=-(x-v),E=y-_,W=Math.sqrt(w*w+E*E),w/=W,E/=W,w*=p,E*=p,M=-(v-B),U=_-T,W=Math.sqrt(M*M+U*U),M/=W,U/=W,M*=p,U*=p;const V=_-y,rt=x-v,R=_-T,I=B-v,Y=V*R+rt*I,Z=rt*R-I*V,Q=Z<0;if(Math.abs(Z)<.001*Math.abs(Y)){u.push(_-w*b,v-E*b,_+w*S,v+E*S),Y>=0&&(n.join===St.ROUND?d+=xe(_,v,_-w*b,v-E*b,_-M*b,v-U*b,u,!1)+4:d+=2,u.push(_-M*S,v-U*S,_+M*b,v+U*b));continue}const ct=(-w+y)*(-E+v)-(-w+_)*(-E+x),at=(-M+T)*(-U+v)-(-M+_)*(-U+B),dt=(V*at-R*ct)/Z,_t=(I*ct-rt*at)/Z,Tt=(dt-_)*(dt-_)+(_t-v)*(_t-v),pt=_+(dt-_)*b,J=v+(_t-v)*b,ot=_-(dt-_)*S,lt=v-(_t-v)*S,kt=Math.min(V*V+rt*rt,R*R+I*I),Gt=Q?b:S,Qe=kt+Gt*Gt*m,Hh=Tt<=Qe;let Cs=n.join;if(Cs===St.MITER&&Tt/m>g&&(Cs=St.BEVEL),Hh)switch(Cs){case St.MITER:{u.push(pt,J,ot,lt);break}case St.BEVEL:{Q?u.push(pt,J,_+w*S,v+E*S,pt,J,_+M*S,v+U*S):u.push(_-w*b,v-E*b,ot,lt,_-M*b,v-U*b,ot,lt),d+=2;break}case St.ROUND:{Q?(u.push(pt,J,_+w*S,v+E*S),d+=xe(_,v,_+w*S,v+E*S,_+M*S,v+U*S,u,!0)+4,u.push(pt,J,_+M*S,v+U*S)):(u.push(_-w*b,v-E*b,ot,lt),d+=xe(_,v,_-w*b,v-E*b,_-M*b,v-U*b,u,!1)+4,u.push(_-M*b,v-U*b,ot,lt));break}}else{switch(u.push(_-w*b,v-E*b,_+w*S,v+E*S),Cs){case St.MITER:{Q?u.push(ot,lt,ot,lt):u.push(pt,J,pt,J),d+=2;break}case St.ROUND:{Q?d+=xe(_,v,_+w*S,v+E*S,_+M*S,v+U*S,u,!0)+2:d+=xe(_,v,_-w*b,v-E*b,_-M*b,v-U*b,u,!1)+2;break}}u.push(_-M*b,v-U*b,_+M*S,v+U*S),d+=2}}y=s[(c-2)*2],x=s[(c-2)*2+1],_=s[(c-1)*2],v=s[(c-1)*2+1],w=-(x-v),E=y-_,W=Math.sqrt(w*w+E*E),w/=W,E/=W,w*=p,E*=p,u.push(_-w*b,v-E*b,_+w*S,v+E*S),h||(n.cap===ce.ROUND?d+=xe(_-w*(b-S)*.5,v-E*(b-S)*.5,_-w*b,v-E*b,_+w*S,v+E*S,u,!1)+2:n.cap===ce.SQUARE&&(d+=Wa(_,v,w,E,b,S,!1,u)));const G=t.indices,z=Me.epsilon*Me.epsilon;for(let $=f;$<d+f-2;++$)y=u[$*2],x=u[$*2+1],_=u[($+1)*2],v=u[($+1)*2+1],T=u[($+2)*2],B=u[($+2)*2+1],!(Math.abs(y*(v-B)+_*(B-x)+T*(x-v))<z)&&G.push($,$+1,$+2)}function Pp(i,t){let e=0;const s=i.shape,r=i.points||s.points,n=s.type!==mt.POLY||s.closeStroke;if(r.length===0)return;const a=t.points,o=t.indices,h=r.length/2,l=a.length/2;let u=l;for(a.push(r[0],r[1]),e=1;e<h;e++)a.push(r[e*2],r[e*2+1]),o.push(u,u+1),u++;n&&o.push(u,l)}function qr(i,t){i.lineStyle.native?Pp(i,t):Cp(i,t)}class Ci{static curveLength(t,e,s,r,n,a){const o=t-2*s+n,h=e-2*r+a,l=2*s-2*t,u=2*r-2*e,c=4*(o*o+h*h),d=4*(o*l+h*u),f=l*l+u*u,p=2*Math.sqrt(c+d+f),m=Math.sqrt(c),g=2*c*m,y=2*Math.sqrt(f),x=d/m;return(g*p+m*d*(p-y)+(4*f*c-d*d)*Math.log((2*m+x+p)/(x+y)))/(4*g)}static curveTo(t,e,s,r,n){const a=n[n.length-2],o=n[n.length-1],h=Me._segmentsCount(Ci.curveLength(a,o,t,e,s,r));let l=0,u=0;for(let c=1;c<=h;++c){const d=c/h;l=a+(t-a)*d,u=o+(e-o)*d,n.push(l+(t+(s-t)*d-l)*d,u+(e+(r-e)*d-u)*d)}}}const ii={[mt.POLY]:gn,[mt.CIRC]:Ts,[mt.ELIP]:Ts,[mt.RECT]:_h,[mt.RREC]:vh},Kr=[],cs=[];class vi{constructor(t,e=null,s=null,r=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=s,this.fillStyle=e,this.matrix=r,this.type=t.type}clone(){return new vi(this.shape,this.fillStyle,this.lineStyle,this.matrix)}destroy(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null}}const Ne=new q,xh=class bh extends So{constructor(){super(),this.closePointEps=1e-4,this.boundsPadding=0,this.uvsFloat32=null,this.indicesUint16=null,this.batchable=!1,this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.drawCalls=[],this.batchDirty=-1,this.batches=[],this.dirty=0,this.cacheDirty=-1,this.clearDirty=0,this.shapeIndex=0,this._bounds=new pi,this.boundsDirty=-1}get bounds(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds}invalidate(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(let t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),cs.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),Kr.push(e)}this.batches.length=0}clear(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,e=null,s=null,r=null){const n=new vi(t,e,s,r);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const s=new vi(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return s.lineStyle=r.lineStyle,r.holes.push(s),this.dirty++,this}destroy(){super.destroy();for(let t=0;t<this.graphicsData.length;++t)this.graphicsData[t].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null}containsPoint(t){const e=this.graphicsData;for(let s=0;s<e.length;++s){const r=e[s];if(r.fillStyle.visible&&r.shape&&(r.matrix?r.matrix.applyInverse(t,Ne):Ne.copyFrom(t),r.shape.contains(Ne.x,Ne.y))){let n=!1;if(r.holes){for(let a=0;a<r.holes.length;a++)if(r.holes[a].shape.contains(Ne.x,Ne.y)){n=!0;break}}if(!n)return!0}}return!1}updateBatches(){if(!this.graphicsData.length){this.batchable=!0;return}if(!this.validateBatching())return;this.cacheDirty=this.dirty;const t=this.uvs,e=this.graphicsData;let s=null,r=null;this.batches.length>0&&(s=this.batches[this.batches.length-1],r=s.style);for(let h=this.shapeIndex;h<e.length;h++){this.shapeIndex++;const l=e[h],u=l.fillStyle,c=l.lineStyle;ii[l.type].build(l),l.matrix&&this.transformPoints(l.points,l.matrix),(u.visible||c.visible)&&this.processHoles(l.holes);for(let d=0;d<2;d++){const f=d===0?u:c;if(!f.visible)continue;const p=f.texture.baseTexture,m=this.indices.length,g=this.points.length/2;p.wrapMode=re.REPEAT,d===0?this.processFill(l):this.processLine(l);const y=this.points.length/2-g;y!==0&&(s&&!this._compareStyles(r,f)&&(s.end(m,g),s=null),s||(s=Kr.pop()||new yh,s.begin(f,m,g),this.batches.push(s),r=f),this.addUvs(this.points,t,f.texture,g,y,f.matrix))}}const n=this.indices.length,a=this.points.length/2;if(s&&s.end(n,a),this.batches.length===0){this.batchable=!0;return}const o=a>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&o===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=o?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(t,e){return!(!t||!e||t.texture.baseTexture!==e.texture.baseTexture||t.color+t.alpha!==e.color+e.alpha||!!t.native!=!!e.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let t=0,e=this.graphicsData.length;t<e;t++){const s=this.graphicsData[t],r=s.fillStyle,n=s.lineStyle;if(r&&!r.texture.baseTexture.valid||n&&!n.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);const t=this.batches;for(let e=0,s=t.length;e<s;e++){const r=t[e];for(let n=0;n<r.size;n++){const a=r.start+n;this.indicesUint16[a]=this.indicesUint16[a]-r.attribStart}}}isBatchable(){if(this.points.length>65535*2)return!1;const t=this.batches;for(let e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<bh.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++X._globalBatch;for(let c=0;c<this.drawCalls.length;c++)this.drawCalls[c].texArray.clear(),cs.push(this.drawCalls[c]);this.drawCalls.length=0;const e=this.colors,s=this.textureIds;let r=cs.pop();r||(r=new Sr,r.texArray=new Pr),r.texArray.count=0,r.start=0,r.size=0,r.type=zt.TRIANGLES;let n=0,a=null,o=0,h=!1,l=zt.TRIANGLES,u=0;this.drawCalls.push(r);for(let c=0;c<this.batches.length;c++){const d=this.batches[c],f=8,p=d.style,m=p.texture.baseTexture;h!==!!p.native&&(h=!!p.native,l=h?zt.LINES:zt.TRIANGLES,a=null,n=f,t++),a!==m&&(a=m,m._batchEnabled!==t&&(n===f&&(t++,n=0,r.size>0&&(r=cs.pop(),r||(r=new Sr,r.texArray=new Pr),this.drawCalls.push(r)),r.start=u,r.size=0,r.texArray.count=0,r.type=l),m.touched=1,m._batchEnabled=t,m._batchLocation=n,m.wrapMode=re.REPEAT,r.texArray.elements[r.texArray.count++]=m,n++)),r.size+=d.size,u+=d.size,o=m._batchLocation,this.addColors(e,p.color,p.alpha,d.attribSize,d.attribStart),this.addTextureIds(s,o,d.attribSize,d.attribStart)}X._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,s=this.colors,r=this.textureIds,n=new ArrayBuffer(t.length*3*4),a=new Float32Array(n),o=new Uint32Array(n);let h=0;for(let l=0;l<t.length/2;l++)a[h++]=t[l*2],a[h++]=t[l*2+1],a[h++]=e[l*2],a[h++]=e[l*2+1],o[h++]=s[l],a[h++]=r[l];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?gn.triangulate(t,this):ii[t.type].triangulate(t,this)}processLine(t){qr(t,this);for(let e=0;e<t.holes.length;e++)qr(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const s=t[e];ii[s.type].build(s),s.matrix&&this.transformPoints(s.points,s.matrix)}}calculateBounds(){const t=this._bounds;t.clear(),t.addVertexData(this.points,0,this.points.length),t.pad(this.boundsPadding,this.boundsPadding)}transformPoints(t,e){for(let s=0;s<t.length/2;s++){const r=t[s*2],n=t[s*2+1];t[s*2]=e.a*r+e.c*n+e.tx,t[s*2+1]=e.b*r+e.d*n+e.ty}}addColors(t,e,s,r,n=0){const a=K.shared.setValue(e).toLittleEndianNumber(),o=K.shared.setValue(a).toPremultiplied(s);t.length=Math.max(t.length,n+r);for(let h=0;h<r;h++)t[n+h]=o}addTextureIds(t,e,s,r=0){t.length=Math.max(t.length,r+s);for(let n=0;n<s;n++)t[r+n]=e}addUvs(t,e,s,r,n,a=null){let o=0;const h=e.length,l=s.frame;for(;o<n;){let c=t[(r+o)*2],d=t[(r+o)*2+1];if(a){const f=a.a*c+a.c*d+a.tx;d=a.b*c+a.d*d+a.ty,c=f}o++,e.push(c/l.width,d/l.height)}const u=s.baseTexture;(l.width<u.width||l.height<u.height)&&this.adjustUvs(e,s,h,n)}adjustUvs(t,e,s,r){const n=e.baseTexture,a=1e-6,o=s+r*2,h=e.frame,l=h.width/n.width,u=h.height/n.height;let c=h.x/h.width,d=h.y/h.height,f=Math.floor(t[s]+a),p=Math.floor(t[s+1]+a);for(let m=s+2;m<o;m+=2)f=Math.min(f,Math.floor(t[m]+a)),p=Math.min(p,Math.floor(t[m+1]+a));c-=f,d-=p;for(let m=s;m<o;m+=2)t[m]=(t[m]+c)*l,t[m+1]=(t[m+1]+d)*u}};xh.BATCHABLE_SIZE=100;let Mp=xh;class Pi{constructor(){this.color=16777215,this.alpha=1,this.texture=D.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new Pi;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t}reset(){this.color=16777215,this.alpha=1,this.texture=D.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class _n extends Pi{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=ce.BUTT,this.join=St.MITER,this.miterLimit=10}clone(){const t=new _n;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t}reset(){super.reset(),this.color=0,this.alignment=.5,this.width=0,this.native=!1,this.cap=ce.BUTT,this.join=St.MITER,this.miterLimit=10}}const sr={},Zr=class ri extends Mt{constructor(t=null){super(),this.shader=null,this.pluginName="batch",this.currentPath=null,this.batches=[],this.batchTint=-1,this.batchDirty=-1,this.vertexData=null,this._fillStyle=new Pi,this._lineStyle=new _n,this._matrix=null,this._holeMode=!1,this.state=ne.for2d(),this._geometry=t||new Mp,this._geometry.refCount++,this._transformID=-1,this._tintColor=new K(16777215),this.blendMode=H.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new ri(this._geometry)}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(t=null,e=0,s,r=.5,n=!1){return typeof t=="number"&&(t={width:t,color:e,alpha:s,alignment:r,native:n}),this.lineTextureStyle(t)}lineTextureStyle(t){const e={width:0,texture:D.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:ce.BUTT,join:St.MITER,miterLimit:10};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const s=t.width>0&&t.alpha>0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:s},t)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new We,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new We,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this}lineTo(t,e){this.currentPath||this.moveTo(0,0);const s=this.currentPath.points,r=s[s.length-2],n=s[s.length-1];return(r!==t||n!==e)&&s.push(t,e),this}_initCurve(t=0,e=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[t,e]):this.moveTo(t,e)}quadraticCurveTo(t,e,s,r){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),Ci.curveTo(t,e,s,r,n),this}bezierCurveTo(t,e,s,r,n,a){return this._initCurve(),Ri.curveTo(t,e,s,r,n,a,this.currentPath.points),this}arcTo(t,e,s,r,n){this._initCurve(t,e);const a=this.currentPath.points,o=Yr.curveTo(t,e,s,r,n,a);if(o){const{cx:h,cy:l,radius:u,startAngle:c,endAngle:d,anticlockwise:f}=o;this.arc(h,l,u,c,d,f)}return this}arc(t,e,s,r,n,a=!1){if(r===n)return this;if(!a&&n<=r?n+=li:a&&r<=n&&(r+=li),n-r===0)return this;const o=t+Math.cos(r)*s,h=e+Math.sin(r)*s,l=this._geometry.closePointEps;let u=this.currentPath?this.currentPath.points:null;if(u){const c=Math.abs(u[u.length-2]-o),d=Math.abs(u[u.length-1]-h);c<l&&d<l||u.push(o,h)}else this.moveTo(o,h),u=this.currentPath.points;return Yr.arc(o,h,t,e,s,r,n,a,u),this}beginFill(t=0,e){return this.beginTextureFill({texture:D.WHITE,color:t,alpha:e})}normalizeColor(t){var e,s;const r=K.shared.setValue((e=t.color)!=null?e:0);t.color=r.toNumber(),(s=t.alpha)!=null||(t.alpha=r.alpha)}beginTextureFill(t){const e={texture:D.WHITE,color:16777215,matrix:null};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const s=t.alpha>0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:s},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,s,r){return this.drawShape(new j(t,e,s,r))}drawRoundedRect(t,e,s,r,n){return this.drawShape(new cn(t,e,s,r,n))}drawCircle(t,e,s){return this.drawShape(new ln(t,e,s))}drawEllipse(t,e,s,r){return this.drawShape(new un(t,e,s,r))}drawPolygon(...t){let e,s=!0;const r=t[0];r.points?(s=r.closeStroke,e=r.points):Array.isArray(t[0])?e=t[0]:e=t;const n=new We(e);return n.closeStroke=s,this.drawShape(n),this}drawShape(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this}clear(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this}isFastRect(){const t=this._geometry.graphicsData;return t.length===1&&t[0].shape.type===mt.RECT&&!t[0].matrix&&!t[0].holes.length&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)}_render(t){this.finishPoly();const e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))}_populateBatches(){const t=this._geometry,e=this.blendMode,s=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=s,this.vertexData=new Float32Array(t.points);for(let r=0;r<s;r++){const n=t.batches[r],a=n.style.color,o=new Float32Array(this.vertexData.buffer,n.attribStart*4*2,n.attribSize*2),h=new Float32Array(t.uvsFloat32.buffer,n.attribStart*4*2,n.attribSize*2),l=new Uint16Array(t.indicesUint16.buffer,n.start*2,n.size),u={vertexData:o,blendMode:e,indices:l,uvs:h,_batchRGB:K.shared.setValue(a).toRgbArray(),_tintRGB:a,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[r]=u}}_renderBatched(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let e=0,s=this.batches.length;e<s;e++){const r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}}_renderDirect(t){const e=this._resolveDirectShader(t),s=this._geometry,r=this.worldAlpha,n=e.uniforms,a=s.drawCalls;n.translationMatrix=this.transform.worldTransform,K.shared.setValue(this._tintColor).premultiply(r).toArray(n.tint),t.shader.bind(e),t.geometry.bind(s,e),t.state.set(this.state);for(let o=0,h=a.length;o<h;o++)this._renderDrawCallDirect(t,s.drawCalls[o])}_renderDrawCallDirect(t,e){const{texArray:s,type:r,size:n,start:a}=e,o=s.count;for(let h=0;h<o;h++)t.texture.bind(s.elements[h],h);t.geometry.draw(r,n,a)}_resolveDirectShader(t){let e=this.shader;const s=this.pluginName;if(!e){if(!sr[s]){const{maxTextures:r}=t.plugins[s],n=new Int32Array(r);for(let h=0;h<r;h++)n[h]=h;const a={tint:new Float32Array([1,1,1,1]),translationMatrix:new tt,default:Lt.from({uSamplers:n},!0)},o=t.plugins[s]._shader.program;sr[s]=new qt(o,a)}e=sr[s]}return e}_calculateBounds(){this.finishPoly();const t=this._geometry;if(!t.graphicsData.length)return;const{minX:e,minY:s,maxX:r,maxY:n}=t.bounds;this._bounds.addFrame(this.transform,e,s,r,n)}containsPoint(t){return this.worldTransform.applyInverse(t,ri._TEMP_POINT),this._geometry.containsPoint(ri._TEMP_POINT)}calculateTints(){if(this.batchTint!==this.tint){this.batchTint=this._tintColor.toNumber();for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e._tintRGB=K.shared.setValue(this._tintColor).multiply(e._batchRGB).toLittleEndianNumber()}}}calculateVertices(){const t=this.transform._worldID;if(this._transformID===t)return;this._transformID=t;const e=this.transform.worldTransform,s=e.a,r=e.b,n=e.c,a=e.d,o=e.tx,h=e.ty,l=this._geometry.points,u=this.vertexData;let c=0;for(let d=0;d<l.length;d+=2){const f=l[d],p=l[d+1];u[c++]=s*f+n*p+o,u[c++]=a*p+r*f+h}}closePath(){const t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this}setMatrix(t){return this._matrix=t,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(t){this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,super.destroy(t)}};Zr.curves=Me,Zr._TEMP_POINT=new q;let Th=Zr;const $m={buildPoly:gn,buildCircle:Ts,buildRectangle:_h,buildRoundedRectangle:vh,buildLine:qr,ArcUtils:Yr,BezierUtils:Ri,QuadraticUtils:Ci,BatchPart:yh,FILL_COMMANDS:ii,BATCH_POOL:Kr,DRAW_CALL_POOL:cs};class Dp{constructor(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}update(t){if(!t&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)return;this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;const e=this.uvBuffer.data;(!this.data||this.data.length!==e.length)&&(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}}const ir=new q,Ya=new We,Eh=class Ah extends Mt{constructor(t,e,s,r=zt.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=s||ne.for2d(),this.drawMode=r,this.start=0,this.size=0,this.uvs=null,this.indices=null,this.vertexData=new Float32Array(1),this.vertexDirty=-1,this._transformID=-1,this._roundPixels=O.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}get uvBuffer(){return this.geometry.buffers[1]}get verticesBuffer(){return this.geometry.buffers[0]}set material(t){this.shader=t}get material(){return this.shader}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get tint(){return"tint"in this.shader?this.shader.tint:null}set tint(t){this.shader.tint=t}get tintValue(){return this.shader.tintValue}get texture(){return"texture"in this.shader?this.shader.texture:null}set texture(t){this.shader.texture=t}_render(t){const e=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===zt.TRIANGLES&&e.length<Ah.BATCHABLE_SIZE*2?this._renderToBatch(t):this._renderDefault(t)}_renderDefault(t){const e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}_renderToBatch(t){const e=this.geometry,s=this.shader;s.uvMatrix&&(s.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=s._tintRGB,this._texture=s.texture;const r=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[r]),t.plugins[r].render(this)}calculateVertices(){const t=this.geometry.buffers[0],e=t.data,s=t._updateID;if(s===this.vertexDirty&&this._transformID===this.transform._worldID)return;this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));const r=this.transform.worldTransform,n=r.a,a=r.b,o=r.c,h=r.d,l=r.tx,u=r.ty,c=this.vertexData;for(let d=0;d<c.length/2;d++){const f=e[d*2],p=e[d*2+1];c[d*2]=n*f+o*p+l,c[d*2+1]=a*f+h*p+u}if(this._roundPixels){const d=O.RESOLUTION;for(let f=0;f<c.length;++f)c[f]=Math.round(c[f]*d)/d}this.vertexDirty=s}calculateUvs(){const t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new Dp(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)}_calculateBounds(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)}containsPoint(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,ir);const e=this.geometry.getBuffer("aVertexPosition").data,s=Ya.points,r=this.geometry.getIndex().data,n=r.length,a=this.drawMode===4?3:1;for(let o=0;o+2<n;o+=a){const h=r[o]*2,l=r[o+1]*2,u=r[o+2]*2;if(s[0]=e[h],s[1]=e[h+1],s[2]=e[l],s[3]=e[l+1],s[4]=e[u],s[5]=e[u+1],Ya.contains(ir.x,ir.y))return!0}return!1}destroy(t){super.destroy(t),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null}};Eh.BATCHABLE_SIZE=100;let Es=Eh;class Mi extends fe{constructor(t,e,s){super();const r=new nt(t),n=new nt(e,!0),a=new nt(s,!0,!0);this.addAttribute("aVertexPosition",r,2,!1,k.FLOAT).addAttribute("aTextureCoord",n,2,!1,k.FLOAT).addIndex(a),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var Op=`varying vec2 vTextureCoord;
|
|
925
|
+
};`};let tr,cf=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 e=URL.createObjectURL(new Blob([lf.code],{type:"application/javascript"})),s=new Worker(e);s.addEventListener("message",r=>{s.terminate(),URL.revokeObjectURL(e),t(r.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){Ji===void 0&&(Ji=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<Ji&&(tr||(tr=URL.createObjectURL(new Blob([uf.code],{type:"application/javascript"}))),this._createdWorkers++,t=new Worker(tr),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 s=new Promise((r,n)=>{this.queue.push({id:t,arguments:e,resolve:r,reject:n})});return this.next(),s}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),s=e.id;this.resolveHash[Aa]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Aa++,id:s})}};const wa=new cf;function Rs(i,t,e){i.resource.internal=!0;const s=new O(i),r=()=>{delete t.promiseCache[e],Ie.has(e)&&Ie.remove(e)};return s.baseTexture.once("destroyed",()=>{e in t.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),r())}),s.once("destroyed",()=>{i.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),r())}),s}var df=Object.defineProperty,Sa=Object.getOwnPropertySymbols,ff=Object.prototype.hasOwnProperty,pf=Object.prototype.propertyIsEnumerable,Ia=(i,t,e)=>t in i?df(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ra=(i,t)=>{for(var e in t||(t={}))ff.call(t,e)&&Ia(i,e,t[e]);if(Sa)for(var e of Sa(t))pf.call(t,e)&&Ia(i,e,t[e]);return i};const mf=[".jpeg",".jpg",".png",".webp",".avif"],gf=["image/jpeg","image/png","image/webp","image/avif"];async function _f(i){const t=await D.ADAPTER.fetch(i);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${t.status} ${t.statusText}`);const e=await t.blob();return await createImageBitmap(e)}const Ii={name:"loadTextures",extension:{type:C.LoadParser,priority:Ut.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return Ze(i,gf)||ve(i,mf)},async load(i,t,e){var s,r;const n=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let a;n?this.config.preferWorkers&&await wa.isImageBitmapSupported()?a=await wa.loadImageBitmap(i):a=await _f(i):a=await new Promise((l,u)=>{const c=new Image;c.crossOrigin=this.config.crossOrigin,c.src=i,c.complete?l(c):(c.onload=()=>l(c),c.onerror=d=>u(d))});const o=Ra({},t.data);(s=o.resolution)!=null||(o.resolution=Zt(i)),n&&((r=o.resourceOptions)==null?void 0:r.ownsImageBitmap)===void 0&&(o.resourceOptions=Ra({},o.resourceOptions),o.resourceOptions.ownsImageBitmap=!0);const h=new X(a,o);return h.resource.src=i,Rs(h,e,i)},unload(i){i.destroy(!0)}};N.add(Ii);var vf=Object.defineProperty,Ca=Object.getOwnPropertySymbols,yf=Object.prototype.hasOwnProperty,xf=Object.prototype.propertyIsEnumerable,Pa=(i,t,e)=>t in i?vf(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,bf=(i,t)=>{for(var e in t||(t={}))yf.call(t,e)&&Pa(i,e,t[e]);if(Ca)for(var e of Ca(t))xf.call(t,e)&&Pa(i,e,t[e]);return i};const Tf=".svg",Ef="image/svg+xml",Af={extension:{type:C.LoadParser,priority:Ut.High},name:"loadSVG",test(i){return Ze(i,Ef)||ve(i,Tf)},async testParse(i){return Nr.test(i)},async parse(i,t,e){var s;const r=new Nr(i,(s=t==null?void 0:t.data)==null?void 0:s.resourceOptions);await r.load();const n=new X(r,bf({resolution:Zt(i)},t==null?void 0:t.data));return n.resource.src=t.src,Rs(n,e,t.src)},async load(i,t){return(await D.ADAPTER.fetch(i)).text()},unload:Ii.unload};N.add(Af);var wf=Object.defineProperty,Ma=Object.getOwnPropertySymbols,Sf=Object.prototype.hasOwnProperty,If=Object.prototype.propertyIsEnumerable,Da=(i,t,e)=>t in i?wf(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Oa=(i,t)=>{for(var e in t||(t={}))Sf.call(t,e)&&Da(i,e,t[e]);if(Ma)for(var e of Ma(t))If.call(t,e)&&Da(i,e,t[e]);return i};const Rf=[".mp4",".m4v",".webm",".ogv"],Cf=["video/mp4","video/webm","video/ogg"],Pf={name:"loadVideo",extension:{type:C.LoadParser,priority:Ut.High},config:{defaultAutoPlay:!0},test(i){return Ze(i,Cf)||ve(i,Rf)},async load(i,t,e){var s;let r;const n=await(await D.ADAPTER.fetch(i)).blob(),a=URL.createObjectURL(n);try{const o=Oa({autoPlay:this.config.defaultAutoPlay},(s=t==null?void 0:t.data)==null?void 0:s.resourceOptions),h=new lh(a,o);await h.load();const l=new X(h,Oa({alphaMode:await co(),resolution:Zt(i)},t==null?void 0:t.data));l.resource.src=i,r=Rs(l,e,i),r.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(a)})}catch(o){throw URL.revokeObjectURL(a),o}return r},unload(i){i.destroy(!0)}};N.add(Pf);var Mf=Object.defineProperty,Df=Object.defineProperties,Of=Object.getOwnPropertyDescriptors,Ba=Object.getOwnPropertySymbols,Bf=Object.prototype.hasOwnProperty,Ff=Object.prototype.propertyIsEnumerable,Fa=(i,t,e)=>t in i?Mf(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Fe=(i,t)=>{for(var e in t||(t={}))Bf.call(t,e)&&Fa(i,e,t[e]);if(Ba)for(var e of Ba(t))Ff.call(t,e)&&Fa(i,e,t[e]);return i},Na=(i,t)=>Df(i,Of(t));class Nf{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,s,r;if(this._bundleIdConnector=(e=t.connector)!=null?e:this._bundleIdConnector,this._createBundleAssetId=(s=t.createBundleAssetId)!=null?s:this._createBundleAssetId,this._extractAssetIdFromBundle=(r=t.extractAssetIdFromBundle)!=null?r: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(s=>`${encodeURIComponent(s)}=${encodeURIComponent(e[s])}`).join("&")}}getAlias(t){const{alias:e,name:s,src:r,srcs:n}=t;return Nt(e||s||r||n,a=>{var o;return typeof a=="string"?a:Array.isArray(a)?a.map(h=>{var l,u;return(u=(l=h==null?void 0:h.src)!=null?l:h==null?void 0:h.srcs)!=null?u:h}):a!=null&&a.src||a!=null&&a.srcs?(o=a.src)!=null?o:a.srcs:a},!0)}addManifest(t){this._manifest,this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const s=[];Array.isArray(e)?e.forEach(r=>{var n,a;const o=(n=r.src)!=null?n:r.srcs,h=(a=r.alias)!=null?a:r.name;let l;if(typeof h=="string"){const u=this._createBundleAssetId(t,h);s.push(u),l=[h,u]}else{const u=h.map(c=>this._createBundleAssetId(t,c));s.push(...u),l=[...h,...u]}this.add(Na(Fe({},r),{alias:l,src:o}))}):Object.keys(e).forEach(r=>{var n;const a=[r,this._createBundleAssetId(t,r)];if(typeof e[r]=="string")this.add({alias:a,src:e[r]});else if(Array.isArray(e[r]))this.add({alias:a,src:e[r]});else{const o=e[r],h=(n=o.src)!=null?n:o.srcs;this.add(Na(Fe({},o),{alias:a,src:Array.isArray(h)?h:[h]}))}s.push(...a)}),this._bundles[t]=s}add(t,e,s,r,n){const a=[];typeof t=="string"||Array.isArray(t)&&typeof t[0]=="string"?a.push({alias:t,src:e,data:s,format:r,loadParser:n}):Array.isArray(t)?a.push(...t):a.push(t);let o;Nt(a).forEach(h=>{const{src:l,srcs:u}=h;let{data:c,format:d,loadParser:f}=h;const p=Nt(l||u).map(v=>typeof v=="string"?Pd(v):Array.isArray(v)?v:[v]),m=this.getAlias(h),g=[];p.forEach(v=>{v.forEach(x=>{var _,y,T;let P={};if(typeof x!="object"){P.src=x;for(let w=0;w<this._parsers.length;w++){const A=this._parsers[w];if(A.test(x)){P=A.parse(x);break}}}else c=(_=x.data)!=null?_:c,d=(y=x.format)!=null?y:d,f=(T=x.loadParser)!=null?T:f,P=Fe(Fe({},P),x);if(!m)throw new Error(`[Resolver] alias is undefined for this asset: ${P.src}`);P=this.buildResolvedAsset(P,{aliases:m,data:c,format:d,loadParser:f}),g.push(P)})}),m.forEach(v=>{this._assetMap[v]=g})})}resolveBundle(t){const e=gi(t);t=Nt(t);const s={};return t.forEach(r=>{const n=this._bundles[r];if(n){const a=this.resolve(n),o={};for(const h in a){const l=a[h];o[this._extractAssetIdFromBundle(r,h)]=l}s[r]=o}}),e?s[t[0]]:s}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const s={};for(const r in e)s[r]=e[r].src;return s}return e.src}resolve(t){const e=gi(t);t=Nt(t);const s={};return t.forEach(r=>{var n;if(!this._resolverHash[r])if(this._assetMap[r]){let a=this._assetMap[r];const o=a[0],h=this._getPreferredOrder(a);h==null||h.priority.forEach(l=>{h.params[l].forEach(u=>{const c=a.filter(d=>d[l]?d[l]===u:!1);c.length&&(a=c)})}),this._resolverHash[r]=(n=a[0])!=null?n:o}else this._resolverHash[r]=this.buildResolvedAsset({alias:[r],src:r},{});s[r]=this._resolverHash[r]}),e?s[t[0]]:s}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const s=t[0],r=this._preferredOrder.find(n=>n.params.format.includes(s.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}buildResolvedAsset(t,e){var s;const{aliases:r,data:n,loadParser:a,format:o}=e;return(this._basePath||this._rootPath)&&(t.src=lt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=(s=r!=null?r:t.alias)!=null?s:[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data=Fe(Fe({},n||{}),t.data),t.loadParser=a!=null?a:t.loadParser,t.format=o!=null?o:lt.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class Lf{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Nf,this.loader=new kd,this.cache=Ie,this._backgroundLoader=new Cd(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var e,s,r;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 h=t.manifest;typeof h=="string"&&(h=await this.load(h)),this.resolver.addManifest(h)}const n=(s=(e=t.texturePreference)==null?void 0:e.resolution)!=null?s:1,a=typeof n=="number"?[n]:n,o=await this._detectFormats({preferredFormats:(r=t.texturePreference)==null?void 0:r.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:o,resolution:a}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,s,r,n){this.resolver.add(t,e,s,r,n)}async load(t,e){this._initialized||await this.init();const s=gi(t),r=Nt(t).map(o=>{if(typeof o!="string"){const h=this.resolver.getAlias(o);return h.some(l=>!this.resolver.hasKey(l))&&this.add(o),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(o)||this.add({alias:o,src:o}),o}),n=this.resolver.resolve(r),a=await this._mapLoadToResolve(n,e);return s?a[r[0]]:a}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let s=!1;typeof t=="string"&&(s=!0,t=[t]);const r=this.resolver.resolveBundle(t),n={},a=Object.keys(r);let o=0,h=0;const l=()=>{e==null||e(++o/h)},u=a.map(c=>{const d=r[c];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{n[c]=f})});return await Promise.all(u),s?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(s=>{this._backgroundLoader.add(Object.values(s))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return Ie.get(t);const e={};for(let s=0;s<t.length;s++)e[s]=Ie.get(t[s]);return e}async _mapLoadToResolve(t,e){const s=Object.values(t),r=Object.keys(t);this._backgroundLoader.active=!1;const n=await this.loader.load(s,e);this._backgroundLoader.active=!0;const a={};return s.forEach((o,h)=>{const l=n[o.src],u=[o.src];o.alias&&u.push(...o.alias),a[r[h]]=l,Ie.set(u,l)}),a}async unload(t){this._initialized||await this.init();const e=Nt(t).map(r=>typeof r!="string"?r.src:r),s=this.resolver.resolve(e);await this._unloadFromResolved(s)}async unloadBundle(t){this._initialized||await this.init(),t=Nt(t);const e=this.resolver.resolveBundle(t),s=Object.keys(e).map(r=>this._unloadFromResolved(e[r]));await Promise.all(s)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(s=>{Ie.remove(s.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const s of t.detections)t.skipDetections||await s.test()?e=await s.add(e):t.skipDetections||(e=await s.remove(e));return e=e.filter((s,r)=>e.indexOf(s)===r),e}get detections(){return this._detections}get preferWorkers(){return Ii.config.preferWorkers}set preferWorkers(t){this.setPreferences({preferWorkers:t})}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(s=>s in t).forEach(s=>{e.config[s]=t[s]})})}}const Xs=new Lf;N.handleByList(C.LoadParser,Xs.loader.parsers).handleByList(C.ResolveParser,Xs.resolver.parsers).handleByList(C.CacheParser,Xs.cache.parsers).handleByList(C.DetectionParser,Xs.detections);const Uf={extension:C.CacheParser,test:i=>Array.isArray(i)&&i.every(t=>t instanceof O),getCacheableAssets:(i,t)=>{const e={};return i.forEach(s=>{t.forEach((r,n)=>{e[s+(n===0?"":n+1)]=r})}),e}};N.add(Uf);async function gh(i){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(i)).blob();await createImageBitmap(t)}catch(t){return!1}return!0}return!1}const kf={extension:{type:C.DetectionParser,priority:1},test:async()=>gh("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};N.add(kf);const Gf={extension:{type:C.DetectionParser,priority:0},test:async()=>gh("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};N.add(Gf);const La=["png","jpg","jpeg"],$f={extension:{type:C.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...La],remove:async i=>i.filter(t=>!La.includes(t))};N.add($f);const Hf="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function mn(i){return Hf?!1:document.createElement("video").canPlayType(i)!==""}const Vf={extension:{type:C.DetectionParser,priority:0},test:async()=>mn("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};N.add(Vf);const Xf={extension:{type:C.DetectionParser,priority:0},test:async()=>mn("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};N.add(Xf);const jf={extension:{type:C.DetectionParser,priority:0},test:async()=>mn("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};N.add(jf);const zf={extension:C.ResolveParser,test:Ii.test,parse:i=>{var t,e;return{resolution:parseFloat((e=(t=D.RETINA_PREFIX.exec(i))==null?void 0:t[1])!=null?e:"1"),format:lt.extname(i).slice(1),src:i}}};N.add(zf);var At=(i=>(i[i.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",i[i.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",i[i.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",i[i.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",i[i.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",i[i.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",i[i.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",i[i.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",i[i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",i[i.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",i[i.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",i[i.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",i))(At||{});const _i={33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,35840:.5,35842:.5,35841:.25,35843:.25,36196:.5,35986:.5,35986:1,34798:1,37808:1};let te,Ge;function Ua(){Ge={s3tc:te.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:te.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:te.getExtension("WEBGL_compressed_texture_etc"),etc1:te.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:te.getExtension("WEBGL_compressed_texture_pvrtc")||te.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:te.getExtension("WEBGL_compressed_texture_atc"),astc:te.getExtension("WEBGL_compressed_texture_astc")}}const Wf={extension:{type:C.DetectionParser,priority:2},test:async()=>{const i=D.ADAPTER.createCanvas().getContext("webgl");return i?(te=i,!0):!1},add:async i=>{Ge||Ua();const t=[];for(const e in Ge)Ge[e]&&t.push(e);return[...t,...i]},remove:async i=>(Ge||Ua(),i.filter(t=>!(t in Ge)))};N.add(Wf);class Yf extends wi{constructor(t,e={width:1,height:1,autoLoad:!0}){let s,r;typeof t=="string"?(s=t,r=new Uint8Array):(s=null,r=t),super(r,e),this.origin=s,this.buffer=r?new Er(r):null,this._load=null,this.loaded=!1,this.origin!==null&&e.autoLoad!==!1&&this.load(),this.origin===null&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}load(){return this._load?this._load:(this._load=fetch(this.origin).then(t=>t.blob()).then(t=>t.arrayBuffer()).then(t=>(this.data=new Uint32Array(t),this.buffer=new Er(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class Ce extends Yf{constructor(t,e){super(t,e),this.format=e.format,this.levels=e.levels||1,this._width=e.width,this._height=e.height,this._extension=Ce._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||Ce._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,s){const r=t.gl;if(!t.context.extensions[this._extension])throw new Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;r.pixelStorei(r.UNPACK_ALIGNMENT,4);for(let n=0,a=this.levels;n<a;n++){const{levelID:o,levelWidth:h,levelHeight:l,levelBuffer:u}=this._levelBuffers[n];r.compressedTexImage2D(r.TEXTURE_2D,o,this.format,h,l,0,u)}return!0}onBlobLoaded(){this._levelBuffers=Ce._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(t){if(t>=33776&&t<=33779)return"s3tc";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(t>=36196)return"etc1";if(t>=35986&&t<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")}static _createLevelBuffers(t,e,s,r,n,a,o){const h=new Array(s);let l=t.byteOffset,u=a,c=o,d=u+r-1&~(r-1),f=c+n-1&~(n-1),p=d*f*_i[e];for(let m=0;m<s;m++)h[m]={levelID:m,levelWidth:s>1?u:d,levelHeight:s>1?c:f,levelBuffer:new Uint8Array(t.buffer,l,p)},l+=p,u=u>>1||1,c=c>>1||1,d=u+r-1&~(r-1),f=c+n-1&~(n-1),p=d*f*_i[e];return h}}const er=4,js=124,qf=32,ka=20,Kf=542327876,zs={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},Zf={SIZE:0,FLAGS:1,FOURCC:2,RGB_BITCOUNT:3,R_BIT_MASK:4,G_BIT_MASK:5,B_BIT_MASK:6,A_BIT_MASK:7},Ws={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},Qf=1,Jf=2,tp=4,ep=64,sp=512,ip=131072,rp=827611204,np=861165636,ap=894720068,op=808540228,hp=4,lp={[rp]:At.COMPRESSED_RGBA_S3TC_DXT1_EXT,[np]:At.COMPRESSED_RGBA_S3TC_DXT3_EXT,[ap]:At.COMPRESSED_RGBA_S3TC_DXT5_EXT},up={70:At.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:At.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:At.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:At.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:At.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:At.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:At.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:At.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:At.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT};function cp(i){const t=new Uint32Array(i);if(t[0]!==Kf)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(i,0,js/Uint32Array.BYTES_PER_ELEMENT),s=e[zs.HEIGHT],r=e[zs.WIDTH],n=e[zs.MIPMAP_COUNT],a=new Uint32Array(i,zs.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,qf/Uint32Array.BYTES_PER_ELEMENT),o=a[Qf];if(o&tp){const h=a[Zf.FOURCC];if(h!==op){const x=lp[h],_=er+js,y=new Uint8Array(i,_);return[new Ce(y,{format:x,width:r,height:s,levels:n})]}const l=er+js,u=new Uint32Array(t.buffer,l,ka/Uint32Array.BYTES_PER_ELEMENT),c=u[Ws.DXGI_FORMAT],d=u[Ws.RESOURCE_DIMENSION],f=u[Ws.MISC_FLAG],p=u[Ws.ARRAY_SIZE],m=up[c];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${c}`);if(f===hp)throw new Error("DDSParser does not support cubemap textures");if(d===6)throw new Error("DDSParser does not supported 3D texture data");const g=new Array,v=er+js+ka;if(p===1)g.push(new Uint8Array(i,v));else{const x=_i[m];let _=0,y=r,T=s;for(let w=0;w<n;w++){const A=Math.max(1,y+3&-4),B=Math.max(1,T+3&-4),k=A*B*x;_+=k,y=y>>>1,T=T>>>1}let P=v;for(let w=0;w<p;w++)g.push(new Uint8Array(i,P,_)),P+=_}return g.map(x=>new Ce(x,{format:m,width:r,height:s,levels:n}))}throw o&ep?new Error("DDSParser does not support uncompressed texture data."):o&sp?new Error("DDSParser does not supported YUV uncompressed texture data."):o&ip?new Error("DDSParser does not support single-channel (lumninance) texture data!"):o&Jf?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!")}const Ga=[171,75,84,88,32,49,49,187,13,10,26,10],dp=67305985,Ot={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},Wr=64,$a={[U.UNSIGNED_BYTE]:1,[U.UNSIGNED_SHORT]:2,[U.INT]:4,[U.UNSIGNED_INT]:4,[U.FLOAT]:4,[U.HALF_FLOAT]:8},fp={[E.RGBA]:4,[E.RGB]:3,[E.RG]:2,[E.RED]:1,[E.LUMINANCE]:1,[E.LUMINANCE_ALPHA]:2,[E.ALPHA]:1},pp={[U.UNSIGNED_SHORT_4_4_4_4]:2,[U.UNSIGNED_SHORT_5_5_5_1]:2,[U.UNSIGNED_SHORT_5_6_5]:2};function mp(i,t,e=!1){const s=new DataView(t);if(!gp(i,s))return null;const r=s.getUint32(Ot.ENDIANNESS,!0)===dp,n=s.getUint32(Ot.GL_TYPE,r),a=s.getUint32(Ot.GL_FORMAT,r),o=s.getUint32(Ot.GL_INTERNAL_FORMAT,r),h=s.getUint32(Ot.PIXEL_WIDTH,r),l=s.getUint32(Ot.PIXEL_HEIGHT,r)||1,u=s.getUint32(Ot.PIXEL_DEPTH,r)||1,c=s.getUint32(Ot.NUMBER_OF_ARRAY_ELEMENTS,r)||1,d=s.getUint32(Ot.NUMBER_OF_FACES,r),f=s.getUint32(Ot.NUMBER_OF_MIPMAP_LEVELS,r),p=s.getUint32(Ot.BYTES_OF_KEY_VALUE_DATA,r);if(l===0||u!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(c!==1)throw new Error("WebGL does not support array textures");const m=4,g=4,v=h+3&-4,x=l+3&-4,_=new Array(c);let y=h*l;n===0&&(y=v*x);let T;if(n!==0?$a[n]?T=$a[n]*fp[a]:T=pp[n]:T=_i[o],T===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const P=e?vp(s,p,r):null;let w=y*T,A=h,B=l,k=v,W=x,F=Wr+p;for(let b=0;b<f;b++){const S=s.getUint32(F,r);let G=F+4;for(let z=0;z<c;z++){let $=_[z];$||($=_[z]=new Array(f)),$[b]={levelID:b,levelWidth:f>1||n!==0?A:k,levelHeight:f>1||n!==0?B:W,levelBuffer:new Uint8Array(t,G,w)},G+=w}F+=S+4,F=F%4!==0?F+4-F%4:F,A=A>>1||1,B=B>>1||1,k=A+m-1&~(m-1),W=B+g-1&~(g-1),w=k*W*T}return n!==0?{uncompressed:_.map(b=>{let S=b[0].levelBuffer,G=!1;return n===U.FLOAT?S=new Float32Array(b[0].levelBuffer.buffer,b[0].levelBuffer.byteOffset,b[0].levelBuffer.byteLength/4):n===U.UNSIGNED_INT?(G=!0,S=new Uint32Array(b[0].levelBuffer.buffer,b[0].levelBuffer.byteOffset,b[0].levelBuffer.byteLength/4)):n===U.INT&&(G=!0,S=new Int32Array(b[0].levelBuffer.buffer,b[0].levelBuffer.byteOffset,b[0].levelBuffer.byteLength/4)),{resource:new wi(S,{width:b[0].levelWidth,height:b[0].levelHeight}),type:n,format:G?_p(a):a}}),kvData:P}:{compressed:_.map(b=>new Ce(null,{format:o,width:h,height:l,levels:f,levelBuffers:b})),kvData:P}}function gp(i,t){for(let e=0;e<Ga.length;e++)if(t.getUint8(e)!==Ga[e])return!1;return!0}function _p(i){switch(i){case E.RGBA:return E.RGBA_INTEGER;case E.RGB:return E.RGB_INTEGER;case E.RG:return E.RG_INTEGER;case E.RED:return E.RED_INTEGER;default:return i}}function vp(i,t,e){const s=new Map;let r=0;for(;r<t;){const n=i.getUint32(Wr+r,e),a=Wr+r+4,o=3-(n+3)%4;if(n===0||n>t-r){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h<n&&i.getUint8(a+h)!==0;h++);if(h===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const l=new TextDecoder().decode(new Uint8Array(i.buffer,a,h)),u=new DataView(i.buffer,a+h+1,n-h-1);s.set(l,u),r+=4+n+o}return s}var yp=Object.defineProperty,Ha=Object.getOwnPropertySymbols,xp=Object.prototype.hasOwnProperty,bp=Object.prototype.propertyIsEnumerable,Va=(i,t,e)=>t in i?yp(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Tp=(i,t)=>{for(var e in t||(t={}))xp.call(t,e)&&Va(i,e,t[e]);if(Ha)for(var e of Ha(t))bp.call(t,e)&&Va(i,e,t[e]);return i};const Ep={extension:{type:C.LoadParser,priority:Ut.High},name:"loadDDS",test(i){return ve(i,".dds")},async load(i,t,e){const s=await(await D.ADAPTER.fetch(i)).arrayBuffer(),r=cp(s).map(n=>{const a=new X(n,Tp({mipmap:Kt.OFF,alphaMode:bt.NO_PREMULTIPLIED_ALPHA,resolution:Zt(i)},t.data));return Rs(a,e,i)});return r.length===1?r[0]:r},unload(i){Array.isArray(i)?i.forEach(t=>t.destroy(!0)):i.destroy(!0)}};N.add(Ep);var Ap=Object.defineProperty,Xa=Object.getOwnPropertySymbols,wp=Object.prototype.hasOwnProperty,Sp=Object.prototype.propertyIsEnumerable,ja=(i,t,e)=>t in i?Ap(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ip=(i,t)=>{for(var e in t||(t={}))wp.call(t,e)&&ja(i,e,t[e]);if(Xa)for(var e of Xa(t))Sp.call(t,e)&&ja(i,e,t[e]);return i};const Rp={extension:{type:C.LoadParser,priority:Ut.High},name:"loadKTX",test(i){return ve(i,".ktx")},async load(i,t,e){const s=await(await D.ADAPTER.fetch(i)).arrayBuffer(),{compressed:r,uncompressed:n,kvData:a}=mp(i,s),o=r!=null?r:n,h=Ip({mipmap:Kt.OFF,alphaMode:bt.NO_PREMULTIPLIED_ALPHA,resolution:Zt(i)},t.data),l=o.map(u=>{var c;o===n&&Object.assign(h,{type:u.type,format:u.format});const d=(c=u.resource)!=null?c:u,f=new X(d,h);return f.ktxKeyValueData=a,Rs(f,e,i)});return l.length===1?l[0]:l},unload(i){Array.isArray(i)?i.forEach(t=>t.destroy(!0)):i.destroy(!0)}};N.add(Rp);const Cp={extension:C.ResolveParser,test:i=>{const t=lt.extname(i).slice(1);return["basis","ktx","dds"].includes(t)},parse:i=>{var t,e,s,r;const n=lt.extname(i).slice(1);if(n==="ktx"){const a=[".s3tc.ktx",".s3tc_sRGB.ktx",".etc.ktx",".etc1.ktx",".pvrt.ktx",".atc.ktx",".astc.ktx"];if(a.some(o=>i.endsWith(o)))return{resolution:parseFloat((e=(t=D.RETINA_PREFIX.exec(i))==null?void 0:t[1])!=null?e:"1"),format:a.find(o=>i.endsWith(o)),src:i}}return{resolution:parseFloat((r=(s=D.RETINA_PREFIX.exec(i))==null?void 0:s[1])!=null?r:"1"),format:n,src:i}}};N.add(Cp);const Ys=new j,Pp=4,_h=class us{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){var t;const e=(t=this.renderer)==null?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}async image(t,e,s,r){const n=new Image;return n.src=await this.base64(t,e,s,r),n}async base64(t,e,s,r){const n=this.canvas(t,r);if(n.toBlob!==void 0)return new Promise((a,o)=>{n.toBlob(h=>{if(!h){o(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>a(l.result),l.onerror=o,l.readAsDataURL(h)},e,s)});if(n.toDataURL!==void 0)return n.toDataURL(e,s);if(n.convertToBlob!==void 0){const a=await n.convertToBlob({type:e,quality:s});return new Promise((o,h)=>{const l=new FileReader;l.onload=()=>o(l.result),l.onerror=h,l.readAsDataURL(a)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const{pixels:s,width:r,height:n,flipY:a,premultipliedAlpha:o}=this._rawPixels(t,e);a&&us._flipY(s,r,n),o&&us._unpremultiplyAlpha(s);const h=new bo(r,n,1),l=new ImageData(new Uint8ClampedArray(s.buffer),r,n);return h.context.putImageData(l,0,0),h.canvas}pixels(t,e){const{pixels:s,width:r,height:n,flipY:a,premultipliedAlpha:o}=this._rawPixels(t,e);return a&&us._flipY(s,r,n),o&&us._unpremultiplyAlpha(s),s}_rawPixels(t,e){const s=this.renderer;if(!s)throw new Error("The Extract has already been destroyed");let r,n=!1,a=!1,o,h=!1;t&&(t instanceof Oe?o=t:(o=s.generateTexture(t,{region:e,resolution:s.resolution,multisample:s.multisample}),h=!0,e&&(Ys.width=e.width,Ys.height=e.height,e=Ys)));const l=s.gl;if(o){if(r=o.baseTexture.resolution,e=e!=null?e:o.frame,n=!1,a=o.baseTexture.alphaMode>0&&o.baseTexture.format===E.RGBA,!h){s.renderTexture.bind(o);const f=o.framebuffer.glFramebuffers[s.CONTEXT_UID];f.blitFramebuffer&&s.framebuffer.bind(f.blitFramebuffer)}}else r=s.resolution,e||(e=Ys,e.width=s.width/r,e.height=s.height/r),n=!0,a=this._rendererPremultipliedAlpha,s.renderTexture.bind();const u=Math.max(Math.round(e.width*r),1),c=Math.max(Math.round(e.height*r),1),d=new Uint8Array(Pp*u*c);return l.readPixels(Math.round(e.x*r),Math.round(e.y*r),u,c,l.RGBA,l.UNSIGNED_BYTE,d),h&&(o==null||o.destroy(!0)),{pixels:d,width:u,height:c,flipY:n,premultipliedAlpha:a}}destroy(){this.renderer=null}static _flipY(t,e,s){const r=e<<2,n=s>>1,a=new Uint8Array(r);for(let o=0;o<n;o++){const h=o*r,l=(s-o-1)*r;a.set(t.subarray(h,h+r)),t.copyWithin(h,l,l+r),t.set(a,l)}}static _unpremultiplyAlpha(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));const e=t.length;for(let s=0;s<e;s+=4){const r=t[s+3];if(r!==0){const n=255.001/r;t[s]=t[s]*n+.5,t[s+1]=t[s+1]*n+.5,t[s+2]=t[s+2]*n+.5}}}};_h.extension={name:"extract",type:C.RendererSystem};let Mp=_h;N.add(Mp);const Ts={build(i){const t=i.points;let e,s,r,n,a,o;if(i.type===gt.CIRC){const p=i.shape;e=p.x,s=p.y,a=o=p.radius,r=n=0}else if(i.type===gt.ELIP){const p=i.shape;e=p.x,s=p.y,a=p.width,o=p.height,r=n=0}else{const p=i.shape,m=p.width/2,g=p.height/2;e=p.x+m,s=p.y+g,a=o=Math.max(0,Math.min(p.radius,Math.min(m,g))),r=m-a,n=g-o}if(!(a>=0&&o>=0&&r>=0&&n>=0)){t.length=0;return}const h=Math.ceil(2.3*Math.sqrt(a+o)),l=h*8+(r?4:0)+(n?4:0);if(t.length=l,l===0)return;if(h===0){t.length=8,t[0]=t[6]=e+r,t[1]=t[3]=s+n,t[2]=t[4]=e-r,t[5]=t[7]=s-n;return}let u=0,c=h*4+(r?2:0)+2,d=c,f=l;{const p=r+a,m=n,g=e+p,v=e-p,x=s+m;if(t[u++]=g,t[u++]=x,t[--c]=x,t[--c]=v,n){const _=s-m;t[d++]=v,t[d++]=_,t[--f]=_,t[--f]=g}}for(let p=1;p<h;p++){const m=Math.PI/2*(p/h),g=r+Math.cos(m)*a,v=n+Math.sin(m)*o,x=e+g,_=e-g,y=s+v,T=s-v;t[u++]=x,t[u++]=y,t[--c]=y,t[--c]=_,t[d++]=_,t[d++]=T,t[--f]=T,t[--f]=x}{const p=r,m=n+o,g=e+p,v=e-p,x=s+m,_=s-m;t[u++]=g,t[u++]=x,t[--f]=_,t[--f]=g,r&&(t[u++]=v,t[u++]=x,t[--f]=_,t[--f]=v)}},triangulate(i,t){const e=i.points,s=t.points,r=t.indices;if(e.length===0)return;let n=s.length/2;const a=n;let o,h;if(i.type!==gt.RREC){const u=i.shape;o=u.x,h=u.y}else{const u=i.shape;o=u.x+u.width/2,h=u.y+u.height/2}const l=i.matrix;s.push(i.matrix?l.a*o+l.c*h+l.tx:o,i.matrix?l.b*o+l.d*h+l.ty:h),n++,s.push(e[0],e[1]);for(let u=2;u<e.length;u+=2)s.push(e[u],e[u+1]),r.push(n++,a,n);r.push(a+1,a,n)}};function za(i,t=!1){const e=i.length;if(e<6)return;let s=0;for(let r=0,n=i[e-2],a=i[e-1];r<e;r+=2){const o=i[r],h=i[r+1];s+=(o-n)*(h+a),n=o,a=h}if(!t&&s>0||t&&s<=0){const r=e/2;for(let n=r+r%2;n<e;n+=2){const a=e-n-2,o=e-n-1,h=n,l=n+1;[i[a],i[h]]=[i[h],i[a]],[i[o],i[l]]=[i[l],i[o]]}}}const gn={build(i){i.points=i.shape.points.slice()},triangulate(i,t){let e=i.points;const s=i.holes,r=t.points,n=t.indices;if(e.length>=6){za(e,!1);const a=[];for(let l=0;l<s.length;l++){const u=s[l];za(u.points,!0),a.push(e.length/2),e=e.concat(u.points)}const o=lo(e,a,2);if(!o)return;const h=r.length/2;for(let l=0;l<o.length;l+=3)n.push(o[l]+h),n.push(o[l+1]+h),n.push(o[l+2]+h);for(let l=0;l<e.length;l++)r.push(e[l])}}},vh={build(i){const t=i.shape,e=t.x,s=t.y,r=t.width,n=t.height,a=i.points;a.length=0,r>=0&&n>=0&&a.push(e,s,e+r,s,e+r,s+n,e,s+n)},triangulate(i,t){const e=i.points,s=t.points;if(e.length===0)return;const r=s.length/2;s.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(r,r+1,r+2,r+1,r+2,r+3)}},yh={build(i){Ts.build(i)},triangulate(i,t){Ts.triangulate(i,t)}};var St=(i=>(i.MITER="miter",i.BEVEL="bevel",i.ROUND="round",i))(St||{}),ce=(i=>(i.BUTT="butt",i.ROUND="round",i.SQUARE="square",i))(ce||{});const Me={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(i,t=20){if(!this.adaptive||!i||isNaN(i))return t;let e=Math.ceil(i/this.maxLength);return e<this.minSegments?e=this.minSegments:e>this.maxSegments&&(e=this.maxSegments),e}},Vm=Me;class Yr{static curveTo(t,e,s,r,n,a){const o=a[a.length-2],h=a[a.length-1]-e,l=o-t,u=r-e,c=s-t,d=Math.abs(h*c-l*u);if(d<1e-8||n===0)return(a[a.length-2]!==t||a[a.length-1]!==e)&&a.push(t,e),null;const f=h*h+l*l,p=u*u+c*c,m=h*u+l*c,g=n*Math.sqrt(f)/d,v=n*Math.sqrt(p)/d,x=g*m/f,_=v*m/p,y=g*c+v*l,T=g*u+v*h,P=l*(v+x),w=h*(v+x),A=c*(g+_),B=u*(g+_),k=Math.atan2(w-T,P-y),W=Math.atan2(B-T,A-y);return{cx:y+t,cy:T+e,radius:n,startAngle:k,endAngle:W,anticlockwise:l*u>c*h}}static arc(t,e,s,r,n,a,o,h,l){const u=o-a,c=Me._segmentsCount(Math.abs(u)*n,Math.ceil(Math.abs(u)/li)*40),d=u/(c*2),f=d*2,p=Math.cos(d),m=Math.sin(d),g=c-1,v=g%1/g;for(let x=0;x<=g;++x){const _=x+v*x,y=d+a+f*_,T=Math.cos(y),P=-Math.sin(y);l.push((p*T+m*P)*n+s,(p*-P+m*T)*n+r)}}}class xh{constructor(){this.reset()}begin(t,e,s){this.reset(),this.style=t,this.start=e,this.attribStart=s}end(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}class Ri{static curveLength(t,e,s,r,n,a,o,h){let l=0,u=0,c=0,d=0,f=0,p=0,m=0,g=0,v=0,x=0,_=0,y=t,T=e;for(let P=1;P<=10;++P)u=P/10,c=u*u,d=c*u,f=1-u,p=f*f,m=p*f,g=m*t+3*p*u*s+3*f*c*n+d*o,v=m*e+3*p*u*r+3*f*c*a+d*h,x=y-g,_=T-v,y=g,T=v,l+=Math.sqrt(x*x+_*_);return l}static curveTo(t,e,s,r,n,a,o){const h=o[o.length-2],l=o[o.length-1];o.length-=2;const u=Me._segmentsCount(Ri.curveLength(h,l,t,e,s,r,n,a));let c=0,d=0,f=0,p=0,m=0;o.push(h,l);for(let g=1,v=0;g<=u;++g)v=g/u,c=1-v,d=c*c,f=d*c,p=v*v,m=p*v,o.push(f*h+3*d*v*t+3*c*p*s+m*n,f*l+3*d*v*e+3*c*p*r+m*a)}}function Wa(i,t,e,s,r,n,a,o){const h=i-e*r,l=t-s*r,u=i+e*n,c=t+s*n;let d,f;a?(d=s,f=-e):(d=-s,f=e);const p=h+d,m=l+f,g=u+d,v=c+f;return o.push(p,m,g,v),2}function xe(i,t,e,s,r,n,a,o){const h=e-i,l=s-t;let u=Math.atan2(h,l),c=Math.atan2(r-i,n-t);o&&u<c?u+=Math.PI*2:!o&&u>c&&(c+=Math.PI*2);let d=u;const f=c-u,p=Math.abs(f),m=Math.sqrt(h*h+l*l),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,v=f/g;if(d+=v,o){a.push(i,t,e,s);for(let x=1,_=d;x<g;x++,_+=v)a.push(i,t,i+Math.sin(_)*m,t+Math.cos(_)*m);a.push(i,t,r,n)}else{a.push(e,s,i,t);for(let x=1,_=d;x<g;x++,_+=v)a.push(i+Math.sin(_)*m,t+Math.cos(_)*m,i,t);a.push(r,n,i,t)}return g*2}function Dp(i,t){const e=i.shape;let s=i.points||e.points.slice();const r=t.closePointEps;if(s.length===0)return;const n=i.lineStyle,a=new q(s[0],s[1]),o=new q(s[s.length-2],s[s.length-1]),h=e.type!==gt.POLY||e.closeStroke,l=Math.abs(a.x-o.x)<r&&Math.abs(a.y-o.y)<r;if(h){s=s.slice(),l&&(s.pop(),s.pop(),o.set(s[s.length-2],s[s.length-1]));const $=(a.x+o.x)*.5,V=(o.y+a.y)*.5;s.unshift($,V),s.push($,V)}const u=t.points,c=s.length/2;let d=s.length;const f=u.length/2,p=n.width/2,m=p*p,g=n.miterLimit*n.miterLimit;let v=s[0],x=s[1],_=s[2],y=s[3],T=0,P=0,w=-(x-y),A=v-_,B=0,k=0,W=Math.sqrt(w*w+A*A);w/=W,A/=W,w*=p,A*=p;const F=n.alignment,b=(1-F)*2,S=F*2;h||(n.cap===ce.ROUND?d+=xe(v-w*(b-S)*.5,x-A*(b-S)*.5,v-w*b,x-A*b,v+w*S,x+A*S,u,!0)+2:n.cap===ce.SQUARE&&(d+=Wa(v,x,w,A,b,S,!0,u))),u.push(v-w*b,x-A*b,v+w*S,x+A*S);for(let $=1;$<c-1;++$){v=s[($-1)*2],x=s[($-1)*2+1],_=s[$*2],y=s[$*2+1],T=s[($+1)*2],P=s[($+1)*2+1],w=-(x-y),A=v-_,W=Math.sqrt(w*w+A*A),w/=W,A/=W,w*=p,A*=p,B=-(y-P),k=_-T,W=Math.sqrt(B*B+k*k),B/=W,k/=W,B*=p,k*=p;const V=_-v,rt=x-y,R=_-T,I=P-y,Y=V*R+rt*I,Z=rt*R-I*V,Q=Z<0;if(Math.abs(Z)<.001*Math.abs(Y)){u.push(_-w*b,y-A*b,_+w*S,y+A*S),Y>=0&&(n.join===St.ROUND?d+=xe(_,y,_-w*b,y-A*b,_-B*b,y-k*b,u,!1)+4:d+=2,u.push(_-B*S,y-k*S,_+B*b,y+k*b));continue}const dt=(-w+v)*(-A+y)-(-w+_)*(-A+x),at=(-B+T)*(-k+y)-(-B+_)*(-k+P),ft=(V*at-R*dt)/Z,vt=(I*dt-rt*at)/Z,Tt=(ft-_)*(ft-_)+(vt-y)*(vt-y),mt=_+(ft-_)*b,J=y+(vt-y)*b,ot=_-(ft-_)*S,ut=y-(vt-y)*S,kt=Math.min(V*V+rt*rt,R*R+I*I),Gt=Q?b:S,Qe=kt+Gt*Gt*m,Vh=Tt<=Qe;let Cs=n.join;if(Cs===St.MITER&&Tt/m>g&&(Cs=St.BEVEL),Vh)switch(Cs){case St.MITER:{u.push(mt,J,ot,ut);break}case St.BEVEL:{Q?u.push(mt,J,_+w*S,y+A*S,mt,J,_+B*S,y+k*S):u.push(_-w*b,y-A*b,ot,ut,_-B*b,y-k*b,ot,ut),d+=2;break}case St.ROUND:{Q?(u.push(mt,J,_+w*S,y+A*S),d+=xe(_,y,_+w*S,y+A*S,_+B*S,y+k*S,u,!0)+4,u.push(mt,J,_+B*S,y+k*S)):(u.push(_-w*b,y-A*b,ot,ut),d+=xe(_,y,_-w*b,y-A*b,_-B*b,y-k*b,u,!1)+4,u.push(_-B*b,y-k*b,ot,ut));break}}else{switch(u.push(_-w*b,y-A*b,_+w*S,y+A*S),Cs){case St.MITER:{Q?u.push(ot,ut,ot,ut):u.push(mt,J,mt,J),d+=2;break}case St.ROUND:{Q?d+=xe(_,y,_+w*S,y+A*S,_+B*S,y+k*S,u,!0)+2:d+=xe(_,y,_-w*b,y-A*b,_-B*b,y-k*b,u,!1)+2;break}}u.push(_-B*b,y-k*b,_+B*S,y+k*S),d+=2}}v=s[(c-2)*2],x=s[(c-2)*2+1],_=s[(c-1)*2],y=s[(c-1)*2+1],w=-(x-y),A=v-_,W=Math.sqrt(w*w+A*A),w/=W,A/=W,w*=p,A*=p,u.push(_-w*b,y-A*b,_+w*S,y+A*S),h||(n.cap===ce.ROUND?d+=xe(_-w*(b-S)*.5,y-A*(b-S)*.5,_-w*b,y-A*b,_+w*S,y+A*S,u,!1)+2:n.cap===ce.SQUARE&&(d+=Wa(_,y,w,A,b,S,!1,u)));const G=t.indices,z=Me.epsilon*Me.epsilon;for(let $=f;$<d+f-2;++$)v=u[$*2],x=u[$*2+1],_=u[($+1)*2],y=u[($+1)*2+1],T=u[($+2)*2],P=u[($+2)*2+1],!(Math.abs(v*(y-P)+_*(P-x)+T*(x-y))<z)&&G.push($,$+1,$+2)}function Op(i,t){let e=0;const s=i.shape,r=i.points||s.points,n=s.type!==gt.POLY||s.closeStroke;if(r.length===0)return;const a=t.points,o=t.indices,h=r.length/2,l=a.length/2;let u=l;for(a.push(r[0],r[1]),e=1;e<h;e++)a.push(r[e*2],r[e*2+1]),o.push(u,u+1),u++;n&&o.push(u,l)}function qr(i,t){i.lineStyle.native?Op(i,t):Dp(i,t)}class Ci{static curveLength(t,e,s,r,n,a){const o=t-2*s+n,h=e-2*r+a,l=2*s-2*t,u=2*r-2*e,c=4*(o*o+h*h),d=4*(o*l+h*u),f=l*l+u*u,p=2*Math.sqrt(c+d+f),m=Math.sqrt(c),g=2*c*m,v=2*Math.sqrt(f),x=d/m;return(g*p+m*d*(p-v)+(4*f*c-d*d)*Math.log((2*m+x+p)/(x+v)))/(4*g)}static curveTo(t,e,s,r,n){const a=n[n.length-2],o=n[n.length-1],h=Me._segmentsCount(Ci.curveLength(a,o,t,e,s,r));let l=0,u=0;for(let c=1;c<=h;++c){const d=c/h;l=a+(t-a)*d,u=o+(e-o)*d,n.push(l+(t+(s-t)*d-l)*d,u+(e+(r-e)*d-u)*d)}}}const ii={[gt.POLY]:gn,[gt.CIRC]:Ts,[gt.ELIP]:Ts,[gt.RECT]:vh,[gt.RREC]:yh},Kr=[],cs=[];class vi{constructor(t,e=null,s=null,r=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=s,this.fillStyle=e,this.matrix=r,this.type=t.type}clone(){return new vi(this.shape,this.fillStyle,this.lineStyle,this.matrix)}destroy(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null}}const Ne=new q,bh=class Th extends So{constructor(){super(),this.closePointEps=1e-4,this.boundsPadding=0,this.uvsFloat32=null,this.indicesUint16=null,this.batchable=!1,this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.drawCalls=[],this.batchDirty=-1,this.batches=[],this.dirty=0,this.cacheDirty=-1,this.clearDirty=0,this.shapeIndex=0,this._bounds=new pi,this.boundsDirty=-1}get bounds(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds}invalidate(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(let t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),cs.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),Kr.push(e)}this.batches.length=0}clear(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,e=null,s=null,r=null){const n=new vi(t,e,s,r);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const s=new vi(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return s.lineStyle=r.lineStyle,r.holes.push(s),this.dirty++,this}destroy(){super.destroy();for(let t=0;t<this.graphicsData.length;++t)this.graphicsData[t].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null}containsPoint(t){const e=this.graphicsData;for(let s=0;s<e.length;++s){const r=e[s];if(r.fillStyle.visible&&r.shape&&(r.matrix?r.matrix.applyInverse(t,Ne):Ne.copyFrom(t),r.shape.contains(Ne.x,Ne.y))){let n=!1;if(r.holes){for(let a=0;a<r.holes.length;a++)if(r.holes[a].shape.contains(Ne.x,Ne.y)){n=!0;break}}if(!n)return!0}}return!1}updateBatches(){if(!this.graphicsData.length){this.batchable=!0;return}if(!this.validateBatching())return;this.cacheDirty=this.dirty;const t=this.uvs,e=this.graphicsData;let s=null,r=null;this.batches.length>0&&(s=this.batches[this.batches.length-1],r=s.style);for(let h=this.shapeIndex;h<e.length;h++){this.shapeIndex++;const l=e[h],u=l.fillStyle,c=l.lineStyle;ii[l.type].build(l),l.matrix&&this.transformPoints(l.points,l.matrix),(u.visible||c.visible)&&this.processHoles(l.holes);for(let d=0;d<2;d++){const f=d===0?u:c;if(!f.visible)continue;const p=f.texture.baseTexture,m=this.indices.length,g=this.points.length/2;p.wrapMode=re.REPEAT,d===0?this.processFill(l):this.processLine(l);const v=this.points.length/2-g;v!==0&&(s&&!this._compareStyles(r,f)&&(s.end(m,g),s=null),s||(s=Kr.pop()||new xh,s.begin(f,m,g),this.batches.push(s),r=f),this.addUvs(this.points,t,f.texture,g,v,f.matrix))}}const n=this.indices.length,a=this.points.length/2;if(s&&s.end(n,a),this.batches.length===0){this.batchable=!0;return}const o=a>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&o===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=o?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(t,e){return!(!t||!e||t.texture.baseTexture!==e.texture.baseTexture||t.color+t.alpha!==e.color+e.alpha||!!t.native!=!!e.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let t=0,e=this.graphicsData.length;t<e;t++){const s=this.graphicsData[t],r=s.fillStyle,n=s.lineStyle;if(r&&!r.texture.baseTexture.valid||n&&!n.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);const t=this.batches;for(let e=0,s=t.length;e<s;e++){const r=t[e];for(let n=0;n<r.size;n++){const a=r.start+n;this.indicesUint16[a]=this.indicesUint16[a]-r.attribStart}}}isBatchable(){if(this.points.length>65535*2)return!1;const t=this.batches;for(let e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<Th.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++X._globalBatch;for(let c=0;c<this.drawCalls.length;c++)this.drawCalls[c].texArray.clear(),cs.push(this.drawCalls[c]);this.drawCalls.length=0;const e=this.colors,s=this.textureIds;let r=cs.pop();r||(r=new Sr,r.texArray=new Pr),r.texArray.count=0,r.start=0,r.size=0,r.type=zt.TRIANGLES;let n=0,a=null,o=0,h=!1,l=zt.TRIANGLES,u=0;this.drawCalls.push(r);for(let c=0;c<this.batches.length;c++){const d=this.batches[c],f=8,p=d.style,m=p.texture.baseTexture;h!==!!p.native&&(h=!!p.native,l=h?zt.LINES:zt.TRIANGLES,a=null,n=f,t++),a!==m&&(a=m,m._batchEnabled!==t&&(n===f&&(t++,n=0,r.size>0&&(r=cs.pop(),r||(r=new Sr,r.texArray=new Pr),this.drawCalls.push(r)),r.start=u,r.size=0,r.texArray.count=0,r.type=l),m.touched=1,m._batchEnabled=t,m._batchLocation=n,m.wrapMode=re.REPEAT,r.texArray.elements[r.texArray.count++]=m,n++)),r.size+=d.size,u+=d.size,o=m._batchLocation,this.addColors(e,p.color,p.alpha,d.attribSize,d.attribStart),this.addTextureIds(s,o,d.attribSize,d.attribStart)}X._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,s=this.colors,r=this.textureIds,n=new ArrayBuffer(t.length*3*4),a=new Float32Array(n),o=new Uint32Array(n);let h=0;for(let l=0;l<t.length/2;l++)a[h++]=t[l*2],a[h++]=t[l*2+1],a[h++]=e[l*2],a[h++]=e[l*2+1],o[h++]=s[l],a[h++]=r[l];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?gn.triangulate(t,this):ii[t.type].triangulate(t,this)}processLine(t){qr(t,this);for(let e=0;e<t.holes.length;e++)qr(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const s=t[e];ii[s.type].build(s),s.matrix&&this.transformPoints(s.points,s.matrix)}}calculateBounds(){const t=this._bounds;t.clear(),t.addVertexData(this.points,0,this.points.length),t.pad(this.boundsPadding,this.boundsPadding)}transformPoints(t,e){for(let s=0;s<t.length/2;s++){const r=t[s*2],n=t[s*2+1];t[s*2]=e.a*r+e.c*n+e.tx,t[s*2+1]=e.b*r+e.d*n+e.ty}}addColors(t,e,s,r,n=0){const a=K.shared.setValue(e).toLittleEndianNumber(),o=K.shared.setValue(a).toPremultiplied(s);t.length=Math.max(t.length,n+r);for(let h=0;h<r;h++)t[n+h]=o}addTextureIds(t,e,s,r=0){t.length=Math.max(t.length,r+s);for(let n=0;n<s;n++)t[r+n]=e}addUvs(t,e,s,r,n,a=null){let o=0;const h=e.length,l=s.frame;for(;o<n;){let c=t[(r+o)*2],d=t[(r+o)*2+1];if(a){const f=a.a*c+a.c*d+a.tx;d=a.b*c+a.d*d+a.ty,c=f}o++,e.push(c/l.width,d/l.height)}const u=s.baseTexture;(l.width<u.width||l.height<u.height)&&this.adjustUvs(e,s,h,n)}adjustUvs(t,e,s,r){const n=e.baseTexture,a=1e-6,o=s+r*2,h=e.frame,l=h.width/n.width,u=h.height/n.height;let c=h.x/h.width,d=h.y/h.height,f=Math.floor(t[s]+a),p=Math.floor(t[s+1]+a);for(let m=s+2;m<o;m+=2)f=Math.min(f,Math.floor(t[m]+a)),p=Math.min(p,Math.floor(t[m+1]+a));c-=f,d-=p;for(let m=s;m<o;m+=2)t[m]=(t[m]+c)*l,t[m+1]=(t[m+1]+d)*u}};bh.BATCHABLE_SIZE=100;let Bp=bh;class Pi{constructor(){this.color=16777215,this.alpha=1,this.texture=O.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new Pi;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t}reset(){this.color=16777215,this.alpha=1,this.texture=O.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class _n extends Pi{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=ce.BUTT,this.join=St.MITER,this.miterLimit=10}clone(){const t=new _n;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t}reset(){super.reset(),this.color=0,this.alignment=.5,this.width=0,this.native=!1,this.cap=ce.BUTT,this.join=St.MITER,this.miterLimit=10}}const sr={},Zr=class ri extends Mt{constructor(t=null){super(),this.shader=null,this.pluginName="batch",this.currentPath=null,this.batches=[],this.batchTint=-1,this.batchDirty=-1,this.vertexData=null,this._fillStyle=new Pi,this._lineStyle=new _n,this._matrix=null,this._holeMode=!1,this.state=ne.for2d(),this._geometry=t||new Bp,this._geometry.refCount++,this._transformID=-1,this._tintColor=new K(16777215),this.blendMode=H.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new ri(this._geometry)}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(t=null,e=0,s,r=.5,n=!1){return typeof t=="number"&&(t={width:t,color:e,alpha:s,alignment:r,native:n}),this.lineTextureStyle(t)}lineTextureStyle(t){const e={width:0,texture:O.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:ce.BUTT,join:St.MITER,miterLimit:10};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const s=t.width>0&&t.alpha>0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:s},t)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new We,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new We,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this}lineTo(t,e){this.currentPath||this.moveTo(0,0);const s=this.currentPath.points,r=s[s.length-2],n=s[s.length-1];return(r!==t||n!==e)&&s.push(t,e),this}_initCurve(t=0,e=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[t,e]):this.moveTo(t,e)}quadraticCurveTo(t,e,s,r){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),Ci.curveTo(t,e,s,r,n),this}bezierCurveTo(t,e,s,r,n,a){return this._initCurve(),Ri.curveTo(t,e,s,r,n,a,this.currentPath.points),this}arcTo(t,e,s,r,n){this._initCurve(t,e);const a=this.currentPath.points,o=Yr.curveTo(t,e,s,r,n,a);if(o){const{cx:h,cy:l,radius:u,startAngle:c,endAngle:d,anticlockwise:f}=o;this.arc(h,l,u,c,d,f)}return this}arc(t,e,s,r,n,a=!1){if(r===n)return this;if(!a&&n<=r?n+=li:a&&r<=n&&(r+=li),n-r===0)return this;const o=t+Math.cos(r)*s,h=e+Math.sin(r)*s,l=this._geometry.closePointEps;let u=this.currentPath?this.currentPath.points:null;if(u){const c=Math.abs(u[u.length-2]-o),d=Math.abs(u[u.length-1]-h);c<l&&d<l||u.push(o,h)}else this.moveTo(o,h),u=this.currentPath.points;return Yr.arc(o,h,t,e,s,r,n,a,u),this}beginFill(t=0,e){return this.beginTextureFill({texture:O.WHITE,color:t,alpha:e})}normalizeColor(t){var e,s;const r=K.shared.setValue((e=t.color)!=null?e:0);t.color=r.toNumber(),(s=t.alpha)!=null||(t.alpha=r.alpha)}beginTextureFill(t){const e={texture:O.WHITE,color:16777215,matrix:null};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const s=t.alpha>0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:s},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,s,r){return this.drawShape(new j(t,e,s,r))}drawRoundedRect(t,e,s,r,n){return this.drawShape(new cn(t,e,s,r,n))}drawCircle(t,e,s){return this.drawShape(new ln(t,e,s))}drawEllipse(t,e,s,r){return this.drawShape(new un(t,e,s,r))}drawPolygon(...t){let e,s=!0;const r=t[0];r.points?(s=r.closeStroke,e=r.points):Array.isArray(t[0])?e=t[0]:e=t;const n=new We(e);return n.closeStroke=s,this.drawShape(n),this}drawShape(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this}clear(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this}isFastRect(){const t=this._geometry.graphicsData;return t.length===1&&t[0].shape.type===gt.RECT&&!t[0].matrix&&!t[0].holes.length&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)}_render(t){this.finishPoly();const e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))}_populateBatches(){const t=this._geometry,e=this.blendMode,s=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=s,this.vertexData=new Float32Array(t.points);for(let r=0;r<s;r++){const n=t.batches[r],a=n.style.color,o=new Float32Array(this.vertexData.buffer,n.attribStart*4*2,n.attribSize*2),h=new Float32Array(t.uvsFloat32.buffer,n.attribStart*4*2,n.attribSize*2),l=new Uint16Array(t.indicesUint16.buffer,n.start*2,n.size),u={vertexData:o,blendMode:e,indices:l,uvs:h,_batchRGB:K.shared.setValue(a).toRgbArray(),_tintRGB:a,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[r]=u}}_renderBatched(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let e=0,s=this.batches.length;e<s;e++){const r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}}_renderDirect(t){const e=this._resolveDirectShader(t),s=this._geometry,r=this.worldAlpha,n=e.uniforms,a=s.drawCalls;n.translationMatrix=this.transform.worldTransform,K.shared.setValue(this._tintColor).premultiply(r).toArray(n.tint),t.shader.bind(e),t.geometry.bind(s,e),t.state.set(this.state);for(let o=0,h=a.length;o<h;o++)this._renderDrawCallDirect(t,s.drawCalls[o])}_renderDrawCallDirect(t,e){const{texArray:s,type:r,size:n,start:a}=e,o=s.count;for(let h=0;h<o;h++)t.texture.bind(s.elements[h],h);t.geometry.draw(r,n,a)}_resolveDirectShader(t){let e=this.shader;const s=this.pluginName;if(!e){if(!sr[s]){const{maxTextures:r}=t.plugins[s],n=new Int32Array(r);for(let h=0;h<r;h++)n[h]=h;const a={tint:new Float32Array([1,1,1,1]),translationMatrix:new tt,default:Lt.from({uSamplers:n},!0)},o=t.plugins[s]._shader.program;sr[s]=new qt(o,a)}e=sr[s]}return e}_calculateBounds(){this.finishPoly();const t=this._geometry;if(!t.graphicsData.length)return;const{minX:e,minY:s,maxX:r,maxY:n}=t.bounds;this._bounds.addFrame(this.transform,e,s,r,n)}containsPoint(t){return this.worldTransform.applyInverse(t,ri._TEMP_POINT),this._geometry.containsPoint(ri._TEMP_POINT)}calculateTints(){if(this.batchTint!==this.tint){this.batchTint=this._tintColor.toNumber();for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e._tintRGB=K.shared.setValue(this._tintColor).multiply(e._batchRGB).toLittleEndianNumber()}}}calculateVertices(){const t=this.transform._worldID;if(this._transformID===t)return;this._transformID=t;const e=this.transform.worldTransform,s=e.a,r=e.b,n=e.c,a=e.d,o=e.tx,h=e.ty,l=this._geometry.points,u=this.vertexData;let c=0;for(let d=0;d<l.length;d+=2){const f=l[d],p=l[d+1];u[c++]=s*f+n*p+o,u[c++]=a*p+r*f+h}}closePath(){const t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this}setMatrix(t){return this._matrix=t,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(t){this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,super.destroy(t)}};Zr.curves=Me,Zr._TEMP_POINT=new q;let Eh=Zr;const Xm={buildPoly:gn,buildCircle:Ts,buildRectangle:vh,buildRoundedRectangle:yh,buildLine:qr,ArcUtils:Yr,BezierUtils:Ri,QuadraticUtils:Ci,BatchPart:xh,FILL_COMMANDS:ii,BATCH_POOL:Kr,DRAW_CALL_POOL:cs};class Fp{constructor(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}update(t){if(!t&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)return;this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;const e=this.uvBuffer.data;(!this.data||this.data.length!==e.length)&&(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}}const ir=new q,Ya=new We,Ah=class wh extends Mt{constructor(t,e,s,r=zt.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=s||ne.for2d(),this.drawMode=r,this.start=0,this.size=0,this.uvs=null,this.indices=null,this.vertexData=new Float32Array(1),this.vertexDirty=-1,this._transformID=-1,this._roundPixels=D.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}get uvBuffer(){return this.geometry.buffers[1]}get verticesBuffer(){return this.geometry.buffers[0]}set material(t){this.shader=t}get material(){return this.shader}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get tint(){return"tint"in this.shader?this.shader.tint:null}set tint(t){this.shader.tint=t}get tintValue(){return this.shader.tintValue}get texture(){return"texture"in this.shader?this.shader.texture:null}set texture(t){this.shader.texture=t}_render(t){const e=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===zt.TRIANGLES&&e.length<wh.BATCHABLE_SIZE*2?this._renderToBatch(t):this._renderDefault(t)}_renderDefault(t){const e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}_renderToBatch(t){const e=this.geometry,s=this.shader;s.uvMatrix&&(s.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=s._tintRGB,this._texture=s.texture;const r=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[r]),t.plugins[r].render(this)}calculateVertices(){const t=this.geometry.buffers[0],e=t.data,s=t._updateID;if(s===this.vertexDirty&&this._transformID===this.transform._worldID)return;this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));const r=this.transform.worldTransform,n=r.a,a=r.b,o=r.c,h=r.d,l=r.tx,u=r.ty,c=this.vertexData;for(let d=0;d<c.length/2;d++){const f=e[d*2],p=e[d*2+1];c[d*2]=n*f+o*p+l,c[d*2+1]=a*f+h*p+u}if(this._roundPixels){const d=D.RESOLUTION;for(let f=0;f<c.length;++f)c[f]=Math.round(c[f]*d)/d}this.vertexDirty=s}calculateUvs(){const t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new Fp(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)}_calculateBounds(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)}containsPoint(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,ir);const e=this.geometry.getBuffer("aVertexPosition").data,s=Ya.points,r=this.geometry.getIndex().data,n=r.length,a=this.drawMode===4?3:1;for(let o=0;o+2<n;o+=a){const h=r[o]*2,l=r[o+1]*2,u=r[o+2]*2;if(s[0]=e[h],s[1]=e[h+1],s[2]=e[l],s[3]=e[l+1],s[4]=e[u],s[5]=e[u+1],Ya.contains(ir.x,ir.y))return!0}return!1}destroy(t){super.destroy(t),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null}};Ah.BATCHABLE_SIZE=100;let Es=Ah;class Mi extends fe{constructor(t,e,s){super();const r=new nt(t),n=new nt(e,!0),a=new nt(s,!0,!0);this.addAttribute("aVertexPosition",r,2,!1,U.FLOAT).addAttribute("aTextureCoord",n,2,!1,U.FLOAT).addIndex(a),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var Np=`varying vec2 vTextureCoord;
|
|
926
926
|
uniform vec4 uColor;
|
|
927
927
|
|
|
928
928
|
uniform sampler2D uSampler;
|
|
@@ -931,7 +931,7 @@ void main(void)
|
|
|
931
931
|
{
|
|
932
932
|
gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;
|
|
933
933
|
}
|
|
934
|
-
`,
|
|
934
|
+
`,Lp=`attribute vec2 aVertexPosition;
|
|
935
935
|
attribute vec2 aTextureCoord;
|
|
936
936
|
|
|
937
937
|
uniform mat3 projectionMatrix;
|
|
@@ -946,7 +946,7 @@ void main(void)
|
|
|
946
946
|
|
|
947
947
|
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
|
|
948
948
|
}
|
|
949
|
-
`;class As extends qt{constructor(t,e){const s={uSampler:t,alpha:1,uTextureMatrix:tt.IDENTITY,uColor:new Float32Array([1,1,1,1])};e=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},e),e.uniforms&&Object.assign(s,e.uniforms),super(e.program||ie.from(Bp,Op),s),this._colorDirty=!1,this.uvMatrix=new fn(t),this.batchable=e.program===void 0,this.pluginName=e.pluginName,this._tintColor=new K(e.tint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0,this.alpha=e.alpha}get texture(){return this.uniforms.uSampler}set texture(t){this.uniforms.uSampler!==t&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!t.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=t,this.uvMatrix.texture=t)}set alpha(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(t){t!==this.tint&&(this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}get tintValue(){return this._tintColor.toNumber()}update(){if(this._colorDirty){this._colorDirty=!1;const t=this.texture.baseTexture.alphaMode;K.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class Fp extends Mi{constructor(t=100,e=100,s=10,r=10){super(),this.segWidth=s,this.segHeight=r,this.width=t,this.height=e,this.build()}build(){const t=this.segWidth*this.segHeight,e=[],s=[],r=[],n=this.segWidth-1,a=this.segHeight-1,o=this.width/n,h=this.height/a;for(let u=0;u<t;u++){const c=u%this.segWidth,d=u/this.segWidth|0;e.push(c*o,d*h),s.push(c/n,d/a)}const l=n*a;for(let u=0;u<l;u++){const c=u%n,d=u/n|0,f=d*this.segWidth+c,p=d*this.segWidth+c+1,m=(d+1)*this.segWidth+c,g=(d+1)*this.segWidth+c+1;r.push(f,p,m,p,g,m)}this.buffers[0].data=new Float32Array(e),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint16Array(r),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}}class Np extends Mi{constructor(t=200,e,s=0){super(new Float32Array(e.length*4),new Float32Array(e.length*4),new Uint16Array((e.length-1)*6)),this.points=e,this._width=t,this.textureScale=s,this.build()}get width(){return this._width}build(){const t=this.points;if(!t)return;const e=this.getBuffer("aVertexPosition"),s=this.getBuffer("aTextureCoord"),r=this.getIndex();if(t.length<1)return;e.data.length/4!==t.length&&(e.data=new Float32Array(t.length*4),s.data=new Float32Array(t.length*4),r.data=new Uint16Array((t.length-1)*6));const n=s.data,a=r.data;n[0]=0,n[1]=0,n[2]=0,n[3]=1;let o=0,h=t[0];const l=this._width*this.textureScale,u=t.length;for(let d=0;d<u;d++){const f=d*4;if(this.textureScale>0){const p=h.x-t[d].x,m=h.y-t[d].y,g=Math.sqrt(p*p+m*m);h=t[d],o+=g/l}else o=d/(u-1);n[f]=o,n[f+1]=0,n[f+2]=o,n[f+3]=1}let c=0;for(let d=0;d<u-1;d++){const f=d*2;a[c++]=f,a[c++]=f+1,a[c++]=f+2,a[c++]=f+2,a[c++]=f+1,a[c++]=f+3}s.update(),r.update(),this.updateVertices()}updateVertices(){const t=this.points;if(t.length<1)return;let e=t[0],s,r=0,n=0;const a=this.buffers[0].data,o=t.length,h=this.textureScale>0?this.textureScale*this._width/2:this._width/2;for(let l=0;l<o;l++){const u=t[l],c=l*4;l<t.length-1?s=t[l+1]:s=u,n=-(s.x-e.x),r=s.y-e.y;let d=(1-l/(o-1))*10;d>1&&(d=1);const f=Math.sqrt(r*r+n*n);f<1e-6?(r=0,n=0):(r/=f,n/=f,r*=h,n*=h),a[c]=u.x+r,a[c+1]=u.y+n,a[c+2]=u.x-r,a[c+3]=u.y-n,e=u}this.buffers[0].update()}update(){this.textureScale>0?this.build():this.updateVertices()}}class Lp extends Es{constructor(t,e,s){const r=new Fp(t.width,t.height,e,s),n=new As(D.WHITE);super(r,n),this.texture=t,this.autoResize=!0}textureUpdated(){this._textureID=this.shader.texture._updateID;const t=this.geometry,{width:e,height:s}=this.shader.texture;this.autoResize&&(t.width!==e||t.height!==s)&&(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())}set texture(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))}get texture(){return this.shader.texture}_render(t){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),super._render(t)}destroy(t){this.shader.texture.off("update",this.textureUpdated,this),super.destroy(t)}}const qs=10;class Hm extends Lp{constructor(t,e,s,r,n){var a,o,h,l,u,c,d,f;super(D.WHITE,4,4),this._origWidth=t.orig.width,this._origHeight=t.orig.height,this._width=this._origWidth,this._height=this._origHeight,this._leftWidth=(o=e!=null?e:(a=t.defaultBorders)==null?void 0:a.left)!=null?o:qs,this._rightWidth=(l=r!=null?r:(h=t.defaultBorders)==null?void 0:h.right)!=null?l:qs,this._topHeight=(c=s!=null?s:(u=t.defaultBorders)==null?void 0:u.top)!=null?c:qs,this._bottomHeight=(f=n!=null?n:(d=t.defaultBorders)==null?void 0:d.bottom)!=null?f:qs,this.texture=t}textureUpdated(){this._textureID=this.shader.texture._updateID,this._refresh()}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(t){this.geometry.getBuffer("aVertexPosition").data=t}updateHorizontalVertices(){const t=this.vertices,e=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*e,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*e,t[25]=t[27]=t[29]=t[31]=this._height}updateVerticalVertices(){const t=this.vertices,e=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*e,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*e,t[6]=t[14]=t[22]=t[30]=this._width}_getMinScale(){const t=this._leftWidth+this._rightWidth,e=this._width>t?1:this._width/t,s=this._topHeight+this._bottomHeight,r=this._height>s?1:this._height/s;return Math.min(e,r)}get width(){return this._width}set width(t){this._width=t,this._refresh()}get height(){return this._height}set height(t){this._height=t,this._refresh()}get leftWidth(){return this._leftWidth}set leftWidth(t){this._leftWidth=t,this._refresh()}get rightWidth(){return this._rightWidth}set rightWidth(t){this._rightWidth=t,this._refresh()}get topHeight(){return this._topHeight}set topHeight(t){this._topHeight=t,this._refresh()}get bottomHeight(){return this._bottomHeight}set bottomHeight(t){this._bottomHeight=t,this._refresh()}_refresh(){const t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;const s=1/this._origWidth,r=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=s*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-s*this._rightWidth,e[9]=e[11]=e[13]=e[15]=r*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-r*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()}}class Vm extends Es{constructor(t=D.EMPTY,e,s,r,n){const a=new Mi(e,s,r);a.getBuffer("aVertexPosition").static=!1;const o=new As(t);super(a,o,null,n),this.autoUpdate=!0}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(t){this.geometry.getBuffer("aVertexPosition").data=t}_render(t){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),super._render(t)}}class Xm extends Es{constructor(t,e,s=0){const r=new Np(t.height,e,s),n=new As(t);s>0&&(t.baseTexture.wrapMode=re.REPEAT),super(r,n),this.autoUpdate=!0}_render(t){const e=this.geometry;(this.autoUpdate||e._width!==this.shader.texture.height)&&(e._width=this.shader.texture.height,e.update()),super._render(t)}}class jm extends Mt{constructor(t=1500,e,s=16384,r=!1){super();const n=16384;s>n&&(s=n),this._properties=[!1,!0,!1,!1,!1],this._maxSize=t,this._batchSize=s,this._buffers=null,this._bufferUpdateIDs=[],this._updateID=0,this.interactiveChildren=!1,this.blendMode=H.NORMAL,this.autoResize=r,this.roundPixels=!0,this.baseTexture=null,this.setProperties(e),this._tintColor=new K(0),this.tintRgb=new Float32Array(3),this.tint=16777215}setProperties(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])}updateTransform(){this.displayObjectUpdateTransform()}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintColor.toRgbArray(this.tintRgb)}render(t){!this.visible||this.worldAlpha<=0||!this.children.length||!this.renderable||(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",()=>this.onChildrenChange(0))),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))}onChildrenChange(t){const e=Math.floor(t/this._batchSize);for(;this._bufferUpdateIDs.length<e;)this._bufferUpdateIDs.push(0);this._bufferUpdateIDs[e]=++this._updateID}dispose(){if(this._buffers){for(let t=0;t<this._buffers.length;++t)this._buffers[t].destroy();this._buffers=null}}destroy(t){super.destroy(t),this.dispose(),this._properties=null,this._buffers=null,this._bufferUpdateIDs=null}}class qa{constructor(t,e,s){this.geometry=new fe,this.indexBuffer=null,this.size=s,this.dynamicProperties=[],this.staticProperties=[];for(let r=0;r<t.length;++r){let n=t[r];n={attributeName:n.attributeName,size:n.size,uploadFunction:n.uploadFunction,type:n.type||k.FLOAT,offset:n.offset},e[r]?this.dynamicProperties.push(n):this.staticProperties.push(n)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}initBuffers(){const t=this.geometry;let e=0;this.indexBuffer=new nt(xo(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(let a=0;a<this.dynamicProperties.length;++a){const o=this.dynamicProperties[a];o.offset=e,e+=o.size,this.dynamicStride+=o.size}const s=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(s),this.dynamicDataUint32=new Uint32Array(s),this.dynamicBuffer=new nt(this.dynamicData,!1,!1);let r=0;this.staticStride=0;for(let a=0;a<this.staticProperties.length;++a){const o=this.staticProperties[a];o.offset=r,r+=o.size,this.staticStride+=o.size}const n=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(n),this.staticDataUint32=new Uint32Array(n),this.staticBuffer=new nt(this.staticData,!0,!1);for(let a=0;a<this.dynamicProperties.length;++a){const o=this.dynamicProperties[a];t.addAttribute(o.attributeName,this.dynamicBuffer,0,o.type===k.UNSIGNED_BYTE,o.type,this.dynamicStride*4,o.offset*4)}for(let a=0;a<this.staticProperties.length;++a){const o=this.staticProperties[a];t.addAttribute(o.attributeName,this.staticBuffer,0,o.type===k.UNSIGNED_BYTE,o.type,this.staticStride*4,o.offset*4)}}uploadDynamic(t,e,s){for(let r=0;r<this.dynamicProperties.length;r++){const n=this.dynamicProperties[r];n.uploadFunction(t,e,s,n.type===k.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,n.offset)}this.dynamicBuffer._updateID++}uploadStatic(t,e,s){for(let r=0;r<this.staticProperties.length;r++){const n=this.staticProperties[r];n.uploadFunction(t,e,s,n.type===k.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,n.offset)}this.staticBuffer._updateID++}destroy(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()}}var Up=`varying vec2 vTextureCoord;
|
|
949
|
+
`;class As extends qt{constructor(t,e){const s={uSampler:t,alpha:1,uTextureMatrix:tt.IDENTITY,uColor:new Float32Array([1,1,1,1])};e=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},e),e.uniforms&&Object.assign(s,e.uniforms),super(e.program||ie.from(Lp,Np),s),this._colorDirty=!1,this.uvMatrix=new fn(t),this.batchable=e.program===void 0,this.pluginName=e.pluginName,this._tintColor=new K(e.tint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0,this.alpha=e.alpha}get texture(){return this.uniforms.uSampler}set texture(t){this.uniforms.uSampler!==t&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!t.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=t,this.uvMatrix.texture=t)}set alpha(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(t){t!==this.tint&&(this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}get tintValue(){return this._tintColor.toNumber()}update(){if(this._colorDirty){this._colorDirty=!1;const t=this.texture.baseTexture.alphaMode;K.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class Up extends Mi{constructor(t=100,e=100,s=10,r=10){super(),this.segWidth=s,this.segHeight=r,this.width=t,this.height=e,this.build()}build(){const t=this.segWidth*this.segHeight,e=[],s=[],r=[],n=this.segWidth-1,a=this.segHeight-1,o=this.width/n,h=this.height/a;for(let u=0;u<t;u++){const c=u%this.segWidth,d=u/this.segWidth|0;e.push(c*o,d*h),s.push(c/n,d/a)}const l=n*a;for(let u=0;u<l;u++){const c=u%n,d=u/n|0,f=d*this.segWidth+c,p=d*this.segWidth+c+1,m=(d+1)*this.segWidth+c,g=(d+1)*this.segWidth+c+1;r.push(f,p,m,p,g,m)}this.buffers[0].data=new Float32Array(e),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint16Array(r),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}}class kp extends Mi{constructor(t=200,e,s=0){super(new Float32Array(e.length*4),new Float32Array(e.length*4),new Uint16Array((e.length-1)*6)),this.points=e,this._width=t,this.textureScale=s,this.build()}get width(){return this._width}build(){const t=this.points;if(!t)return;const e=this.getBuffer("aVertexPosition"),s=this.getBuffer("aTextureCoord"),r=this.getIndex();if(t.length<1)return;e.data.length/4!==t.length&&(e.data=new Float32Array(t.length*4),s.data=new Float32Array(t.length*4),r.data=new Uint16Array((t.length-1)*6));const n=s.data,a=r.data;n[0]=0,n[1]=0,n[2]=0,n[3]=1;let o=0,h=t[0];const l=this._width*this.textureScale,u=t.length;for(let d=0;d<u;d++){const f=d*4;if(this.textureScale>0){const p=h.x-t[d].x,m=h.y-t[d].y,g=Math.sqrt(p*p+m*m);h=t[d],o+=g/l}else o=d/(u-1);n[f]=o,n[f+1]=0,n[f+2]=o,n[f+3]=1}let c=0;for(let d=0;d<u-1;d++){const f=d*2;a[c++]=f,a[c++]=f+1,a[c++]=f+2,a[c++]=f+2,a[c++]=f+1,a[c++]=f+3}s.update(),r.update(),this.updateVertices()}updateVertices(){const t=this.points;if(t.length<1)return;let e=t[0],s,r=0,n=0;const a=this.buffers[0].data,o=t.length,h=this.textureScale>0?this.textureScale*this._width/2:this._width/2;for(let l=0;l<o;l++){const u=t[l],c=l*4;l<t.length-1?s=t[l+1]:s=u,n=-(s.x-e.x),r=s.y-e.y;let d=(1-l/(o-1))*10;d>1&&(d=1);const f=Math.sqrt(r*r+n*n);f<1e-6?(r=0,n=0):(r/=f,n/=f,r*=h,n*=h),a[c]=u.x+r,a[c+1]=u.y+n,a[c+2]=u.x-r,a[c+3]=u.y-n,e=u}this.buffers[0].update()}update(){this.textureScale>0?this.build():this.updateVertices()}}class Gp extends Es{constructor(t,e,s){const r=new Up(t.width,t.height,e,s),n=new As(O.WHITE);super(r,n),this.texture=t,this.autoResize=!0}textureUpdated(){this._textureID=this.shader.texture._updateID;const t=this.geometry,{width:e,height:s}=this.shader.texture;this.autoResize&&(t.width!==e||t.height!==s)&&(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())}set texture(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))}get texture(){return this.shader.texture}_render(t){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),super._render(t)}destroy(t){this.shader.texture.off("update",this.textureUpdated,this),super.destroy(t)}}const qs=10;class jm extends Gp{constructor(t,e,s,r,n){var a,o,h,l,u,c,d,f;super(O.WHITE,4,4),this._origWidth=t.orig.width,this._origHeight=t.orig.height,this._width=this._origWidth,this._height=this._origHeight,this._leftWidth=(o=e!=null?e:(a=t.defaultBorders)==null?void 0:a.left)!=null?o:qs,this._rightWidth=(l=r!=null?r:(h=t.defaultBorders)==null?void 0:h.right)!=null?l:qs,this._topHeight=(c=s!=null?s:(u=t.defaultBorders)==null?void 0:u.top)!=null?c:qs,this._bottomHeight=(f=n!=null?n:(d=t.defaultBorders)==null?void 0:d.bottom)!=null?f:qs,this.texture=t}textureUpdated(){this._textureID=this.shader.texture._updateID,this._refresh()}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(t){this.geometry.getBuffer("aVertexPosition").data=t}updateHorizontalVertices(){const t=this.vertices,e=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*e,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*e,t[25]=t[27]=t[29]=t[31]=this._height}updateVerticalVertices(){const t=this.vertices,e=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*e,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*e,t[6]=t[14]=t[22]=t[30]=this._width}_getMinScale(){const t=this._leftWidth+this._rightWidth,e=this._width>t?1:this._width/t,s=this._topHeight+this._bottomHeight,r=this._height>s?1:this._height/s;return Math.min(e,r)}get width(){return this._width}set width(t){this._width=t,this._refresh()}get height(){return this._height}set height(t){this._height=t,this._refresh()}get leftWidth(){return this._leftWidth}set leftWidth(t){this._leftWidth=t,this._refresh()}get rightWidth(){return this._rightWidth}set rightWidth(t){this._rightWidth=t,this._refresh()}get topHeight(){return this._topHeight}set topHeight(t){this._topHeight=t,this._refresh()}get bottomHeight(){return this._bottomHeight}set bottomHeight(t){this._bottomHeight=t,this._refresh()}_refresh(){const t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;const s=1/this._origWidth,r=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=s*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-s*this._rightWidth,e[9]=e[11]=e[13]=e[15]=r*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-r*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()}}class zm extends Es{constructor(t=O.EMPTY,e,s,r,n){const a=new Mi(e,s,r);a.getBuffer("aVertexPosition").static=!1;const o=new As(t);super(a,o,null,n),this.autoUpdate=!0}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(t){this.geometry.getBuffer("aVertexPosition").data=t}_render(t){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),super._render(t)}}class Wm extends Es{constructor(t,e,s=0){const r=new kp(t.height,e,s),n=new As(t);s>0&&(t.baseTexture.wrapMode=re.REPEAT),super(r,n),this.autoUpdate=!0}_render(t){const e=this.geometry;(this.autoUpdate||e._width!==this.shader.texture.height)&&(e._width=this.shader.texture.height,e.update()),super._render(t)}}class Ym extends Mt{constructor(t=1500,e,s=16384,r=!1){super();const n=16384;s>n&&(s=n),this._properties=[!1,!0,!1,!1,!1],this._maxSize=t,this._batchSize=s,this._buffers=null,this._bufferUpdateIDs=[],this._updateID=0,this.interactiveChildren=!1,this.blendMode=H.NORMAL,this.autoResize=r,this.roundPixels=!0,this.baseTexture=null,this.setProperties(e),this._tintColor=new K(0),this.tintRgb=new Float32Array(3),this.tint=16777215}setProperties(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])}updateTransform(){this.displayObjectUpdateTransform()}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintColor.toRgbArray(this.tintRgb)}render(t){!this.visible||this.worldAlpha<=0||!this.children.length||!this.renderable||(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",()=>this.onChildrenChange(0))),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))}onChildrenChange(t){const e=Math.floor(t/this._batchSize);for(;this._bufferUpdateIDs.length<e;)this._bufferUpdateIDs.push(0);this._bufferUpdateIDs[e]=++this._updateID}dispose(){if(this._buffers){for(let t=0;t<this._buffers.length;++t)this._buffers[t].destroy();this._buffers=null}}destroy(t){super.destroy(t),this.dispose(),this._properties=null,this._buffers=null,this._bufferUpdateIDs=null}}class qa{constructor(t,e,s){this.geometry=new fe,this.indexBuffer=null,this.size=s,this.dynamicProperties=[],this.staticProperties=[];for(let r=0;r<t.length;++r){let n=t[r];n={attributeName:n.attributeName,size:n.size,uploadFunction:n.uploadFunction,type:n.type||U.FLOAT,offset:n.offset},e[r]?this.dynamicProperties.push(n):this.staticProperties.push(n)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}initBuffers(){const t=this.geometry;let e=0;this.indexBuffer=new nt(xo(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(let a=0;a<this.dynamicProperties.length;++a){const o=this.dynamicProperties[a];o.offset=e,e+=o.size,this.dynamicStride+=o.size}const s=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(s),this.dynamicDataUint32=new Uint32Array(s),this.dynamicBuffer=new nt(this.dynamicData,!1,!1);let r=0;this.staticStride=0;for(let a=0;a<this.staticProperties.length;++a){const o=this.staticProperties[a];o.offset=r,r+=o.size,this.staticStride+=o.size}const n=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(n),this.staticDataUint32=new Uint32Array(n),this.staticBuffer=new nt(this.staticData,!0,!1);for(let a=0;a<this.dynamicProperties.length;++a){const o=this.dynamicProperties[a];t.addAttribute(o.attributeName,this.dynamicBuffer,0,o.type===U.UNSIGNED_BYTE,o.type,this.dynamicStride*4,o.offset*4)}for(let a=0;a<this.staticProperties.length;++a){const o=this.staticProperties[a];t.addAttribute(o.attributeName,this.staticBuffer,0,o.type===U.UNSIGNED_BYTE,o.type,this.staticStride*4,o.offset*4)}}uploadDynamic(t,e,s){for(let r=0;r<this.dynamicProperties.length;r++){const n=this.dynamicProperties[r];n.uploadFunction(t,e,s,n.type===U.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,n.offset)}this.dynamicBuffer._updateID++}uploadStatic(t,e,s){for(let r=0;r<this.staticProperties.length;r++){const n=this.staticProperties[r];n.uploadFunction(t,e,s,n.type===U.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,n.offset)}this.staticBuffer._updateID++}destroy(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()}}var $p=`varying vec2 vTextureCoord;
|
|
950
950
|
varying vec4 vColor;
|
|
951
951
|
|
|
952
952
|
uniform sampler2D uSampler;
|
|
@@ -954,7 +954,7 @@ uniform sampler2D uSampler;
|
|
|
954
954
|
void main(void){
|
|
955
955
|
vec4 color = texture2D(uSampler, vTextureCoord) * vColor;
|
|
956
956
|
gl_FragColor = color;
|
|
957
|
-
}`,
|
|
957
|
+
}`,Hp=`attribute vec2 aVertexPosition;
|
|
958
958
|
attribute vec2 aTextureCoord;
|
|
959
959
|
attribute vec4 aColor;
|
|
960
960
|
|
|
@@ -979,8 +979,8 @@ void main(void){
|
|
|
979
979
|
vTextureCoord = aTextureCoord;
|
|
980
980
|
vColor = aColor * uColor;
|
|
981
981
|
}
|
|
982
|
-
`;class
|
|
983
|
-
`:t,t}static getFromCache(t,e,s,r){let n=s[t];return typeof n!="number"&&(n=L._measureText(t,e,r)+e,s[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 s=t[e];if(!L.isBreakingSpace(s))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:L._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:L._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let s="";if(typeof t!="string")return e;for(let r=0;r<t.length;r++){const n=t[r],a=t[r+1];if(L.isBreakingSpace(n,a)||L.isNewline(n)){s!==""&&(e.push(s),s=""),e.push(n);continue}s+=n}return s!==""&&e.push(s),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,s,r,n){return!0}static wordWrapSplit(t){return L.graphemeSegmenter(t)}static measureFont(t){if(L._fonts[t])return L._fonts[t];const e={ascent:0,descent:0,fontSize:0},s=L._canvas,r=L._context;r.font=t;const n=L.METRICS_STRING+L.BASELINE_SYMBOL,a=Math.ceil(r.measureText(n).width);let o=Math.ceil(r.measureText(L.BASELINE_SYMBOL).width);const h=Math.ceil(L.HEIGHT_MULTIPLIER*o);if(o=o*L.BASELINE_MULTIPLIER|0,a===0||h===0)return L._fonts[t]=e,e;s.width=a,s.height=h,r.fillStyle="#f00",r.fillRect(0,0,a,h),r.font=t,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(n,0,o);const l=r.getImageData(0,0,a,h).data,u=l.length,c=a*4;let d=0,f=0,p=!1;for(d=0;d<o;++d){for(let m=0;m<c;m+=4)if(l[f+m]!==255){p=!0;break}if(!p)f+=c;else break}for(e.ascent=o-d,f=u-c,p=!1,d=h;d>o;--d){for(let m=0;m<c;m+=4)if(l[f+m]!==255){p=!0;break}if(!p)f-=c;else break}return e.descent=d-o,e.fontSize=e.ascent+e.descent,L._fonts[t]=e,e}static clearMetrics(t=""){t?delete L._fonts[t]:L._fonts={}}static get _canvas(){if(!L.__canvas){let t;try{const e=new OffscreenCanvas(0,0),s=e.getContext("2d",Ks);if(s!=null&&s.measureText)return L.__canvas=e,e;t=O.ADAPTER.createCanvas()}catch(e){t=O.ADAPTER.createCanvas()}t.width=t.height=10,L.__canvas=t}return L.__canvas}static get _context(){return L.__context||(L.__context=L._canvas.getContext("2d",Ks)),L.__context}};Ht.METRICS_STRING="|\xC9q\xC5",Ht.BASELINE_SYMBOL="M",Ht.BASELINE_MULTIPLIER=1.4,Ht.HEIGHT_MULTIPLIER=2,Ht.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const i=new Intl.Segmenter;return t=>[...i.segment(t)].map(e=>e.segment)}return i=>[...i]})(),Ht.experimentalLetterSpacing=!1,Ht._fonts={},Ht._newlines=[10,13],Ht._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let he=Ht;const Gp=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Sh=class ds{constructor(t){this.styleID=0,this.reset(),nr(this,t,t)}clone(){const t={};return nr(t,this,ds.defaultStyle),new ds(t)}reset(){nr(this,ds.defaultStyle,ds.defaultStyle)}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(t){const e=rr(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)}get dropShadowDistance(){return this._dropShadowDistance}set dropShadowDistance(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)}get fill(){return this._fill}set fill(t){const e=rr(t);this._fill!==e&&(this._fill=e,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(t){$p(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.styleID++)}get stroke(){return this._stroke}set stroke(t){const e=rr(t);this._stroke!==e&&(this._stroke=e,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)}toFontString(){const t=typeof this.fontSize=="number"?`${this.fontSize}px`:this.fontSize;let e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(let s=e.length-1;s>=0;s--){let r=e[s].trim();!/([\"\'])[^\'\"]+\1/.test(r)&&!Gp.includes(r)&&(r=`"${r}"`),e[s]=r}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};Sh.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Di.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let ge=Sh;function rr(i){const t=K.shared,e=s=>{const r=t.setValue(s);return r.alpha===1?r.toHex():r.toRgbaString()};return Array.isArray(i)?i.map(e):e(i)}function $p(i,t){if(!Array.isArray(i)||!Array.isArray(t)||i.length!==t.length)return!1;for(let e=0;e<i.length;++e)if(i[e]!==t[e])return!1;return!0}function nr(i,t,e){for(const s in e)Array.isArray(t[s])?i[s]=t[s].slice():i[s]=t[s]}const Hp={texture:!0,children:!1,baseTexture:!0},Ih=class Qr extends _e{constructor(t,e,s){var r;let n=!1;s||(s=O.ADAPTER.createCanvas(),n=!0),s.width=3,s.height=3;const a=D.from(s);a.orig=new j,a.trim=new j,super(a),this._ownCanvas=n,this.canvas=s,this.context=s.getContext("2d",{willReadFrequently:!0}),this._resolution=(r=Qr.defaultResolution)!=null?r:O.RESOLUTION,this._autoResolution=Qr.defaultAutoResolution,this._text=null,this._style=null,this._styleListener=null,this._font="",this.text=t,this.style=e,this.localStyleID=-1}static get experimentalLetterSpacing(){return he.experimentalLetterSpacing}static set experimentalLetterSpacing(t){he.experimentalLetterSpacing=t}updateText(t){const e=this._style;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;this._font=this._style.toFontString();const s=this.context,r=he.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=r.width,a=r.height,o=r.lines,h=r.lineHeight,l=r.lineWidths,u=r.maxLineWidth,c=r.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,n)+e.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,a)+e.padding*2)*this._resolution),s.scale(this._resolution,this._resolution),s.clearRect(0,0,this.canvas.width,this.canvas.height),s.font=this._font,s.lineWidth=e.strokeThickness,s.textBaseline=e.textBaseline,s.lineJoin=e.lineJoin,s.miterLimit=e.miterLimit;let d,f;const p=e.dropShadow?2:1;for(let m=0;m<p;++m){const g=e.dropShadow&&m===0,y=g?Math.ceil(Math.max(1,a)+e.padding*2):0,x=y*this._resolution;if(g){s.fillStyle="black",s.strokeStyle="black";const v=e.dropShadowColor,T=e.dropShadowBlur*this._resolution,B=e.dropShadowDistance*this._resolution;s.shadowColor=K.shared.setValue(v).setAlpha(e.dropShadowAlpha).toRgbaString(),s.shadowBlur=T,s.shadowOffsetX=Math.cos(e.dropShadowAngle)*B,s.shadowOffsetY=Math.sin(e.dropShadowAngle)*B+x}else s.fillStyle=this._generateFillStyle(e,o,r),s.strokeStyle=e.stroke,s.shadowColor="black",s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0;let _=(h-c.fontSize)/2;h-c.fontSize<0&&(_=0);for(let v=0;v<o.length;v++)d=e.strokeThickness/2,f=e.strokeThickness/2+v*h+c.ascent+_,e.align==="right"?d+=u-l[v]:e.align==="center"&&(d+=(u-l[v])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(o[v],d+e.padding,f+e.padding-y,!0),e.fill&&this.drawLetterSpacing(o[v],d+e.padding,f+e.padding-y)}this.updateTexture()}drawLetterSpacing(t,e,s,r=!1){const n=this._style.letterSpacing;let a=!1;if(he.experimentalLetterSpacingSupported&&(he.experimentalLetterSpacing?(this.context.letterSpacing=`${n}px`,this.context.textLetterSpacing=`${n}px`,a=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),n===0||a){r?this.context.strokeText(t,e,s):this.context.fillText(t,e,s);return}let o=e;const h=he.graphemeSegmenter(t);let l=this.context.measureText(t).width,u=0;for(let c=0;c<h.length;++c){const d=h[c];r?this.context.strokeText(d,o,s):this.context.fillText(d,o,s);let f="";for(let p=c+1;p<h.length;++p)f+=h[p];u=this.context.measureText(f).width,o+=l-u+n,l=u}}updateTexture(){const t=this.canvas;if(this._style.trim){const a=Eo(t);a.data&&(t.width=a.width,t.height=a.height,this.context.putImageData(a.data,0,0))}const e=this._texture,s=this._style,r=s.trim?0:s.padding,n=e.baseTexture;e.trim.width=e._frame.width=t.width/this._resolution,e.trim.height=e._frame.height=t.height/this._resolution,e.trim.x=-r,e.trim.y=-r,e.orig.width=e._frame.width-r*2,e.orig.height=e._frame.height-r*2,this._onTextureUpdate(),n.setRealSize(t.width,t.height,this._resolution),e.updateUvs(),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}updateTransform(){this.updateText(!0),super.updateTransform()}getBounds(t,e){return this.updateText(!0),this._textureID===-1&&(t=!1),super.getBounds(t,e)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds.call(this,t)}_calculateBounds(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_generateFillStyle(t,e,s){const r=t.fill;if(Array.isArray(r)){if(r.length===1)return r[0]}else return r;let n;const a=t.dropShadow?t.dropShadowDistance:0,o=t.padding||0,h=this.canvas.width/this._resolution-a-o*2,l=this.canvas.height/this._resolution-a-o*2,u=r.slice(),c=t.fillGradientStops.slice();if(!c.length){const d=u.length+1;for(let f=1;f<d;++f)c.push(f/d)}if(u.unshift(r[0]),c.unshift(0),u.push(r[r.length-1]),c.push(1),t.fillGradientType===Di.LINEAR_VERTICAL){n=this.context.createLinearGradient(h/2,o,h/2,l+o);const d=s.fontProperties.fontSize+t.strokeThickness;for(let f=0;f<e.length;f++){const p=s.lineHeight*(f-1)+d,m=s.lineHeight*f;let g=m;f>0&&p>m&&(g=(m+p)/2);const y=m+d,x=s.lineHeight*(f+1);let _=y;f+1<e.length&&x<y&&(_=(y+x)/2);const v=(_-g)/l;for(let T=0;T<u.length;T++){let B=0;typeof c[T]=="number"?B=c[T]:B=T/u.length;let w=Math.min(1,Math.max(0,g/l+B*v));w=Number(w.toFixed(5)),n.addColorStop(w,u[T])}}}else{n=this.context.createLinearGradient(o,l/2,h+o,l/2);const d=u.length+1;let f=1;for(let p=0;p<u.length;p++){let m;typeof c[p]=="number"?m=c[p]:m=f/d,n.addColorStop(m,u[p]),f++}}return n}destroy(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},Hp,t),super.destroy(t),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this.updateText(!0);const e=se(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this.updateText(!0);const e=se(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get style(){return this._style}set style(t){t=t||{},t instanceof ge?this._style=t:this._style=new ge(t),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(t){t=String(t==null?"":t),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}};Ih.defaultAutoResolution=!0;let Rh=Ih;class Vp{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function Xp(i,t){var e;let s=!1;if((e=i==null?void 0:i._textures)!=null&&e.length){for(let r=0;r<i._textures.length;r++)if(i._textures[r]instanceof D){const n=i._textures[r].baseTexture;t.includes(n)||(t.push(n),s=!0)}}return s}function jp(i,t){if(i.baseTexture instanceof X){const e=i.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function zp(i,t){if(i._texture&&i._texture instanceof D){const e=i._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function Wp(i,t){return t instanceof Rh?(t.updateText(!0),!0):!1}function Yp(i,t){if(t instanceof ge){const e=t.toFontString();return he.measureFont(e),!0}return!1}function qp(i,t){if(i instanceof Rh){t.includes(i.style)||t.push(i.style),t.includes(i)||t.push(i);const e=i._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function Kp(i,t){return i instanceof ge?(t.includes(i)||t.push(i),!0):!1}const Ch=class Ph{constructor(t){this.limiter=new Vp(Ph.uploadsPerFrame),this.renderer=t,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=()=>{this.queue&&this.prepareItems()},this.registerFindHook(qp),this.registerFindHook(Kp),this.registerFindHook(Xp),this.registerFindHook(jp),this.registerFindHook(zp),this.registerUploadHook(Wp),this.registerUploadHook(Yp)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,gt.system.addOnce(this.tick,this,me.UTILITY))):e()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const t=this.queue[0];let e=!1;if(t&&!t._destroyed){for(let s=0,r=this.uploadHooks.length;s<r;s++)if(this.uploadHooks[s](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}}e||this.queue.shift()}if(this.queue.length)gt.system.addOnce(this.tick,this,me.UTILITY);else{this.ticking=!1;const t=this.completes.slice(0);this.completes.length=0;for(let e=0,s=t.length;e<s;e++)t[e]()}}registerFindHook(t){return t&&this.addHooks.push(t),this}registerUploadHook(t){return t&&this.uploadHooks.push(t),this}add(t){for(let e=0,s=this.addHooks.length;e<s&&!this.addHooks[e](t,this.queue);e++);if(t instanceof Mt)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&>.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null}};Ch.uploadsPerFrame=4;let Jr=Ch;Object.defineProperties(O,{UPLOADS_PER_FRAME:{get(){return Jr.uploadsPerFrame},set(i){Jr.uploadsPerFrame=i}}});function Mh(i,t){return t instanceof X?(t._glTextures[i.CONTEXT_UID]||i.texture.bind(t),!0):!1}function Zp(i,t){if(!(t instanceof Th))return!1;const{geometry:e}=t;t.finishPoly(),e.updateBatches();const{batches:s}=e;for(let r=0;r<s.length;r++){const{texture:n}=s[r].style;n&&Mh(i,n.baseTexture)}return e.batchable||i.geometry.bind(e,t._resolveDirectShader(i)),!0}function Qp(i,t){return i instanceof Th?(t.push(i),!0):!1}class Dh extends Jr{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(Qp),this.registerUploadHook(Mh),this.registerUploadHook(Zp)}}Dh.extension={name:"prepare",type:C.RendererSystem};N.add(Dh);class zm{constructor(t){this.maxMilliseconds=t,this.frameStart=0}beginFrame(){this.frameStart=Date.now()}allowedToUpload(){return Date.now()-this.frameStart<this.maxMilliseconds}}class tn extends _e{constructor(t,e=!0){super(t[0]instanceof D?t[0]:t[0].texture),this._textures=null,this._durations=null,this._autoUpdate=e,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=t}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(gt.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(gt.shared.add(this.update,this,me.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=this.animationSpeed*t,s=this.currentFrame;if(this._durations!==null){let r=this._currentTime%1*this._durations[this.currentFrame];for(r+=e/60*1e3;r<0;)this._currentTime--,r+=this._durations[this.currentFrame];const n=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);r>=this._durations[this.currentFrame];)r-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=r/this._durations[this.currentFrame]}else this._currentTime+=e;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._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(t){this.stop(),super.destroy(t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){const e=[];for(let s=0;s<t.length;++s)e.push(D.from(t[s]));return new tn(e)}static fromImages(t){const e=[];for(let s=0;s<t.length;++s)e.push(D.from(t[s]));return new tn(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof D)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?(gt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(gt.shared.add(this.update,this),this._isConnectedToTicker=!0))}}const ns=new q;class Oh extends _e{constructor(t,e=100,s=100){super(t),this.tileTransform=new dn,this._width=e,this._height=s,this.uvMatrix=this.texture.uvMatrix||new fn(t),this.pluginName="tilingSprite",this.uvRespectAnchor=!1}get clampMargin(){return this.uvMatrix.clampMargin}set clampMargin(t){this.uvMatrix.clampMargin=t,this.uvMatrix.update(!0)}get tileScale(){return this.tileTransform.scale}set tileScale(t){this.tileTransform.scale.copyFrom(t)}get tilePosition(){return this.tileTransform.position}set tilePosition(t){this.tileTransform.position.copyFrom(t)}_onTextureUpdate(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=16777215}_render(t){const e=this._texture;!e||!e.valid||(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this))}_calculateBounds(){const t=this._width*-this._anchor._x,e=this._height*-this._anchor._y,s=this._width*(1-this._anchor._x),r=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,t,e,s,r)}getLocalBounds(t){return this.children.length===0?(this._bounds.minX=this._width*-this._anchor._x,this._bounds.minY=this._height*-this._anchor._y,this._bounds.maxX=this._width*(1-this._anchor._x),this._bounds.maxY=this._height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new j),t=this._localBoundsRect),this._bounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,ns);const e=this._width,s=this._height,r=-e*this.anchor._x;if(ns.x>=r&&ns.x<r+e){const n=-s*this.anchor._y;if(ns.y>=n&&ns.y<n+s)return!0}return!1}destroy(t){super.destroy(t),this.tileTransform=null,this.uvMatrix=null}static from(t,e){const s=t instanceof D?t:D.from(t,e);return new Oh(s,e.width,e.height)}get width(){return this._width}set width(t){this._width=t}get height(){return this._height}set height(t){this._height=t}}var Jp=`#version 300 es
|
|
982
|
+
`;class Sh extends Si{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new tt,this.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:this.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:this.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:this.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:this.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:U.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=qt.from(Hp,$p,{}),this.state=ne.for2d()}render(t){const e=t.children,s=t._maxSize,r=t._batchSize,n=this.renderer;let a=e.length;if(a===0)return;a>s&&!t.autoResize&&(a=s);let o=t._buffers;o||(o=t._buffers=this.generateBuffers(t));const h=e[0]._texture.baseTexture,l=h.alphaMode>0;this.state.blendMode=hn(t.blendMode,l),n.state.set(this.state);const u=n.gl,c=t.worldTransform.copyTo(this.tempMatrix);c.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=c.toArray(!0),this.shader.uniforms.uColor=K.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,l).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=h,this.renderer.shader.bind(this.shader);let d=!1;for(let f=0,p=0;f<a;f+=r,p+=1){let m=a-f;m>r&&(m=r),p>=o.length&&o.push(this._generateOneMoreBuffer(t));const g=o[p];g.uploadDynamic(e,f,m);const v=t._bufferUpdateIDs[p]||0;d=d||g._updateID<v,d&&(g._updateID=t._updateID,g.uploadStatic(e,f,m)),n.geometry.bind(g.geometry),u.drawElements(u.TRIANGLES,m*6,u.UNSIGNED_SHORT,0)}}generateBuffers(t){const e=[],s=t._maxSize,r=t._batchSize,n=t._properties;for(let a=0;a<s;a+=r)e.push(new qa(this.properties,n,r));return e}_generateOneMoreBuffer(t){const e=t._batchSize,s=t._properties;return new qa(this.properties,s,e)}uploadVertices(t,e,s,r,n,a){let o=0,h=0,l=0,u=0;for(let c=0;c<s;++c){const d=t[e+c],f=d._texture,p=d.scale.x,m=d.scale.y,g=f.trim,v=f.orig;g?(h=g.x-d.anchor.x*v.width,o=h+g.width,u=g.y-d.anchor.y*v.height,l=u+g.height):(o=v.width*(1-d.anchor.x),h=v.width*-d.anchor.x,l=v.height*(1-d.anchor.y),u=v.height*-d.anchor.y),r[a]=h*p,r[a+1]=u*m,r[a+n]=o*p,r[a+n+1]=u*m,r[a+n*2]=o*p,r[a+n*2+1]=l*m,r[a+n*3]=h*p,r[a+n*3+1]=l*m,a+=n*4}}uploadPosition(t,e,s,r,n,a){for(let o=0;o<s;o++){const h=t[e+o].position;r[a]=h.x,r[a+1]=h.y,r[a+n]=h.x,r[a+n+1]=h.y,r[a+n*2]=h.x,r[a+n*2+1]=h.y,r[a+n*3]=h.x,r[a+n*3+1]=h.y,a+=n*4}}uploadRotation(t,e,s,r,n,a){for(let o=0;o<s;o++){const h=t[e+o].rotation;r[a]=h,r[a+n]=h,r[a+n*2]=h,r[a+n*3]=h,a+=n*4}}uploadUvs(t,e,s,r,n,a){for(let o=0;o<s;++o){const h=t[e+o]._texture._uvs;h?(r[a]=h.x0,r[a+1]=h.y0,r[a+n]=h.x1,r[a+n+1]=h.y1,r[a+n*2]=h.x2,r[a+n*2+1]=h.y2,r[a+n*3]=h.x3,r[a+n*3+1]=h.y3,a+=n*4):(r[a]=0,r[a+1]=0,r[a+n]=0,r[a+n+1]=0,r[a+n*2]=0,r[a+n*2+1]=0,r[a+n*3]=0,r[a+n*3+1]=0,a+=n*4)}}uploadTint(t,e,s,r,n,a){for(let o=0;o<s;++o){const h=t[e+o],l=K.shared.setValue(h._tintRGB).toPremultiplied(h.alpha,h.texture.baseTexture.alphaMode>0);r[a]=l,r[a+n]=l,r[a+n*2]=l,r[a+n*3]=l,a+=n*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}Sh.extension={name:"particle",type:C.RendererPlugin};N.add(Sh);var Di=(i=>(i[i.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",i[i.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",i))(Di||{});const Ks={willReadFrequently:!0},Ht=class L{static get experimentalLetterSpacingSupported(){let t=L._experimentalLetterSpacingSupported;if(t!==void 0){const e=D.ADAPTER.getCanvasRenderingContext2D().prototype;t=L._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,s,r,n,a,o,h,l){this.text=t,this.style=e,this.width=s,this.height=r,this.lines=n,this.lineWidths=a,this.lineHeight=o,this.maxLineWidth=h,this.fontProperties=l}static measureText(t,e,s,r=L._canvas){s=s==null?e.wordWrap:s;const n=e.toFontString(),a=L.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);const o=r.getContext("2d",Ks);o.font=n;const h=(s?L.wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),l=new Array(h.length);let u=0;for(let p=0;p<h.length;p++){const m=L._measureText(h[p],e.letterSpacing,o);l[p]=m,u=Math.max(u,m)}let c=u+e.strokeThickness;e.dropShadow&&(c+=e.dropShadowDistance);const d=e.lineHeight||a.fontSize+e.strokeThickness;let f=Math.max(d,a.fontSize+e.strokeThickness*2)+e.leading+(h.length-1)*(d+e.leading);return e.dropShadow&&(f+=e.dropShadowDistance),new L(t,e,c,f,h,l,d+e.leading,u,a)}static _measureText(t,e,s){let r=!1;L.experimentalLetterSpacingSupported&&(L.experimentalLetterSpacing?(s.letterSpacing=`${e}px`,s.textLetterSpacing=`${e}px`,r=!0):(s.letterSpacing="0px",s.textLetterSpacing="0px"));let n=s.measureText(t).width;return n>0&&(r?n-=e:n+=(L.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,s=L._canvas){const r=s.getContext("2d",Ks);let n=0,a="",o="";const h=Object.create(null),{letterSpacing:l,whiteSpace:u}=e,c=L.collapseSpaces(u),d=L.collapseNewlines(u);let f=!c;const p=e.wordWrapWidth+l,m=L.tokenize(t);for(let g=0;g<m.length;g++){let v=m[g];if(L.isNewline(v)){if(!d){o+=L.addLine(a),f=!c,a="",n=0;continue}v=" "}if(c){const _=L.isBreakingSpace(v),y=L.isBreakingSpace(a[a.length-1]);if(_&&y)continue}const x=L.getFromCache(v,l,h,r);if(x>p)if(a!==""&&(o+=L.addLine(a),a="",n=0),L.canBreakWords(v,e.breakWords)){const _=L.wordWrapSplit(v);for(let y=0;y<_.length;y++){let T=_[y],P=T,w=1;for(;_[y+w];){const B=_[y+w];if(!L.canBreakChars(P,B,v,y,e.breakWords))T+=B;else break;P=B,w++}y+=w-1;const A=L.getFromCache(T,l,h,r);A+n>p&&(o+=L.addLine(a),f=!1,a="",n=0),a+=T,n+=A}}else{a.length>0&&(o+=L.addLine(a),a="",n=0);const _=g===m.length-1;o+=L.addLine(v,!_),f=!1,a="",n=0}else x+n>p&&(f=!1,o+=L.addLine(a),a="",n=0),(a.length>0||!L.isBreakingSpace(v)||f)&&(a+=v,n+=x)}return o+=L.addLine(a,!1),o}static addLine(t,e=!0){return t=L.trimRight(t),t=e?`${t}
|
|
983
|
+
`:t,t}static getFromCache(t,e,s,r){let n=s[t];return typeof n!="number"&&(n=L._measureText(t,e,r)+e,s[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 s=t[e];if(!L.isBreakingSpace(s))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:L._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:L._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let s="";if(typeof t!="string")return e;for(let r=0;r<t.length;r++){const n=t[r],a=t[r+1];if(L.isBreakingSpace(n,a)||L.isNewline(n)){s!==""&&(e.push(s),s=""),e.push(n);continue}s+=n}return s!==""&&e.push(s),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,s,r,n){return!0}static wordWrapSplit(t){return L.graphemeSegmenter(t)}static measureFont(t){if(L._fonts[t])return L._fonts[t];const e={ascent:0,descent:0,fontSize:0},s=L._canvas,r=L._context;r.font=t;const n=L.METRICS_STRING+L.BASELINE_SYMBOL,a=Math.ceil(r.measureText(n).width);let o=Math.ceil(r.measureText(L.BASELINE_SYMBOL).width);const h=Math.ceil(L.HEIGHT_MULTIPLIER*o);if(o=o*L.BASELINE_MULTIPLIER|0,a===0||h===0)return L._fonts[t]=e,e;s.width=a,s.height=h,r.fillStyle="#f00",r.fillRect(0,0,a,h),r.font=t,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(n,0,o);const l=r.getImageData(0,0,a,h).data,u=l.length,c=a*4;let d=0,f=0,p=!1;for(d=0;d<o;++d){for(let m=0;m<c;m+=4)if(l[f+m]!==255){p=!0;break}if(!p)f+=c;else break}for(e.ascent=o-d,f=u-c,p=!1,d=h;d>o;--d){for(let m=0;m<c;m+=4)if(l[f+m]!==255){p=!0;break}if(!p)f-=c;else break}return e.descent=d-o,e.fontSize=e.ascent+e.descent,L._fonts[t]=e,e}static clearMetrics(t=""){t?delete L._fonts[t]:L._fonts={}}static get _canvas(){if(!L.__canvas){let t;try{const e=new OffscreenCanvas(0,0),s=e.getContext("2d",Ks);if(s!=null&&s.measureText)return L.__canvas=e,e;t=D.ADAPTER.createCanvas()}catch(e){t=D.ADAPTER.createCanvas()}t.width=t.height=10,L.__canvas=t}return L.__canvas}static get _context(){return L.__context||(L.__context=L._canvas.getContext("2d",Ks)),L.__context}};Ht.METRICS_STRING="|\xC9q\xC5",Ht.BASELINE_SYMBOL="M",Ht.BASELINE_MULTIPLIER=1.4,Ht.HEIGHT_MULTIPLIER=2,Ht.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const i=new Intl.Segmenter;return t=>[...i.segment(t)].map(e=>e.segment)}return i=>[...i]})(),Ht.experimentalLetterSpacing=!1,Ht._fonts={},Ht._newlines=[10,13],Ht._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let he=Ht;const Vp=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Ih=class ds{constructor(t){this.styleID=0,this.reset(),nr(this,t,t)}clone(){const t={};return nr(t,this,ds.defaultStyle),new ds(t)}reset(){nr(this,ds.defaultStyle,ds.defaultStyle)}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(t){const e=rr(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)}get dropShadowDistance(){return this._dropShadowDistance}set dropShadowDistance(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)}get fill(){return this._fill}set fill(t){const e=rr(t);this._fill!==e&&(this._fill=e,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(t){Xp(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.styleID++)}get stroke(){return this._stroke}set stroke(t){const e=rr(t);this._stroke!==e&&(this._stroke=e,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)}toFontString(){const t=typeof this.fontSize=="number"?`${this.fontSize}px`:this.fontSize;let e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(let s=e.length-1;s>=0;s--){let r=e[s].trim();!/([\"\'])[^\'\"]+\1/.test(r)&&!Vp.includes(r)&&(r=`"${r}"`),e[s]=r}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};Ih.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Di.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let ge=Ih;function rr(i){const t=K.shared,e=s=>{const r=t.setValue(s);return r.alpha===1?r.toHex():r.toRgbaString()};return Array.isArray(i)?i.map(e):e(i)}function Xp(i,t){if(!Array.isArray(i)||!Array.isArray(t)||i.length!==t.length)return!1;for(let e=0;e<i.length;++e)if(i[e]!==t[e])return!1;return!0}function nr(i,t,e){for(const s in e)Array.isArray(t[s])?i[s]=t[s].slice():i[s]=t[s]}const jp={texture:!0,children:!1,baseTexture:!0},Rh=class Qr extends _e{constructor(t,e,s){var r;let n=!1;s||(s=D.ADAPTER.createCanvas(),n=!0),s.width=3,s.height=3;const a=O.from(s);a.orig=new j,a.trim=new j,super(a),this._ownCanvas=n,this.canvas=s,this.context=s.getContext("2d",{willReadFrequently:!0}),this._resolution=(r=Qr.defaultResolution)!=null?r:D.RESOLUTION,this._autoResolution=Qr.defaultAutoResolution,this._text=null,this._style=null,this._styleListener=null,this._font="",this.text=t,this.style=e,this.localStyleID=-1}static get experimentalLetterSpacing(){return he.experimentalLetterSpacing}static set experimentalLetterSpacing(t){he.experimentalLetterSpacing=t}updateText(t){const e=this._style;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;this._font=this._style.toFontString();const s=this.context,r=he.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=r.width,a=r.height,o=r.lines,h=r.lineHeight,l=r.lineWidths,u=r.maxLineWidth,c=r.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,n)+e.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,a)+e.padding*2)*this._resolution),s.scale(this._resolution,this._resolution),s.clearRect(0,0,this.canvas.width,this.canvas.height),s.font=this._font,s.lineWidth=e.strokeThickness,s.textBaseline=e.textBaseline,s.lineJoin=e.lineJoin,s.miterLimit=e.miterLimit;let d,f;const p=e.dropShadow?2:1;for(let m=0;m<p;++m){const g=e.dropShadow&&m===0,v=g?Math.ceil(Math.max(1,a)+e.padding*2):0,x=v*this._resolution;if(g){s.fillStyle="black",s.strokeStyle="black";const y=e.dropShadowColor,T=e.dropShadowBlur*this._resolution,P=e.dropShadowDistance*this._resolution;s.shadowColor=K.shared.setValue(y).setAlpha(e.dropShadowAlpha).toRgbaString(),s.shadowBlur=T,s.shadowOffsetX=Math.cos(e.dropShadowAngle)*P,s.shadowOffsetY=Math.sin(e.dropShadowAngle)*P+x}else s.fillStyle=this._generateFillStyle(e,o,r),s.strokeStyle=e.stroke,s.shadowColor="black",s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0;let _=(h-c.fontSize)/2;h-c.fontSize<0&&(_=0);for(let y=0;y<o.length;y++)d=e.strokeThickness/2,f=e.strokeThickness/2+y*h+c.ascent+_,e.align==="right"?d+=u-l[y]:e.align==="center"&&(d+=(u-l[y])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(o[y],d+e.padding,f+e.padding-v,!0),e.fill&&this.drawLetterSpacing(o[y],d+e.padding,f+e.padding-v)}this.updateTexture()}drawLetterSpacing(t,e,s,r=!1){const n=this._style.letterSpacing;let a=!1;if(he.experimentalLetterSpacingSupported&&(he.experimentalLetterSpacing?(this.context.letterSpacing=`${n}px`,this.context.textLetterSpacing=`${n}px`,a=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),n===0||a){r?this.context.strokeText(t,e,s):this.context.fillText(t,e,s);return}let o=e;const h=he.graphemeSegmenter(t);let l=this.context.measureText(t).width,u=0;for(let c=0;c<h.length;++c){const d=h[c];r?this.context.strokeText(d,o,s):this.context.fillText(d,o,s);let f="";for(let p=c+1;p<h.length;++p)f+=h[p];u=this.context.measureText(f).width,o+=l-u+n,l=u}}updateTexture(){const t=this.canvas;if(this._style.trim){const a=Eo(t);a.data&&(t.width=a.width,t.height=a.height,this.context.putImageData(a.data,0,0))}const e=this._texture,s=this._style,r=s.trim?0:s.padding,n=e.baseTexture;e.trim.width=e._frame.width=t.width/this._resolution,e.trim.height=e._frame.height=t.height/this._resolution,e.trim.x=-r,e.trim.y=-r,e.orig.width=e._frame.width-r*2,e.orig.height=e._frame.height-r*2,this._onTextureUpdate(),n.setRealSize(t.width,t.height,this._resolution),e.updateUvs(),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}updateTransform(){this.updateText(!0),super.updateTransform()}getBounds(t,e){return this.updateText(!0),this._textureID===-1&&(t=!1),super.getBounds(t,e)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds.call(this,t)}_calculateBounds(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_generateFillStyle(t,e,s){const r=t.fill;if(Array.isArray(r)){if(r.length===1)return r[0]}else return r;let n;const a=t.dropShadow?t.dropShadowDistance:0,o=t.padding||0,h=this.canvas.width/this._resolution-a-o*2,l=this.canvas.height/this._resolution-a-o*2,u=r.slice(),c=t.fillGradientStops.slice();if(!c.length){const d=u.length+1;for(let f=1;f<d;++f)c.push(f/d)}if(u.unshift(r[0]),c.unshift(0),u.push(r[r.length-1]),c.push(1),t.fillGradientType===Di.LINEAR_VERTICAL){n=this.context.createLinearGradient(h/2,o,h/2,l+o);const d=s.fontProperties.fontSize+t.strokeThickness;for(let f=0;f<e.length;f++){const p=s.lineHeight*(f-1)+d,m=s.lineHeight*f;let g=m;f>0&&p>m&&(g=(m+p)/2);const v=m+d,x=s.lineHeight*(f+1);let _=v;f+1<e.length&&x<v&&(_=(v+x)/2);const y=(_-g)/l;for(let T=0;T<u.length;T++){let P=0;typeof c[T]=="number"?P=c[T]:P=T/u.length;let w=Math.min(1,Math.max(0,g/l+P*y));w=Number(w.toFixed(5)),n.addColorStop(w,u[T])}}}else{n=this.context.createLinearGradient(o,l/2,h+o,l/2);const d=u.length+1;let f=1;for(let p=0;p<u.length;p++){let m;typeof c[p]=="number"?m=c[p]:m=f/d,n.addColorStop(m,u[p]),f++}}return n}destroy(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},jp,t),super.destroy(t),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this.updateText(!0);const e=se(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this.updateText(!0);const e=se(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get style(){return this._style}set style(t){t=t||{},t instanceof ge?this._style=t:this._style=new ge(t),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(t){t=String(t==null?"":t),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}};Rh.defaultAutoResolution=!0;let Ch=Rh;class zp{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function Wp(i,t){var e;let s=!1;if((e=i==null?void 0:i._textures)!=null&&e.length){for(let r=0;r<i._textures.length;r++)if(i._textures[r]instanceof O){const n=i._textures[r].baseTexture;t.includes(n)||(t.push(n),s=!0)}}return s}function Yp(i,t){if(i.baseTexture instanceof X){const e=i.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function qp(i,t){if(i._texture&&i._texture instanceof O){const e=i._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function Kp(i,t){return t instanceof Ch?(t.updateText(!0),!0):!1}function Zp(i,t){if(t instanceof ge){const e=t.toFontString();return he.measureFont(e),!0}return!1}function Qp(i,t){if(i instanceof Ch){t.includes(i.style)||t.push(i.style),t.includes(i)||t.push(i);const e=i._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function Jp(i,t){return i instanceof ge?(t.includes(i)||t.push(i),!0):!1}const Ph=class Mh{constructor(t){this.limiter=new zp(Mh.uploadsPerFrame),this.renderer=t,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=()=>{this.queue&&this.prepareItems()},this.registerFindHook(Qp),this.registerFindHook(Jp),this.registerFindHook(Wp),this.registerFindHook(Yp),this.registerFindHook(qp),this.registerUploadHook(Kp),this.registerUploadHook(Zp)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,_t.system.addOnce(this.tick,this,me.UTILITY))):e()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const t=this.queue[0];let e=!1;if(t&&!t._destroyed){for(let s=0,r=this.uploadHooks.length;s<r;s++)if(this.uploadHooks[s](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}}e||this.queue.shift()}if(this.queue.length)_t.system.addOnce(this.tick,this,me.UTILITY);else{this.ticking=!1;const t=this.completes.slice(0);this.completes.length=0;for(let e=0,s=t.length;e<s;e++)t[e]()}}registerFindHook(t){return t&&this.addHooks.push(t),this}registerUploadHook(t){return t&&this.uploadHooks.push(t),this}add(t){for(let e=0,s=this.addHooks.length;e<s&&!this.addHooks[e](t,this.queue);e++);if(t instanceof Mt)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&_t.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null}};Ph.uploadsPerFrame=4;let Jr=Ph;Object.defineProperties(D,{UPLOADS_PER_FRAME:{get(){return Jr.uploadsPerFrame},set(i){Jr.uploadsPerFrame=i}}});function Dh(i,t){return t instanceof X?(t._glTextures[i.CONTEXT_UID]||i.texture.bind(t),!0):!1}function tm(i,t){if(!(t instanceof Eh))return!1;const{geometry:e}=t;t.finishPoly(),e.updateBatches();const{batches:s}=e;for(let r=0;r<s.length;r++){const{texture:n}=s[r].style;n&&Dh(i,n.baseTexture)}return e.batchable||i.geometry.bind(e,t._resolveDirectShader(i)),!0}function em(i,t){return i instanceof Eh?(t.push(i),!0):!1}class Oh extends Jr{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(em),this.registerUploadHook(Dh),this.registerUploadHook(tm)}}Oh.extension={name:"prepare",type:C.RendererSystem};N.add(Oh);class qm{constructor(t){this.maxMilliseconds=t,this.frameStart=0}beginFrame(){this.frameStart=Date.now()}allowedToUpload(){return Date.now()-this.frameStart<this.maxMilliseconds}}class tn extends _e{constructor(t,e=!0){super(t[0]instanceof O?t[0]:t[0].texture),this._textures=null,this._durations=null,this._autoUpdate=e,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=t}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(_t.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(_t.shared.add(this.update,this,me.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=this.animationSpeed*t,s=this.currentFrame;if(this._durations!==null){let r=this._currentTime%1*this._durations[this.currentFrame];for(r+=e/60*1e3;r<0;)this._currentTime--,r+=this._durations[this.currentFrame];const n=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);r>=this._durations[this.currentFrame];)r-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=r/this._durations[this.currentFrame]}else this._currentTime+=e;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._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(t){this.stop(),super.destroy(t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){const e=[];for(let s=0;s<t.length;++s)e.push(O.from(t[s]));return new tn(e)}static fromImages(t){const e=[];for(let s=0;s<t.length;++s)e.push(O.from(t[s]));return new tn(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof O)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?(_t.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(_t.shared.add(this.update,this),this._isConnectedToTicker=!0))}}const ns=new q;class Bh extends _e{constructor(t,e=100,s=100){super(t),this.tileTransform=new dn,this._width=e,this._height=s,this.uvMatrix=this.texture.uvMatrix||new fn(t),this.pluginName="tilingSprite",this.uvRespectAnchor=!1}get clampMargin(){return this.uvMatrix.clampMargin}set clampMargin(t){this.uvMatrix.clampMargin=t,this.uvMatrix.update(!0)}get tileScale(){return this.tileTransform.scale}set tileScale(t){this.tileTransform.scale.copyFrom(t)}get tilePosition(){return this.tileTransform.position}set tilePosition(t){this.tileTransform.position.copyFrom(t)}_onTextureUpdate(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=16777215}_render(t){const e=this._texture;!e||!e.valid||(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this))}_calculateBounds(){const t=this._width*-this._anchor._x,e=this._height*-this._anchor._y,s=this._width*(1-this._anchor._x),r=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,t,e,s,r)}getLocalBounds(t){return this.children.length===0?(this._bounds.minX=this._width*-this._anchor._x,this._bounds.minY=this._height*-this._anchor._y,this._bounds.maxX=this._width*(1-this._anchor._x),this._bounds.maxY=this._height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new j),t=this._localBoundsRect),this._bounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,ns);const e=this._width,s=this._height,r=-e*this.anchor._x;if(ns.x>=r&&ns.x<r+e){const n=-s*this.anchor._y;if(ns.y>=n&&ns.y<n+s)return!0}return!1}destroy(t){super.destroy(t),this.tileTransform=null,this.uvMatrix=null}static from(t,e){const s=t instanceof O?t:O.from(t,e);return new Bh(s,e.width,e.height)}get width(){return this._width}set width(t){this._width=t}get height(){return this._height}set height(t){this._height=t}}var sm=`#version 300 es
|
|
984
984
|
#define SHADER_NAME Tiling-Sprite-100
|
|
985
985
|
|
|
986
986
|
precision lowp float;
|
|
@@ -1006,7 +1006,7 @@ void main(void)
|
|
|
1006
1006
|
|
|
1007
1007
|
fragmentColor = texSample * uColor;
|
|
1008
1008
|
}
|
|
1009
|
-
`,
|
|
1009
|
+
`,im=`#version 300 es
|
|
1010
1010
|
#define SHADER_NAME Tiling-Sprite-300
|
|
1011
1011
|
|
|
1012
1012
|
precision lowp float;
|
|
@@ -1026,7 +1026,7 @@ void main(void)
|
|
|
1026
1026
|
|
|
1027
1027
|
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
|
|
1028
1028
|
}
|
|
1029
|
-
`,
|
|
1029
|
+
`,rm=`#version 100
|
|
1030
1030
|
#ifdef GL_EXT_shader_texture_lod
|
|
1031
1031
|
#extension GL_EXT_shader_texture_lod : enable
|
|
1032
1032
|
#endif
|
|
@@ -1079,7 +1079,7 @@ void main(void)
|
|
|
1079
1079
|
|
|
1080
1080
|
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
|
|
1081
1081
|
}
|
|
1082
|
-
`,
|
|
1082
|
+
`,nm=`#version 100
|
|
1083
1083
|
#define SHADER_NAME Tiling-Sprite-Simple-100
|
|
1084
1084
|
|
|
1085
1085
|
precision lowp float;
|
|
@@ -1094,7 +1094,7 @@ void main(void)
|
|
|
1094
1094
|
vec4 texSample = texture2D(uSampler, vTextureCoord);
|
|
1095
1095
|
gl_FragColor = texSample * uColor;
|
|
1096
1096
|
}
|
|
1097
|
-
`;const Zs=new tt;class Bh extends Si{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new Lo,this.state=ne.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=qt.from(Ka,sm,e),this.shader=t.context.webGLVersion>1?qt.from(tm,Jp,e):qt.from(Ka,em,e)}render(t){const e=this.renderer,s=this.quad;let r=s.vertices;r[0]=r[6]=t._width*-t.anchor.x,r[1]=r[3]=t._height*-t.anchor.y,r[2]=r[4]=t._width*(1-t.anchor.x),r[5]=r[7]=t._height*(1-t.anchor.y);const n=t.uvRespectAnchor?t.anchor.x:0,a=t.uvRespectAnchor?t.anchor.y:0;r=s.uvs,r[0]=r[6]=-n,r[1]=r[3]=-a,r[2]=r[4]=1-n,r[5]=r[7]=1-a,s.invalidate();const o=t._texture,h=o.baseTexture,l=h.alphaMode>0,u=t.tileTransform.localTransform,c=t.uvMatrix;let d=h.isPowerOfTwo&&o.frame.width===h.width&&o.frame.height===h.height;d&&(h._glTextures[e.CONTEXT_UID]?d=h.wrapMode!==re.CLAMP:h.wrapMode===re.CLAMP&&(h.wrapMode=re.REPEAT));const f=d?this.simpleShader:this.shader,p=o.width,m=o.height,g=t._width,y=t._height;Zs.set(u.a*p/g,u.b*p/y,u.c*m/g,u.d*m/y,u.tx/g,u.ty/y),Zs.invert(),d?Zs.prepend(c.mapCoord):(f.uniforms.uMapCoord=c.mapCoord.toArray(!0),f.uniforms.uClampFrame=c.uClampFrame,f.uniforms.uClampOffset=c.uClampOffset),f.uniforms.uTransform=Zs.toArray(!0),f.uniforms.uColor=K.shared.setValue(t.tint).premultiply(t.worldAlpha,l).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=o,e.shader.bind(f),e.geometry.bind(s),this.state.blendMode=hn(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}Bh.extension={name:"tilingSprite",type:C.RendererPlugin};N.add(Bh);const Fh=class fs{constructor(t,e,s=null){this.linkedSheets=[],this._texture=t instanceof D?t:null,this.baseTexture=t instanceof X?t:this._texture.baseTexture,this.textures={},this.animations={},this.data=e;const r=this.baseTexture.resource;this.resolution=this._updateResolution(s||(r?r.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(t=null){const{scale:e}=this.data.meta;let s=Zt(t,null);return s===null&&(s=parseFloat(e!=null?e:"1")),s!==1&&this.baseTexture.setResolution(s),s}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=fs.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const s=fs.BATCH_SIZE;for(;e-t<s&&e<this._frameKeys.length;){const r=this._frameKeys[e],n=this._frames[r],a=n.frame;if(a){let o=null,h=null;const l=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,u=new j(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?o=new j(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):o=new j(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(h=new j(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution)),this.textures[r]=new D(this.baseTexture,o,u,h,n.rotated?2:0,n.anchor,n.borders),D.addToCache(this.textures[r],r.toString())}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let s=0;s<t[e].length;s++){const r=t[e][s];this.animations[e].push(this.textures[r])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*fs.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*fs.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const s in this.textures)this.textures[s].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&((e=this._texture)==null||e.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};Fh.BATCH_SIZE=1e3;let Za=Fh;const im=["jpg","png","jpeg","avif","webp"];function Nh(i,t,e){const s={};if(i.forEach(r=>{s[r]=t}),Object.keys(t.textures).forEach(r=>{s[r]=t.textures[r]}),!e){const r=vt.dirname(i[0]);t.linkedSheets.forEach((n,a)=>{const o=Nh([`${r}/${t.data.meta.related_multi_packs[a]}`],n,!0);Object.assign(s,o)})}return s}const rm={extension:C.Asset,cache:{test:i=>i instanceof Za,getCacheableAssets:(i,t)=>Nh(i,t,!1)},resolver:{test:i=>{const t=i.split("?")[0].split("."),e=t.pop(),s=t.pop();return e==="json"&&im.includes(s)},parse:i=>{var t,e;const s=i.split(".");return{resolution:parseFloat((e=(t=O.RETINA_PREFIX.exec(i))==null?void 0:t[1])!=null?e:"1"),format:s[s.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:C.LoadParser,priority:Ut.Normal},async testParse(i,t){return vt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){var s,r;let n=vt.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a=n+i.meta.image;a=zr(a,t.src);const o=(await e.load([a]))[a],h=new Za(o.baseTexture,i,t.src);await h.parse();const l=(s=i==null?void 0:i.meta)==null?void 0:s.related_multi_packs;if(Array.isArray(l)){const u=[];for(const d of l){if(typeof d!="string")continue;let f=n+d;(r=t.data)!=null&&r.ignoreMultiPack||(f=zr(f,t.src),u.push(e.load({src:f,data:{ignoreMultiPack:!0}})))}const c=await Promise.all(u);h.linkedSheets=c,c.forEach(d=>{d.linkedSheets=[h].concat(h.linkedSheets.filter(f=>f!==d))})}return h},unload(i){i.destroy(!0)}}};N.add(rm);class yi{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class ni{static test(t){return typeof t=="string"&&t.startsWith("info face=")}static parse(t){const e=t.match(/^[a-z]+\s+.+$/gm),s={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const n in e){const a=e[n].match(/^[a-z]+/gm)[0],o=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),h={};for(const l in o){const u=o[l].split("="),c=u[0],d=u[1].replace(/"/gm,""),f=parseFloat(d),p=isNaN(f)?d:f;h[c]=p}s[a].push(h)}const r=new yi;return s.info.forEach(n=>r.info.push({face:n.face,size:parseInt(n.size,10)})),s.common.forEach(n=>r.common.push({lineHeight:parseInt(n.lineHeight,10)})),s.page.forEach(n=>r.page.push({id:parseInt(n.id,10),file:n.file})),s.char.forEach(n=>r.char.push({id:parseInt(n.id,10),page:parseInt(n.page,10),x:parseInt(n.x,10),y:parseInt(n.y,10),width:parseInt(n.width,10),height:parseInt(n.height,10),xoffset:parseInt(n.xoffset,10),yoffset:parseInt(n.yoffset,10),xadvance:parseInt(n.xadvance,10)})),s.kerning.forEach(n=>r.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),s.distanceField.forEach(n=>r.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),r}}class en{static test(t){const e=t;return typeof t!="string"&&"getElementsByTagName"in t&&e.getElementsByTagName("page").length&&e.getElementsByTagName("info")[0].getAttribute("face")!==null}static parse(t){const e=new yi,s=t.getElementsByTagName("info"),r=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),a=t.getElementsByTagName("char"),o=t.getElementsByTagName("kerning"),h=t.getElementsByTagName("distanceField");for(let l=0;l<s.length;l++)e.info.push({face:s[l].getAttribute("face"),size:parseInt(s[l].getAttribute("size"),10)});for(let l=0;l<r.length;l++)e.common.push({lineHeight:parseInt(r[l].getAttribute("lineHeight"),10)});for(let l=0;l<n.length;l++)e.page.push({id:parseInt(n[l].getAttribute("id"),10)||0,file:n[l].getAttribute("file")});for(let l=0;l<a.length;l++){const u=a[l];e.char.push({id:parseInt(u.getAttribute("id"),10),page:parseInt(u.getAttribute("page"),10)||0,x:parseInt(u.getAttribute("x"),10),y:parseInt(u.getAttribute("y"),10),width:parseInt(u.getAttribute("width"),10),height:parseInt(u.getAttribute("height"),10),xoffset:parseInt(u.getAttribute("xoffset"),10),yoffset:parseInt(u.getAttribute("yoffset"),10),xadvance:parseInt(u.getAttribute("xadvance"),10)})}for(let l=0;l<o.length;l++)e.kerning.push({first:parseInt(o[l].getAttribute("first"),10),second:parseInt(o[l].getAttribute("second"),10),amount:parseInt(o[l].getAttribute("amount"),10)});for(let l=0;l<h.length;l++)e.distanceField.push({fieldType:h[l].getAttribute("fieldType"),distanceRange:parseInt(h[l].getAttribute("distanceRange"),10)});return e}}class sn{static test(t){return typeof t=="string"&&t.includes("<font>")?en.test(O.ADAPTER.parseXML(t)):!1}static parse(t){return en.parse(O.ADAPTER.parseXML(t))}}const ar=[ni,en,sn];function nm(i){for(let t=0;t<ar.length;t++)if(ar[t].test(i))return ar[t];return null}function am(i,t,e,s,r,n){const a=e.fill;if(Array.isArray(a)){if(a.length===1)return a[0]}else return a;let o;const h=e.dropShadow?e.dropShadowDistance:0,l=e.padding||0,u=i.width/s-h-l*2,c=i.height/s-h-l*2,d=a.slice(),f=e.fillGradientStops.slice();if(!f.length){const p=d.length+1;for(let m=1;m<p;++m)f.push(m/p)}if(d.unshift(a[0]),f.unshift(0),d.push(a[a.length-1]),f.push(1),e.fillGradientType===Di.LINEAR_VERTICAL){o=t.createLinearGradient(u/2,l,u/2,c+l);let p=0;const m=(n.fontProperties.fontSize+e.strokeThickness)/c;for(let g=0;g<r.length;g++){const y=n.lineHeight*g;for(let x=0;x<d.length;x++){let _=0;typeof f[x]=="number"?_=f[x]:_=x/d.length;const v=y/c+_*m;let T=Math.max(p,v);T=Math.min(T,1),o.addColorStop(T,d[x]),p=T}}}else{o=t.createLinearGradient(l,c/2,u+l,c/2);const p=d.length+1;let m=1;for(let g=0;g<d.length;g++){let y;typeof f[g]=="number"?y=f[g]:y=m/p,o.addColorStop(y,d[g]),m++}}return o}function om(i,t,e,s,r,n,a){const o=e.text,h=e.fontProperties;t.translate(s,r),t.scale(n,n);const l=a.strokeThickness/2,u=-(a.strokeThickness/2);if(t.font=a.toFontString(),t.lineWidth=a.strokeThickness,t.textBaseline=a.textBaseline,t.lineJoin=a.lineJoin,t.miterLimit=a.miterLimit,t.fillStyle=am(i,t,a,n,[o],e),t.strokeStyle=a.stroke,a.dropShadow){const c=a.dropShadowColor,d=a.dropShadowBlur*n,f=a.dropShadowDistance*n;t.shadowColor=K.shared.setValue(c).setAlpha(a.dropShadowAlpha).toRgbaString(),t.shadowBlur=d,t.shadowOffsetX=Math.cos(a.dropShadowAngle)*f,t.shadowOffsetY=Math.sin(a.dropShadowAngle)*f}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;a.stroke&&a.strokeThickness&&t.strokeText(o,l,u+e.lineHeight-h.descent),a.fill&&t.fillText(o,l,u+e.lineHeight-h.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function ai(i){return i.codePointAt?i.codePointAt(0):i.charCodeAt(0)}function Lh(i){return Array.from?Array.from(i):i.split("")}function hm(i){typeof i=="string"&&(i=[i]);const t=[];for(let e=0,s=i.length;e<s;e++){const r=i[e];if(Array.isArray(r)){if(r.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${r.length}.`);const n=r[0].charCodeAt(0),a=r[1].charCodeAt(0);if(a<n)throw new Error("[BitmapFont]: Invalid character range.");for(let o=n,h=a;o<=h;o++)t.push(String.fromCharCode(o))}else t.push(...Lh(r))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}var lm=Object.defineProperty,xi=Object.getOwnPropertySymbols,Uh=Object.prototype.hasOwnProperty,kh=Object.prototype.propertyIsEnumerable,Qa=(i,t,e)=>t in i?lm(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,um=(i,t)=>{for(var e in t||(t={}))Uh.call(t,e)&&Qa(i,e,t[e]);if(xi)for(var e of xi(t))kh.call(t,e)&&Qa(i,e,t[e]);return i},cm=(i,t)=>{var e={};for(var s in i)Uh.call(i,s)&&t.indexOf(s)<0&&(e[s]=i[s]);if(i!=null&&xi)for(var s of xi(i))t.indexOf(s)<0&&kh.call(i,s)&&(e[s]=i[s]);return e};const ae=class Vt{constructor(t,e,s){var r,n;const[a]=t.info,[o]=t.common,[h]=t.page,[l]=t.distanceField,u=Zt(h.file),c={};this._ownsTextures=s,this.font=a.face,this.size=a.size,this.lineHeight=o.lineHeight/u,this.chars={},this.pageTextures=c;for(let d=0;d<t.page.length;d++){const{id:f,file:p}=t.page[d];c[f]=e instanceof Array?e[d]:e[p],l!=null&&l.fieldType&&l.fieldType!=="none"&&(c[f].baseTexture.alphaMode=bt.NO_PREMULTIPLIED_ALPHA,c[f].baseTexture.mipmap=Kt.OFF)}for(let d=0;d<t.char.length;d++){const{id:f,page:p}=t.char[d];let{x:m,y:g,width:y,height:x,xoffset:_,yoffset:v,xadvance:T}=t.char[d];m/=u,g/=u,y/=u,x/=u,_/=u,v/=u,T/=u;const B=new j(m+c[p].frame.x/u,g+c[p].frame.y/u,y,x);this.chars[f]={xOffset:_,yOffset:v,xAdvance:T,kerning:{},texture:new D(c[p].baseTexture,B),page:p}}for(let d=0;d<t.kerning.length;d++){let{first:f,second:p,amount:m}=t.kerning[d];f/=u,p/=u,m/=u,this.chars[p]&&(this.chars[p].kerning[f]=m)}this.distanceFieldRange=l==null?void 0:l.distanceRange,this.distanceFieldType=(n=(r=l==null?void 0:l.fieldType)==null?void 0:r.toLowerCase())!=null?n:"none"}destroy(){for(const t in this.chars)this.chars[t].texture.destroy(),this.chars[t].texture=null;for(const t in this.pageTextures)this._ownsTextures&&this.pageTextures[t].destroy(!0),this.pageTextures[t]=null;this.chars=null,this.pageTextures=null}static install(t,e,s){let r;if(t instanceof yi)r=t;else{const a=nm(t);if(!a)throw new Error("Unrecognized data format for font.");r=a.parse(t)}e instanceof D&&(e=[e]);const n=new Vt(r,e,s);return Vt.available[n.font]=n,n}static uninstall(t){const e=Vt.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete Vt.available[t]}static from(t,e,s){if(!t)throw new Error("[BitmapFont] Property `name` is required.");const r=Object.assign({},Vt.defaultOptions,s),{chars:n,padding:a,resolution:o,textureWidth:h,textureHeight:l}=r,u=cm(r,["chars","padding","resolution","textureWidth","textureHeight"]),c=hm(n),d=e instanceof ge?e:new ge(e),f=h,p=new yi;p.info[0]={face:d.fontFamily,size:d.fontSize},p.common[0]={lineHeight:d.fontSize};let m=0,g=0,y,x,_,v=0;const T=[],B=[];for(let E=0;E<c.length;E++){y||(y=O.ADAPTER.createCanvas(),y.width=h,y.height=l,x=y.getContext("2d"),_=new X(y,um({resolution:o},u)),T.push(_),B.push(new D(_)),p.page.push({id:B.length-1,file:""}));const M=c[E],U=he.measureText(M,d,!1,y),W=U.width,F=Math.ceil(U.height),b=Math.ceil((d.fontStyle==="italic"?2:1)*W);if(g>=l-F*o){if(g===0)throw new Error(`[BitmapFont] textureHeight ${l}px is too small (fontFamily: '${d.fontFamily}', fontSize: ${d.fontSize}px, char: '${M}')`);--E,y=null,x=null,_=null,g=0,m=0,v=0;continue}if(v=Math.max(F+U.fontProperties.descent,v),b*o+m>=f){if(m===0)throw new Error(`[BitmapFont] textureWidth ${h}px is too small (fontFamily: '${d.fontFamily}', fontSize: ${d.fontSize}px, char: '${M}')`);--E,g+=v*o,g=Math.ceil(g),m=0,v=0;continue}om(y,x,U,m,g,o,d);const S=ai(U.text);p.char.push({id:S,page:B.length-1,x:m/o,y:g/o,width:b,height:F,xoffset:0,yoffset:0,xadvance:W-(d.dropShadow?d.dropShadowDistance:0)-(d.stroke?d.strokeThickness:0)}),m+=(b+2*a)*o,m=Math.ceil(m)}if(!(s!=null&&s.skipKerning))for(let E=0,M=c.length;E<M;E++){const U=c[E];for(let W=0;W<M;W++){const F=c[W],b=x.measureText(U).width,S=x.measureText(F).width,G=x.measureText(U+F).width-(b+S);G&&p.kerning.push({first:ai(U),second:ai(F),amount:G})}}const w=new Vt(p,B,!0);return Vt.available[t]!==void 0&&Vt.uninstall(t),Vt.available[t]=w,w}};ae.ALPHA=[["a","z"],["A","Z"]," "],ae.NUMERIC=[["0","9"]],ae.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],ae.ASCII=[[" ","~"]],ae.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:ae.ALPHANUMERIC},ae.available={};let oe=ae;var dm=`// Pixi texture info\r
|
|
1097
|
+
`;const Zs=new tt;class Fh extends Si{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new Lo,this.state=ne.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=qt.from(Ka,nm,e),this.shader=t.context.webGLVersion>1?qt.from(im,sm,e):qt.from(Ka,rm,e)}render(t){const e=this.renderer,s=this.quad;let r=s.vertices;r[0]=r[6]=t._width*-t.anchor.x,r[1]=r[3]=t._height*-t.anchor.y,r[2]=r[4]=t._width*(1-t.anchor.x),r[5]=r[7]=t._height*(1-t.anchor.y);const n=t.uvRespectAnchor?t.anchor.x:0,a=t.uvRespectAnchor?t.anchor.y:0;r=s.uvs,r[0]=r[6]=-n,r[1]=r[3]=-a,r[2]=r[4]=1-n,r[5]=r[7]=1-a,s.invalidate();const o=t._texture,h=o.baseTexture,l=h.alphaMode>0,u=t.tileTransform.localTransform,c=t.uvMatrix;let d=h.isPowerOfTwo&&o.frame.width===h.width&&o.frame.height===h.height;d&&(h._glTextures[e.CONTEXT_UID]?d=h.wrapMode!==re.CLAMP:h.wrapMode===re.CLAMP&&(h.wrapMode=re.REPEAT));const f=d?this.simpleShader:this.shader,p=o.width,m=o.height,g=t._width,v=t._height;Zs.set(u.a*p/g,u.b*p/v,u.c*m/g,u.d*m/v,u.tx/g,u.ty/v),Zs.invert(),d?Zs.prepend(c.mapCoord):(f.uniforms.uMapCoord=c.mapCoord.toArray(!0),f.uniforms.uClampFrame=c.uClampFrame,f.uniforms.uClampOffset=c.uClampOffset),f.uniforms.uTransform=Zs.toArray(!0),f.uniforms.uColor=K.shared.setValue(t.tint).premultiply(t.worldAlpha,l).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=o,e.shader.bind(f),e.geometry.bind(s),this.state.blendMode=hn(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}Fh.extension={name:"tilingSprite",type:C.RendererPlugin};N.add(Fh);const Nh=class fs{constructor(t,e,s=null){this.linkedSheets=[],this._texture=t instanceof O?t:null,this.baseTexture=t instanceof X?t:this._texture.baseTexture,this.textures={},this.animations={},this.data=e;const r=this.baseTexture.resource;this.resolution=this._updateResolution(s||(r?r.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(t=null){const{scale:e}=this.data.meta;let s=Zt(t,null);return s===null&&(s=parseFloat(e!=null?e:"1")),s!==1&&this.baseTexture.setResolution(s),s}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=fs.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const s=fs.BATCH_SIZE;for(;e-t<s&&e<this._frameKeys.length;){const r=this._frameKeys[e],n=this._frames[r],a=n.frame;if(a){let o=null,h=null;const l=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,u=new j(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?o=new j(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):o=new j(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(h=new j(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution)),this.textures[r]=new O(this.baseTexture,o,u,h,n.rotated?2:0,n.anchor,n.borders),O.addToCache(this.textures[r],r.toString())}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let s=0;s<t[e].length;s++){const r=t[e][s];this.animations[e].push(this.textures[r])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*fs.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*fs.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const s in this.textures)this.textures[s].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&((e=this._texture)==null||e.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};Nh.BATCH_SIZE=1e3;let Za=Nh;const am=["jpg","png","jpeg","avif","webp"];function Lh(i,t,e){const s={};if(i.forEach(r=>{s[r]=t}),Object.keys(t.textures).forEach(r=>{s[r]=t.textures[r]}),!e){const r=lt.dirname(i[0]);t.linkedSheets.forEach((n,a)=>{const o=Lh([`${r}/${t.data.meta.related_multi_packs[a]}`],n,!0);Object.assign(s,o)})}return s}const om={extension:C.Asset,cache:{test:i=>i instanceof Za,getCacheableAssets:(i,t)=>Lh(i,t,!1)},resolver:{test:i=>{const t=i.split("?")[0].split("."),e=t.pop(),s=t.pop();return e==="json"&&am.includes(s)},parse:i=>{var t,e;const s=i.split(".");return{resolution:parseFloat((e=(t=D.RETINA_PREFIX.exec(i))==null?void 0:t[1])!=null?e:"1"),format:s[s.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:C.LoadParser,priority:Ut.Normal},async testParse(i,t){return lt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){var s,r;let n=lt.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a=n+i.meta.image;a=zr(a,t.src);const o=(await e.load([a]))[a],h=new Za(o.baseTexture,i,t.src);await h.parse();const l=(s=i==null?void 0:i.meta)==null?void 0:s.related_multi_packs;if(Array.isArray(l)){const u=[];for(const d of l){if(typeof d!="string")continue;let f=n+d;(r=t.data)!=null&&r.ignoreMultiPack||(f=zr(f,t.src),u.push(e.load({src:f,data:{ignoreMultiPack:!0}})))}const c=await Promise.all(u);h.linkedSheets=c,c.forEach(d=>{d.linkedSheets=[h].concat(h.linkedSheets.filter(f=>f!==d))})}return h},unload(i){i.destroy(!0)}}};N.add(om);class yi{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class ni{static test(t){return typeof t=="string"&&t.startsWith("info face=")}static parse(t){const e=t.match(/^[a-z]+\s+.+$/gm),s={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const n in e){const a=e[n].match(/^[a-z]+/gm)[0],o=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),h={};for(const l in o){const u=o[l].split("="),c=u[0],d=u[1].replace(/"/gm,""),f=parseFloat(d),p=isNaN(f)?d:f;h[c]=p}s[a].push(h)}const r=new yi;return s.info.forEach(n=>r.info.push({face:n.face,size:parseInt(n.size,10)})),s.common.forEach(n=>r.common.push({lineHeight:parseInt(n.lineHeight,10)})),s.page.forEach(n=>r.page.push({id:parseInt(n.id,10),file:n.file})),s.char.forEach(n=>r.char.push({id:parseInt(n.id,10),page:parseInt(n.page,10),x:parseInt(n.x,10),y:parseInt(n.y,10),width:parseInt(n.width,10),height:parseInt(n.height,10),xoffset:parseInt(n.xoffset,10),yoffset:parseInt(n.yoffset,10),xadvance:parseInt(n.xadvance,10)})),s.kerning.forEach(n=>r.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),s.distanceField.forEach(n=>r.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),r}}class en{static test(t){const e=t;return typeof t!="string"&&"getElementsByTagName"in t&&e.getElementsByTagName("page").length&&e.getElementsByTagName("info")[0].getAttribute("face")!==null}static parse(t){const e=new yi,s=t.getElementsByTagName("info"),r=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),a=t.getElementsByTagName("char"),o=t.getElementsByTagName("kerning"),h=t.getElementsByTagName("distanceField");for(let l=0;l<s.length;l++)e.info.push({face:s[l].getAttribute("face"),size:parseInt(s[l].getAttribute("size"),10)});for(let l=0;l<r.length;l++)e.common.push({lineHeight:parseInt(r[l].getAttribute("lineHeight"),10)});for(let l=0;l<n.length;l++)e.page.push({id:parseInt(n[l].getAttribute("id"),10)||0,file:n[l].getAttribute("file")});for(let l=0;l<a.length;l++){const u=a[l];e.char.push({id:parseInt(u.getAttribute("id"),10),page:parseInt(u.getAttribute("page"),10)||0,x:parseInt(u.getAttribute("x"),10),y:parseInt(u.getAttribute("y"),10),width:parseInt(u.getAttribute("width"),10),height:parseInt(u.getAttribute("height"),10),xoffset:parseInt(u.getAttribute("xoffset"),10),yoffset:parseInt(u.getAttribute("yoffset"),10),xadvance:parseInt(u.getAttribute("xadvance"),10)})}for(let l=0;l<o.length;l++)e.kerning.push({first:parseInt(o[l].getAttribute("first"),10),second:parseInt(o[l].getAttribute("second"),10),amount:parseInt(o[l].getAttribute("amount"),10)});for(let l=0;l<h.length;l++)e.distanceField.push({fieldType:h[l].getAttribute("fieldType"),distanceRange:parseInt(h[l].getAttribute("distanceRange"),10)});return e}}class sn{static test(t){return typeof t=="string"&&t.includes("<font>")?en.test(D.ADAPTER.parseXML(t)):!1}static parse(t){return en.parse(D.ADAPTER.parseXML(t))}}const ar=[ni,en,sn];function hm(i){for(let t=0;t<ar.length;t++)if(ar[t].test(i))return ar[t];return null}function lm(i,t,e,s,r,n){const a=e.fill;if(Array.isArray(a)){if(a.length===1)return a[0]}else return a;let o;const h=e.dropShadow?e.dropShadowDistance:0,l=e.padding||0,u=i.width/s-h-l*2,c=i.height/s-h-l*2,d=a.slice(),f=e.fillGradientStops.slice();if(!f.length){const p=d.length+1;for(let m=1;m<p;++m)f.push(m/p)}if(d.unshift(a[0]),f.unshift(0),d.push(a[a.length-1]),f.push(1),e.fillGradientType===Di.LINEAR_VERTICAL){o=t.createLinearGradient(u/2,l,u/2,c+l);let p=0;const m=(n.fontProperties.fontSize+e.strokeThickness)/c;for(let g=0;g<r.length;g++){const v=n.lineHeight*g;for(let x=0;x<d.length;x++){let _=0;typeof f[x]=="number"?_=f[x]:_=x/d.length;const y=v/c+_*m;let T=Math.max(p,y);T=Math.min(T,1),o.addColorStop(T,d[x]),p=T}}}else{o=t.createLinearGradient(l,c/2,u+l,c/2);const p=d.length+1;let m=1;for(let g=0;g<d.length;g++){let v;typeof f[g]=="number"?v=f[g]:v=m/p,o.addColorStop(v,d[g]),m++}}return o}function um(i,t,e,s,r,n,a){const o=e.text,h=e.fontProperties;t.translate(s,r),t.scale(n,n);const l=a.strokeThickness/2,u=-(a.strokeThickness/2);if(t.font=a.toFontString(),t.lineWidth=a.strokeThickness,t.textBaseline=a.textBaseline,t.lineJoin=a.lineJoin,t.miterLimit=a.miterLimit,t.fillStyle=lm(i,t,a,n,[o],e),t.strokeStyle=a.stroke,a.dropShadow){const c=a.dropShadowColor,d=a.dropShadowBlur*n,f=a.dropShadowDistance*n;t.shadowColor=K.shared.setValue(c).setAlpha(a.dropShadowAlpha).toRgbaString(),t.shadowBlur=d,t.shadowOffsetX=Math.cos(a.dropShadowAngle)*f,t.shadowOffsetY=Math.sin(a.dropShadowAngle)*f}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;a.stroke&&a.strokeThickness&&t.strokeText(o,l,u+e.lineHeight-h.descent),a.fill&&t.fillText(o,l,u+e.lineHeight-h.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function ai(i){return i.codePointAt?i.codePointAt(0):i.charCodeAt(0)}function Uh(i){return Array.from?Array.from(i):i.split("")}function cm(i){typeof i=="string"&&(i=[i]);const t=[];for(let e=0,s=i.length;e<s;e++){const r=i[e];if(Array.isArray(r)){if(r.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${r.length}.`);const n=r[0].charCodeAt(0),a=r[1].charCodeAt(0);if(a<n)throw new Error("[BitmapFont]: Invalid character range.");for(let o=n,h=a;o<=h;o++)t.push(String.fromCharCode(o))}else t.push(...Uh(r))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}var dm=Object.defineProperty,xi=Object.getOwnPropertySymbols,kh=Object.prototype.hasOwnProperty,Gh=Object.prototype.propertyIsEnumerable,Qa=(i,t,e)=>t in i?dm(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,fm=(i,t)=>{for(var e in t||(t={}))kh.call(t,e)&&Qa(i,e,t[e]);if(xi)for(var e of xi(t))Gh.call(t,e)&&Qa(i,e,t[e]);return i},pm=(i,t)=>{var e={};for(var s in i)kh.call(i,s)&&t.indexOf(s)<0&&(e[s]=i[s]);if(i!=null&&xi)for(var s of xi(i))t.indexOf(s)<0&&Gh.call(i,s)&&(e[s]=i[s]);return e};const ae=class Vt{constructor(t,e,s){var r,n;const[a]=t.info,[o]=t.common,[h]=t.page,[l]=t.distanceField,u=Zt(h.file),c={};this._ownsTextures=s,this.font=a.face,this.size=a.size,this.lineHeight=o.lineHeight/u,this.chars={},this.pageTextures=c;for(let d=0;d<t.page.length;d++){const{id:f,file:p}=t.page[d];c[f]=e instanceof Array?e[d]:e[p],l!=null&&l.fieldType&&l.fieldType!=="none"&&(c[f].baseTexture.alphaMode=bt.NO_PREMULTIPLIED_ALPHA,c[f].baseTexture.mipmap=Kt.OFF)}for(let d=0;d<t.char.length;d++){const{id:f,page:p}=t.char[d];let{x:m,y:g,width:v,height:x,xoffset:_,yoffset:y,xadvance:T}=t.char[d];m/=u,g/=u,v/=u,x/=u,_/=u,y/=u,T/=u;const P=new j(m+c[p].frame.x/u,g+c[p].frame.y/u,v,x);this.chars[f]={xOffset:_,yOffset:y,xAdvance:T,kerning:{},texture:new O(c[p].baseTexture,P),page:p}}for(let d=0;d<t.kerning.length;d++){let{first:f,second:p,amount:m}=t.kerning[d];f/=u,p/=u,m/=u,this.chars[p]&&(this.chars[p].kerning[f]=m)}this.distanceFieldRange=l==null?void 0:l.distanceRange,this.distanceFieldType=(n=(r=l==null?void 0:l.fieldType)==null?void 0:r.toLowerCase())!=null?n:"none"}destroy(){for(const t in this.chars)this.chars[t].texture.destroy(),this.chars[t].texture=null;for(const t in this.pageTextures)this._ownsTextures&&this.pageTextures[t].destroy(!0),this.pageTextures[t]=null;this.chars=null,this.pageTextures=null}static install(t,e,s){let r;if(t instanceof yi)r=t;else{const a=hm(t);if(!a)throw new Error("Unrecognized data format for font.");r=a.parse(t)}e instanceof O&&(e=[e]);const n=new Vt(r,e,s);return Vt.available[n.font]=n,n}static uninstall(t){const e=Vt.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete Vt.available[t]}static from(t,e,s){if(!t)throw new Error("[BitmapFont] Property `name` is required.");const r=Object.assign({},Vt.defaultOptions,s),{chars:n,padding:a,resolution:o,textureWidth:h,textureHeight:l}=r,u=pm(r,["chars","padding","resolution","textureWidth","textureHeight"]),c=cm(n),d=e instanceof ge?e:new ge(e),f=h,p=new yi;p.info[0]={face:d.fontFamily,size:d.fontSize},p.common[0]={lineHeight:d.fontSize};let m=0,g=0,v,x,_,y=0;const T=[],P=[];for(let A=0;A<c.length;A++){v||(v=D.ADAPTER.createCanvas(),v.width=h,v.height=l,x=v.getContext("2d"),_=new X(v,fm({resolution:o},u)),T.push(_),P.push(new O(_)),p.page.push({id:P.length-1,file:""}));const B=c[A],k=he.measureText(B,d,!1,v),W=k.width,F=Math.ceil(k.height),b=Math.ceil((d.fontStyle==="italic"?2:1)*W);if(g>=l-F*o){if(g===0)throw new Error(`[BitmapFont] textureHeight ${l}px is too small (fontFamily: '${d.fontFamily}', fontSize: ${d.fontSize}px, char: '${B}')`);--A,v=null,x=null,_=null,g=0,m=0,y=0;continue}if(y=Math.max(F+k.fontProperties.descent,y),b*o+m>=f){if(m===0)throw new Error(`[BitmapFont] textureWidth ${h}px is too small (fontFamily: '${d.fontFamily}', fontSize: ${d.fontSize}px, char: '${B}')`);--A,g+=y*o,g=Math.ceil(g),m=0,y=0;continue}um(v,x,k,m,g,o,d);const S=ai(k.text);p.char.push({id:S,page:P.length-1,x:m/o,y:g/o,width:b,height:F,xoffset:0,yoffset:0,xadvance:W-(d.dropShadow?d.dropShadowDistance:0)-(d.stroke?d.strokeThickness:0)}),m+=(b+2*a)*o,m=Math.ceil(m)}if(!(s!=null&&s.skipKerning))for(let A=0,B=c.length;A<B;A++){const k=c[A];for(let W=0;W<B;W++){const F=c[W],b=x.measureText(k).width,S=x.measureText(F).width,G=x.measureText(k+F).width-(b+S);G&&p.kerning.push({first:ai(k),second:ai(F),amount:G})}}const w=new Vt(p,P,!0);return Vt.available[t]!==void 0&&Vt.uninstall(t),Vt.available[t]=w,w}};ae.ALPHA=[["a","z"],["A","Z"]," "],ae.NUMERIC=[["0","9"]],ae.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],ae.ASCII=[[" ","~"]],ae.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:ae.ALPHANUMERIC},ae.available={};let oe=ae;var mm=`// Pixi texture info\r
|
|
1098
1098
|
varying vec2 vTextureCoord;\r
|
|
1099
1099
|
uniform sampler2D uSampler;\r
|
|
1100
1100
|
\r
|
|
@@ -1132,7 +1132,7 @@ void main(void) {\r
|
|
|
1132
1132
|
// NPM Textures, NPM outputs\r
|
|
1133
1133
|
gl_FragColor = vec4(uColor.rgb, coverage);\r
|
|
1134
1134
|
}\r
|
|
1135
|
-
`,
|
|
1135
|
+
`,gm=`// Mesh material default fragment\r
|
|
1136
1136
|
attribute vec2 aVertexPosition;\r
|
|
1137
1137
|
attribute vec2 aTextureCoord;\r
|
|
1138
1138
|
\r
|
|
@@ -1148,15 +1148,15 @@ void main(void)\r
|
|
|
1148
1148
|
\r
|
|
1149
1149
|
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r
|
|
1150
1150
|
}\r
|
|
1151
|
-
`;const Ja=[],to=[],eo=[]
|
|
1152
|
-
`)||" ",u=
|
|
1153
|
-
`){o.push(p),h.push(-1),m=Math.max(m,p),++g,++_,n.x=0,n.y+=e.lineHeight,f=null,T=0;continue}const G=e.chars[S];if(!G)continue;f&&G.kerning[f]&&(n.x+=G.kerning[f]);const z=eo.pop()||{texture:
|
|
1154
|
-
`&&(/(?:\s)/.test(
|
|
1151
|
+
`;const Ja=[],to=[],eo=[],$h=class Hh extends Mt{constructor(t,e={}){super();const{align:s,tint:r,maxWidth:n,letterSpacing:a,fontName:o,fontSize:h}=Object.assign({},Hh.styleDefaults,e);if(!oe.available[o])throw new Error(`Missing BitmapFont "${o}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=s,this._tintColor=new K(r),this._font=void 0,this._fontName=o,this._fontSize=h,this.text=t,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=a,this._anchor=new ue(()=>{this.dirty=!0},this,0,0),this._roundPixels=D.ROUND_PIXELS,this.dirty=!0,this._resolution=D.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var t;const e=oe.available[this._fontName],s=this.fontSize,r=s/e.size,n=new q,a=[],o=[],h=[],l=this._text.replace(/(?:\r\n|\r)/g,`
|
|
1152
|
+
`)||" ",u=Uh(l),c=this._maxWidth*e.size/s,d=e.distanceFieldType==="none"?Ja:to;let f=null,p=0,m=0,g=0,v=-1,x=0,_=0,y=0,T=0;for(let F=0;F<u.length;F++){const b=u[F],S=ai(b);if(/(?:\s)/.test(b)&&(v=F,x=p,T++),b==="\r"||b===`
|
|
1153
|
+
`){o.push(p),h.push(-1),m=Math.max(m,p),++g,++_,n.x=0,n.y+=e.lineHeight,f=null,T=0;continue}const G=e.chars[S];if(!G)continue;f&&G.kerning[f]&&(n.x+=G.kerning[f]);const z=eo.pop()||{texture:O.EMPTY,line:0,charCode:0,prevSpaces:0,position:new q};z.texture=G.texture,z.line=g,z.charCode=S,z.position.x=Math.round(n.x+G.xOffset+this._letterSpacing/2),z.position.y=Math.round(n.y+G.yOffset),z.prevSpaces=T,a.push(z),p=z.position.x+Math.max(G.xAdvance-G.xOffset,G.texture.orig.width),n.x+=G.xAdvance+this._letterSpacing,y=Math.max(y,G.yOffset+G.texture.height),f=S,v!==-1&&c>0&&n.x>c&&(++_,Re(a,1+v-_,1+F-v),F=v,v=-1,o.push(x),h.push(a.length>0?a[a.length-1].prevSpaces:0),m=Math.max(m,x),g++,n.x=0,n.y+=e.lineHeight,f=null,T=0)}const P=u[u.length-1];P!=="\r"&&P!==`
|
|
1154
|
+
`&&(/(?:\s)/.test(P)&&(p=x),o.push(p),m=Math.max(m,p),h.push(-1));const w=[];for(let F=0;F<=g;F++){let b=0;this._align==="right"?b=m-o[F]:this._align==="center"?b=(m-o[F])/2:this._align==="justify"&&(b=h[F]<0?0:(m-o[F])/h[F]),w.push(b)}const A=a.length,B={},k=[],W=this._activePagesMeshData;d.push(...W);for(let F=0;F<A;F++){const b=a[F].texture,S=b.baseTexture.uid;if(!B[S]){let G=d.pop();if(!G){const $=new Mi;let V,rt;e.distanceFieldType==="none"?(V=new As(O.EMPTY),rt=H.NORMAL):(V=new As(O.EMPTY,{program:ie.from(gm,mm),uniforms:{uFWidth:0}}),rt=H.NORMAL_NPM);const R=new Es($,V);R.blendMode=rt,G={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:R,vertices:null,uvs:null,indices:null}}G.index=0,G.indexCount=0,G.vertexCount=0,G.uvsCount=0,G.total=0;const{_textureCache:z}=this;z[S]=z[S]||new O(b.baseTexture),G.mesh.texture=z[S],G.mesh.tint=this._tintColor.value,k.push(G),B[S]=G}B[S].total++}for(let F=0;F<W.length;F++)k.includes(W[F])||this.removeChild(W[F].mesh);for(let F=0;F<k.length;F++)k[F].mesh.parent!==this&&this.addChild(k[F].mesh);this._activePagesMeshData=k;for(const F in B){const b=B[F],S=b.total;if(!(((t=b.indices)==null?void 0:t.length)>6*S)||b.vertices.length<Es.BATCHABLE_SIZE*2)b.vertices=new Float32Array(4*2*S),b.uvs=new Float32Array(4*2*S),b.indices=new Uint16Array(6*S);else{const G=b.total,z=b.vertices;for(let $=G*4*2;$<z.length;$++)z[$]=0}b.mesh.size=6*S}for(let F=0;F<A;F++){const b=a[F];let S=b.position.x+w[b.line]*(this._align==="justify"?b.prevSpaces:1);this._roundPixels&&(S=Math.round(S));const G=S*r,z=b.position.y*r,$=b.texture,V=B[$.baseTexture.uid],rt=$.frame,R=$._uvs,I=V.index++;V.indices[I*6+0]=0+I*4,V.indices[I*6+1]=1+I*4,V.indices[I*6+2]=2+I*4,V.indices[I*6+3]=0+I*4,V.indices[I*6+4]=2+I*4,V.indices[I*6+5]=3+I*4,V.vertices[I*8+0]=G,V.vertices[I*8+1]=z,V.vertices[I*8+2]=G+rt.width*r,V.vertices[I*8+3]=z,V.vertices[I*8+4]=G+rt.width*r,V.vertices[I*8+5]=z+rt.height*r,V.vertices[I*8+6]=G,V.vertices[I*8+7]=z+rt.height*r,V.uvs[I*8+0]=R.x0,V.uvs[I*8+1]=R.y0,V.uvs[I*8+2]=R.x1,V.uvs[I*8+3]=R.y1,V.uvs[I*8+4]=R.x2,V.uvs[I*8+5]=R.y2,V.uvs[I*8+6]=R.x3,V.uvs[I*8+7]=R.y3}this._textWidth=m*r,this._textHeight=(n.y+e.lineHeight)*r;for(const F in B){const b=B[F];if(this.anchor.x!==0||this.anchor.y!==0){let $=0;const V=this._textWidth*this.anchor.x,rt=this._textHeight*this.anchor.y;for(let R=0;R<b.total;R++)b.vertices[$++]-=V,b.vertices[$++]-=rt,b.vertices[$++]-=V,b.vertices[$++]-=rt,b.vertices[$++]-=V,b.vertices[$++]-=rt,b.vertices[$++]-=V,b.vertices[$++]-=rt}this._maxLineHeight=y*r;const S=b.mesh.geometry.getBuffer("aVertexPosition"),G=b.mesh.geometry.getBuffer("aTextureCoord"),z=b.mesh.geometry.getIndex();S.data=b.vertices,G.data=b.uvs,z.data=b.indices,S.update(),G.update(),z.update()}for(let F=0;F<a.length;F++)eo.push(a[F]);this._font=e,this.dirty=!1}updateTransform(){this.validate(),this.containerUpdateTransform()}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0);const{distanceFieldRange:e,distanceFieldType:s,size:r}=oe.available[this._fontName];if(s!=="none"){const{a:n,b:a,c:o,d:h}=this.worldTransform,l=Math.sqrt(n*n+a*a),u=Math.sqrt(o*o+h*h),c=(Math.abs(l)+Math.abs(u))/2,d=this.fontSize/r,f=t._view.resolution;for(const p of this._activePagesMeshData)p.mesh.shader.uniforms.uFWidth=c*e*d*f}super._render(t)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const t=oe.available[this._fontName];if(!t)throw new Error(`Missing BitmapFont "${this._fontName}"`);this._font!==t&&(this.dirty=!0),this.dirty&&this.updateText()}get tint(){return this._tintColor.value}set tint(t){if(this.tint!==t){this._tintColor.setValue(t);for(let e=0;e<this._activePagesMeshData.length;e++)this._activePagesMeshData[e].mesh.tint=t}}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.dirty=!0)}get fontName(){return this._fontName}set fontName(t){if(!oe.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){var t;return(t=this._fontSize)!=null?t:oe.available[this._fontName].size}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.dirty=!0)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get text(){return this._text}set text(t){t=String(t==null?"":t),this._text!==t&&(this._text=t,this.dirty=!0)}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth!==t&&(this._maxWidth=t,this.dirty=!0)}get maxLineHeight(){return this.validate(),this._maxLineHeight}get textWidth(){return this.validate(),this._textWidth}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.dirty=!0)}get roundPixels(){return this._roundPixels}set roundPixels(t){t!==this._roundPixels&&(this._roundPixels=t,this.dirty=!0)}get textHeight(){return this.validate(),this._textHeight}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}destroy(t){const{_textureCache:e}=this,s=oe.available[this._fontName].distanceFieldType==="none"?Ja:to;s.push(...this._activePagesMeshData);for(const r of this._activePagesMeshData)this.removeChild(r.mesh);this._activePagesMeshData=[],s.filter(r=>e[r.mesh.texture.baseTexture.uid]).forEach(r=>{r.mesh.texture=O.EMPTY});for(const r in e)e[r].destroy(),delete e[r];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};$h.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let Km=$h;const _m=[".xml",".fnt"],vm={extension:{type:C.LoadParser,priority:Ut.Normal},name:"loadBitmapFont",test(i){return _m.includes(lt.extname(i).toLowerCase())},async testParse(i){return ni.test(i)||sn.test(i)},async parse(i,t,e){const s=ni.test(i)?ni.parse(i):sn.parse(i),{src:r}=t,{page:n}=s,a=[];for(let l=0;l<n.length;++l){const u=n[l].file;let c=lt.join(lt.dirname(r),u);c=zr(c,r),a.push(c)}const o=await e.load(a),h=a.map(l=>o[l]);return oe.install(s,h,!0)},async load(i,t){return(await D.ADAPTER.fetch(i)).text()},unload(i){i.destroy()}};N.add(vm);var ym=Object.defineProperty,xm=Object.defineProperties,bm=Object.getOwnPropertyDescriptors,so=Object.getOwnPropertySymbols,Tm=Object.prototype.hasOwnProperty,Em=Object.prototype.propertyIsEnumerable,io=(i,t,e)=>t in i?ym(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Am=(i,t)=>{for(var e in t||(t={}))Tm.call(t,e)&&io(i,e,t[e]);if(so)for(var e of so(t))Em.call(t,e)&&io(i,e,t[e]);return i},wm=(i,t)=>xm(i,bm(t));const rn=class $e extends ge{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new $e(Object.keys($e.defaultOptions).reduce((e,s)=>wm(Am({},e),{[s]:t[s]}),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach(t=>{URL.revokeObjectURL(t.src),t.refs--,t.refs===0&&(t.fontFace&&document.fonts.delete(t.fontFace),delete $e.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:s}=$e;if(s[t]){const r=s[t];return this._fonts.push(r),r.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return D.ADAPTER.fetch(t).then(r=>r.blob()).then(async r=>new Promise((n,a)=>{const o=URL.createObjectURL(r),h=new FileReader;h.onload=()=>n([o,h.result]),h.onerror=a,h.readAsDataURL(r)})).then(async([r,n])=>{const a=Object.assign({family:lt.basename(t,lt.extname(t)),weight:"normal",style:"normal",display:"auto",src:r,dataSrc:n,refs:1,originalUrl:t,fontFace:null},e);s[t]=a,this._fonts.push(a),this.styleID++;const o=new FontFace(a.family,`url(${a.src})`,{weight:a.weight,style:a.style,display:a.display});a.fontFace=o,await o.load(),document.fonts.add(o),await document.fonts.ready,this.styleID++,this.fontsDirty=!0})}addOverride(...t){const e=t.filter(s=>!this._overrides.includes(s));e.length>0&&(this._overrides.push(...e),this.styleID++)}removeOverride(...t){const e=t.filter(s=>this._overrides.includes(s));e.length>0&&(this._overrides=this._overrides.filter(s=>!e.includes(s)),this.styleID++)}toCSS(t){return[`transform: scale(${t})`,"transform-origin: top left","display: inline-block",`color: ${this.normalizeColor(this.fill)}`,`font-size: ${this.fontSize}px`,`font-family: ${this.fontFamily}`,`font-weight: ${this.fontWeight}`,`font-style: ${this.fontStyle}`,`font-variant: ${this.fontVariant}`,`letter-spacing: ${this.letterSpacing}px`,`text-align: ${this.align}`,`padding: ${this.padding}px`,`white-space: ${this.whiteSpace}`,...this.lineHeight?[`line-height: ${this.lineHeight}px`]:[],...this.wordWrap?[`word-wrap: ${this.breakWords?"break-all":"break-word"}`,`max-width: ${this.wordWrapWidth}px`]:[],...this.strokeThickness?[`-webkit-text-stroke-width: ${this.strokeThickness}px`,`-webkit-text-stroke-color: ${this.normalizeColor(this.stroke)}`,`text-stroke-width: ${this.strokeThickness}px`,`text-stroke-color: ${this.normalizeColor(this.stroke)}`,"paint-order: stroke"]:[],...this.dropShadow?[this.dropShadowToCSS()]:[],...this._overrides].join(";")}toGlobalCSS(){return this._fonts.reduce((t,e)=>`${t}
|
|
1155
1155
|
@font-face {
|
|
1156
1156
|
font-family: "${e.family}";
|
|
1157
1157
|
src: url('${e.dataSrc}');
|
|
1158
1158
|
font-weight: ${e.weight};
|
|
1159
1159
|
font-style: ${e.style};
|
|
1160
1160
|
font-display: ${e.display};
|
|
1161
|
-
}`,this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(t){this._stylesheet!==t&&(this._stylesheet=t,this.styleID++)}normalizeColor(t){return Array.isArray(t)&&(t=vo(t)),typeof t=="number"?_o(t):t}dropShadowToCSS(){let t=this.normalizeColor(this.dropShadowColor);const e=this.dropShadowAlpha,s=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),r=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);t.startsWith("#")&&e<1&&(t+=(e*255|0).toString(16).padStart(2,"0"));const n=`${s}px ${r}px`;return this.dropShadowBlur>0?`text-shadow: ${n} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${n} ${t}`}reset(){Object.assign(this,$e.defaultOptions)}onBeforeDraw(){const{fontsDirty:t}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&t?new Promise(e=>setTimeout(e,100)):Promise.resolve()}get isSafari(){const{userAgent:t}=O.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}set fillGradientStops(t){console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText")}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(t){console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText")}get fillGradientType(){return super.fillGradientType}set miterLimit(t){console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText")}get miterLimit(){return super.miterLimit}set trim(t){console.warn("[HTMLTextStyle] trim is not supported by HTMLText")}get trim(){return super.trim}set textBaseline(t){console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText")}get textBaseline(){return super.textBaseline}set leading(t){console.warn("[HTMLTextStyle] leading is not supported by HTMLText")}get leading(){return super.leading}set lineJoin(t){console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText")}get lineJoin(){return super.lineJoin}};rn.availableFonts={},rn.defaultOptions={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,padding:0,stroke:"black",strokeThickness:0,whiteSpace:"normal",wordWrap:!1,wordWrapWidth:100};let or=rn;const ps=class He extends _e{constructor(t="",e={}){var s;super(D.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const r=new Image,n=D.from(r,{scaleMode:O.SCALE_MODE,resourceOptions:{autoLoad:!1}});n.orig=new j,n.trim=new j,this.texture=n;const a="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",h=document.createElementNS(a,"svg"),l=document.createElementNS(a,"foreignObject"),u=document.createElementNS(o,"div"),c=document.createElementNS(o,"style");l.setAttribute("width","10000"),l.setAttribute("height","10000"),l.style.overflow="hidden",h.appendChild(l),this.maxWidth=He.defaultMaxWidth,this.maxHeight=He.defaultMaxHeight,this._domElement=u,this._styleElement=c,this._svgRoot=h,this._foreignObject=l,this._foreignObject.appendChild(c),this._foreignObject.appendChild(u),this._image=r,this._loadImage=new Image,this._autoResolution=He.defaultAutoResolution,this._resolution=(s=He.defaultResolution)!=null?s:O.RESOLUTION,this.text=t,this.style=e}measureText(t){var e,s;const{text:r,style:n,resolution:a}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:r,style:n.toCSS(a)}),this._styleElement.textContent=n.toGlobalCSS(),document.body.appendChild(this._svgRoot);const o=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:h,height:l}=o,u=Math.min(this.maxWidth,Math.ceil(h)),c=Math.min(this.maxHeight,Math.ceil(l));return this._svgRoot.setAttribute("width",u.toString()),this._svgRoot.setAttribute("height",c.toString()),r!==this._text&&(this._domElement.innerHTML=this._text),n!==this._style&&(Object.assign(this._domElement,{style:(e=this._style)==null?void 0:e.toCSS(a)}),this._styleElement.textContent=(s=this._style)==null?void 0:s.toGlobalCSS()),{width:u+n.padding*2,height:c+n.padding*2}}async updateText(t=!0){const{style:e,_image:s,_loadImage:r}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;const{width:n,height:a}=this.measureText();s.width=r.width=Math.ceil(Math.max(1,n)),s.height=r.height=Math.ceil(Math.max(1,a)),this._updateID++;const o=this._updateID;await new Promise(h=>{r.onload=async()=>{if(o<this._updateID){h();return}await e.onBeforeDraw(),s.src=r.src,r.onload=null,r.src="",this.updateTexture(),h()};const l=new XMLSerializer().serializeToString(this._svgRoot);r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(l)}`})}get source(){return this._image}updateTexture(){const{style:t,texture:e,_image:s,resolution:r}=this,{padding:n}=t,{baseTexture:a}=e;e.trim.width=e._frame.width=s.width/r,e.trim.height=e._frame.height=s.height/r,e.trim.x=-n,e.trim.y=-n,e.orig.width=e._frame.width-n*2,e.orig.height=e._frame.height-n*2,this._onTextureUpdate(),a.setRealSize(s.width,s.height,r),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}_renderCanvas(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(t)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds(t)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(t){var e,s,r,n,a;typeof t=="boolean"&&(t={children:t}),t=Object.assign({},He.defaultDestroyOptions,t),super.destroy(t);const o=null;this.ownsStyle&&((e=this._style)==null||e.cleanFonts()),this._style=o,(s=this._svgRoot)==null||s.remove(),this._svgRoot=o,(r=this._domElement)==null||r.remove(),this._domElement=o,(n=this._foreignObject)==null||n.remove(),this._foreignObject=o,(a=this._styleElement)==null||a.remove(),this._styleElement=o,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=o,this._image.src="",this._image=o}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(t){this.updateText(!0);const e=se(this.scale.x)||1;this.scale.x=e*t/this._image.width/this.resolution,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._image.height/this.resolution}set height(t){this.updateText(!0);const e=se(this.scale.y)||1;this.scale.y=e*t/this._image.height/this.resolution,this._height=t}get style(){return this._style}set style(t){this._style!==t&&(t=t||{},t instanceof or?(this.ownsStyle=!1,this._style=t):t instanceof ge?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=or.from(t)):(this.ownsStyle=!0,this._style=new or(t)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(t){t=String(t===""||t===null||t===void 0?" ":t),t=this.sanitiseText(t),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}sanitiseText(t){return t.replace(/<br>/gi,"<br/>").replace(/<hr>/gi,"<hr/>").replace(/ /gi," ")}};ps.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},ps.defaultMaxWidth=2024,ps.defaultMaxHeight=2024,ps.defaultAutoResolution=!0;let Ym=ps;export{bt as ALPHA_MODES,oh as AbstractMultiResource,dh as AccessibilityManager,Wc as AlphaFilter,tn as AnimatedSprite,Id as Application,Uc as ArrayResource,Xs as Assets,Bf as AssetsClass,hi as Attribute,H as BLEND_MODES,hr as BUFFER_BITS,Yt as BUFFER_TYPE,ui as BackgroundSystem,pe as BaseImageResource,Jr as BasePrepare,Oo as BaseRenderTexture,X as BaseTexture,Sr as BatchDrawCall,So as BatchGeometry,we as BatchRenderer,Vu as BatchShaderGenerator,Do as BatchSystem,Pr as BatchTextureArray,oe as BitmapFont,yi as BitmapFontData,Wm as BitmapText,jf as BlobResource,Jc as BlurFilter,Gr as BlurFilterPass,pi as Bounds,Xh as BrowserAdapter,nt as Buffer,wi as BufferResource,nh as BufferSystem,Xt as CLEAR_MODES,Vh as COLOR_MASK_BITS,Ie as Cache,kc as CanvasResource,ln as Circle,K as Color,$r as ColorMatrixFilter,Ce as CompressedTextureResource,Mt as Container,ci as ContextSystem,Vp as CountLimiter,Gc as CubeResource,Cu as DEG_TO_RAD,zt as DRAW_MODES,id as DisplacementFilter,it as DisplayObject,De as ENV,un as Ellipse,dd as EventBoundary,Xr as EventSystem,C as ExtensionType,Rp as Extract,A as FORMATS,up as FORMATS_TO_COMPONENTS,ad as FXAAFilter,yd as FederatedDisplayObject,Is as FederatedEvent,mi as FederatedMouseEvent,Ft as FederatedPointerEvent,qe as FederatedWheelEvent,Pi as FillStyle,xt as Filter,Zu as FilterState,Uo as FilterSystem,Dr as Framebuffer,ko as FramebufferSystem,nn as GC_MODES,Qu as GLFramebuffer,lc as GLProgram,Ki as GLTexture,Gm as GRAPHICS_CURVES,Wo as GenerateTextureSystem,fe as Geometry,Go as GeometrySystem,Th as Graphics,vi as GraphicsData,Mp as GraphicsGeometry,Ym as HTMLText,or as HTMLTextStyle,Bm as IGLUniformData,Ar as INSTALLED,At as INTERNAL_FORMATS,_i as INTERNAL_FORMAT_TO_BYTES_PER_PIXEL,Xe as ImageBitmapResource,Bo as ImageResource,ce as LINE_CAP,St as LINE_JOIN,_n as LineStyle,Ut as LoaderParserPriority,ut as MASK_TYPES,Kt as MIPMAP_MODES,ht as MSAA_QUALITY,ic as MaskData,$o as MaskSystem,tt as Matrix,Es as Mesh,Dp as MeshBatchUvs,Mi as MeshGeometry,As as MeshMaterial,rh as MultisampleSystem,Hm as NineSlicePlane,hd as NoiseFilter,Si as ObjectRenderer,ah as ObjectRendererSystem,ue as ObservablePoint,li as PI_2,It as PRECISION,jm as ParticleContainer,wh as ParticleRenderer,Fp as PlaneGeometry,jo as PluginSystem,q as Point,We as Polygon,Dh as Prepare,ie as Program,zo as ProjectionSystem,Ku as Quad,Lo as QuadUv,Ru as RAD_TO_DEG,ro as RENDERER_TYPE,j as Rectangle,Oe as RenderTexture,No as RenderTexturePool,Yo as RenderTextureSystem,pn as Renderer,ph as ResizePlugin,bs as Resource,Np as RopeGeometry,cn as RoundedRectangle,Pt as Runner,P as SAMPLER_TYPES,ee as SCALE_MODES,mt as SHAPES,Nr as SVGResource,rc as ScissorSystem,qt as Shader,Ko as ShaderSystem,Vm as SimpleMesh,Lp as SimplePlane,Xm as SimpleRope,_e as Sprite,sc as SpriteMaskFilter,Za as Spritesheet,di as StartupSystem,ne as State,Sc as StateSystem,Xo as StencilSystem,Ic as SystemManager,je as TARGETS,Di as TEXT_GRADIENT,k as TYPES,$a as TYPES_TO_BYTES_PER_COMPONENT,cp as TYPES_TO_BYTES_PER_PIXEL,$c as TemporaryDisplayObject,Rh as Text,ni as TextFormat,he as TextMetrics,ge as TextStyle,D as Texture,Se as TextureGCSystem,fn as TextureMatrix,Qo as TextureSystem,Fo as TextureUvs,gt as Ticker,eh as TickerPlugin,Oh as TilingSprite,Bh as TilingSpriteRenderer,zm as TimeLimiter,dn as Transform,Fm as TransformFeedback,Jo as TransformFeedbackSystem,me as UPDATE_PRIORITY,Lt as UniformGroup,Nm as VERSION,lh as VideoResource,fi as ViewSystem,Er as ViewableBuffer,re as WRAP_MODES,en as XMLFormat,sn as XMLStringFormat,xd as accessibleTarget,nm as autoDetectFormat,Oc as autoDetectRenderer,wo as autoDetectResource,Ff as cacheTextureArray,Ze as checkDataUrl,ve as checkExtension,_u as checkMaxIfStatementsInShader,Nt as convertToList,zr as copySearchParams,Cd as createStringVariations,Rs as createTexture,mc as createUBOElements,Me as curves,ih as defaultFilterVertex,Nc as defaultVertex,Nf as detectAvif,Xf as detectCompressedTextures,Uf as detectDefaults,$f as detectMp4,Hf as detectOgv,Gf as detectWebm,Lf as detectWebp,N as extensions,fa as filters,dc as generateProgram,_c as generateUniformBufferSync,sf as getFontFamilyName,Nu as getTestContext,gc as getUBOData,$m as graphicsUtils,et as groupD8,Wt as isMobile,gi as isSingleItem,mm as loadBitmapFont,xp as loadDDS,pf as loadImageBitmap,$d as loadJson,wp as loadKTX,bf as loadSVG,Ii as loadTextures,Xd as loadTxt,If as loadVideo,rf as loadWebFont,hp as parseDDS,dp as parseKTX,Sp as resolveCompressedTextureUrl,Vf as resolveTextureUrl,O as settings,rm as spritesheetAsset,Ye as uniformParsers,Gu as unsafeEvalSupported,Dm as utils};
|
|
1161
|
+
}`,this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(t){this._stylesheet!==t&&(this._stylesheet=t,this.styleID++)}normalizeColor(t){return Array.isArray(t)&&(t=vo(t)),typeof t=="number"?_o(t):t}dropShadowToCSS(){let t=this.normalizeColor(this.dropShadowColor);const e=this.dropShadowAlpha,s=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),r=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);t.startsWith("#")&&e<1&&(t+=(e*255|0).toString(16).padStart(2,"0"));const n=`${s}px ${r}px`;return this.dropShadowBlur>0?`text-shadow: ${n} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${n} ${t}`}reset(){Object.assign(this,$e.defaultOptions)}onBeforeDraw(){const{fontsDirty:t}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&t?new Promise(e=>setTimeout(e,100)):Promise.resolve()}get isSafari(){const{userAgent:t}=D.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}set fillGradientStops(t){console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText")}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(t){console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText")}get fillGradientType(){return super.fillGradientType}set miterLimit(t){console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText")}get miterLimit(){return super.miterLimit}set trim(t){console.warn("[HTMLTextStyle] trim is not supported by HTMLText")}get trim(){return super.trim}set textBaseline(t){console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText")}get textBaseline(){return super.textBaseline}set leading(t){console.warn("[HTMLTextStyle] leading is not supported by HTMLText")}get leading(){return super.leading}set lineJoin(t){console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText")}get lineJoin(){return super.lineJoin}};rn.availableFonts={},rn.defaultOptions={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,padding:0,stroke:"black",strokeThickness:0,whiteSpace:"normal",wordWrap:!1,wordWrapWidth:100};let or=rn;const ps=class He extends _e{constructor(t="",e={}){var s;super(O.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const r=new Image,n=O.from(r,{scaleMode:D.SCALE_MODE,resourceOptions:{autoLoad:!1}});n.orig=new j,n.trim=new j,this.texture=n;const a="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",h=document.createElementNS(a,"svg"),l=document.createElementNS(a,"foreignObject"),u=document.createElementNS(o,"div"),c=document.createElementNS(o,"style");l.setAttribute("width","10000"),l.setAttribute("height","10000"),l.style.overflow="hidden",h.appendChild(l),this.maxWidth=He.defaultMaxWidth,this.maxHeight=He.defaultMaxHeight,this._domElement=u,this._styleElement=c,this._svgRoot=h,this._foreignObject=l,this._foreignObject.appendChild(c),this._foreignObject.appendChild(u),this._image=r,this._loadImage=new Image,this._autoResolution=He.defaultAutoResolution,this._resolution=(s=He.defaultResolution)!=null?s:D.RESOLUTION,this.text=t,this.style=e}measureText(t){var e,s;const{text:r,style:n,resolution:a}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:r,style:n.toCSS(a)}),this._styleElement.textContent=n.toGlobalCSS(),document.body.appendChild(this._svgRoot);const o=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:h,height:l}=o,u=Math.min(this.maxWidth,Math.ceil(h)),c=Math.min(this.maxHeight,Math.ceil(l));return this._svgRoot.setAttribute("width",u.toString()),this._svgRoot.setAttribute("height",c.toString()),r!==this._text&&(this._domElement.innerHTML=this._text),n!==this._style&&(Object.assign(this._domElement,{style:(e=this._style)==null?void 0:e.toCSS(a)}),this._styleElement.textContent=(s=this._style)==null?void 0:s.toGlobalCSS()),{width:u+n.padding*2,height:c+n.padding*2}}async updateText(t=!0){const{style:e,_image:s,_loadImage:r}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;const{width:n,height:a}=this.measureText();s.width=r.width=Math.ceil(Math.max(1,n)),s.height=r.height=Math.ceil(Math.max(1,a)),this._updateID++;const o=this._updateID;await new Promise(h=>{r.onload=async()=>{if(o<this._updateID){h();return}await e.onBeforeDraw(),s.src=r.src,r.onload=null,r.src="",this.updateTexture(),h()};const l=new XMLSerializer().serializeToString(this._svgRoot);r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(l)}`})}get source(){return this._image}updateTexture(){const{style:t,texture:e,_image:s,resolution:r}=this,{padding:n}=t,{baseTexture:a}=e;e.trim.width=e._frame.width=s.width/r,e.trim.height=e._frame.height=s.height/r,e.trim.x=-n,e.trim.y=-n,e.orig.width=e._frame.width-n*2,e.orig.height=e._frame.height-n*2,this._onTextureUpdate(),a.setRealSize(s.width,s.height,r),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}_renderCanvas(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(t)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds(t)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(t){var e,s,r,n,a;typeof t=="boolean"&&(t={children:t}),t=Object.assign({},He.defaultDestroyOptions,t),super.destroy(t);const o=null;this.ownsStyle&&((e=this._style)==null||e.cleanFonts()),this._style=o,(s=this._svgRoot)==null||s.remove(),this._svgRoot=o,(r=this._domElement)==null||r.remove(),this._domElement=o,(n=this._foreignObject)==null||n.remove(),this._foreignObject=o,(a=this._styleElement)==null||a.remove(),this._styleElement=o,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=o,this._image.src="",this._image=o}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(t){this.updateText(!0);const e=se(this.scale.x)||1;this.scale.x=e*t/this._image.width/this.resolution,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._image.height/this.resolution}set height(t){this.updateText(!0);const e=se(this.scale.y)||1;this.scale.y=e*t/this._image.height/this.resolution,this._height=t}get style(){return this._style}set style(t){this._style!==t&&(t=t||{},t instanceof or?(this.ownsStyle=!1,this._style=t):t instanceof ge?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=or.from(t)):(this.ownsStyle=!0,this._style=new or(t)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(t){t=String(t===""||t===null||t===void 0?" ":t),t=this.sanitiseText(t),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}sanitiseText(t){return t.replace(/<br>/gi,"<br/>").replace(/<hr>/gi,"<hr/>").replace(/ /gi," ")}};ps.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},ps.defaultMaxWidth=2024,ps.defaultMaxHeight=2024,ps.defaultAutoResolution=!0;let Zm=ps;export{bt as ALPHA_MODES,oh as AbstractMultiResource,dh as AccessibilityManager,Yc as AlphaFilter,tn as AnimatedSprite,Rd as Application,kc as ArrayResource,Xs as Assets,Lf as AssetsClass,hi as Attribute,H as BLEND_MODES,hr as BUFFER_BITS,Yt as BUFFER_TYPE,ui as BackgroundSystem,pe as BaseImageResource,Jr as BasePrepare,Oo as BaseRenderTexture,X as BaseTexture,Sr as BatchDrawCall,So as BatchGeometry,we as BatchRenderer,Xu as BatchShaderGenerator,Do as BatchSystem,Pr as BatchTextureArray,oe as BitmapFont,yi as BitmapFontData,Km as BitmapText,Yf as BlobResource,td as BlurFilter,Gr as BlurFilterPass,pi as Bounds,jh as BrowserAdapter,nt as Buffer,wi as BufferResource,nh as BufferSystem,Xt as CLEAR_MODES,Xh as COLOR_MASK_BITS,Ie as Cache,Gc as CanvasResource,ln as Circle,K as Color,$r as ColorMatrixFilter,Ce as CompressedTextureResource,Mt as Container,ci as ContextSystem,zp as CountLimiter,$c as CubeResource,Pu as DEG_TO_RAD,zt as DRAW_MODES,rd as DisplacementFilter,it as DisplayObject,De as ENV,un as Ellipse,fd as EventBoundary,Xr as EventSystem,C as ExtensionType,Mp as Extract,E as FORMATS,fp as FORMATS_TO_COMPONENTS,od as FXAAFilter,xd as FederatedDisplayObject,Is as FederatedEvent,mi as FederatedMouseEvent,Ft as FederatedPointerEvent,qe as FederatedWheelEvent,Pi as FillStyle,xt as Filter,Qu as FilterState,Uo as FilterSystem,Dr as Framebuffer,ko as FramebufferSystem,nn as GC_MODES,Ju as GLFramebuffer,uc as GLProgram,Ki as GLTexture,Vm as GRAPHICS_CURVES,Wo as GenerateTextureSystem,fe as Geometry,Go as GeometrySystem,Eh as Graphics,vi as GraphicsData,Bp as GraphicsGeometry,Zm as HTMLText,or as HTMLTextStyle,Lm as IGLUniformData,Ar as INSTALLED,At as INTERNAL_FORMATS,_i as INTERNAL_FORMAT_TO_BYTES_PER_PIXEL,Xe as ImageBitmapResource,Bo as ImageResource,ce as LINE_CAP,St as LINE_JOIN,_n as LineStyle,Ut as LoaderParserPriority,ct as MASK_TYPES,Kt as MIPMAP_MODES,ht as MSAA_QUALITY,rc as MaskData,$o as MaskSystem,tt as Matrix,Es as Mesh,Fp as MeshBatchUvs,Mi as MeshGeometry,As as MeshMaterial,rh as MultisampleSystem,jm as NineSlicePlane,ld as NoiseFilter,Si as ObjectRenderer,ah as ObjectRendererSystem,ue as ObservablePoint,li as PI_2,It as PRECISION,Ym as ParticleContainer,Sh as ParticleRenderer,Up as PlaneGeometry,jo as PluginSystem,q as Point,We as Polygon,Oh as Prepare,ie as Program,zo as ProjectionSystem,Zu as Quad,Lo as QuadUv,Cu as RAD_TO_DEG,ro as RENDERER_TYPE,j as Rectangle,Oe as RenderTexture,No as RenderTexturePool,Yo as RenderTextureSystem,pn as Renderer,ph as ResizePlugin,bs as Resource,kp as RopeGeometry,cn as RoundedRectangle,Pt as Runner,M as SAMPLER_TYPES,ee as SCALE_MODES,gt as SHAPES,Nr as SVGResource,nc as ScissorSystem,qt as Shader,Ko as ShaderSystem,zm as SimpleMesh,Gp as SimplePlane,Wm as SimpleRope,_e as Sprite,ic as SpriteMaskFilter,Za as Spritesheet,di as StartupSystem,ne as State,Ic as StateSystem,Xo as StencilSystem,Rc as SystemManager,je as TARGETS,Di as TEXT_GRADIENT,U as TYPES,$a as TYPES_TO_BYTES_PER_COMPONENT,pp as TYPES_TO_BYTES_PER_PIXEL,Hc as TemporaryDisplayObject,Ch as Text,ni as TextFormat,he as TextMetrics,ge as TextStyle,O as Texture,Se as TextureGCSystem,fn as TextureMatrix,Qo as TextureSystem,Fo as TextureUvs,_t as Ticker,eh as TickerPlugin,Bh as TilingSprite,Fh as TilingSpriteRenderer,qm as TimeLimiter,dn as Transform,Um as TransformFeedback,Jo as TransformFeedbackSystem,me as UPDATE_PRIORITY,Lt as UniformGroup,km as VERSION,lh as VideoResource,fi as ViewSystem,Er as ViewableBuffer,re as WRAP_MODES,en as XMLFormat,sn as XMLStringFormat,bd as accessibleTarget,hm as autoDetectFormat,Bc as autoDetectRenderer,wo as autoDetectResource,Uf as cacheTextureArray,Ze as checkDataUrl,ve as checkExtension,vu as checkMaxIfStatementsInShader,Nt as convertToList,zr as copySearchParams,Pd as createStringVariations,Rs as createTexture,gc as createUBOElements,Me as curves,ih as defaultFilterVertex,Lc as defaultVertex,kf as detectAvif,Wf as detectCompressedTextures,$f as detectDefaults,Xf as detectMp4,jf as detectOgv,Vf as detectWebm,Gf as detectWebp,N as extensions,fa as filters,fc as generateProgram,vc as generateUniformBufferSync,rf as getFontFamilyName,Lu as getTestContext,_c as getUBOData,Xm as graphicsUtils,et as groupD8,Wt as isMobile,gi as isSingleItem,vm as loadBitmapFont,Ep as loadDDS,_f as loadImageBitmap,Hd as loadJson,Rp as loadKTX,Af as loadSVG,Ii as loadTextures,jd as loadTxt,Pf as loadVideo,of as loadWebFont,cp as parseDDS,mp as parseKTX,Cp as resolveCompressedTextureUrl,zf as resolveTextureUrl,D as settings,om as spritesheetAsset,Ye as uniformParsers,$u as unsafeEvalSupported,Fm as utils};
|
|
1162
1162
|
//# sourceMappingURL=pixi.min.mjs.map
|