lyb-pixi-js 1.4.1 → 1.4.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/lyb-pixi.js CHANGED
@@ -1,21 +1,21 @@
1
- (function(Ns){typeof define=="function"&&define.amd?define(Ns):Ns()})(function(){"use strict";var Ns=(i=>(i[i.WEBGL_LEGACY=0]="WEBGL_LEGACY",i[i.WEBGL=1]="WEBGL",i[i.WEBGL2=2]="WEBGL2",i))(Ns||{}),Ed=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.WEBGL=1]="WEBGL",i[i.CANVAS=2]="CANVAS",i))(Ed||{}),Cl=(i=>(i[i.COLOR=16384]="COLOR",i[i.DEPTH=256]="DEPTH",i[i.STENCIL=1024]="STENCIL",i))(Cl||{}),W=(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))(W||{}),xs=(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))(xs||{}),G=(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))(G||{}),Wi=(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))(Wi||{}),tt=(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))(tt||{}),j=(i=>(i[i.FLOAT=0]="FLOAT",i[i.INT=1]="INT",i[i.UINT=2]="UINT",i))(j||{}),je=(i=>(i[i.NEAREST=0]="NEAREST",i[i.LINEAR=1]="LINEAR",i))(je||{}),Fr=(i=>(i[i.CLAMP=33071]="CLAMP",i[i.REPEAT=10497]="REPEAT",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i))(Fr||{}),vs=(i=>(i[i.OFF=0]="OFF",i[i.POW2=1]="POW2",i[i.ON=2]="ON",i[i.ON_MANUAL=3]="ON_MANUAL",i))(vs||{}),Re=(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))(Re||{}),Vs=(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))(Vs||{}),Il=(i=>(i[i.AUTO=0]="AUTO",i[i.MANUAL=1]="MANUAL",i))(Il||{}),os=(i=>(i.LOW="lowp",i.MEDIUM="mediump",i.HIGH="highp",i))(os||{}),ce=(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))(ce||{}),re=(i=>(i[i.NONE=0]="NONE",i[i.LOW=2]="LOW",i[i.MEDIUM=4]="MEDIUM",i[i.HIGH=8]="HIGH",i))(re||{}),Us=(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))(Us||{});const z={ADAPTER:{createCanvas:(i,t)=>{const e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")},RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var Pl=/iPhone/i,Td=/iPod/i,Ad=/iPad/i,Sd=/\biOS-universal(?:.+)Mac\b/i,Rl=/\bAndroid(?:.+)Mobile\b/i,Cd=/Android/i,zi=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Uo=/Silk/i,dr=/Windows Phone/i,Id=/\bWindows(?:.+)ARM\b/i,Pd=/BlackBerry/i,Rd=/BB10/i,Md=/Opera Mini/i,Fd=/\b(CriOS|Chrome)(?:.+)Mobile/i,kd=/Mobile(?:.+)Firefox\b/i,Bd=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"};function uy(i){return function(t){return t.test(i)}}function Dd(i){var t={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?t.userAgent=i:i&&i.userAgent&&(t={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var e=t.userAgent,s=e.split("[FBAN");typeof s[1]<"u"&&(e=s[0]),s=e.split("Twitter"),typeof s[1]<"u"&&(e=s[0]);var r=uy(e),n={apple:{phone:r(Pl)&&!r(dr),ipod:r(Td),tablet:!r(Pl)&&(r(Ad)||Bd(t))&&!r(dr),universal:r(Sd),device:(r(Pl)||r(Td)||r(Ad)||r(Sd)||Bd(t))&&!r(dr)},amazon:{phone:r(zi),tablet:!r(zi)&&r(Uo),device:r(zi)||r(Uo)},android:{phone:!r(dr)&&r(zi)||!r(dr)&&r(Rl),tablet:!r(dr)&&!r(zi)&&!r(Rl)&&(r(Uo)||r(Cd)),device:!r(dr)&&(r(zi)||r(Uo)||r(Rl)||r(Cd))||r(/\bokhttp\b/i)},windows:{phone:r(dr),tablet:r(Id),device:r(dr)||r(Id)},other:{blackberry:r(Pd),blackberry10:r(Rd),opera:r(Md),firefox:r(kd),chrome:r(Fd),device:r(Pd)||r(Rd)||r(Md)||r(kd)||r(Fd)},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}const dy=Dd.default??Dd,fr=dy(globalThis.navigator);z.RETINA_PREFIX=/@([0-9\.]+)x/,z.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Gs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Od(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function fy(i){if(i.__esModule)return i;var t=i.default;if(typeof t=="function"){var e=function s(){return this instanceof s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(i).forEach(function(s){var r=Object.getOwnPropertyDescriptor(i,s);Object.defineProperty(e,s,r.get?r:{enumerable:!0,get:function(){return i[s]}})}),e}var Ld={exports:{}};(function(i){var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function r(o,l,u){this.fn=o,this.context=l,this.once=u||!1}function n(o,l,u,c,d){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new r(u,c||o,d),p=e?e+l:l;return o._events[p]?o._events[p].fn?o._events[p]=[o._events[p],f]:o._events[p].push(f):(o._events[p]=f,o._eventsCount++),o}function a(o,l){--o._eventsCount===0?o._events=new s:delete o._events[l]}function h(){this._events=new s,this._eventsCount=0}h.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},h.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},h.prototype.listenerCount=function(l){var u=e?e+l:l,c=this._events[u];return c?c.fn?1:c.length:0},h.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],_=arguments.length,x,y;if(g.fn){switch(g.once&&this.removeListener(l,g.fn,void 0,!0),_){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(y=1,x=new Array(_-1);y<_;y++)x[y-1]=arguments[y];g.fn.apply(g.context,x)}else{var v=g.length,b;for(y=0;y<v;y++)switch(g[y].once&&this.removeListener(l,g[y].fn,void 0,!0),_){case 1:g[y].fn.call(g[y].context);break;case 2:g[y].fn.call(g[y].context,u);break;case 3:g[y].fn.call(g[y].context,u,c);break;case 4:g[y].fn.call(g[y].context,u,c,d);break;default:if(!x)for(b=1,x=new Array(_-1);b<_;b++)x[b-1]=arguments[b];g[y].fn.apply(g[y].context,x)}}return!0},h.prototype.on=function(l,u,c){return n(this,l,u,c,!1)},h.prototype.once=function(l,u,c){return n(this,l,u,c,!0)},h.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=[],_=p.length;m<_;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},h.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},h.prototype.off=h.prototype.removeListener,h.prototype.addListener=h.prototype.on,h.prefixed=e,h.EventEmitter=h,i.exports=h})(Ld);var py=Ld.exports;const Xs=Od(py);var Ml={exports:{}};Ml.exports=Go,Ml.exports.default=Go;function Go(i,t,e){e=e||2;var s=t&&t.length,r=s?t[0]*e:i.length,n=Nd(i,0,r,e,!0),a=[];if(!n||n.next===n.prev)return a;var h,o,l,u,c,d,f;if(s&&(n=xy(i,t,n,e)),i.length>80*e){h=l=i[0],o=u=i[1];for(var p=e;p<r;p+=e)c=i[p],d=i[p+1],c<h&&(h=c),d<o&&(o=d),c>l&&(l=c),d>u&&(u=d);f=Math.max(l-h,u-o),f=f!==0?32767/f:0}return Xn(n,a,e,h,o,f,0),a}function Nd(i,t,e,s,r){var n,a;if(r===Bl(i,t,e,s)>0)for(n=t;n<e;n+=s)a=Gd(n,i[n],i[n+1],a);else for(n=e-s;n>=t;n-=s)a=Gd(n,i[n],i[n+1],a);return a&&Xo(a,a.next)&&(Yn(a),a=a.next),a}function di(i,t){if(!i)return i;t||(t=i);var e=i,s;do if(s=!1,!e.steiner&&(Xo(e,e.next)||Lt(e.prev,e,e.next)===0)){if(Yn(e),e=t=e.prev,e===e.next)break;s=!0}else e=e.next;while(s||e!==t);return t}function Xn(i,t,e,s,r,n,a){if(i){!a&&n&&Ty(i,s,r,n);for(var h=i,o,l;i.prev!==i.next;){if(o=i.prev,l=i.next,n?gy(i,s,r,n):my(i)){t.push(o.i/e|0),t.push(i.i/e|0),t.push(l.i/e|0),Yn(i),i=l.next,h=l.next;continue}if(i=l,i===h){a?a===1?(i=_y(di(i),t,e),Xn(i,t,e,s,r,n,2)):a===2&&yy(i,t,e,s,r,n):Xn(di(i),t,e,s,r,n,1);break}}}}function my(i){var t=i.prev,e=i,s=i.next;if(Lt(t,e,s)>=0)return!1;for(var r=t.x,n=e.x,a=s.x,h=t.y,o=e.y,l=s.y,u=r<n?r<a?r:a:n<a?n:a,c=h<o?h<l?h:l:o<l?o:l,d=r>n?r>a?r:a:n>a?n:a,f=h>o?h>l?h:l:o>l?o:l,p=s.next;p!==t;){if(p.x>=u&&p.x<=d&&p.y>=c&&p.y<=f&&ji(r,h,n,o,a,l,p.x,p.y)&&Lt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function gy(i,t,e,s){var r=i.prev,n=i,a=i.next;if(Lt(r,n,a)>=0)return!1;for(var h=r.x,o=n.x,l=a.x,u=r.y,c=n.y,d=a.y,f=h<o?h<l?h:l:o<l?o:l,p=u<c?u<d?u:d:c<d?c:d,m=h>o?h>l?h:l:o>l?o:l,g=u>c?u>d?u:d:c>d?c:d,_=Fl(f,p,t,e,s),x=Fl(m,g,t,e,s),y=i.prevZ,v=i.nextZ;y&&y.z>=_&&v&&v.z<=x;){if(y.x>=f&&y.x<=m&&y.y>=p&&y.y<=g&&y!==r&&y!==a&&ji(h,u,o,c,l,d,y.x,y.y)&&Lt(y.prev,y,y.next)>=0||(y=y.prevZ,v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==r&&v!==a&&ji(h,u,o,c,l,d,v.x,v.y)&&Lt(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;y&&y.z>=_;){if(y.x>=f&&y.x<=m&&y.y>=p&&y.y<=g&&y!==r&&y!==a&&ji(h,u,o,c,l,d,y.x,y.y)&&Lt(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;v&&v.z<=x;){if(v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==r&&v!==a&&ji(h,u,o,c,l,d,v.x,v.y)&&Lt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function _y(i,t,e){var s=i;do{var r=s.prev,n=s.next.next;!Xo(r,n)&&Vd(r,s,s.next,n)&&$n(r,n)&&$n(n,r)&&(t.push(r.i/e|0),t.push(s.i/e|0),t.push(n.i/e|0),Yn(s),Yn(s.next),s=i=n),s=s.next}while(s!==i);return di(s)}function yy(i,t,e,s,r,n){var a=i;do{for(var h=a.next.next;h!==a.prev;){if(a.i!==h.i&&Cy(a,h)){var o=Ud(a,h);a=di(a,a.next),o=di(o,o.next),Xn(a,t,e,s,r,n,0),Xn(o,t,e,s,r,n,0);return}h=h.next}a=a.next}while(a!==i)}function xy(i,t,e,s){var r=[],n,a,h,o,l;for(n=0,a=t.length;n<a;n++)h=t[n]*s,o=n<a-1?t[n+1]*s:i.length,l=Nd(i,h,o,s,!1),l===l.next&&(l.steiner=!0),r.push(Sy(l));for(r.sort(vy),n=0;n<r.length;n++)e=by(r[n],e);return e}function vy(i,t){return i.x-t.x}function by(i,t){var e=wy(i,t);if(!e)return t;var s=Ud(e,i);return di(s,s.next),di(e,e.next)}function wy(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 h=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=s&&h>n&&(n=h,a=e.x<e.next.x?e:e.next,h===s))return a}e=e.next}while(e!==t);if(!a)return null;var o=a,l=a.x,u=a.y,c=1/0,d;e=a;do s>=e.x&&e.x>=l&&s!==e.x&&ji(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),$n(e,i)&&(d<c||d===c&&(e.x>a.x||e.x===a.x&&Ey(a,e)))&&(a=e,c=d)),e=e.next;while(e!==o);return a}function Ey(i,t){return Lt(i.prev,i,t.prev)<0&&Lt(t.next,i,i.next)<0}function Ty(i,t,e,s){var r=i;do r.z===0&&(r.z=Fl(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,Ay(r)}function Ay(i){var t,e,s,r,n,a,h,o,l=1;do{for(e=i,i=null,n=null,a=0;e;){for(a++,s=e,h=0,t=0;t<l&&(h++,s=s.nextZ,!!s);t++);for(o=l;h>0||o>0&&s;)h!==0&&(o===0||!s||e.z<=s.z)?(r=e,e=e.nextZ,h--):(r=s,s=s.nextZ,o--),n?n.nextZ=r:i=r,r.prevZ=n,n=r;e=s}n.nextZ=null,l*=2}while(a>1);return i}function Fl(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 Sy(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 ji(i,t,e,s,r,n,a,h){return(r-a)*(t-h)>=(i-a)*(n-h)&&(i-a)*(s-h)>=(e-a)*(t-h)&&(e-a)*(n-h)>=(r-a)*(s-h)}function Cy(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!Iy(i,t)&&($n(i,t)&&$n(t,i)&&Py(i,t)&&(Lt(i.prev,i,t.prev)||Lt(i,t.prev,t))||Xo(i,t)&&Lt(i.prev,i,i.next)>0&&Lt(t.prev,t,t.next)>0)}function Lt(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function Xo(i,t){return i.x===t.x&&i.y===t.y}function Vd(i,t,e,s){var r=Yo(Lt(i,t,e)),n=Yo(Lt(i,t,s)),a=Yo(Lt(e,s,i)),h=Yo(Lt(e,s,t));return!!(r!==n&&a!==h||r===0&&$o(i,e,t)||n===0&&$o(i,s,t)||a===0&&$o(e,i,s)||h===0&&$o(e,t,s))}function $o(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 Yo(i){return i>0?1:i<0?-1:0}function Iy(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&&Vd(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function $n(i,t){return Lt(i.prev,i,i.next)<0?Lt(i,t,i.next)>=0&&Lt(i,i.prev,t)>=0:Lt(i,t,i.prev)<0||Lt(i,i.next,t)<0}function Py(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 Ud(i,t){var e=new kl(i.i,i.x,i.y),s=new kl(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 Gd(i,t,e,s){var r=new kl(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 Yn(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 kl(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}Go.deviation=function(i,t,e,s){var r=t&&t.length,n=r?t[0]*e:i.length,a=Math.abs(Bl(i,0,n,e));if(r)for(var h=0,o=t.length;h<o;h++){var l=t[h]*e,u=h<o-1?t[h+1]*e:i.length;a-=Math.abs(Bl(i,l,u,e))}var c=0;for(h=0;h<s.length;h+=3){var d=s[h]*e,f=s[h+1]*e,p=s[h+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 Bl(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}Go.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 Ry=Ml.exports;const My=Od(Ry);var Ho={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */Ho.exports,function(i,t){(function(e){var s=t&&!t.nodeType&&t,r=i&&!i.nodeType&&i,n=typeof Gs=="object"&&Gs;(n.global===n||n.window===n||n.self===n)&&(e=n);var a,h=2147483647,o=36,l=1,u=26,c=38,d=700,f=72,p=128,m="-",g=/^xn--/,_=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=o-l,b=Math.floor,w=String.fromCharCode,E;function T(O){throw new RangeError(y[O])}function A(O,N){for(var Z=O.length,Q=[];Z--;)Q[Z]=N(O[Z]);return Q}function I(O,N){var Z=O.split("@"),Q="";Z.length>1&&(Q=Z[0]+"@",O=Z[1]),O=O.replace(x,".");var H=O.split("."),lt=A(H,N).join(".");return Q+lt}function M(O){for(var N=[],Z=0,Q=O.length,H,lt;Z<Q;)H=O.charCodeAt(Z++),H>=55296&&H<=56319&&Z<Q?(lt=O.charCodeAt(Z++),(lt&64512)==56320?N.push(((H&1023)<<10)+(lt&1023)+65536):(N.push(H),Z--)):N.push(H);return N}function R(O){return A(O,function(N){var Z="";return N>65535&&(N-=65536,Z+=w(N>>>10&1023|55296),N=56320|N&1023),Z+=w(N),Z}).join("")}function C(O){return O-48<10?O-22:O-65<26?O-65:O-97<26?O-97:o}function P(O,N){return O+22+75*(O<26)-((N!=0)<<5)}function k(O,N,Z){var Q=0;for(O=Z?b(O/d):O>>1,O+=b(O/N);O>v*u>>1;Q+=o)O=b(O/v);return b(Q+(v+1)*O/(O+c))}function U(O){var N=[],Z=O.length,Q,H=0,lt=p,Tt=f,_t,kt,zt,Qt,Pt,jt,Ot,ze,is;for(_t=O.lastIndexOf(m),_t<0&&(_t=0),kt=0;kt<_t;++kt)O.charCodeAt(kt)>=128&&T("not-basic"),N.push(O.charCodeAt(kt));for(zt=_t>0?_t+1:0;zt<Z;){for(Qt=H,Pt=1,jt=o;zt>=Z&&T("invalid-input"),Ot=C(O.charCodeAt(zt++)),(Ot>=o||Ot>b((h-H)/Pt))&&T("overflow"),H+=Ot*Pt,ze=jt<=Tt?l:jt>=Tt+u?u:jt-Tt,!(Ot<ze);jt+=o)is=o-ze,Pt>b(h/is)&&T("overflow"),Pt*=is;Q=N.length+1,Tt=k(H-Qt,Q,Qt==0),b(H/Q)>h-lt&&T("overflow"),lt+=b(H/Q),H%=Q,N.splice(H++,0,lt)}return R(N)}function V(O){var N,Z,Q,H,lt,Tt,_t,kt,zt,Qt,Pt,jt=[],Ot,ze,is,li;for(O=M(O),Ot=O.length,N=p,Z=0,lt=f,Tt=0;Tt<Ot;++Tt)Pt=O[Tt],Pt<128&&jt.push(w(Pt));for(Q=H=jt.length,H&&jt.push(m);Q<Ot;){for(_t=h,Tt=0;Tt<Ot;++Tt)Pt=O[Tt],Pt>=N&&Pt<_t&&(_t=Pt);for(ze=Q+1,_t-N>b((h-Z)/ze)&&T("overflow"),Z+=(_t-N)*ze,N=_t,Tt=0;Tt<Ot;++Tt)if(Pt=O[Tt],Pt<N&&++Z>h&&T("overflow"),Pt==N){for(kt=Z,zt=o;Qt=zt<=lt?l:zt>=lt+u?u:zt-lt,!(kt<Qt);zt+=o)li=kt-Qt,is=o-Qt,jt.push(w(P(Qt+li%is,0))),kt=b(li/is);jt.push(w(P(kt,0))),lt=k(Z,ze,Q==H),Z=0,++Q}++Z,++N}return jt.join("")}function L(O){return I(O,function(N){return g.test(N)?U(N.slice(4).toLowerCase()):N})}function $(O){return I(O,function(N){return _.test(N)?"xn--"+V(N):N})}if(a={version:"1.4.1",ucs2:{decode:M,encode:R},decode:U,encode:V,toASCII:$,toUnicode:L},s&&r)if(i.exports==s)r.exports=a;else for(E in a)a.hasOwnProperty(E)&&(s[E]=a[E]);else e.punycode=a})(Gs)}(Ho,Ho.exports);var Fy=Ho.exports,qi=TypeError;const ky=fy(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Dl=typeof Map=="function"&&Map.prototype,Ol=Object.getOwnPropertyDescriptor&&Dl?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Wo=Dl&&Ol&&typeof Ol.get=="function"?Ol.get:null,Xd=Dl&&Map.prototype.forEach,Ll=typeof Set=="function"&&Set.prototype,Nl=Object.getOwnPropertyDescriptor&&Ll?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,zo=Ll&&Nl&&typeof Nl.get=="function"?Nl.get:null,$d=Ll&&Set.prototype.forEach,By=typeof WeakMap=="function"&&WeakMap.prototype,Hn=By?WeakMap.prototype.has:null,Dy=typeof WeakSet=="function"&&WeakSet.prototype,Wn=Dy?WeakSet.prototype.has:null,Oy=typeof WeakRef=="function"&&WeakRef.prototype,Yd=Oy?WeakRef.prototype.deref:null,Ly=Boolean.prototype.valueOf,Ny=Object.prototype.toString,Vy=Function.prototype.toString,Uy=String.prototype.match,Vl=String.prototype.slice,kr=String.prototype.replace,Gy=String.prototype.toUpperCase,Hd=String.prototype.toLowerCase,Wd=RegExp.prototype.test,zd=Array.prototype.concat,$s=Array.prototype.join,Xy=Array.prototype.slice,jd=Math.floor,Ul=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Gl=Object.getOwnPropertySymbols,Xl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Zi=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Te=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Zi||"symbol")?Symbol.toStringTag:null,qd=Object.prototype.propertyIsEnumerable,Zd=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(i){return i.__proto__}:null);function Kd(i,t){if(i===1/0||i===-1/0||i!==i||i&&i>-1e3&&i<1e3||Wd.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof i=="number"){var s=i<0?-jd(-i):jd(i);if(s!==i){var r=String(s),n=Vl.call(t,r.length+1);return kr.call(r,e,"$&_")+"."+kr.call(kr.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return kr.call(t,e,"$&_")}var $l=ky,Qd=$l.custom,Jd=rf(Qd)?Qd:null,tf={__proto__:null,double:'"',single:"'"},$y={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},jo=function i(t,e,s,r){var n=e||{};if(pr(n,"quoteStyle")&&!pr(tf,n.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(pr(n,"maxStringLength")&&(typeof n.maxStringLength=="number"?n.maxStringLength<0&&n.maxStringLength!==1/0:n.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=pr(n,"customInspect")?n.customInspect:!0;if(typeof a!="boolean"&&a!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(pr(n,"indent")&&n.indent!==null&&n.indent!==" "&&!(parseInt(n.indent,10)===n.indent&&n.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(pr(n,"numericSeparator")&&typeof n.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var h=n.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return of(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var o=String(t);return h?Kd(t,o):o}if(typeof t=="bigint"){var l=String(t)+"n";return h?Kd(t,l):l}var u=typeof n.depth>"u"?5:n.depth;if(typeof s>"u"&&(s=0),s>=u&&u>0&&typeof t=="object")return Yl(t)?"[Array]":"[Object]";var c=ax(n,s);if(typeof r>"u")r=[];else if(nf(r,t)>=0)return"[Circular]";function d(C,P,k){if(P&&(r=Xy.call(r),r.push(P)),k){var U={depth:n.depth};return pr(n,"quoteStyle")&&(U.quoteStyle=n.quoteStyle),i(C,U,s+1,r)}return i(C,n,s+1,r)}if(typeof t=="function"&&!sf(t)){var f=Qy(t),p=qo(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+$s.call(p,", ")+" }":"")}if(rf(t)){var m=Zi?kr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Xl.call(t);return typeof t=="object"&&!Zi?zn(m):m}if(ix(t)){for(var g="<"+Hd.call(String(t.nodeName)),_=t.attributes||[],x=0;x<_.length;x++)g+=" "+_[x].name+"="+ef(Yy(_[x].value),"double",n);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+Hd.call(String(t.nodeName))+">",g}if(Yl(t)){if(t.length===0)return"[]";var y=qo(t,d);return c&&!ox(y)?"["+Wl(y,c)+"]":"[ "+$s.call(y,", ")+" ]"}if(Wy(t)){var v=qo(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!qd.call(t,"cause")?"{ ["+String(t)+"] "+$s.call(zd.call("[cause]: "+d(t.cause),v),", ")+" }":v.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+$s.call(v,", ")+" }"}if(typeof t=="object"&&a){if(Jd&&typeof t[Jd]=="function"&&$l)return $l(t,{depth:u-s});if(a!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(Jy(t)){var b=[];return Xd&&Xd.call(t,function(C,P){b.push(d(P,t,!0)+" => "+d(C,t))}),af("Map",Wo.call(t),b,c)}if(sx(t)){var w=[];return $d&&$d.call(t,function(C){w.push(d(C,t))}),af("Set",zo.call(t),w,c)}if(tx(t))return Hl("WeakMap");if(rx(t))return Hl("WeakSet");if(ex(t))return Hl("WeakRef");if(jy(t))return zn(d(Number(t)));if(Zy(t))return zn(d(Ul.call(t)));if(qy(t))return zn(Ly.call(t));if(zy(t))return zn(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof Gs<"u"&&t===Gs)return"{ [object globalThis] }";if(!Hy(t)&&!sf(t)){var E=qo(t,d),T=Zd?Zd(t)===Object.prototype:t instanceof Object||t.constructor===Object,A=t instanceof Object?"":"null prototype",I=!T&&Te&&Object(t)===t&&Te in t?Vl.call(Br(t),8,-1):A?"Object":"",M=T||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",R=M+(I||A?"["+$s.call(zd.call([],I||[],A||[]),": ")+"] ":"");return E.length===0?R+"{}":c?R+"{"+Wl(E,c)+"}":R+"{ "+$s.call(E,", ")+" }"}return String(t)};function ef(i,t,e){var s=e.quoteStyle||t,r=tf[s];return r+i+r}function Yy(i){return kr.call(String(i),/"/g,"&quot;")}function Yl(i){return Br(i)==="[object Array]"&&(!Te||!(typeof i=="object"&&Te in i))}function Hy(i){return Br(i)==="[object Date]"&&(!Te||!(typeof i=="object"&&Te in i))}function sf(i){return Br(i)==="[object RegExp]"&&(!Te||!(typeof i=="object"&&Te in i))}function Wy(i){return Br(i)==="[object Error]"&&(!Te||!(typeof i=="object"&&Te in i))}function zy(i){return Br(i)==="[object String]"&&(!Te||!(typeof i=="object"&&Te in i))}function jy(i){return Br(i)==="[object Number]"&&(!Te||!(typeof i=="object"&&Te in i))}function qy(i){return Br(i)==="[object Boolean]"&&(!Te||!(typeof i=="object"&&Te in i))}function rf(i){if(Zi)return i&&typeof i=="object"&&i instanceof Symbol;if(typeof i=="symbol")return!0;if(!i||typeof i!="object"||!Xl)return!1;try{return Xl.call(i),!0}catch{}return!1}function Zy(i){if(!i||typeof i!="object"||!Ul)return!1;try{return Ul.call(i),!0}catch{}return!1}var Ky=Object.prototype.hasOwnProperty||function(i){return i in this};function pr(i,t){return Ky.call(i,t)}function Br(i){return Ny.call(i)}function Qy(i){if(i.name)return i.name;var t=Uy.call(Vy.call(i),/^function\s*([\w$]+)/);return t?t[1]:null}function nf(i,t){if(i.indexOf)return i.indexOf(t);for(var e=0,s=i.length;e<s;e++)if(i[e]===t)return e;return-1}function Jy(i){if(!Wo||!i||typeof i!="object")return!1;try{Wo.call(i);try{zo.call(i)}catch{return!0}return i instanceof Map}catch{}return!1}function tx(i){if(!Hn||!i||typeof i!="object")return!1;try{Hn.call(i,Hn);try{Wn.call(i,Wn)}catch{return!0}return i instanceof WeakMap}catch{}return!1}function ex(i){if(!Yd||!i||typeof i!="object")return!1;try{return Yd.call(i),!0}catch{}return!1}function sx(i){if(!zo||!i||typeof i!="object")return!1;try{zo.call(i);try{Wo.call(i)}catch{return!0}return i instanceof Set}catch{}return!1}function rx(i){if(!Wn||!i||typeof i!="object")return!1;try{Wn.call(i,Wn);try{Hn.call(i,Hn)}catch{return!0}return i instanceof WeakSet}catch{}return!1}function ix(i){return!i||typeof i!="object"?!1:typeof HTMLElement<"u"&&i instanceof HTMLElement?!0:typeof i.nodeName=="string"&&typeof i.getAttribute=="function"}function of(i,t){if(i.length>t.maxStringLength){var e=i.length-t.maxStringLength,s="... "+e+" more character"+(e>1?"s":"");return of(Vl.call(i,0,t.maxStringLength),t)+s}var r=$y[t.quoteStyle||"single"];r.lastIndex=0;var n=kr.call(kr.call(i,r,"\\$1"),/[\x00-\x1f]/g,nx);return ef(n,"single",t)}function nx(i){var t=i.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+Gy.call(t.toString(16))}function zn(i){return"Object("+i+")"}function Hl(i){return i+" { ? }"}function af(i,t,e,s){var r=s?Wl(e,s):$s.call(e,", ");return i+" ("+t+") {"+r+"}"}function ox(i){for(var t=0;t<i.length;t++)if(nf(i[t],`
2
- `)>=0)return!1;return!0}function ax(i,t){var e;if(i.indent===" ")e=" ";else if(typeof i.indent=="number"&&i.indent>0)e=$s.call(Array(i.indent+1)," ");else return null;return{base:e,prev:$s.call(Array(t+1),e)}}function Wl(i,t){if(i.length===0)return"";var e=`
1
+ (function(Ns){typeof define=="function"&&define.amd?define(Ns):Ns()})(function(){"use strict";var Ns=(i=>(i[i.WEBGL_LEGACY=0]="WEBGL_LEGACY",i[i.WEBGL=1]="WEBGL",i[i.WEBGL2=2]="WEBGL2",i))(Ns||{}),vd=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.WEBGL=1]="WEBGL",i[i.CANVAS=2]="CANVAS",i))(vd||{}),Cl=(i=>(i[i.COLOR=16384]="COLOR",i[i.DEPTH=256]="DEPTH",i[i.STENCIL=1024]="STENCIL",i))(Cl||{}),W=(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))(W||{}),xs=(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))(xs||{}),G=(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))(G||{}),Wi=(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))(Wi||{}),tt=(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))(tt||{}),j=(i=>(i[i.FLOAT=0]="FLOAT",i[i.INT=1]="INT",i[i.UINT=2]="UINT",i))(j||{}),je=(i=>(i[i.NEAREST=0]="NEAREST",i[i.LINEAR=1]="LINEAR",i))(je||{}),Fr=(i=>(i[i.CLAMP=33071]="CLAMP",i[i.REPEAT=10497]="REPEAT",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i))(Fr||{}),vs=(i=>(i[i.OFF=0]="OFF",i[i.POW2=1]="POW2",i[i.ON=2]="ON",i[i.ON_MANUAL=3]="ON_MANUAL",i))(vs||{}),Re=(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))(Re||{}),Vs=(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))(Vs||{}),Il=(i=>(i[i.AUTO=0]="AUTO",i[i.MANUAL=1]="MANUAL",i))(Il||{}),os=(i=>(i.LOW="lowp",i.MEDIUM="mediump",i.HIGH="highp",i))(os||{}),ce=(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))(ce||{}),re=(i=>(i[i.NONE=0]="NONE",i[i.LOW=2]="LOW",i[i.MEDIUM=4]="MEDIUM",i[i.HIGH=8]="HIGH",i))(re||{}),Us=(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))(Us||{});const z={ADAPTER:{createCanvas:(i,t)=>{const e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")},RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var Pl=/iPhone/i,bd=/iPod/i,wd=/iPad/i,Ed=/\biOS-universal(?:.+)Mac\b/i,Rl=/\bAndroid(?:.+)Mobile\b/i,Td=/Android/i,zi=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Uo=/Silk/i,dr=/Windows Phone/i,Ad=/\bWindows(?:.+)ARM\b/i,Sd=/BlackBerry/i,Cd=/BB10/i,Id=/Opera Mini/i,Pd=/\b(CriOS|Chrome)(?:.+)Mobile/i,Rd=/Mobile(?:.+)Firefox\b/i,Md=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"};function oy(i){return function(t){return t.test(i)}}function Fd(i){var t={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?t.userAgent=i:i&&i.userAgent&&(t={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var e=t.userAgent,s=e.split("[FBAN");typeof s[1]<"u"&&(e=s[0]),s=e.split("Twitter"),typeof s[1]<"u"&&(e=s[0]);var r=oy(e),n={apple:{phone:r(Pl)&&!r(dr),ipod:r(bd),tablet:!r(Pl)&&(r(wd)||Md(t))&&!r(dr),universal:r(Ed),device:(r(Pl)||r(bd)||r(wd)||r(Ed)||Md(t))&&!r(dr)},amazon:{phone:r(zi),tablet:!r(zi)&&r(Uo),device:r(zi)||r(Uo)},android:{phone:!r(dr)&&r(zi)||!r(dr)&&r(Rl),tablet:!r(dr)&&!r(zi)&&!r(Rl)&&(r(Uo)||r(Td)),device:!r(dr)&&(r(zi)||r(Uo)||r(Rl)||r(Td))||r(/\bokhttp\b/i)},windows:{phone:r(dr),tablet:r(Ad),device:r(dr)||r(Ad)},other:{blackberry:r(Sd),blackberry10:r(Cd),opera:r(Id),firefox:r(Rd),chrome:r(Pd),device:r(Sd)||r(Cd)||r(Id)||r(Rd)||r(Pd)},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}const ay=Fd.default??Fd,fr=ay(globalThis.navigator);z.RETINA_PREFIX=/@([0-9\.]+)x/,z.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Gs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function kd(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function ly(i){if(i.__esModule)return i;var t=i.default;if(typeof t=="function"){var e=function s(){return this instanceof s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(i).forEach(function(s){var r=Object.getOwnPropertyDescriptor(i,s);Object.defineProperty(e,s,r.get?r:{enumerable:!0,get:function(){return i[s]}})}),e}var Bd={exports:{}};(function(i){var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function r(o,l,u){this.fn=o,this.context=l,this.once=u||!1}function n(o,l,u,c,d){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new r(u,c||o,d),p=e?e+l:l;return o._events[p]?o._events[p].fn?o._events[p]=[o._events[p],f]:o._events[p].push(f):(o._events[p]=f,o._eventsCount++),o}function a(o,l){--o._eventsCount===0?o._events=new s:delete o._events[l]}function h(){this._events=new s,this._eventsCount=0}h.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},h.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},h.prototype.listenerCount=function(l){var u=e?e+l:l,c=this._events[u];return c?c.fn?1:c.length:0},h.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],_=arguments.length,x,y;if(g.fn){switch(g.once&&this.removeListener(l,g.fn,void 0,!0),_){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(y=1,x=new Array(_-1);y<_;y++)x[y-1]=arguments[y];g.fn.apply(g.context,x)}else{var v=g.length,b;for(y=0;y<v;y++)switch(g[y].once&&this.removeListener(l,g[y].fn,void 0,!0),_){case 1:g[y].fn.call(g[y].context);break;case 2:g[y].fn.call(g[y].context,u);break;case 3:g[y].fn.call(g[y].context,u,c);break;case 4:g[y].fn.call(g[y].context,u,c,d);break;default:if(!x)for(b=1,x=new Array(_-1);b<_;b++)x[b-1]=arguments[b];g[y].fn.apply(g[y].context,x)}}return!0},h.prototype.on=function(l,u,c){return n(this,l,u,c,!1)},h.prototype.once=function(l,u,c){return n(this,l,u,c,!0)},h.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=[],_=p.length;m<_;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},h.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},h.prototype.off=h.prototype.removeListener,h.prototype.addListener=h.prototype.on,h.prefixed=e,h.EventEmitter=h,i.exports=h})(Bd);var hy=Bd.exports;const Xs=kd(hy);var Ml={exports:{}};Ml.exports=Go,Ml.exports.default=Go;function Go(i,t,e){e=e||2;var s=t&&t.length,r=s?t[0]*e:i.length,n=Dd(i,0,r,e,!0),a=[];if(!n||n.next===n.prev)return a;var h,o,l,u,c,d,f;if(s&&(n=py(i,t,n,e)),i.length>80*e){h=l=i[0],o=u=i[1];for(var p=e;p<r;p+=e)c=i[p],d=i[p+1],c<h&&(h=c),d<o&&(o=d),c>l&&(l=c),d>u&&(u=d);f=Math.max(l-h,u-o),f=f!==0?32767/f:0}return Xn(n,a,e,h,o,f,0),a}function Dd(i,t,e,s,r){var n,a;if(r===Bl(i,t,e,s)>0)for(n=t;n<e;n+=s)a=Nd(n,i[n],i[n+1],a);else for(n=e-s;n>=t;n-=s)a=Nd(n,i[n],i[n+1],a);return a&&Xo(a,a.next)&&(Yn(a),a=a.next),a}function di(i,t){if(!i)return i;t||(t=i);var e=i,s;do if(s=!1,!e.steiner&&(Xo(e,e.next)||Lt(e.prev,e,e.next)===0)){if(Yn(e),e=t=e.prev,e===e.next)break;s=!0}else e=e.next;while(s||e!==t);return t}function Xn(i,t,e,s,r,n,a){if(i){!a&&n&&xy(i,s,r,n);for(var h=i,o,l;i.prev!==i.next;){if(o=i.prev,l=i.next,n?uy(i,s,r,n):cy(i)){t.push(o.i/e|0),t.push(i.i/e|0),t.push(l.i/e|0),Yn(i),i=l.next,h=l.next;continue}if(i=l,i===h){a?a===1?(i=dy(di(i),t,e),Xn(i,t,e,s,r,n,2)):a===2&&fy(i,t,e,s,r,n):Xn(di(i),t,e,s,r,n,1);break}}}}function cy(i){var t=i.prev,e=i,s=i.next;if(Lt(t,e,s)>=0)return!1;for(var r=t.x,n=e.x,a=s.x,h=t.y,o=e.y,l=s.y,u=r<n?r<a?r:a:n<a?n:a,c=h<o?h<l?h:l:o<l?o:l,d=r>n?r>a?r:a:n>a?n:a,f=h>o?h>l?h:l:o>l?o:l,p=s.next;p!==t;){if(p.x>=u&&p.x<=d&&p.y>=c&&p.y<=f&&ji(r,h,n,o,a,l,p.x,p.y)&&Lt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function uy(i,t,e,s){var r=i.prev,n=i,a=i.next;if(Lt(r,n,a)>=0)return!1;for(var h=r.x,o=n.x,l=a.x,u=r.y,c=n.y,d=a.y,f=h<o?h<l?h:l:o<l?o:l,p=u<c?u<d?u:d:c<d?c:d,m=h>o?h>l?h:l:o>l?o:l,g=u>c?u>d?u:d:c>d?c:d,_=Fl(f,p,t,e,s),x=Fl(m,g,t,e,s),y=i.prevZ,v=i.nextZ;y&&y.z>=_&&v&&v.z<=x;){if(y.x>=f&&y.x<=m&&y.y>=p&&y.y<=g&&y!==r&&y!==a&&ji(h,u,o,c,l,d,y.x,y.y)&&Lt(y.prev,y,y.next)>=0||(y=y.prevZ,v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==r&&v!==a&&ji(h,u,o,c,l,d,v.x,v.y)&&Lt(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;y&&y.z>=_;){if(y.x>=f&&y.x<=m&&y.y>=p&&y.y<=g&&y!==r&&y!==a&&ji(h,u,o,c,l,d,y.x,y.y)&&Lt(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;v&&v.z<=x;){if(v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==r&&v!==a&&ji(h,u,o,c,l,d,v.x,v.y)&&Lt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function dy(i,t,e){var s=i;do{var r=s.prev,n=s.next.next;!Xo(r,n)&&Od(r,s,s.next,n)&&$n(r,n)&&$n(n,r)&&(t.push(r.i/e|0),t.push(s.i/e|0),t.push(n.i/e|0),Yn(s),Yn(s.next),s=i=n),s=s.next}while(s!==i);return di(s)}function fy(i,t,e,s,r,n){var a=i;do{for(var h=a.next.next;h!==a.prev;){if(a.i!==h.i&&wy(a,h)){var o=Ld(a,h);a=di(a,a.next),o=di(o,o.next),Xn(a,t,e,s,r,n,0),Xn(o,t,e,s,r,n,0);return}h=h.next}a=a.next}while(a!==i)}function py(i,t,e,s){var r=[],n,a,h,o,l;for(n=0,a=t.length;n<a;n++)h=t[n]*s,o=n<a-1?t[n+1]*s:i.length,l=Dd(i,h,o,s,!1),l===l.next&&(l.steiner=!0),r.push(by(l));for(r.sort(my),n=0;n<r.length;n++)e=gy(r[n],e);return e}function my(i,t){return i.x-t.x}function gy(i,t){var e=_y(i,t);if(!e)return t;var s=Ld(e,i);return di(s,s.next),di(e,e.next)}function _y(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 h=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=s&&h>n&&(n=h,a=e.x<e.next.x?e:e.next,h===s))return a}e=e.next}while(e!==t);if(!a)return null;var o=a,l=a.x,u=a.y,c=1/0,d;e=a;do s>=e.x&&e.x>=l&&s!==e.x&&ji(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),$n(e,i)&&(d<c||d===c&&(e.x>a.x||e.x===a.x&&yy(a,e)))&&(a=e,c=d)),e=e.next;while(e!==o);return a}function yy(i,t){return Lt(i.prev,i,t.prev)<0&&Lt(t.next,i,i.next)<0}function xy(i,t,e,s){var r=i;do r.z===0&&(r.z=Fl(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,vy(r)}function vy(i){var t,e,s,r,n,a,h,o,l=1;do{for(e=i,i=null,n=null,a=0;e;){for(a++,s=e,h=0,t=0;t<l&&(h++,s=s.nextZ,!!s);t++);for(o=l;h>0||o>0&&s;)h!==0&&(o===0||!s||e.z<=s.z)?(r=e,e=e.nextZ,h--):(r=s,s=s.nextZ,o--),n?n.nextZ=r:i=r,r.prevZ=n,n=r;e=s}n.nextZ=null,l*=2}while(a>1);return i}function Fl(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 by(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 ji(i,t,e,s,r,n,a,h){return(r-a)*(t-h)>=(i-a)*(n-h)&&(i-a)*(s-h)>=(e-a)*(t-h)&&(e-a)*(n-h)>=(r-a)*(s-h)}function wy(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!Ey(i,t)&&($n(i,t)&&$n(t,i)&&Ty(i,t)&&(Lt(i.prev,i,t.prev)||Lt(i,t.prev,t))||Xo(i,t)&&Lt(i.prev,i,i.next)>0&&Lt(t.prev,t,t.next)>0)}function Lt(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function Xo(i,t){return i.x===t.x&&i.y===t.y}function Od(i,t,e,s){var r=Yo(Lt(i,t,e)),n=Yo(Lt(i,t,s)),a=Yo(Lt(e,s,i)),h=Yo(Lt(e,s,t));return!!(r!==n&&a!==h||r===0&&$o(i,e,t)||n===0&&$o(i,s,t)||a===0&&$o(e,i,s)||h===0&&$o(e,t,s))}function $o(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 Yo(i){return i>0?1:i<0?-1:0}function Ey(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&&Od(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function $n(i,t){return Lt(i.prev,i,i.next)<0?Lt(i,t,i.next)>=0&&Lt(i,i.prev,t)>=0:Lt(i,t,i.prev)<0||Lt(i,i.next,t)<0}function Ty(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 Ld(i,t){var e=new kl(i.i,i.x,i.y),s=new kl(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 Nd(i,t,e,s){var r=new kl(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 Yn(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 kl(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}Go.deviation=function(i,t,e,s){var r=t&&t.length,n=r?t[0]*e:i.length,a=Math.abs(Bl(i,0,n,e));if(r)for(var h=0,o=t.length;h<o;h++){var l=t[h]*e,u=h<o-1?t[h+1]*e:i.length;a-=Math.abs(Bl(i,l,u,e))}var c=0;for(h=0;h<s.length;h+=3){var d=s[h]*e,f=s[h+1]*e,p=s[h+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 Bl(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}Go.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 Ay=Ml.exports;const Sy=kd(Ay);var Ho={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */Ho.exports,function(i,t){(function(e){var s=t&&!t.nodeType&&t,r=i&&!i.nodeType&&i,n=typeof Gs=="object"&&Gs;(n.global===n||n.window===n||n.self===n)&&(e=n);var a,h=2147483647,o=36,l=1,u=26,c=38,d=700,f=72,p=128,m="-",g=/^xn--/,_=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=o-l,b=Math.floor,w=String.fromCharCode,E;function T(O){throw new RangeError(y[O])}function A(O,N){for(var Z=O.length,Q=[];Z--;)Q[Z]=N(O[Z]);return Q}function I(O,N){var Z=O.split("@"),Q="";Z.length>1&&(Q=Z[0]+"@",O=Z[1]),O=O.replace(x,".");var H=O.split("."),lt=A(H,N).join(".");return Q+lt}function M(O){for(var N=[],Z=0,Q=O.length,H,lt;Z<Q;)H=O.charCodeAt(Z++),H>=55296&&H<=56319&&Z<Q?(lt=O.charCodeAt(Z++),(lt&64512)==56320?N.push(((H&1023)<<10)+(lt&1023)+65536):(N.push(H),Z--)):N.push(H);return N}function R(O){return A(O,function(N){var Z="";return N>65535&&(N-=65536,Z+=w(N>>>10&1023|55296),N=56320|N&1023),Z+=w(N),Z}).join("")}function C(O){return O-48<10?O-22:O-65<26?O-65:O-97<26?O-97:o}function P(O,N){return O+22+75*(O<26)-((N!=0)<<5)}function k(O,N,Z){var Q=0;for(O=Z?b(O/d):O>>1,O+=b(O/N);O>v*u>>1;Q+=o)O=b(O/v);return b(Q+(v+1)*O/(O+c))}function U(O){var N=[],Z=O.length,Q,H=0,lt=p,Tt=f,_t,kt,zt,Qt,Pt,jt,Ot,ze,is;for(_t=O.lastIndexOf(m),_t<0&&(_t=0),kt=0;kt<_t;++kt)O.charCodeAt(kt)>=128&&T("not-basic"),N.push(O.charCodeAt(kt));for(zt=_t>0?_t+1:0;zt<Z;){for(Qt=H,Pt=1,jt=o;zt>=Z&&T("invalid-input"),Ot=C(O.charCodeAt(zt++)),(Ot>=o||Ot>b((h-H)/Pt))&&T("overflow"),H+=Ot*Pt,ze=jt<=Tt?l:jt>=Tt+u?u:jt-Tt,!(Ot<ze);jt+=o)is=o-ze,Pt>b(h/is)&&T("overflow"),Pt*=is;Q=N.length+1,Tt=k(H-Qt,Q,Qt==0),b(H/Q)>h-lt&&T("overflow"),lt+=b(H/Q),H%=Q,N.splice(H++,0,lt)}return R(N)}function V(O){var N,Z,Q,H,lt,Tt,_t,kt,zt,Qt,Pt,jt=[],Ot,ze,is,li;for(O=M(O),Ot=O.length,N=p,Z=0,lt=f,Tt=0;Tt<Ot;++Tt)Pt=O[Tt],Pt<128&&jt.push(w(Pt));for(Q=H=jt.length,H&&jt.push(m);Q<Ot;){for(_t=h,Tt=0;Tt<Ot;++Tt)Pt=O[Tt],Pt>=N&&Pt<_t&&(_t=Pt);for(ze=Q+1,_t-N>b((h-Z)/ze)&&T("overflow"),Z+=(_t-N)*ze,N=_t,Tt=0;Tt<Ot;++Tt)if(Pt=O[Tt],Pt<N&&++Z>h&&T("overflow"),Pt==N){for(kt=Z,zt=o;Qt=zt<=lt?l:zt>=lt+u?u:zt-lt,!(kt<Qt);zt+=o)li=kt-Qt,is=o-Qt,jt.push(w(P(Qt+li%is,0))),kt=b(li/is);jt.push(w(P(kt,0))),lt=k(Z,ze,Q==H),Z=0,++Q}++Z,++N}return jt.join("")}function L(O){return I(O,function(N){return g.test(N)?U(N.slice(4).toLowerCase()):N})}function $(O){return I(O,function(N){return _.test(N)?"xn--"+V(N):N})}if(a={version:"1.4.1",ucs2:{decode:M,encode:R},decode:U,encode:V,toASCII:$,toUnicode:L},s&&r)if(i.exports==s)r.exports=a;else for(E in a)a.hasOwnProperty(E)&&(s[E]=a[E]);else e.punycode=a})(Gs)}(Ho,Ho.exports);var Cy=Ho.exports,qi=TypeError;const Iy=ly(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Dl=typeof Map=="function"&&Map.prototype,Ol=Object.getOwnPropertyDescriptor&&Dl?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Wo=Dl&&Ol&&typeof Ol.get=="function"?Ol.get:null,Vd=Dl&&Map.prototype.forEach,Ll=typeof Set=="function"&&Set.prototype,Nl=Object.getOwnPropertyDescriptor&&Ll?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,zo=Ll&&Nl&&typeof Nl.get=="function"?Nl.get:null,Ud=Ll&&Set.prototype.forEach,Py=typeof WeakMap=="function"&&WeakMap.prototype,Hn=Py?WeakMap.prototype.has:null,Ry=typeof WeakSet=="function"&&WeakSet.prototype,Wn=Ry?WeakSet.prototype.has:null,My=typeof WeakRef=="function"&&WeakRef.prototype,Gd=My?WeakRef.prototype.deref:null,Fy=Boolean.prototype.valueOf,ky=Object.prototype.toString,By=Function.prototype.toString,Dy=String.prototype.match,Vl=String.prototype.slice,kr=String.prototype.replace,Oy=String.prototype.toUpperCase,Xd=String.prototype.toLowerCase,$d=RegExp.prototype.test,Yd=Array.prototype.concat,$s=Array.prototype.join,Ly=Array.prototype.slice,Hd=Math.floor,Ul=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Gl=Object.getOwnPropertySymbols,Xl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Zi=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Te=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Zi||"symbol")?Symbol.toStringTag:null,Wd=Object.prototype.propertyIsEnumerable,zd=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(i){return i.__proto__}:null);function jd(i,t){if(i===1/0||i===-1/0||i!==i||i&&i>-1e3&&i<1e3||$d.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof i=="number"){var s=i<0?-Hd(-i):Hd(i);if(s!==i){var r=String(s),n=Vl.call(t,r.length+1);return kr.call(r,e,"$&_")+"."+kr.call(kr.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return kr.call(t,e,"$&_")}var $l=Iy,qd=$l.custom,Zd=tf(qd)?qd:null,Kd={__proto__:null,double:'"',single:"'"},Ny={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},jo=function i(t,e,s,r){var n=e||{};if(pr(n,"quoteStyle")&&!pr(Kd,n.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(pr(n,"maxStringLength")&&(typeof n.maxStringLength=="number"?n.maxStringLength<0&&n.maxStringLength!==1/0:n.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=pr(n,"customInspect")?n.customInspect:!0;if(typeof a!="boolean"&&a!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(pr(n,"indent")&&n.indent!==null&&n.indent!==" "&&!(parseInt(n.indent,10)===n.indent&&n.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(pr(n,"numericSeparator")&&typeof n.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var h=n.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return sf(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var o=String(t);return h?jd(t,o):o}if(typeof t=="bigint"){var l=String(t)+"n";return h?jd(t,l):l}var u=typeof n.depth>"u"?5:n.depth;if(typeof s>"u"&&(s=0),s>=u&&u>0&&typeof t=="object")return Yl(t)?"[Array]":"[Object]";var c=sx(n,s);if(typeof r>"u")r=[];else if(ef(r,t)>=0)return"[Circular]";function d(C,P,k){if(P&&(r=Ly.call(r),r.push(P)),k){var U={depth:n.depth};return pr(n,"quoteStyle")&&(U.quoteStyle=n.quoteStyle),i(C,U,s+1,r)}return i(C,n,s+1,r)}if(typeof t=="function"&&!Jd(t)){var f=zy(t),p=qo(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+$s.call(p,", ")+" }":"")}if(tf(t)){var m=Zi?kr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Xl.call(t);return typeof t=="object"&&!Zi?zn(m):m}if(Jy(t)){for(var g="<"+Xd.call(String(t.nodeName)),_=t.attributes||[],x=0;x<_.length;x++)g+=" "+_[x].name+"="+Qd(Vy(_[x].value),"double",n);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+Xd.call(String(t.nodeName))+">",g}if(Yl(t)){if(t.length===0)return"[]";var y=qo(t,d);return c&&!ex(y)?"["+Wl(y,c)+"]":"[ "+$s.call(y,", ")+" ]"}if(Gy(t)){var v=qo(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!Wd.call(t,"cause")?"{ ["+String(t)+"] "+$s.call(Yd.call("[cause]: "+d(t.cause),v),", ")+" }":v.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+$s.call(v,", ")+" }"}if(typeof t=="object"&&a){if(Zd&&typeof t[Zd]=="function"&&$l)return $l(t,{depth:u-s});if(a!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(jy(t)){var b=[];return Vd&&Vd.call(t,function(C,P){b.push(d(P,t,!0)+" => "+d(C,t))}),rf("Map",Wo.call(t),b,c)}if(Ky(t)){var w=[];return Ud&&Ud.call(t,function(C){w.push(d(C,t))}),rf("Set",zo.call(t),w,c)}if(qy(t))return Hl("WeakMap");if(Qy(t))return Hl("WeakSet");if(Zy(t))return Hl("WeakRef");if($y(t))return zn(d(Number(t)));if(Hy(t))return zn(d(Ul.call(t)));if(Yy(t))return zn(Fy.call(t));if(Xy(t))return zn(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof Gs<"u"&&t===Gs)return"{ [object globalThis] }";if(!Uy(t)&&!Jd(t)){var E=qo(t,d),T=zd?zd(t)===Object.prototype:t instanceof Object||t.constructor===Object,A=t instanceof Object?"":"null prototype",I=!T&&Te&&Object(t)===t&&Te in t?Vl.call(Br(t),8,-1):A?"Object":"",M=T||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",R=M+(I||A?"["+$s.call(Yd.call([],I||[],A||[]),": ")+"] ":"");return E.length===0?R+"{}":c?R+"{"+Wl(E,c)+"}":R+"{ "+$s.call(E,", ")+" }"}return String(t)};function Qd(i,t,e){var s=e.quoteStyle||t,r=Kd[s];return r+i+r}function Vy(i){return kr.call(String(i),/"/g,"&quot;")}function Yl(i){return Br(i)==="[object Array]"&&(!Te||!(typeof i=="object"&&Te in i))}function Uy(i){return Br(i)==="[object Date]"&&(!Te||!(typeof i=="object"&&Te in i))}function Jd(i){return Br(i)==="[object RegExp]"&&(!Te||!(typeof i=="object"&&Te in i))}function Gy(i){return Br(i)==="[object Error]"&&(!Te||!(typeof i=="object"&&Te in i))}function Xy(i){return Br(i)==="[object String]"&&(!Te||!(typeof i=="object"&&Te in i))}function $y(i){return Br(i)==="[object Number]"&&(!Te||!(typeof i=="object"&&Te in i))}function Yy(i){return Br(i)==="[object Boolean]"&&(!Te||!(typeof i=="object"&&Te in i))}function tf(i){if(Zi)return i&&typeof i=="object"&&i instanceof Symbol;if(typeof i=="symbol")return!0;if(!i||typeof i!="object"||!Xl)return!1;try{return Xl.call(i),!0}catch{}return!1}function Hy(i){if(!i||typeof i!="object"||!Ul)return!1;try{return Ul.call(i),!0}catch{}return!1}var Wy=Object.prototype.hasOwnProperty||function(i){return i in this};function pr(i,t){return Wy.call(i,t)}function Br(i){return ky.call(i)}function zy(i){if(i.name)return i.name;var t=Dy.call(By.call(i),/^function\s*([\w$]+)/);return t?t[1]:null}function ef(i,t){if(i.indexOf)return i.indexOf(t);for(var e=0,s=i.length;e<s;e++)if(i[e]===t)return e;return-1}function jy(i){if(!Wo||!i||typeof i!="object")return!1;try{Wo.call(i);try{zo.call(i)}catch{return!0}return i instanceof Map}catch{}return!1}function qy(i){if(!Hn||!i||typeof i!="object")return!1;try{Hn.call(i,Hn);try{Wn.call(i,Wn)}catch{return!0}return i instanceof WeakMap}catch{}return!1}function Zy(i){if(!Gd||!i||typeof i!="object")return!1;try{return Gd.call(i),!0}catch{}return!1}function Ky(i){if(!zo||!i||typeof i!="object")return!1;try{zo.call(i);try{Wo.call(i)}catch{return!0}return i instanceof Set}catch{}return!1}function Qy(i){if(!Wn||!i||typeof i!="object")return!1;try{Wn.call(i,Wn);try{Hn.call(i,Hn)}catch{return!0}return i instanceof WeakSet}catch{}return!1}function Jy(i){return!i||typeof i!="object"?!1:typeof HTMLElement<"u"&&i instanceof HTMLElement?!0:typeof i.nodeName=="string"&&typeof i.getAttribute=="function"}function sf(i,t){if(i.length>t.maxStringLength){var e=i.length-t.maxStringLength,s="... "+e+" more character"+(e>1?"s":"");return sf(Vl.call(i,0,t.maxStringLength),t)+s}var r=Ny[t.quoteStyle||"single"];r.lastIndex=0;var n=kr.call(kr.call(i,r,"\\$1"),/[\x00-\x1f]/g,tx);return Qd(n,"single",t)}function tx(i){var t=i.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+Oy.call(t.toString(16))}function zn(i){return"Object("+i+")"}function Hl(i){return i+" { ? }"}function rf(i,t,e,s){var r=s?Wl(e,s):$s.call(e,", ");return i+" ("+t+") {"+r+"}"}function ex(i){for(var t=0;t<i.length;t++)if(ef(i[t],`
2
+ `)>=0)return!1;return!0}function sx(i,t){var e;if(i.indent===" ")e=" ";else if(typeof i.indent=="number"&&i.indent>0)e=$s.call(Array(i.indent+1)," ");else return null;return{base:e,prev:$s.call(Array(t+1),e)}}function Wl(i,t){if(i.length===0)return"";var e=`
3
3
  `+t.prev+t.base;return e+$s.call(i,","+e)+`
4
- `+t.prev}function qo(i,t){var e=Yl(i),s=[];if(e){s.length=i.length;for(var r=0;r<i.length;r++)s[r]=pr(i,r)?t(i[r],i):""}var n=typeof Gl=="function"?Gl(i):[],a;if(Zi){a={};for(var h=0;h<n.length;h++)a["$"+n[h]]=n[h]}for(var o in i)pr(i,o)&&(e&&String(Number(o))===o&&o<i.length||Zi&&a["$"+o]instanceof Symbol||(Wd.call(/[^\w$]/,o)?s.push(t(o,i)+": "+t(i[o],i)):s.push(o+": "+t(i[o],i))));if(typeof Gl=="function")for(var l=0;l<n.length;l++)qd.call(i,n[l])&&s.push("["+t(n[l])+"]: "+t(i[n[l]],i));return s}var lx=jo,hx=qi,Zo=function(i,t,e){for(var s=i,r;(r=s.next)!=null;s=r)if(r.key===t)return s.next=r.next,e||(r.next=i.next,i.next=r),r},cx=function(i,t){if(i){var e=Zo(i,t);return e&&e.value}},ux=function(i,t,e){var s=Zo(i,t);s?s.value=e:i.next={key:t,next:i.next,value:e}},dx=function(i,t){return i?!!Zo(i,t):!1},fx=function(i,t){if(i)return Zo(i,t,!0)},px=function(){var t,e={assert:function(s){if(!e.has(s))throw new hx("Side channel does not contain "+lx(s))},delete:function(s){var r=t&&t.next,n=fx(t,s);return n&&r&&r===n&&(t=void 0),!!n},get:function(s){return cx(t,s)},has:function(s){return dx(t,s)},set:function(s,r){t||(t={next:void 0}),ux(t,s,r)}};return e},lf=Object,mx=Error,gx=EvalError,_x=RangeError,yx=ReferenceError,xx=SyntaxError,vx=URIError,bx=Math.abs,wx=Math.floor,Ex=Math.max,Tx=Math.min,Ax=Math.pow,Sx=Math.round,Cx=Number.isNaN||function(t){return t!==t},Ix=Cx,Px=function(t){return Ix(t)||t===0?t:t<0?-1:1},Rx=Object.getOwnPropertyDescriptor,Ko=Rx;if(Ko)try{Ko([],"length")}catch{Ko=null}var hf=Ko,Qo=Object.defineProperty||!1;if(Qo)try{Qo({},"a",{value:1})}catch{Qo=!1}var Mx=Qo,zl,cf;function Fx(){return cf||(cf=1,zl=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),s=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(s)!=="[object Symbol]")return!1;var r=42;t[e]=r;for(var n in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var a=Object.getOwnPropertySymbols(t);if(a.length!==1||a[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var h=Object.getOwnPropertyDescriptor(t,e);if(h.value!==r||h.enumerable!==!0)return!1}return!0}),zl}var jl,uf;function kx(){if(uf)return jl;uf=1;var i=typeof Symbol<"u"&&Symbol,t=Fx();return jl=function(){return typeof i!="function"||typeof Symbol!="function"||typeof i("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},jl}var ql,df;function ff(){return df||(df=1,ql=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),ql}var Zl,pf;function mf(){if(pf)return Zl;pf=1;var i=lf;return Zl=i.getPrototypeOf||null,Zl}var Kl,gf;function Bx(){if(gf)return Kl;gf=1;var i="Function.prototype.bind called on incompatible ",t=Object.prototype.toString,e=Math.max,s="[object Function]",r=function(o,l){for(var u=[],c=0;c<o.length;c+=1)u[c]=o[c];for(var d=0;d<l.length;d+=1)u[d+o.length]=l[d];return u},n=function(o,l){for(var u=[],c=l||0,d=0;c<o.length;c+=1,d+=1)u[d]=o[c];return u},a=function(h,o){for(var l="",u=0;u<h.length;u+=1)l+=h[u],u+1<h.length&&(l+=o);return l};return Kl=function(o){var l=this;if(typeof l!="function"||t.apply(l)!==s)throw new TypeError(i+l);for(var u=n(arguments,1),c,d=function(){if(this instanceof c){var _=l.apply(this,r(u,arguments));return Object(_)===_?_:this}return l.apply(o,r(u,arguments))},f=e(0,l.length-u.length),p=[],m=0;m<f;m++)p[m]="$"+m;if(c=Function("binder","return function ("+a(p,",")+"){ return binder.apply(this,arguments); }")(d),l.prototype){var g=function(){};g.prototype=l.prototype,c.prototype=new g,g.prototype=null}return c},Kl}var Ql,_f;function Jo(){if(_f)return Ql;_f=1;var i=Bx();return Ql=Function.prototype.bind||i,Ql}var Jl,yf;function th(){return yf||(yf=1,Jl=Function.prototype.call),Jl}var eh,xf;function vf(){return xf||(xf=1,eh=Function.prototype.apply),eh}var Dx=typeof Reflect<"u"&&Reflect&&Reflect.apply,Ox=Jo(),Lx=vf(),Nx=th(),Vx=Dx,Ux=Vx||Ox.call(Nx,Lx),Gx=Jo(),Xx=qi,$x=th(),Yx=Ux,bf=function(t){if(t.length<1||typeof t[0]!="function")throw new Xx("a function is required");return Yx(Gx,$x,t)},sh,wf;function Hx(){if(wf)return sh;wf=1;var i=bf,t=hf,e;try{e=[].__proto__===Array.prototype}catch(a){if(!a||typeof a!="object"||!("code"in a)||a.code!=="ERR_PROTO_ACCESS")throw a}var s=!!e&&t&&t(Object.prototype,"__proto__"),r=Object,n=r.getPrototypeOf;return sh=s&&typeof s.get=="function"?i([s.get]):typeof n=="function"?function(h){return n(h==null?h:r(h))}:!1,sh}var rh,Ef;function Wx(){if(Ef)return rh;Ef=1;var i=ff(),t=mf(),e=Hx();return rh=i?function(r){return i(r)}:t?function(r){if(!r||typeof r!="object"&&typeof r!="function")throw new TypeError("getProto: not an object");return t(r)}:e?function(r){return e(r)}:null,rh}var ih,Tf;function zx(){if(Tf)return ih;Tf=1;var i=Function.prototype.call,t=Object.prototype.hasOwnProperty,e=Jo();return ih=e.call(i,t),ih}var ht,jx=lf,qx=mx,Zx=gx,Kx=_x,Qx=yx,Ki=xx,Qi=qi,Jx=vx,tv=bx,ev=wx,sv=Ex,rv=Tx,iv=Ax,nv=Sx,ov=Px,Af=Function,nh=function(i){try{return Af('"use strict"; return ('+i+").constructor;")()}catch{}},jn=hf,av=Mx,oh=function(){throw new Qi},lv=jn?function(){try{return arguments.callee,oh}catch{try{return jn(arguments,"callee").get}catch{return oh}}}():oh,Ji=kx()(),de=Wx(),hv=mf(),cv=ff(),Sf=vf(),qn=th(),tn={},uv=typeof Uint8Array>"u"||!de?ht:de(Uint8Array),fi={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?ht:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ht:ArrayBuffer,"%ArrayIteratorPrototype%":Ji&&de?de([][Symbol.iterator]()):ht,"%AsyncFromSyncIteratorPrototype%":ht,"%AsyncFunction%":tn,"%AsyncGenerator%":tn,"%AsyncGeneratorFunction%":tn,"%AsyncIteratorPrototype%":tn,"%Atomics%":typeof Atomics>"u"?ht:Atomics,"%BigInt%":typeof BigInt>"u"?ht:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ht:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ht:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ht:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":qx,"%eval%":eval,"%EvalError%":Zx,"%Float32Array%":typeof Float32Array>"u"?ht:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ht:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ht:FinalizationRegistry,"%Function%":Af,"%GeneratorFunction%":tn,"%Int8Array%":typeof Int8Array>"u"?ht:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ht:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ht:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ji&&de?de(de([][Symbol.iterator]())):ht,"%JSON%":typeof JSON=="object"?JSON:ht,"%Map%":typeof Map>"u"?ht:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ji||!de?ht:de(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":jx,"%Object.getOwnPropertyDescriptor%":jn,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ht:Promise,"%Proxy%":typeof Proxy>"u"?ht:Proxy,"%RangeError%":Kx,"%ReferenceError%":Qx,"%Reflect%":typeof Reflect>"u"?ht:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ht:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ji||!de?ht:de(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ht:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ji&&de?de(""[Symbol.iterator]()):ht,"%Symbol%":Ji?Symbol:ht,"%SyntaxError%":Ki,"%ThrowTypeError%":lv,"%TypedArray%":uv,"%TypeError%":Qi,"%Uint8Array%":typeof Uint8Array>"u"?ht:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ht:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ht:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ht:Uint32Array,"%URIError%":Jx,"%WeakMap%":typeof WeakMap>"u"?ht:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ht:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ht:WeakSet,"%Function.prototype.call%":qn,"%Function.prototype.apply%":Sf,"%Object.defineProperty%":av,"%Object.getPrototypeOf%":hv,"%Math.abs%":tv,"%Math.floor%":ev,"%Math.max%":sv,"%Math.min%":rv,"%Math.pow%":iv,"%Math.round%":nv,"%Math.sign%":ov,"%Reflect.getPrototypeOf%":cv};if(de)try{null.error}catch(i){var dv=de(de(i));fi["%Error.prototype%"]=dv}var fv=function i(t){var e;if(t==="%AsyncFunction%")e=nh("async function () {}");else if(t==="%GeneratorFunction%")e=nh("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=nh("async function* () {}");else if(t==="%AsyncGenerator%"){var s=i("%AsyncGeneratorFunction%");s&&(e=s.prototype)}else if(t==="%AsyncIteratorPrototype%"){var r=i("%AsyncGenerator%");r&&de&&(e=de(r.prototype))}return fi[t]=e,e},Cf={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Zn=Jo(),ta=zx(),pv=Zn.call(qn,Array.prototype.concat),mv=Zn.call(Sf,Array.prototype.splice),If=Zn.call(qn,String.prototype.replace),ea=Zn.call(qn,String.prototype.slice),gv=Zn.call(qn,RegExp.prototype.exec),_v=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,yv=/\\(\\)?/g,xv=function(t){var e=ea(t,0,1),s=ea(t,-1);if(e==="%"&&s!=="%")throw new Ki("invalid intrinsic syntax, expected closing `%`");if(s==="%"&&e!=="%")throw new Ki("invalid intrinsic syntax, expected opening `%`");var r=[];return If(t,_v,function(n,a,h,o){r[r.length]=h?If(o,yv,"$1"):a||n}),r},vv=function(t,e){var s=t,r;if(ta(Cf,s)&&(r=Cf[s],s="%"+r[0]+"%"),ta(fi,s)){var n=fi[s];if(n===tn&&(n=fv(s)),typeof n>"u"&&!e)throw new Qi("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:s,value:n}}throw new Ki("intrinsic "+t+" does not exist!")},ah=function(t,e){if(typeof t!="string"||t.length===0)throw new Qi("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Qi('"allowMissing" argument must be a boolean');if(gv(/^%?[^%]*%?$/,t)===null)throw new Ki("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var s=xv(t),r=s.length>0?s[0]:"",n=vv("%"+r+"%",e),a=n.name,h=n.value,o=!1,l=n.alias;l&&(r=l[0],mv(s,pv([0,1],l)));for(var u=1,c=!0;u<s.length;u+=1){var d=s[u],f=ea(d,0,1),p=ea(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new Ki("property names with quotes must have matching quotes");if((d==="constructor"||!c)&&(o=!0),r+="."+d,a="%"+r+"%",ta(fi,a))h=fi[a];else if(h!=null){if(!(d in h)){if(!e)throw new Qi("base intrinsic for "+t+" exists, but the property is not available.");return}if(jn&&u+1>=s.length){var m=jn(h,d);c=!!m,c&&"get"in m&&!("originalValue"in m.get)?h=m.get:h=h[d]}else c=ta(h,d),h=h[d];c&&!o&&(fi[a]=h)}}return h},Pf=ah,Rf=bf,bv=Rf([Pf("%String.prototype.indexOf%")]),Mf=function(t,e){var s=Pf(t,!!e);return typeof s=="function"&&bv(t,".prototype.")>-1?Rf([s]):s},wv=ah,Kn=Mf,Ev=jo,Tv=qi,Ff=wv("%Map%",!0),Av=Kn("Map.prototype.get",!0),Sv=Kn("Map.prototype.set",!0),Cv=Kn("Map.prototype.has",!0),Iv=Kn("Map.prototype.delete",!0),Pv=Kn("Map.prototype.size",!0),kf=!!Ff&&function(){var t,e={assert:function(s){if(!e.has(s))throw new Tv("Side channel does not contain "+Ev(s))},delete:function(s){if(t){var r=Iv(t,s);return Pv(t)===0&&(t=void 0),r}return!1},get:function(s){if(t)return Av(t,s)},has:function(s){return t?Cv(t,s):!1},set:function(s,r){t||(t=new Ff),Sv(t,s,r)}};return e},Rv=ah,sa=Mf,Mv=jo,ra=kf,Fv=qi,en=Rv("%WeakMap%",!0),kv=sa("WeakMap.prototype.get",!0),Bv=sa("WeakMap.prototype.set",!0),Dv=sa("WeakMap.prototype.has",!0),Ov=sa("WeakMap.prototype.delete",!0),Lv=en?function(){var t,e,s={assert:function(r){if(!s.has(r))throw new Fv("Side channel does not contain "+Mv(r))},delete:function(r){if(en&&r&&(typeof r=="object"||typeof r=="function")){if(t)return Ov(t,r)}else if(ra&&e)return e.delete(r);return!1},get:function(r){return en&&r&&(typeof r=="object"||typeof r=="function")&&t?kv(t,r):e&&e.get(r)},has:function(r){return en&&r&&(typeof r=="object"||typeof r=="function")&&t?Dv(t,r):!!e&&e.has(r)},set:function(r,n){en&&r&&(typeof r=="object"||typeof r=="function")?(t||(t=new en),Bv(t,r,n)):ra&&(e||(e=ra()),e.set(r,n))}};return s}:ra,Nv=qi,Vv=jo,Uv=px,Gv=kf,Xv=Lv,$v=Xv||Gv||Uv,Yv=function(){var t,e={assert:function(s){if(!e.has(s))throw new Nv("Side channel does not contain "+Vv(s))},delete:function(s){return!!t&&t.delete(s)},get:function(s){return t&&t.get(s)},has:function(s){return!!t&&t.has(s)},set:function(s,r){t||(t=$v()),t.set(s,r)}};return e},Hv=String.prototype.replace,Wv=/%20/g,lh={RFC1738:"RFC1738",RFC3986:"RFC3986"},hh={default:lh.RFC3986,formatters:{RFC1738:function(i){return Hv.call(i,Wv,"+")},RFC3986:function(i){return String(i)}},RFC1738:lh.RFC1738,RFC3986:lh.RFC3986},zv=hh,ch=Object.prototype.hasOwnProperty,pi=Array.isArray,Ys=function(){for(var i=[],t=0;t<256;++t)i.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return i}(),jv=function(t){for(;t.length>1;){var e=t.pop(),s=e.obj[e.prop];if(pi(s)){for(var r=[],n=0;n<s.length;++n)typeof s[n]<"u"&&r.push(s[n]);e.obj[e.prop]=r}}},Bf=function(t,e){for(var s=e&&e.plainObjects?{__proto__:null}:{},r=0;r<t.length;++r)typeof t[r]<"u"&&(s[r]=t[r]);return s},qv=function i(t,e,s){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(pi(t))t.push(e);else if(t&&typeof t=="object")(s&&(s.plainObjects||s.allowPrototypes)||!ch.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var r=t;return pi(t)&&!pi(e)&&(r=Bf(t,s)),pi(t)&&pi(e)?(e.forEach(function(n,a){if(ch.call(t,a)){var h=t[a];h&&typeof h=="object"&&n&&typeof n=="object"?t[a]=i(h,n,s):t.push(n)}else t[a]=n}),t):Object.keys(e).reduce(function(n,a){var h=e[a];return ch.call(n,a)?n[a]=i(n[a],h,s):n[a]=h,n},r)},Zv=function(t,e){return Object.keys(e).reduce(function(s,r){return s[r]=e[r],s},t)},Kv=function(i,t,e){var s=i.replace(/\+/g," ");if(e==="iso-8859-1")return s.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(s)}catch{return s}},uh=1024,Qv=function(t,e,s,r,n){if(t.length===0)return t;var a=t;if(typeof t=="symbol"?a=Symbol.prototype.toString.call(t):typeof t!="string"&&(a=String(t)),s==="iso-8859-1")return escape(a).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var h="",o=0;o<a.length;o+=uh){for(var l=a.length>=uh?a.slice(o,o+uh):a,u=[],c=0;c<l.length;++c){var d=l.charCodeAt(c);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||n===zv.RFC1738&&(d===40||d===41)){u[u.length]=l.charAt(c);continue}if(d<128){u[u.length]=Ys[d];continue}if(d<2048){u[u.length]=Ys[192|d>>6]+Ys[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=Ys[224|d>>12]+Ys[128|d>>6&63]+Ys[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|l.charCodeAt(c)&1023),u[u.length]=Ys[240|d>>18]+Ys[128|d>>12&63]+Ys[128|d>>6&63]+Ys[128|d&63]}h+=u.join("")}return h},Jv=function(t){for(var e=[{obj:{o:t},prop:"o"}],s=[],r=0;r<e.length;++r)for(var n=e[r],a=n.obj[n.prop],h=Object.keys(a),o=0;o<h.length;++o){var l=h[o],u=a[l];typeof u=="object"&&u!==null&&s.indexOf(u)===-1&&(e.push({obj:a,prop:l}),s.push(u))}return jv(e),t},tb=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},eb=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},sb=function(t,e){return[].concat(t,e)},rb=function(t,e){if(pi(t)){for(var s=[],r=0;r<t.length;r+=1)s.push(e(t[r]));return s}return e(t)},Df={arrayToObject:Bf,assign:Zv,combine:sb,compact:Jv,decode:Kv,encode:Qv,isBuffer:eb,isRegExp:tb,maybeMap:rb,merge:qv},Of=Yv,ia=Df,Qn=hh,ib=Object.prototype.hasOwnProperty,Lf={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Hs=Array.isArray,nb=Array.prototype.push,Nf=function(i,t){nb.apply(i,Hs(t)?t:[t])},ob=Date.prototype.toISOString,Vf=Qn.default,ue={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:ia.encode,encodeValuesOnly:!1,filter:void 0,format:Vf,formatter:Qn.formatters[Vf],indices:!1,serializeDate:function(t){return ob.call(t)},skipNulls:!1,strictNullHandling:!1},ab=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},dh={},lb=function i(t,e,s,r,n,a,h,o,l,u,c,d,f,p,m,g,_,x){for(var y=t,v=x,b=0,w=!1;(v=v.get(dh))!==void 0&&!w;){var E=v.get(t);if(b+=1,typeof E<"u"){if(E===b)throw new RangeError("Cyclic object value");w=!0}typeof v.get(dh)>"u"&&(b=0)}if(typeof u=="function"?y=u(e,y):y instanceof Date?y=f(y):s==="comma"&&Hs(y)&&(y=ia.maybeMap(y,function(O){return O instanceof Date?f(O):O})),y===null){if(a)return l&&!g?l(e,ue.encoder,_,"key",p):e;y=""}if(ab(y)||ia.isBuffer(y)){if(l){var T=g?e:l(e,ue.encoder,_,"key",p);return[m(T)+"="+m(l(y,ue.encoder,_,"value",p))]}return[m(e)+"="+m(String(y))]}var A=[];if(typeof y>"u")return A;var I;if(s==="comma"&&Hs(y))g&&l&&(y=ia.maybeMap(y,l)),I=[{value:y.length>0?y.join(",")||null:void 0}];else if(Hs(u))I=u;else{var M=Object.keys(y);I=c?M.sort(c):M}var R=o?String(e).replace(/\./g,"%2E"):String(e),C=r&&Hs(y)&&y.length===1?R+"[]":R;if(n&&Hs(y)&&y.length===0)return C+"[]";for(var P=0;P<I.length;++P){var k=I[P],U=typeof k=="object"&&k&&typeof k.value<"u"?k.value:y[k];if(!(h&&U===null)){var V=d&&o?String(k).replace(/\./g,"%2E"):String(k),L=Hs(y)?typeof s=="function"?s(C,V):C:C+(d?"."+V:"["+V+"]");x.set(t,b);var $=Of();$.set(dh,x),Nf(A,i(U,L,s,r,n,a,h,o,s==="comma"&&g&&Hs(y)?null:l,u,c,d,f,p,m,g,_,$))}}return A},hb=function(t){if(!t)return ue;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||ue.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var s=Qn.default;if(typeof t.format<"u"){if(!ib.call(Qn.formatters,t.format))throw new TypeError("Unknown format option provided.");s=t.format}var r=Qn.formatters[s],n=ue.filter;(typeof t.filter=="function"||Hs(t.filter))&&(n=t.filter);var a;if(t.arrayFormat in Lf?a=t.arrayFormat:"indices"in t?a=t.indices?"indices":"repeat":a=ue.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var h=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:ue.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:ue.addQueryPrefix,allowDots:h,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:ue.allowEmptyArrays,arrayFormat:a,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ue.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?ue.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:ue.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:ue.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:ue.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:ue.encodeValuesOnly,filter:n,format:s,formatter:r,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:ue.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:ue.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ue.strictNullHandling}},cb=function(i,t){var e=i,s=hb(t),r,n;typeof s.filter=="function"?(n=s.filter,e=n("",e)):Hs(s.filter)&&(n=s.filter,r=n);var a=[];if(typeof e!="object"||e===null)return"";var h=Lf[s.arrayFormat],o=h==="comma"&&s.commaRoundTrip;r||(r=Object.keys(e)),s.sort&&r.sort(s.sort);for(var l=Of(),u=0;u<r.length;++u){var c=r[u],d=e[c];s.skipNulls&&d===null||Nf(a,lb(d,c,h,o,s.allowEmptyArrays,s.strictNullHandling,s.skipNulls,s.encodeDotInKeys,s.encode?s.encoder:null,s.filter,s.sort,s.allowDots,s.serializeDate,s.format,s.formatter,s.encodeValuesOnly,s.charset,l))}var f=a.join(s.delimiter),p=s.addQueryPrefix===!0?"?":"";return s.charsetSentinel&&(s.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""},mi=Df,fh=Object.prototype.hasOwnProperty,Uf=Array.isArray,qt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:mi.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},ub=function(i){return i.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},Gf=function(i,t,e){if(i&&typeof i=="string"&&t.comma&&i.indexOf(",")>-1)return i.split(",");if(t.throwOnLimitExceeded&&e>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(t.arrayLimit===1?"":"s")+" allowed in an array.");return i},db="utf8=%26%2310003%3B",fb="utf8=%E2%9C%93",pb=function(t,e){var s={__proto__:null},r=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;r=r.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var n=e.parameterLimit===1/0?void 0:e.parameterLimit,a=r.split(e.delimiter,e.throwOnLimitExceeded?n+1:n);if(e.throwOnLimitExceeded&&a.length>n)throw new RangeError("Parameter limit exceeded. Only "+n+" parameter"+(n===1?"":"s")+" allowed.");var h=-1,o,l=e.charset;if(e.charsetSentinel)for(o=0;o<a.length;++o)a[o].indexOf("utf8=")===0&&(a[o]===fb?l="utf-8":a[o]===db&&(l="iso-8859-1"),h=o,o=a.length);for(o=0;o<a.length;++o)if(o!==h){var u=a[o],c=u.indexOf("]="),d=c===-1?u.indexOf("="):c+1,f,p;d===-1?(f=e.decoder(u,qt.decoder,l,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(u.slice(0,d),qt.decoder,l,"key"),p=mi.maybeMap(Gf(u.slice(d+1),e,Uf(s[f])?s[f].length:0),function(g){return e.decoder(g,qt.decoder,l,"value")})),p&&e.interpretNumericEntities&&l==="iso-8859-1"&&(p=ub(String(p))),u.indexOf("[]=")>-1&&(p=Uf(p)?[p]:p);var m=fh.call(s,f);m&&e.duplicates==="combine"?s[f]=mi.combine(s[f],p):(!m||e.duplicates==="last")&&(s[f]=p)}return s},mb=function(i,t,e,s){var r=0;if(i.length>0&&i[i.length-1]==="[]"){var n=i.slice(0,-1).join("");r=Array.isArray(t)&&t[n]?t[n].length:0}for(var a=s?t:Gf(t,e,r),h=i.length-1;h>=0;--h){var o,l=i[h];if(l==="[]"&&e.parseArrays)o=e.allowEmptyArrays&&(a===""||e.strictNullHandling&&a===null)?[]:mi.combine([],a);else{o=e.plainObjects?{__proto__:null}:{};var u=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,c=e.decodeDotInKeys?u.replace(/%2E/g,"."):u,d=parseInt(c,10);!e.parseArrays&&c===""?o={0:a}:!isNaN(d)&&l!==c&&String(d)===c&&d>=0&&e.parseArrays&&d<=e.arrayLimit?(o=[],o[d]=a):c!=="__proto__"&&(o[c]=a)}a=o}return a},gb=function(t,e,s,r){if(t){var n=s.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,a=/(\[[^[\]]*])/,h=/(\[[^[\]]*])/g,o=s.depth>0&&a.exec(n),l=o?n.slice(0,o.index):n,u=[];if(l){if(!s.plainObjects&&fh.call(Object.prototype,l)&&!s.allowPrototypes)return;u.push(l)}for(var c=0;s.depth>0&&(o=h.exec(n))!==null&&c<s.depth;){if(c+=1,!s.plainObjects&&fh.call(Object.prototype,o[1].slice(1,-1))&&!s.allowPrototypes)return;u.push(o[1])}if(o){if(s.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+s.depth+" and strictDepth is true");u.push("["+n.slice(o.index)+"]")}return mb(u,e,s,r)}},_b=function(t){if(!t)return qt;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.decodeDotInKeys<"u"&&typeof t.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(t.decoder!==null&&typeof t.decoder<"u"&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof t.throwOnLimitExceeded<"u"&&typeof t.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var e=typeof t.charset>"u"?qt.charset:t.charset,s=typeof t.duplicates>"u"?qt.duplicates:t.duplicates;if(s!=="combine"&&s!=="first"&&s!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var r=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:qt.allowDots:!!t.allowDots;return{allowDots:r,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:qt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:qt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:qt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:qt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:qt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:qt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:qt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:qt.decoder,delimiter:typeof t.delimiter=="string"||mi.isRegExp(t.delimiter)?t.delimiter:qt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:qt.depth,duplicates:s,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:qt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:qt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:qt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:qt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:qt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}},yb=function(i,t){var e=_b(t);if(i===""||i===null||typeof i>"u")return e.plainObjects?{__proto__:null}:{};for(var s=typeof i=="string"?pb(i,e):i,r=e.plainObjects?{__proto__:null}:{},n=Object.keys(s),a=0;a<n.length;++a){var h=n[a],o=gb(h,s[h],e,typeof i=="string");r=mi.merge(r,o,e)}return e.allowSparse===!0?r:mi.compact(r)},xb=cb,vb=yb,bb=hh,wb={formats:bb,parse:vb,stringify:xb},Eb=Fy;function mr(){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 Tb=/^([a-z0-9.+-]+:)/i,Ab=/:[0-9]*$/,Sb=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,Cb=["<",">",'"',"`"," ","\r",`
5
- `," "],Ib=["{","}","|","\\","^","`"].concat(Cb),ph=["'"].concat(Ib),Xf=["%","/","?",";","#"].concat(ph),$f=["/","?","#"],Pb=255,Yf=/^[+a-z0-9A-Z_-]{0,63}$/,Rb=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Mb={javascript:!0,"javascript:":!0},mh={javascript:!0,"javascript:":!0},sn={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},gh=wb;function Fb(i,t,e){if(i&&typeof i=="object"&&i instanceof mr)return i;var s=new mr;return s.parse(i,t,e),s}mr.prototype.parse=function(i,t,e){if(typeof i!="string")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 h=i;if(h=h.trim(),!e&&i.split("#").length===1){var o=Sb.exec(h);if(o)return this.path=h,this.href=h,this.pathname=o[1],o[2]?(this.search=o[2],t?this.query=gh.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=Tb.exec(h);if(l){l=l[0];var u=l.toLowerCase();this.protocol=u,h=h.substr(l.length)}if(e||l||h.match(/^\/\/[^@/]+@[^@/]+/)){var c=h.substr(0,2)==="//";c&&!(l&&mh[l])&&(h=h.substr(2),this.slashes=!0)}if(!mh[l]&&(c||l&&!sn[l])){for(var d=-1,f=0;f<$f.length;f++){var p=h.indexOf($f[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,g;d===-1?g=h.lastIndexOf("@"):g=h.lastIndexOf("@",d),g!==-1&&(m=h.slice(0,g),h=h.slice(g+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<Xf.length;f++){var p=h.indexOf(Xf[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=h.length),this.host=h.slice(0,d),h=h.slice(d),this.parseHost(),this.hostname=this.hostname||"";var _=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!_)for(var x=this.hostname.split(/\./),f=0,y=x.length;f<y;f++){var v=x[f];if(v&&!v.match(Yf)){for(var b="",w=0,E=v.length;w<E;w++)v.charCodeAt(w)>127?b+="x":b+=v[w];if(!b.match(Yf)){var T=x.slice(0,f),A=x.slice(f+1),I=v.match(Rb);I&&(T.push(I[1]),A.unshift(I[2])),A.length&&(h="/"+A.join(".")+h),this.hostname=T.join(".");break}}}this.hostname.length>Pb?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=Eb.toASCII(this.hostname));var M=this.port?":"+this.port:"",R=this.hostname||"";this.host=R+M,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),h[0]!=="/"&&(h="/"+h))}if(!Mb[u])for(var f=0,y=ph.length;f<y;f++){var C=ph[f];if(h.indexOf(C)!==-1){var P=encodeURIComponent(C);P===C&&(P=escape(C)),h=h.split(C).join(P)}}var k=h.indexOf("#");k!==-1&&(this.hash=h.substr(k),h=h.slice(0,k));var U=h.indexOf("?");if(U!==-1?(this.search=h.substr(U),this.query=h.substr(U+1),t&&(this.query=gh.parse(this.query)),h=h.slice(0,U)):t&&(this.search="",this.query={}),h&&(this.pathname=h),sn[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var M=this.pathname||"",V=this.search||"";this.path=M+V}return this.href=this.format(),this},mr.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&&typeof this.query=="object"&&Object.keys(this.query).length&&(n=gh.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var a=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||sn[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(h){return encodeURIComponent(h)}),a=a.replace("#","%23"),t+r+e+a+s},mr.prototype.resolve=function(i){return this.resolveObject(Fb(i,!1,!0)).format()},mr.prototype.resolveObject=function(i){if(typeof i=="string"){var t=new mr;t.parse(i,!1,!0),i=t}for(var e=new mr,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),h=0;h<a.length;h++){var o=a[h];o!=="protocol"&&(e[o]=i[o])}return sn[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(i.protocol&&i.protocol!==e.protocol){if(!sn[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&&!mh[i.protocol]){for(var y=(i.pathname||"").split("/");y.length&&!(i.host=y.shift()););i.host||(i.host=""),i.hostname||(i.hostname=""),y[0]!==""&&y.unshift(""),y.length<2&&y.unshift(""),e.pathname=y.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,_=g,x=e.pathname&&e.pathname.split("/")||[],y=i.pathname&&i.pathname.split("/")||[],v=e.protocol&&!sn[e.protocol];if(v&&(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&&(y[0]===""?y[0]=i.host:y.unshift(i.host)),i.host=null),g=g&&(y[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=y;else if(y.length)x||(x=[]),x.pop(),x=x.concat(y),e.search=i.search,e.query=i.query;else if(i.search!=null){if(v){e.host=x.shift(),e.hostname=e.host;var b=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;b&&(e.auth=b.shift(),e.hostname=b.shift(),e.host=e.hostname)}return e.search=i.search,e.query=i.query,(e.pathname!==null||e.search!==null)&&(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 w=x.slice(-1)[0],E=(e.host||i.host||x.length>1)&&(w==="."||w==="..")||w==="",T=0,A=x.length;A>=0;A--)w=x[A],w==="."?x.splice(A,1):w===".."?(x.splice(A,1),T++):T&&(x.splice(A,1),T--);if(!g&&!_)for(;T--;T)x.unshift("..");g&&x[0]!==""&&(!x[0]||x[0].charAt(0)!=="/")&&x.unshift(""),E&&x.join("/").substr(-1)!=="/"&&x.push("");var I=x[0]===""||x[0]&&x[0].charAt(0)==="/";if(v){e.hostname=I?"":x.length?x.shift():"",e.host=e.hostname;var b=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;b&&(e.auth=b.shift(),e.hostname=b.shift(),e.host=e.hostname)}return g=g||e.host&&x.length,g&&!I&&x.unshift(""),x.length>0?e.pathname=x.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=i.auth||e.auth,e.slashes=e.slashes||i.slashes,e.href=e.format(),e},mr.prototype.parseHost=function(){var i=this.host,t=Ab.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 Hf={};function ot(i,t,e=3){if(Hf[t])return;let s=new Error().stack;typeof s>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
4
+ `+t.prev}function qo(i,t){var e=Yl(i),s=[];if(e){s.length=i.length;for(var r=0;r<i.length;r++)s[r]=pr(i,r)?t(i[r],i):""}var n=typeof Gl=="function"?Gl(i):[],a;if(Zi){a={};for(var h=0;h<n.length;h++)a["$"+n[h]]=n[h]}for(var o in i)pr(i,o)&&(e&&String(Number(o))===o&&o<i.length||Zi&&a["$"+o]instanceof Symbol||($d.call(/[^\w$]/,o)?s.push(t(o,i)+": "+t(i[o],i)):s.push(o+": "+t(i[o],i))));if(typeof Gl=="function")for(var l=0;l<n.length;l++)Wd.call(i,n[l])&&s.push("["+t(n[l])+"]: "+t(i[n[l]],i));return s}var rx=jo,ix=qi,Zo=function(i,t,e){for(var s=i,r;(r=s.next)!=null;s=r)if(r.key===t)return s.next=r.next,e||(r.next=i.next,i.next=r),r},nx=function(i,t){if(i){var e=Zo(i,t);return e&&e.value}},ox=function(i,t,e){var s=Zo(i,t);s?s.value=e:i.next={key:t,next:i.next,value:e}},ax=function(i,t){return i?!!Zo(i,t):!1},lx=function(i,t){if(i)return Zo(i,t,!0)},hx=function(){var t,e={assert:function(s){if(!e.has(s))throw new ix("Side channel does not contain "+rx(s))},delete:function(s){var r=t&&t.next,n=lx(t,s);return n&&r&&r===n&&(t=void 0),!!n},get:function(s){return nx(t,s)},has:function(s){return ax(t,s)},set:function(s,r){t||(t={next:void 0}),ox(t,s,r)}};return e},nf=Object,cx=Error,ux=EvalError,dx=RangeError,fx=ReferenceError,px=SyntaxError,mx=URIError,gx=Math.abs,_x=Math.floor,yx=Math.max,xx=Math.min,vx=Math.pow,bx=Math.round,wx=Number.isNaN||function(t){return t!==t},Ex=wx,Tx=function(t){return Ex(t)||t===0?t:t<0?-1:1},Ax=Object.getOwnPropertyDescriptor,Ko=Ax;if(Ko)try{Ko([],"length")}catch{Ko=null}var of=Ko,Qo=Object.defineProperty||!1;if(Qo)try{Qo({},"a",{value:1})}catch{Qo=!1}var Sx=Qo,zl,af;function Cx(){return af||(af=1,zl=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),s=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(s)!=="[object Symbol]")return!1;var r=42;t[e]=r;for(var n in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var a=Object.getOwnPropertySymbols(t);if(a.length!==1||a[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var h=Object.getOwnPropertyDescriptor(t,e);if(h.value!==r||h.enumerable!==!0)return!1}return!0}),zl}var jl,lf;function Ix(){if(lf)return jl;lf=1;var i=typeof Symbol<"u"&&Symbol,t=Cx();return jl=function(){return typeof i!="function"||typeof Symbol!="function"||typeof i("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},jl}var ql,hf;function cf(){return hf||(hf=1,ql=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),ql}var Zl,uf;function df(){if(uf)return Zl;uf=1;var i=nf;return Zl=i.getPrototypeOf||null,Zl}var Px="Function.prototype.bind called on incompatible ",Rx=Object.prototype.toString,Mx=Math.max,Fx="[object Function]",ff=function(t,e){for(var s=[],r=0;r<t.length;r+=1)s[r]=t[r];for(var n=0;n<e.length;n+=1)s[n+t.length]=e[n];return s},kx=function(t,e){for(var s=[],r=e||0,n=0;r<t.length;r+=1,n+=1)s[n]=t[r];return s},Bx=function(i,t){for(var e="",s=0;s<i.length;s+=1)e+=i[s],s+1<i.length&&(e+=t);return e},Dx=function(t){var e=this;if(typeof e!="function"||Rx.apply(e)!==Fx)throw new TypeError(Px+e);for(var s=kx(arguments,1),r,n=function(){if(this instanceof r){var u=e.apply(this,ff(s,arguments));return Object(u)===u?u:this}return e.apply(t,ff(s,arguments))},a=Mx(0,e.length-s.length),h=[],o=0;o<a;o++)h[o]="$"+o;if(r=Function("binder","return function ("+Bx(h,",")+"){ return binder.apply(this,arguments); }")(n),e.prototype){var l=function(){};l.prototype=e.prototype,r.prototype=new l,l.prototype=null}return r},Ox=Dx,Jo=Function.prototype.bind||Ox,Kl=Function.prototype.call,Ql,pf;function mf(){return pf||(pf=1,Ql=Function.prototype.apply),Ql}var Lx=typeof Reflect<"u"&&Reflect&&Reflect.apply,Nx=Jo,Vx=mf(),Ux=Kl,Gx=Lx,Xx=Gx||Nx.call(Ux,Vx),$x=Jo,Yx=qi,Hx=Kl,Wx=Xx,gf=function(t){if(t.length<1||typeof t[0]!="function")throw new Yx("a function is required");return Wx($x,Hx,t)},Jl,_f;function zx(){if(_f)return Jl;_f=1;var i=gf,t=of,e;try{e=[].__proto__===Array.prototype}catch(a){if(!a||typeof a!="object"||!("code"in a)||a.code!=="ERR_PROTO_ACCESS")throw a}var s=!!e&&t&&t(Object.prototype,"__proto__"),r=Object,n=r.getPrototypeOf;return Jl=s&&typeof s.get=="function"?i([s.get]):typeof n=="function"?function(h){return n(h==null?h:r(h))}:!1,Jl}var th,yf;function jx(){if(yf)return th;yf=1;var i=cf(),t=df(),e=zx();return th=i?function(r){return i(r)}:t?function(r){if(!r||typeof r!="object"&&typeof r!="function")throw new TypeError("getProto: not an object");return t(r)}:e?function(r){return e(r)}:null,th}var eh,xf;function qx(){if(xf)return eh;xf=1;var i=Function.prototype.call,t=Object.prototype.hasOwnProperty,e=Jo;return eh=e.call(i,t),eh}var ht,Zx=nf,Kx=cx,Qx=ux,Jx=dx,tv=fx,Ki=px,Qi=qi,ev=mx,sv=gx,rv=_x,iv=yx,nv=xx,ov=vx,av=bx,lv=Tx,vf=Function,sh=function(i){try{return vf('"use strict"; return ('+i+").constructor;")()}catch{}},jn=of,hv=Sx,rh=function(){throw new Qi},cv=jn?function(){try{return arguments.callee,rh}catch{try{return jn(arguments,"callee").get}catch{return rh}}}():rh,Ji=Ix()(),de=jx(),uv=df(),dv=cf(),bf=mf(),qn=Kl,tn={},fv=typeof Uint8Array>"u"||!de?ht:de(Uint8Array),fi={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?ht:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ht:ArrayBuffer,"%ArrayIteratorPrototype%":Ji&&de?de([][Symbol.iterator]()):ht,"%AsyncFromSyncIteratorPrototype%":ht,"%AsyncFunction%":tn,"%AsyncGenerator%":tn,"%AsyncGeneratorFunction%":tn,"%AsyncIteratorPrototype%":tn,"%Atomics%":typeof Atomics>"u"?ht:Atomics,"%BigInt%":typeof BigInt>"u"?ht:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ht:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ht:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ht:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Kx,"%eval%":eval,"%EvalError%":Qx,"%Float32Array%":typeof Float32Array>"u"?ht:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ht:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ht:FinalizationRegistry,"%Function%":vf,"%GeneratorFunction%":tn,"%Int8Array%":typeof Int8Array>"u"?ht:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ht:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ht:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ji&&de?de(de([][Symbol.iterator]())):ht,"%JSON%":typeof JSON=="object"?JSON:ht,"%Map%":typeof Map>"u"?ht:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ji||!de?ht:de(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Zx,"%Object.getOwnPropertyDescriptor%":jn,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ht:Promise,"%Proxy%":typeof Proxy>"u"?ht:Proxy,"%RangeError%":Jx,"%ReferenceError%":tv,"%Reflect%":typeof Reflect>"u"?ht:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ht:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ji||!de?ht:de(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ht:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ji&&de?de(""[Symbol.iterator]()):ht,"%Symbol%":Ji?Symbol:ht,"%SyntaxError%":Ki,"%ThrowTypeError%":cv,"%TypedArray%":fv,"%TypeError%":Qi,"%Uint8Array%":typeof Uint8Array>"u"?ht:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ht:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ht:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ht:Uint32Array,"%URIError%":ev,"%WeakMap%":typeof WeakMap>"u"?ht:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ht:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ht:WeakSet,"%Function.prototype.call%":qn,"%Function.prototype.apply%":bf,"%Object.defineProperty%":hv,"%Object.getPrototypeOf%":uv,"%Math.abs%":sv,"%Math.floor%":rv,"%Math.max%":iv,"%Math.min%":nv,"%Math.pow%":ov,"%Math.round%":av,"%Math.sign%":lv,"%Reflect.getPrototypeOf%":dv};if(de)try{null.error}catch(i){var pv=de(de(i));fi["%Error.prototype%"]=pv}var mv=function i(t){var e;if(t==="%AsyncFunction%")e=sh("async function () {}");else if(t==="%GeneratorFunction%")e=sh("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=sh("async function* () {}");else if(t==="%AsyncGenerator%"){var s=i("%AsyncGeneratorFunction%");s&&(e=s.prototype)}else if(t==="%AsyncIteratorPrototype%"){var r=i("%AsyncGenerator%");r&&de&&(e=de(r.prototype))}return fi[t]=e,e},wf={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Zn=Jo,ta=qx(),gv=Zn.call(qn,Array.prototype.concat),_v=Zn.call(bf,Array.prototype.splice),Ef=Zn.call(qn,String.prototype.replace),ea=Zn.call(qn,String.prototype.slice),yv=Zn.call(qn,RegExp.prototype.exec),xv=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,vv=/\\(\\)?/g,bv=function(t){var e=ea(t,0,1),s=ea(t,-1);if(e==="%"&&s!=="%")throw new Ki("invalid intrinsic syntax, expected closing `%`");if(s==="%"&&e!=="%")throw new Ki("invalid intrinsic syntax, expected opening `%`");var r=[];return Ef(t,xv,function(n,a,h,o){r[r.length]=h?Ef(o,vv,"$1"):a||n}),r},wv=function(t,e){var s=t,r;if(ta(wf,s)&&(r=wf[s],s="%"+r[0]+"%"),ta(fi,s)){var n=fi[s];if(n===tn&&(n=mv(s)),typeof n>"u"&&!e)throw new Qi("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:s,value:n}}throw new Ki("intrinsic "+t+" does not exist!")},ih=function(t,e){if(typeof t!="string"||t.length===0)throw new Qi("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Qi('"allowMissing" argument must be a boolean');if(yv(/^%?[^%]*%?$/,t)===null)throw new Ki("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var s=bv(t),r=s.length>0?s[0]:"",n=wv("%"+r+"%",e),a=n.name,h=n.value,o=!1,l=n.alias;l&&(r=l[0],_v(s,gv([0,1],l)));for(var u=1,c=!0;u<s.length;u+=1){var d=s[u],f=ea(d,0,1),p=ea(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new Ki("property names with quotes must have matching quotes");if((d==="constructor"||!c)&&(o=!0),r+="."+d,a="%"+r+"%",ta(fi,a))h=fi[a];else if(h!=null){if(!(d in h)){if(!e)throw new Qi("base intrinsic for "+t+" exists, but the property is not available.");return}if(jn&&u+1>=s.length){var m=jn(h,d);c=!!m,c&&"get"in m&&!("originalValue"in m.get)?h=m.get:h=h[d]}else c=ta(h,d),h=h[d];c&&!o&&(fi[a]=h)}}return h},Tf=ih,Af=gf,Ev=Af([Tf("%String.prototype.indexOf%")]),Sf=function(t,e){var s=Tf(t,!!e);return typeof s=="function"&&Ev(t,".prototype.")>-1?Af([s]):s},Tv=ih,Kn=Sf,Av=jo,Sv=qi,Cf=Tv("%Map%",!0),Cv=Kn("Map.prototype.get",!0),Iv=Kn("Map.prototype.set",!0),Pv=Kn("Map.prototype.has",!0),Rv=Kn("Map.prototype.delete",!0),Mv=Kn("Map.prototype.size",!0),If=!!Cf&&function(){var t,e={assert:function(s){if(!e.has(s))throw new Sv("Side channel does not contain "+Av(s))},delete:function(s){if(t){var r=Rv(t,s);return Mv(t)===0&&(t=void 0),r}return!1},get:function(s){if(t)return Cv(t,s)},has:function(s){return t?Pv(t,s):!1},set:function(s,r){t||(t=new Cf),Iv(t,s,r)}};return e},Fv=ih,sa=Sf,kv=jo,ra=If,Bv=qi,en=Fv("%WeakMap%",!0),Dv=sa("WeakMap.prototype.get",!0),Ov=sa("WeakMap.prototype.set",!0),Lv=sa("WeakMap.prototype.has",!0),Nv=sa("WeakMap.prototype.delete",!0),Vv=en?function(){var t,e,s={assert:function(r){if(!s.has(r))throw new Bv("Side channel does not contain "+kv(r))},delete:function(r){if(en&&r&&(typeof r=="object"||typeof r=="function")){if(t)return Nv(t,r)}else if(ra&&e)return e.delete(r);return!1},get:function(r){return en&&r&&(typeof r=="object"||typeof r=="function")&&t?Dv(t,r):e&&e.get(r)},has:function(r){return en&&r&&(typeof r=="object"||typeof r=="function")&&t?Lv(t,r):!!e&&e.has(r)},set:function(r,n){en&&r&&(typeof r=="object"||typeof r=="function")?(t||(t=new en),Ov(t,r,n)):ra&&(e||(e=ra()),e.set(r,n))}};return s}:ra,Uv=qi,Gv=jo,Xv=hx,$v=If,Yv=Vv,Hv=Yv||$v||Xv,Wv=function(){var t,e={assert:function(s){if(!e.has(s))throw new Uv("Side channel does not contain "+Gv(s))},delete:function(s){return!!t&&t.delete(s)},get:function(s){return t&&t.get(s)},has:function(s){return!!t&&t.has(s)},set:function(s,r){t||(t=Hv()),t.set(s,r)}};return e},zv=String.prototype.replace,jv=/%20/g,nh={RFC1738:"RFC1738",RFC3986:"RFC3986"},oh={default:nh.RFC3986,formatters:{RFC1738:function(i){return zv.call(i,jv,"+")},RFC3986:function(i){return String(i)}},RFC1738:nh.RFC1738,RFC3986:nh.RFC3986},qv=oh,ah=Object.prototype.hasOwnProperty,pi=Array.isArray,Ys=function(){for(var i=[],t=0;t<256;++t)i.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return i}(),Zv=function(t){for(;t.length>1;){var e=t.pop(),s=e.obj[e.prop];if(pi(s)){for(var r=[],n=0;n<s.length;++n)typeof s[n]<"u"&&r.push(s[n]);e.obj[e.prop]=r}}},Pf=function(t,e){for(var s=e&&e.plainObjects?{__proto__:null}:{},r=0;r<t.length;++r)typeof t[r]<"u"&&(s[r]=t[r]);return s},Kv=function i(t,e,s){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(pi(t))t.push(e);else if(t&&typeof t=="object")(s&&(s.plainObjects||s.allowPrototypes)||!ah.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var r=t;return pi(t)&&!pi(e)&&(r=Pf(t,s)),pi(t)&&pi(e)?(e.forEach(function(n,a){if(ah.call(t,a)){var h=t[a];h&&typeof h=="object"&&n&&typeof n=="object"?t[a]=i(h,n,s):t.push(n)}else t[a]=n}),t):Object.keys(e).reduce(function(n,a){var h=e[a];return ah.call(n,a)?n[a]=i(n[a],h,s):n[a]=h,n},r)},Qv=function(t,e){return Object.keys(e).reduce(function(s,r){return s[r]=e[r],s},t)},Jv=function(i,t,e){var s=i.replace(/\+/g," ");if(e==="iso-8859-1")return s.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(s)}catch{return s}},lh=1024,tb=function(t,e,s,r,n){if(t.length===0)return t;var a=t;if(typeof t=="symbol"?a=Symbol.prototype.toString.call(t):typeof t!="string"&&(a=String(t)),s==="iso-8859-1")return escape(a).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var h="",o=0;o<a.length;o+=lh){for(var l=a.length>=lh?a.slice(o,o+lh):a,u=[],c=0;c<l.length;++c){var d=l.charCodeAt(c);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||n===qv.RFC1738&&(d===40||d===41)){u[u.length]=l.charAt(c);continue}if(d<128){u[u.length]=Ys[d];continue}if(d<2048){u[u.length]=Ys[192|d>>6]+Ys[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=Ys[224|d>>12]+Ys[128|d>>6&63]+Ys[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|l.charCodeAt(c)&1023),u[u.length]=Ys[240|d>>18]+Ys[128|d>>12&63]+Ys[128|d>>6&63]+Ys[128|d&63]}h+=u.join("")}return h},eb=function(t){for(var e=[{obj:{o:t},prop:"o"}],s=[],r=0;r<e.length;++r)for(var n=e[r],a=n.obj[n.prop],h=Object.keys(a),o=0;o<h.length;++o){var l=h[o],u=a[l];typeof u=="object"&&u!==null&&s.indexOf(u)===-1&&(e.push({obj:a,prop:l}),s.push(u))}return Zv(e),t},sb=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},rb=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},ib=function(t,e){return[].concat(t,e)},nb=function(t,e){if(pi(t)){for(var s=[],r=0;r<t.length;r+=1)s.push(e(t[r]));return s}return e(t)},Rf={arrayToObject:Pf,assign:Qv,combine:ib,compact:eb,decode:Jv,encode:tb,isBuffer:rb,isRegExp:sb,maybeMap:nb,merge:Kv},Mf=Wv,ia=Rf,Qn=oh,ob=Object.prototype.hasOwnProperty,Ff={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Hs=Array.isArray,ab=Array.prototype.push,kf=function(i,t){ab.apply(i,Hs(t)?t:[t])},lb=Date.prototype.toISOString,Bf=Qn.default,ue={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:ia.encode,encodeValuesOnly:!1,filter:void 0,format:Bf,formatter:Qn.formatters[Bf],indices:!1,serializeDate:function(t){return lb.call(t)},skipNulls:!1,strictNullHandling:!1},hb=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},hh={},cb=function i(t,e,s,r,n,a,h,o,l,u,c,d,f,p,m,g,_,x){for(var y=t,v=x,b=0,w=!1;(v=v.get(hh))!==void 0&&!w;){var E=v.get(t);if(b+=1,typeof E<"u"){if(E===b)throw new RangeError("Cyclic object value");w=!0}typeof v.get(hh)>"u"&&(b=0)}if(typeof u=="function"?y=u(e,y):y instanceof Date?y=f(y):s==="comma"&&Hs(y)&&(y=ia.maybeMap(y,function(O){return O instanceof Date?f(O):O})),y===null){if(a)return l&&!g?l(e,ue.encoder,_,"key",p):e;y=""}if(hb(y)||ia.isBuffer(y)){if(l){var T=g?e:l(e,ue.encoder,_,"key",p);return[m(T)+"="+m(l(y,ue.encoder,_,"value",p))]}return[m(e)+"="+m(String(y))]}var A=[];if(typeof y>"u")return A;var I;if(s==="comma"&&Hs(y))g&&l&&(y=ia.maybeMap(y,l)),I=[{value:y.length>0?y.join(",")||null:void 0}];else if(Hs(u))I=u;else{var M=Object.keys(y);I=c?M.sort(c):M}var R=o?String(e).replace(/\./g,"%2E"):String(e),C=r&&Hs(y)&&y.length===1?R+"[]":R;if(n&&Hs(y)&&y.length===0)return C+"[]";for(var P=0;P<I.length;++P){var k=I[P],U=typeof k=="object"&&k&&typeof k.value<"u"?k.value:y[k];if(!(h&&U===null)){var V=d&&o?String(k).replace(/\./g,"%2E"):String(k),L=Hs(y)?typeof s=="function"?s(C,V):C:C+(d?"."+V:"["+V+"]");x.set(t,b);var $=Mf();$.set(hh,x),kf(A,i(U,L,s,r,n,a,h,o,s==="comma"&&g&&Hs(y)?null:l,u,c,d,f,p,m,g,_,$))}}return A},ub=function(t){if(!t)return ue;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||ue.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var s=Qn.default;if(typeof t.format<"u"){if(!ob.call(Qn.formatters,t.format))throw new TypeError("Unknown format option provided.");s=t.format}var r=Qn.formatters[s],n=ue.filter;(typeof t.filter=="function"||Hs(t.filter))&&(n=t.filter);var a;if(t.arrayFormat in Ff?a=t.arrayFormat:"indices"in t?a=t.indices?"indices":"repeat":a=ue.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var h=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:ue.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:ue.addQueryPrefix,allowDots:h,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:ue.allowEmptyArrays,arrayFormat:a,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ue.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?ue.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:ue.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:ue.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:ue.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:ue.encodeValuesOnly,filter:n,format:s,formatter:r,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:ue.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:ue.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ue.strictNullHandling}},db=function(i,t){var e=i,s=ub(t),r,n;typeof s.filter=="function"?(n=s.filter,e=n("",e)):Hs(s.filter)&&(n=s.filter,r=n);var a=[];if(typeof e!="object"||e===null)return"";var h=Ff[s.arrayFormat],o=h==="comma"&&s.commaRoundTrip;r||(r=Object.keys(e)),s.sort&&r.sort(s.sort);for(var l=Mf(),u=0;u<r.length;++u){var c=r[u],d=e[c];s.skipNulls&&d===null||kf(a,cb(d,c,h,o,s.allowEmptyArrays,s.strictNullHandling,s.skipNulls,s.encodeDotInKeys,s.encode?s.encoder:null,s.filter,s.sort,s.allowDots,s.serializeDate,s.format,s.formatter,s.encodeValuesOnly,s.charset,l))}var f=a.join(s.delimiter),p=s.addQueryPrefix===!0?"?":"";return s.charsetSentinel&&(s.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""},mi=Rf,ch=Object.prototype.hasOwnProperty,Df=Array.isArray,qt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:mi.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},fb=function(i){return i.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},Of=function(i,t,e){if(i&&typeof i=="string"&&t.comma&&i.indexOf(",")>-1)return i.split(",");if(t.throwOnLimitExceeded&&e>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(t.arrayLimit===1?"":"s")+" allowed in an array.");return i},pb="utf8=%26%2310003%3B",mb="utf8=%E2%9C%93",gb=function(t,e){var s={__proto__:null},r=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;r=r.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var n=e.parameterLimit===1/0?void 0:e.parameterLimit,a=r.split(e.delimiter,e.throwOnLimitExceeded?n+1:n);if(e.throwOnLimitExceeded&&a.length>n)throw new RangeError("Parameter limit exceeded. Only "+n+" parameter"+(n===1?"":"s")+" allowed.");var h=-1,o,l=e.charset;if(e.charsetSentinel)for(o=0;o<a.length;++o)a[o].indexOf("utf8=")===0&&(a[o]===mb?l="utf-8":a[o]===pb&&(l="iso-8859-1"),h=o,o=a.length);for(o=0;o<a.length;++o)if(o!==h){var u=a[o],c=u.indexOf("]="),d=c===-1?u.indexOf("="):c+1,f,p;d===-1?(f=e.decoder(u,qt.decoder,l,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(u.slice(0,d),qt.decoder,l,"key"),p=mi.maybeMap(Of(u.slice(d+1),e,Df(s[f])?s[f].length:0),function(g){return e.decoder(g,qt.decoder,l,"value")})),p&&e.interpretNumericEntities&&l==="iso-8859-1"&&(p=fb(String(p))),u.indexOf("[]=")>-1&&(p=Df(p)?[p]:p);var m=ch.call(s,f);m&&e.duplicates==="combine"?s[f]=mi.combine(s[f],p):(!m||e.duplicates==="last")&&(s[f]=p)}return s},_b=function(i,t,e,s){var r=0;if(i.length>0&&i[i.length-1]==="[]"){var n=i.slice(0,-1).join("");r=Array.isArray(t)&&t[n]?t[n].length:0}for(var a=s?t:Of(t,e,r),h=i.length-1;h>=0;--h){var o,l=i[h];if(l==="[]"&&e.parseArrays)o=e.allowEmptyArrays&&(a===""||e.strictNullHandling&&a===null)?[]:mi.combine([],a);else{o=e.plainObjects?{__proto__:null}:{};var u=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,c=e.decodeDotInKeys?u.replace(/%2E/g,"."):u,d=parseInt(c,10);!e.parseArrays&&c===""?o={0:a}:!isNaN(d)&&l!==c&&String(d)===c&&d>=0&&e.parseArrays&&d<=e.arrayLimit?(o=[],o[d]=a):c!=="__proto__"&&(o[c]=a)}a=o}return a},yb=function(t,e,s,r){if(t){var n=s.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,a=/(\[[^[\]]*])/,h=/(\[[^[\]]*])/g,o=s.depth>0&&a.exec(n),l=o?n.slice(0,o.index):n,u=[];if(l){if(!s.plainObjects&&ch.call(Object.prototype,l)&&!s.allowPrototypes)return;u.push(l)}for(var c=0;s.depth>0&&(o=h.exec(n))!==null&&c<s.depth;){if(c+=1,!s.plainObjects&&ch.call(Object.prototype,o[1].slice(1,-1))&&!s.allowPrototypes)return;u.push(o[1])}if(o){if(s.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+s.depth+" and strictDepth is true");u.push("["+n.slice(o.index)+"]")}return _b(u,e,s,r)}},xb=function(t){if(!t)return qt;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.decodeDotInKeys<"u"&&typeof t.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(t.decoder!==null&&typeof t.decoder<"u"&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof t.throwOnLimitExceeded<"u"&&typeof t.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var e=typeof t.charset>"u"?qt.charset:t.charset,s=typeof t.duplicates>"u"?qt.duplicates:t.duplicates;if(s!=="combine"&&s!=="first"&&s!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var r=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:qt.allowDots:!!t.allowDots;return{allowDots:r,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:qt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:qt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:qt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:qt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:qt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:qt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:qt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:qt.decoder,delimiter:typeof t.delimiter=="string"||mi.isRegExp(t.delimiter)?t.delimiter:qt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:qt.depth,duplicates:s,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:qt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:qt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:qt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:qt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:qt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}},vb=function(i,t){var e=xb(t);if(i===""||i===null||typeof i>"u")return e.plainObjects?{__proto__:null}:{};for(var s=typeof i=="string"?gb(i,e):i,r=e.plainObjects?{__proto__:null}:{},n=Object.keys(s),a=0;a<n.length;++a){var h=n[a],o=yb(h,s[h],e,typeof i=="string");r=mi.merge(r,o,e)}return e.allowSparse===!0?r:mi.compact(r)},bb=db,wb=vb,Eb=oh,Tb={formats:Eb,parse:wb,stringify:bb},Ab=Cy;function mr(){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 Sb=/^([a-z0-9.+-]+:)/i,Cb=/:[0-9]*$/,Ib=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,Pb=["<",">",'"',"`"," ","\r",`
5
+ `," "],Rb=["{","}","|","\\","^","`"].concat(Pb),uh=["'"].concat(Rb),Lf=["%","/","?",";","#"].concat(uh),Nf=["/","?","#"],Mb=255,Vf=/^[+a-z0-9A-Z_-]{0,63}$/,Fb=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,kb={javascript:!0,"javascript:":!0},dh={javascript:!0,"javascript:":!0},sn={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},fh=Tb;function Bb(i,t,e){if(i&&typeof i=="object"&&i instanceof mr)return i;var s=new mr;return s.parse(i,t,e),s}mr.prototype.parse=function(i,t,e){if(typeof i!="string")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 h=i;if(h=h.trim(),!e&&i.split("#").length===1){var o=Ib.exec(h);if(o)return this.path=h,this.href=h,this.pathname=o[1],o[2]?(this.search=o[2],t?this.query=fh.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=Sb.exec(h);if(l){l=l[0];var u=l.toLowerCase();this.protocol=u,h=h.substr(l.length)}if(e||l||h.match(/^\/\/[^@/]+@[^@/]+/)){var c=h.substr(0,2)==="//";c&&!(l&&dh[l])&&(h=h.substr(2),this.slashes=!0)}if(!dh[l]&&(c||l&&!sn[l])){for(var d=-1,f=0;f<Nf.length;f++){var p=h.indexOf(Nf[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,g;d===-1?g=h.lastIndexOf("@"):g=h.lastIndexOf("@",d),g!==-1&&(m=h.slice(0,g),h=h.slice(g+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<Lf.length;f++){var p=h.indexOf(Lf[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=h.length),this.host=h.slice(0,d),h=h.slice(d),this.parseHost(),this.hostname=this.hostname||"";var _=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!_)for(var x=this.hostname.split(/\./),f=0,y=x.length;f<y;f++){var v=x[f];if(v&&!v.match(Vf)){for(var b="",w=0,E=v.length;w<E;w++)v.charCodeAt(w)>127?b+="x":b+=v[w];if(!b.match(Vf)){var T=x.slice(0,f),A=x.slice(f+1),I=v.match(Fb);I&&(T.push(I[1]),A.unshift(I[2])),A.length&&(h="/"+A.join(".")+h),this.hostname=T.join(".");break}}}this.hostname.length>Mb?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=Ab.toASCII(this.hostname));var M=this.port?":"+this.port:"",R=this.hostname||"";this.host=R+M,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),h[0]!=="/"&&(h="/"+h))}if(!kb[u])for(var f=0,y=uh.length;f<y;f++){var C=uh[f];if(h.indexOf(C)!==-1){var P=encodeURIComponent(C);P===C&&(P=escape(C)),h=h.split(C).join(P)}}var k=h.indexOf("#");k!==-1&&(this.hash=h.substr(k),h=h.slice(0,k));var U=h.indexOf("?");if(U!==-1?(this.search=h.substr(U),this.query=h.substr(U+1),t&&(this.query=fh.parse(this.query)),h=h.slice(0,U)):t&&(this.search="",this.query={}),h&&(this.pathname=h),sn[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var M=this.pathname||"",V=this.search||"";this.path=M+V}return this.href=this.format(),this},mr.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&&typeof this.query=="object"&&Object.keys(this.query).length&&(n=fh.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var a=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||sn[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(h){return encodeURIComponent(h)}),a=a.replace("#","%23"),t+r+e+a+s},mr.prototype.resolve=function(i){return this.resolveObject(Bb(i,!1,!0)).format()},mr.prototype.resolveObject=function(i){if(typeof i=="string"){var t=new mr;t.parse(i,!1,!0),i=t}for(var e=new mr,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),h=0;h<a.length;h++){var o=a[h];o!=="protocol"&&(e[o]=i[o])}return sn[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(i.protocol&&i.protocol!==e.protocol){if(!sn[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&&!dh[i.protocol]){for(var y=(i.pathname||"").split("/");y.length&&!(i.host=y.shift()););i.host||(i.host=""),i.hostname||(i.hostname=""),y[0]!==""&&y.unshift(""),y.length<2&&y.unshift(""),e.pathname=y.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,_=g,x=e.pathname&&e.pathname.split("/")||[],y=i.pathname&&i.pathname.split("/")||[],v=e.protocol&&!sn[e.protocol];if(v&&(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&&(y[0]===""?y[0]=i.host:y.unshift(i.host)),i.host=null),g=g&&(y[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=y;else if(y.length)x||(x=[]),x.pop(),x=x.concat(y),e.search=i.search,e.query=i.query;else if(i.search!=null){if(v){e.host=x.shift(),e.hostname=e.host;var b=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;b&&(e.auth=b.shift(),e.hostname=b.shift(),e.host=e.hostname)}return e.search=i.search,e.query=i.query,(e.pathname!==null||e.search!==null)&&(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 w=x.slice(-1)[0],E=(e.host||i.host||x.length>1)&&(w==="."||w==="..")||w==="",T=0,A=x.length;A>=0;A--)w=x[A],w==="."?x.splice(A,1):w===".."?(x.splice(A,1),T++):T&&(x.splice(A,1),T--);if(!g&&!_)for(;T--;T)x.unshift("..");g&&x[0]!==""&&(!x[0]||x[0].charAt(0)!=="/")&&x.unshift(""),E&&x.join("/").substr(-1)!=="/"&&x.push("");var I=x[0]===""||x[0]&&x[0].charAt(0)==="/";if(v){e.hostname=I?"":x.length?x.shift():"",e.host=e.hostname;var b=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;b&&(e.auth=b.shift(),e.hostname=b.shift(),e.host=e.hostname)}return g=g||e.host&&x.length,g&&!I&&x.unshift(""),x.length>0?e.pathname=x.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=i.auth||e.auth,e.slashes=e.slashes||i.slashes,e.href=e.format(),e},mr.prototype.parseHost=function(){var i=this.host,t=Cb.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 Uf={};function ot(i,t,e=3){if(Uf[t])return;let s=new Error().stack;typeof s>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
6
6
  Deprecated since v${i}`):(s=s.split(`
7
7
  `).splice(e).join(`
8
8
  `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
9
9
  Deprecated since v${i}`),console.warn(s),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
10
- Deprecated since v${i}`),console.warn(s))),Hf[t]=!0}function bs(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function Jn(i){return i.split("?")[0].split("#")[0]}function kb(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Bb(i,t,e){return i.replace(new RegExp(kb(t),"g"),e)}function Db(i,t){let e="",s=0,r=-1,n=0,a=-1;for(let h=0;h<=i.length;++h){if(h<i.length)a=i.charCodeAt(h);else{if(a===47)break;a=47}if(a===47){if(!(r===h-1||n===1))if(r!==h-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 o=e.lastIndexOf("/");if(o!==e.length-1){o===-1?(e="",s=0):(e=e.slice(0,o),s=e.length-1-e.lastIndexOf("/")),r=h,n=0;continue}}else if(e.length===2||e.length===1){e="",s=0,r=h,n=0;continue}}t&&(e.length>0?e+="/..":e="..",s=2)}else e.length>0?e+=`/${i.slice(r+1,h)}`:e=i.slice(r+1,h),s=h-r-1;r=h,n=0}else a===46&&n!==-1?++n:n=-1}return e}const bt={toPosix(i){return Bb(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){bs(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(bs(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;const s=Jn(this.toPosix(t??z.ADAPTER.getBaseUrl())),r=Jn(this.toPosix(e??this.rootname(s)));return i=this.toPosix(i),i.startsWith("/")?bt.join(r,i.slice(1)):this.isAbsolute(i)?i:this.join(s,i)},normalize(i){if(bs(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=Db(i,!1),i.length>0&&s&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return bs(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){if(i.length===0)return".";let t;for(let e=0;e<i.length;++e){const s=i[e];if(bs(s),s.length>0)if(t===void 0)t=s;else{const r=i[e-1]??"";this.joinExtensions.includes(this.extname(r).toLowerCase())?t+=`/../${s}`:t+=`/${s}`}}return t===void 0?".":this.normalize(t)},dirname(i){if(bs(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 h=i.length-1;h>=1;--h)if(t=i.charCodeAt(h),t===47){if(!r){s=h;break}}else r=!1;return s===-1?e?"/":this.isUrl(a)?n+i:n:e&&s===1?"//":n+i.slice(0,s)},rootname(i){bs(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){bs(i),t&&bs(t),i=Jn(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,h=-1;for(n=i.length-1;n>=0;--n){const o=i.charCodeAt(n);if(o===47){if(!r){e=n+1;break}}else h===-1&&(r=!1,h=n+1),a>=0&&(o===t.charCodeAt(a)?--a===-1&&(s=n):(a=-1,s=h))}return e===s?s=h: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){bs(i),i=Jn(this.toPosix(i));let t=-1,e=0,s=-1,r=!0,n=0;for(let a=i.length-1;a>=0;--a){const h=i.charCodeAt(a);if(h===47){if(!r){e=a+1;break}continue}s===-1&&(r=!1,s=a+1),h===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){bs(i);const t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=Jn(this.toPosix(i));let e=i.charCodeAt(0);const s=this.isAbsolute(i);let r;t.root=this.rootname(i),s||this.hasProtocol(i)?r=1:r=0;let n=-1,a=0,h=-1,o=!0,l=i.length-1,u=0;for(;l>=r;--l){if(e=i.charCodeAt(l),e===47){if(!o){a=l+1;break}continue}h===-1&&(o=!1,h=l+1),e===46?n===-1?n=l:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||h===-1||u===0||u===1&&n===h-1&&n===a+1?h!==-1&&(a===0&&s?t.base=t.name=i.slice(1,h):t.base=t.name=i.slice(a,h)):(a===0&&s?(t.name=i.slice(1,n),t.base=i.slice(1,h)):(t.name=i.slice(a,n),t.base=i.slice(a,h)),t.ext=i.slice(n,h)),t.dir=this.dirname(i),t},sep:"/",delimiter:":",joinExtensions:[".html"]};let _h;async function Ob(){return _h??(_h=(async()=>{var n;const i=document.createElement("canvas").getContext("webgl");if(!i)return Re.UNPACK;const t=await new Promise(a=>{const h=document.createElement("video");h.onloadeddata=()=>a(h),h.onerror=()=>a(null),h.autoplay=!1,h.crossOrigin="anonymous",h.preload="auto",h.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",h.load()});if(!t)return Re.UNPACK;const e=i.createTexture();i.bindTexture(i.TEXTURE_2D,e);const s=i.createFramebuffer();i.bindFramebuffer(i.FRAMEBUFFER,s),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.NONE),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t);const r=new Uint8Array(4);return i.readPixels(0,0,1,1,i.RGBA,i.UNSIGNED_BYTE,r),i.deleteFramebuffer(s),i.deleteTexture(e),(n=i.getExtension("WEBGL_lose_context"))==null||n.loseContext(),r[0]<=r[3]?Re.PMA:Re.UNPACK})()),_h}let yh;function Lb(){return typeof yh>"u"&&(yh=function(){var t;const i={stencil:!0,failIfMajorPerformanceCaveat:z.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!z.ADAPTER.getWebGLRenderingContext())return!1;const e=z.ADAPTER.createCanvas();let s=e.getContext("webgl",i)||e.getContext("experimental-webgl",i);const r=!!((t=s==null?void 0:s.getContextAttributes())!=null&&t.stencil);if(s){const n=s.getExtension("WEBGL_lose_context");n&&n.loseContext()}return s=null,r}catch{return!1}}()),yh}var Nb={grad:.9,turn:360,rad:360/(2*Math.PI)},gr=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},fe=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},as=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},Wf=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},zf=function(i){return{r:as(i.r,0,255),g:as(i.g,0,255),b:as(i.b,0,255),a:as(i.a)}},xh=function(i){return{r:fe(i.r),g:fe(i.g),b:fe(i.b),a:fe(i.a,3)}},Vb=/^#([0-9a-f]{3,8})$/i,na=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},jf=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),h=a?n===t?(e-s)/a:n===e?2+(s-t)/a:4+(t-e)/a:0;return{h:60*(h<0?h+6:h),s:n?a/n*100:0,v:n/255*100,a:r}},qf=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),h=s*(1-(t-n)*e),o=s*(1-(1-t+n)*e),l=n%6;return{r:255*[s,h,a,a,o,s][l],g:255*[o,s,s,h,a,a][l],b:255*[a,a,o,s,s,h][l],a:r}},Zf=function(i){return{h:Wf(i.h),s:as(i.s,0,100),l:as(i.l,0,100),a:as(i.a)}},Kf=function(i){return{h:fe(i.h),s:fe(i.s),l:fe(i.l),a:fe(i.a,3)}},Qf=function(i){return qf((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},to=function(i){return{h:(t=jf(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},Ub=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Gb=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Xb=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,$b=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,vh={string:[[function(i){var t=Vb.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?fe(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?fe(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=Xb.exec(i)||$b.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:zf({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=Ub.exec(i)||Gb.exec(i);if(!t)return null;var e,s,r=Zf({h:(e=t[1],s=t[2],s===void 0&&(s="deg"),Number(e)*(Nb[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Qf(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 gr(t)&&gr(e)&&gr(s)?zf({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(!gr(t)||!gr(e)||!gr(s))return null;var a=Zf({h:Number(t),s:Number(e),l:Number(s),a:Number(n)});return Qf(a)},"hsl"],[function(i){var t=i.h,e=i.s,s=i.v,r=i.a,n=r===void 0?1:r;if(!gr(t)||!gr(e)||!gr(s))return null;var a=function(h){return{h:Wf(h.h),s:as(h.s,0,100),v:as(h.v,0,100),a:as(h.a)}}({h:Number(t),s:Number(e),v:Number(s),a:Number(n)});return qf(a)},"hsv"]]},Jf=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]},Yb=function(i){return typeof i=="string"?Jf(i.trim(),vh.string):typeof i=="object"&&i!==null?Jf(i,vh.object):[null,void 0]},bh=function(i,t){var e=to(i);return{h:e.h,s:as(e.s+100*t,0,100),l:e.l,a:e.a}},wh=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},tp=function(i,t){var e=to(i);return{h:e.h,s:e.s,l:as(e.l+100*t,0,100),a:e.a}},Eh=function(){function i(t){this.parsed=Yb(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 fe(wh(this.rgba),2)},i.prototype.isDark=function(){return wh(this.rgba)<.5},i.prototype.isLight=function(){return wh(this.rgba)>=.5},i.prototype.toHex=function(){return t=xh(this.rgba),e=t.r,s=t.g,r=t.b,a=(n=t.a)<1?na(fe(255*n)):"","#"+na(e)+na(s)+na(r)+a;var t,e,s,r,n,a},i.prototype.toRgb=function(){return xh(this.rgba)},i.prototype.toRgbString=function(){return t=xh(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 Kf(to(this.rgba))},i.prototype.toHslString=function(){return t=Kf(to(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=jf(this.rgba),{h:fe(t.h),s:fe(t.s),v:fe(t.v),a:fe(t.a,3)};var t},i.prototype.invert=function(){return Ws({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),Ws(bh(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),Ws(bh(this.rgba,-t))},i.prototype.grayscale=function(){return Ws(bh(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),Ws(tp(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),Ws(tp(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"?Ws({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):fe(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=to(this.rgba);return typeof t=="number"?Ws({h:t,s:e.s,l:e.l,a:e.a}):fe(e.h)},i.prototype.isEqual=function(t){return this.toHex()===Ws(t).toHex()},i}(),Ws=function(i){return i instanceof Eh?i:new Eh(i)},ep=[],Hb=function(i){i.forEach(function(t){ep.indexOf(t)<0&&(t(Eh,vh),ep.push(t))})};function Wb(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 h,o,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=(h=u,o=n[p],Math.pow(h.r-o.r,2)+Math.pow(h.g-o.g,2)+Math.pow(h.b-o.b,2));m<c&&(c=m,d=p)}return d}},t.string.push([function(a){var h=a.toLowerCase(),o=h==="transparent"?"#0000":e[h];return o?new i(o).toRgb():null},"name"])}Hb([Wb]);const rn=class wl{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 wl)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}isSourceEqual(t,e){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??[],t[0]=Math.round(e*255),t[1]=Math.round(s*255),t[2]=Math.round(r*255),t}toRgbArray(t){t=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]=wl.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??[];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 h=wl.HEX_PATTERN.exec(t);h&&(t=`#${h[2]}`)}const a=Ws(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)}};rn.shared=new rn,rn.temp=new rn,rn.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Ct=rn;function sp(i,t=[]){return ot("7.2.0","utils.hex2rgb is deprecated, use Color#toRgbArray instead"),Ct.shared.setValue(i).toRgbArray(t)}function zb(i){return ot("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Ct.shared.setValue(i).toHex()}function eo(i){return ot("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Ct.shared.setValue(i).toNumber()}function jb(){const i=[],t=[];for(let s=0;s<32;s++)i[s]=s,t[s]=s;i[W.NORMAL_NPM]=W.NORMAL,i[W.ADD_NPM]=W.ADD,i[W.SCREEN_NPM]=W.SCREEN,t[W.NORMAL]=W.NORMAL_NPM,t[W.ADD]=W.ADD_NPM,t[W.SCREEN]=W.SCREEN_NPM;const e=[];return e.push(t),e.push(i),e}const rp=jb();function ip(i,t){return rp[t?1:0][i]}function qb(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 np(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}function oa(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 op(i){return!(i&i-1)&&!!i}function ap(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 nn(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 Dr(i){return i===0?0:i<0?-1:1}let Zb=0;function gi(){return++Zb}const Th=class{constructor(i,t,e,s){this.left=i,this.top=t,this.right=e,this.bottom=s}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};Th.EMPTY=new Th(0,0,0,0);let lp=Th;const hp={},zs=Object.create(null),Or=Object.create(null);class Kb{constructor(t,e,s){this._canvas=z.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=s||z.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(){if(this._canvas===null)throw new TypeError("The CanvasRenderTarget has already been destroyed")}}function cp(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 up(i,t,e,s,r){const n=4*t;for(let a=s,h=s*n+4*e;a<=r;++a,h+=n)if(i[h+3]!==0)return!1;return!0}function Qb(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,h=t-1,o=e-1;for(;a<e&&cp(r,t,a);)++a;if(a===e)return lp.EMPTY;for(;cp(r,t,o);)--o;for(;up(r,t,n,a,o);)++n;for(;up(r,t,h,a,o);)--h;return++h,++o,new lp(n,a,h,o)}function Jb(i){const t=Qb(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 t1(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 _r(i,t=1){var s;const e=(s=z.RETINA_PREFIX)==null?void 0:s.exec(i);return e?parseFloat(e[1]):t}var Y=(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))(Y||{});const Ah=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},dp=(i,t)=>Ah(i).priority??t,K={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Ah).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(Ah).forEach(t=>{t.type.forEach(e=>{var n,a;const s=this._addHandlers,r=this._queue;s[e]?(n=s[e])==null||n.call(s,t):(r[e]=r[e]||[],(a=r[e])==null||a.push(t))})}),this},handle(i,t,e){var a;const s=this._addHandlers,r=this._removeHandlers;if(s[i]||r[i])throw new Error(`Extension type ${i} already has a handler`);s[i]=t,r[i]=e;const n=this._queue;return n[i]&&((a=n[i])==null||a.forEach(h=>t(h)),delete n[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&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)=>dp(n,e)-dp(r,e)))},s=>{const r=t.indexOf(s.ref);r!==-1&&t.splice(r,1)})}};class Sh{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 e1=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
11
- `);function s1(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
12
- else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function r1(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=e1.replace(/%forloop%/gi,s1(i));if(t.shaderSource(e,s),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}return i}const Ch=0,Ih=1,Ph=2,Rh=3,Mh=4,Fh=5;class js{constructor(){this.data=0,this.blendMode=W.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Ch)}set blend(t){!!(this.data&1<<Ch)!==t&&(this.data^=1<<Ch)}get offsets(){return!!(this.data&1<<Ih)}set offsets(t){!!(this.data&1<<Ih)!==t&&(this.data^=1<<Ih)}get culling(){return!!(this.data&1<<Ph)}set culling(t){!!(this.data&1<<Ph)!==t&&(this.data^=1<<Ph)}get depthTest(){return!!(this.data&1<<Rh)}set depthTest(t){!!(this.data&1<<Rh)!==t&&(this.data^=1<<Rh)}get depthMask(){return!!(this.data&1<<Fh)}set depthMask(t){!!(this.data&1<<Fh)!==t&&(this.data^=1<<Fh)}get clockwiseFrontFace(){return!!(this.data&1<<Mh)}set clockwiseFrontFace(t){!!(this.data&1<<Mh)!==t&&(this.data^=1<<Mh)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==W.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new js;return t.depthTest=!1,t.blend=!0,t}}js.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const kh=[];function fp(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=kh.length-1;s>=0;--s){const r=kh[s];if(r.test&&r.test(i,e))return new r(i,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class ws{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,s,r,n,a,h,o){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,h,o);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.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(ws.prototype,{dispatch:{value:ws.prototype.emit},run:{value:ws.prototype.emit}});class so{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new ws("setRealSize"),this.onUpdate=new ws("update"),this.onError=new ws("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 aa extends so{constructor(t,e){const{width:s,height:r}=e||{};if(!s||!r)throw new Error("BufferResource width or height invalid");super(s,r),this.data=t,this.unpackAlignment=e.unpackAlignment??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===Re.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}}const i1={scaleMode:je.NEAREST,alphaMode:Re.NPM},Bh=class On extends Xs{constructor(t=null,e=null){super(),e=Object.assign({},On.defaultOptions,e);const{alphaMode:s,mipmap:r,anisotropicLevel:n,scaleMode:a,width:h,height:o,wrapMode:l,format:u,type:c,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof so)&&(t=fp(t,p),t.internal=!0),this.resolution=f||z.RESOLUTION,this.width=Math.round((h||0)*this.resolution)/this.resolution,this.height=Math.round((o||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=gi(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=h>0&&o>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=op(this.realWidth)&&op(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 Or[this.cacheId],delete zs[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),On.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=z.STRICT_TEXTURE_CACHE){const r=typeof t=="string";let n=null;if(r)n=t;else{if(!t._pixiId){const h=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${h}_${gi()}`}n=t._pixiId}let a=Or[n];if(r&&s&&!a)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return a||(a=new On(t,e),a.cacheId=n,On.addToCache(a,n)),a}static fromBuffer(t,e,s,r){t=t||new Float32Array(e*s*4);const n=new aa(t,{width:e,height:s,...r==null?void 0:r.resourceOptions});let a,h;return t instanceof Float32Array?(a=G.RGBA,h=tt.FLOAT):t instanceof Int32Array?(a=G.RGBA_INTEGER,h=tt.INT):t instanceof Uint32Array?(a=G.RGBA_INTEGER,h=tt.UNSIGNED_INT):t instanceof Int16Array?(a=G.RGBA_INTEGER,h=tt.SHORT):t instanceof Uint16Array?(a=G.RGBA_INTEGER,h=tt.UNSIGNED_SHORT):t instanceof Int8Array?(a=G.RGBA,h=tt.BYTE):(a=G.RGBA,h=tt.UNSIGNED_BYTE),n.internal=!0,new On(n,Object.assign({},i1,{type:h,format:a},r))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Or[e]&&Or[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),Or[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Or[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete Or[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete Or[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Bh.defaultOptions={mipmap:vs.POW2,anisotropicLevel:0,scaleMode:je.LINEAR,wrapMode:Fr.CLAMP,alphaMode:Re.UNPACK,target:Wi.TEXTURE_2D,format:G.RGBA,type:tt.UNSIGNED_BYTE},Bh._globalBatch=0;let et=Bh;class Dh{constructor(){this.texArray=null,this.blend=0,this.type=xs.TRIANGLES,this.start=0,this.size=0,this.data=null}}let n1=0;class Jt{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=n1++,this.disposeRunner=new ws("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?Us.ELEMENT_ARRAY_BUFFER:Us.ARRAY_BUFFER}get index(){return this.type===Us.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new Jt(t)}}class la{constructor(t,e=0,s=!1,r=tt.FLOAT,n,a,h,o=1){this.buffer=t,this.size=e,this.normalized=s,this.type=r,this.stride=n,this.start=a,this.instance=h,this.divisor=o}destroy(){this.buffer=null}static from(t,e,s,r,n){return new la(t,e,s,r,n)}}const o1={Float32Array,Uint32Array,Int32Array,Uint8Array};function a1(i,t){let e=0,s=0;const r={};for(let o=0;o<i.length;o++)s+=t[o],e+=i[o].length;const n=new ArrayBuffer(e*4);let a=null,h=0;for(let o=0;o<i.length;o++){const l=t[o],u=i[o],c=np(u);r[c]||(r[c]=new o1[c](n)),a=r[c];for(let d=0;d<u.length;d++){const f=(d/l|0)*s+h,p=d%l;a[f+p]=u[d]}h+=l}return new Float32Array(n)}const pp={5126:4,5123:2,5121:1};let l1=0;const h1={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class Lr{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=l1++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new ws("disposeGeometry"),this.refCount=0}addAttribute(t,e,s=0,r=!1,n,a,h,o=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof Jt||(e instanceof Array&&(e=new Float32Array(e)),e=new Jt(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 la(u,s,r,n,a,h,o),this.instanced=this.instanced||o,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof Jt||(t instanceof Array&&(t=new Uint16Array(t)),t=new Jt(t)),t.type=Us.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 Jt;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*pp[n.type]/4),n.buffer=0}for(s.data=a1(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 Lr;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new Jt(this.buffers[e].data.slice(0));for(const e in this.attributes){const s=this.attributes[e];t.attributes[e]=new la(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=Us.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new Lr,s=[],r=[],n=[];let a;for(let h=0;h<t.length;h++){a=t[h];for(let o=0;o<a.buffers.length;o++)r[o]=r[o]||0,r[o]+=a.buffers[o].data.length,n[o]=0}for(let h=0;h<a.buffers.length;h++)s[h]=new h1[np(a.buffers[h].data)](r[h]),e.buffers[h]=new Jt(s[h]);for(let h=0;h<t.length;h++){a=t[h];for(let o=0;o<a.buffers.length;o++)s[o].set(a.buffers[o].data,n[o]),n[o]+=a.buffers[o].data.length}if(e.attributes=a.attributes,a.indexBuffer){e.indexBuffer=e.buffers[a.buffers.indexOf(a.indexBuffer)],e.indexBuffer.type=Us.ELEMENT_ARRAY_BUFFER;let h=0,o=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&&(o+=d.size*pp[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]+=h;h+=t[c].buffers[u].data.length/o,l+=d.length}}return e}}class mp extends Lr{constructor(t=!1){super(),this._buffer=new Jt(null,t,!1),this._indexBuffer=new Jt(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,tt.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,tt.FLOAT).addAttribute("aColor",this._buffer,4,!0,tt.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,tt.FLOAT).addIndex(this._indexBuffer)}}const ha=Math.PI*2,c1=180/Math.PI,Oh=Math.PI/180;var xe=(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))(xe||{});class st{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new st(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}}st.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const ca=[new st,new st,new st,new st];let rt=class pd{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=xe.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 pd(0,0,0,0)}clone(){return new pd(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 T=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=T)return!1;const A=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>A}const s=this.left,r=this.right,n=this.top,a=this.bottom;if(r<=s||a<=n)return!1;const h=ca[0].set(t.left,t.top),o=ca[1].set(t.left,t.bottom),l=ca[2].set(t.right,t.top),u=ca[3].set(t.right,t.bottom);if(l.x<=h.x||o.y<=h.y)return!1;const c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(h,h),e.apply(o,o),e.apply(l,l),e.apply(u,u),Math.max(h.x,o.x,l.x,u.x)<=s||Math.min(h.x,o.x,l.x,u.x)>=r||Math.max(h.y,o.y,l.y,u.y)<=n||Math.min(h.y,o.y,l.y,u.y)>=a))return!1;const d=c*(o.y-h.y),f=c*(h.x-o.x),p=d*s+f*n,m=d*r+f*n,g=d*s+f*a,_=d*r+f*a;if(Math.max(p,m,g,_)<=d*h.x+f*h.y||Math.min(p,m,g,_)>=d*u.x+f*u.y)return!1;const x=c*(h.y-l.y),y=c*(l.x-h.x),v=x*s+y*n,b=x*r+y*n,w=x*s+y*a,E=x*r+y*a;return!(Math.max(v,b,w,E)<=x*h.x+y*h.y||Math.min(v,b,w,E)>=x*u.x+y*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}};rt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class ua{constructor(t=0,e=0,s=0){this.x=t,this.y=e,this.radius=s,this.type=xe.CIRC}clone(){return new ua(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 rt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}ua.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class da{constructor(t=0,e=0,s=0,r=0){this.x=t,this.y=e,this.width=s,this.height=r,this.type=xe.ELIP}clone(){return new da(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 rt(this.x-this.width,this.y-this.height,this.width,this.height)}}da.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Nr{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=xe.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new Nr(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 h=this.points[n*2],o=this.points[n*2+1],l=this.points[a*2],u=this.points[a*2+1];o>e!=u>e&&t<(l-h)*((e-o)/(u-o))+h&&(s=!s)}return s}}Nr.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((i,t)=>`${i}, ${t}`,"")}]`};class fa{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=xe.RREC}clone(){return new fa(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}}fa.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class Rt{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 st;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 st;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,h,o,l){return this.a=Math.cos(h+l)*n,this.b=Math.sin(h+l)*n,this.c=-Math.sin(h-o)*a,this.d=Math.cos(h-o)*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,h=-Math.atan2(-r,n),o=Math.atan2(s,e),l=Math.abs(h+o);return l<1e-5||Math.abs(ha-l)<1e-5?(t.rotation=o,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=h,t.skew.y=o),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 Rt;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 Rt}static get TEMP_MATRIX(){return new Rt}}Rt.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};const _i=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],yi=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],xi=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],vi=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Lh=[],gp=[],pa=Math.sign;function u1(){for(let i=0;i<16;i++){const t=[];Lh.push(t);for(let e=0;e<16;e++){const s=pa(_i[i]*_i[e]+xi[i]*yi[e]),r=pa(yi[i]*_i[e]+vi[i]*yi[e]),n=pa(_i[i]*xi[e]+xi[i]*vi[e]),a=pa(yi[i]*xi[e]+vi[i]*vi[e]);for(let h=0;h<16;h++)if(_i[h]===s&&yi[h]===r&&xi[h]===n&&vi[h]===a){t.push(h);break}}}for(let i=0;i<16;i++){const t=new Rt;t.set(_i[i],yi[i],xi[i],vi[i],0,0),gp.push(t)}}u1();const Nt={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=>_i[i],uY:i=>yi[i],vX:i=>xi[i],vY:i=>vi[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>Lh[i][t],sub:(i,t)=>Lh[i][Nt.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?Nt.S:Nt.N:Math.abs(t)*2<=Math.abs(i)?i>0?Nt.E:Nt.W:t>0?i>0?Nt.SE:Nt.SW:i>0?Nt.NE:Nt.NW,matrixAppendRotationInv:(i,t,e=0,s=0)=>{const r=gp[Nt.inv(t)];r.tx=e,r.ty=s,i.append(r)}};class qs{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 qs(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))}}qs.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Nh=class{constructor(){this.worldTransform=new Rt,this.localTransform=new Rt,this.position=new qs(this.onChange,this,0,0),this.scale=new qs(this.onChange,this,1,1),this.pivot=new qs(this.onChange,this,0,0),this.skew=new qs(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 i=this.localTransform;this._localID!==this._currentLocalID&&(i.a=this._cx*this.scale.x,i.b=this._sx*this.scale.x,i.c=this._cy*this.scale.y,i.d=this._sy*this.scale.y,i.tx=this.position.x-(this.pivot.x*i.a+this.pivot.y*i.c),i.ty=this.position.y-(this.pivot.x*i.b+this.pivot.y*i.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(i){const t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==i._worldID){const e=i.worldTransform,s=this.worldTransform;s.a=t.a*e.a+t.b*e.c,s.b=t.a*e.b+t.b*e.d,s.c=t.c*e.a+t.d*e.c,s.d=t.c*e.b+t.d*e.d,s.tx=t.tx*e.a+t.ty*e.c+e.tx,s.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=i._worldID,this._worldID++}}setFromMatrix(i){i.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(i){this._rotation!==i&&(this._rotation=i,this.updateSkew())}};Nh.IDENTITY=new Nh;let ma=Nh;ma.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var d1=`varying vec2 vTextureCoord;
10
+ Deprecated since v${i}`),console.warn(s))),Uf[t]=!0}function bs(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function Jn(i){return i.split("?")[0].split("#")[0]}function Db(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ob(i,t,e){return i.replace(new RegExp(Db(t),"g"),e)}function Lb(i,t){let e="",s=0,r=-1,n=0,a=-1;for(let h=0;h<=i.length;++h){if(h<i.length)a=i.charCodeAt(h);else{if(a===47)break;a=47}if(a===47){if(!(r===h-1||n===1))if(r!==h-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 o=e.lastIndexOf("/");if(o!==e.length-1){o===-1?(e="",s=0):(e=e.slice(0,o),s=e.length-1-e.lastIndexOf("/")),r=h,n=0;continue}}else if(e.length===2||e.length===1){e="",s=0,r=h,n=0;continue}}t&&(e.length>0?e+="/..":e="..",s=2)}else e.length>0?e+=`/${i.slice(r+1,h)}`:e=i.slice(r+1,h),s=h-r-1;r=h,n=0}else a===46&&n!==-1?++n:n=-1}return e}const bt={toPosix(i){return Ob(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){bs(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(bs(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;const s=Jn(this.toPosix(t??z.ADAPTER.getBaseUrl())),r=Jn(this.toPosix(e??this.rootname(s)));return i=this.toPosix(i),i.startsWith("/")?bt.join(r,i.slice(1)):this.isAbsolute(i)?i:this.join(s,i)},normalize(i){if(bs(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=Lb(i,!1),i.length>0&&s&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return bs(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){if(i.length===0)return".";let t;for(let e=0;e<i.length;++e){const s=i[e];if(bs(s),s.length>0)if(t===void 0)t=s;else{const r=i[e-1]??"";this.joinExtensions.includes(this.extname(r).toLowerCase())?t+=`/../${s}`:t+=`/${s}`}}return t===void 0?".":this.normalize(t)},dirname(i){if(bs(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 h=i.length-1;h>=1;--h)if(t=i.charCodeAt(h),t===47){if(!r){s=h;break}}else r=!1;return s===-1?e?"/":this.isUrl(a)?n+i:n:e&&s===1?"//":n+i.slice(0,s)},rootname(i){bs(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){bs(i),t&&bs(t),i=Jn(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,h=-1;for(n=i.length-1;n>=0;--n){const o=i.charCodeAt(n);if(o===47){if(!r){e=n+1;break}}else h===-1&&(r=!1,h=n+1),a>=0&&(o===t.charCodeAt(a)?--a===-1&&(s=n):(a=-1,s=h))}return e===s?s=h: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){bs(i),i=Jn(this.toPosix(i));let t=-1,e=0,s=-1,r=!0,n=0;for(let a=i.length-1;a>=0;--a){const h=i.charCodeAt(a);if(h===47){if(!r){e=a+1;break}continue}s===-1&&(r=!1,s=a+1),h===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){bs(i);const t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=Jn(this.toPosix(i));let e=i.charCodeAt(0);const s=this.isAbsolute(i);let r;t.root=this.rootname(i),s||this.hasProtocol(i)?r=1:r=0;let n=-1,a=0,h=-1,o=!0,l=i.length-1,u=0;for(;l>=r;--l){if(e=i.charCodeAt(l),e===47){if(!o){a=l+1;break}continue}h===-1&&(o=!1,h=l+1),e===46?n===-1?n=l:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||h===-1||u===0||u===1&&n===h-1&&n===a+1?h!==-1&&(a===0&&s?t.base=t.name=i.slice(1,h):t.base=t.name=i.slice(a,h)):(a===0&&s?(t.name=i.slice(1,n),t.base=i.slice(1,h)):(t.name=i.slice(a,n),t.base=i.slice(a,h)),t.ext=i.slice(n,h)),t.dir=this.dirname(i),t},sep:"/",delimiter:":",joinExtensions:[".html"]};let ph;async function Nb(){return ph??(ph=(async()=>{var n;const i=document.createElement("canvas").getContext("webgl");if(!i)return Re.UNPACK;const t=await new Promise(a=>{const h=document.createElement("video");h.onloadeddata=()=>a(h),h.onerror=()=>a(null),h.autoplay=!1,h.crossOrigin="anonymous",h.preload="auto",h.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",h.load()});if(!t)return Re.UNPACK;const e=i.createTexture();i.bindTexture(i.TEXTURE_2D,e);const s=i.createFramebuffer();i.bindFramebuffer(i.FRAMEBUFFER,s),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.NONE),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t);const r=new Uint8Array(4);return i.readPixels(0,0,1,1,i.RGBA,i.UNSIGNED_BYTE,r),i.deleteFramebuffer(s),i.deleteTexture(e),(n=i.getExtension("WEBGL_lose_context"))==null||n.loseContext(),r[0]<=r[3]?Re.PMA:Re.UNPACK})()),ph}let mh;function Vb(){return typeof mh>"u"&&(mh=function(){var t;const i={stencil:!0,failIfMajorPerformanceCaveat:z.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!z.ADAPTER.getWebGLRenderingContext())return!1;const e=z.ADAPTER.createCanvas();let s=e.getContext("webgl",i)||e.getContext("experimental-webgl",i);const r=!!((t=s==null?void 0:s.getContextAttributes())!=null&&t.stencil);if(s){const n=s.getExtension("WEBGL_lose_context");n&&n.loseContext()}return s=null,r}catch{return!1}}()),mh}var Ub={grad:.9,turn:360,rad:360/(2*Math.PI)},gr=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},fe=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},as=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},Gf=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},Xf=function(i){return{r:as(i.r,0,255),g:as(i.g,0,255),b:as(i.b,0,255),a:as(i.a)}},gh=function(i){return{r:fe(i.r),g:fe(i.g),b:fe(i.b),a:fe(i.a,3)}},Gb=/^#([0-9a-f]{3,8})$/i,na=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},$f=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),h=a?n===t?(e-s)/a:n===e?2+(s-t)/a:4+(t-e)/a:0;return{h:60*(h<0?h+6:h),s:n?a/n*100:0,v:n/255*100,a:r}},Yf=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),h=s*(1-(t-n)*e),o=s*(1-(1-t+n)*e),l=n%6;return{r:255*[s,h,a,a,o,s][l],g:255*[o,s,s,h,a,a][l],b:255*[a,a,o,s,s,h][l],a:r}},Hf=function(i){return{h:Gf(i.h),s:as(i.s,0,100),l:as(i.l,0,100),a:as(i.a)}},Wf=function(i){return{h:fe(i.h),s:fe(i.s),l:fe(i.l),a:fe(i.a,3)}},zf=function(i){return Yf((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},to=function(i){return{h:(t=$f(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},Xb=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,$b=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Yb=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Hb=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_h={string:[[function(i){var t=Gb.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?fe(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?fe(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=Yb.exec(i)||Hb.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:Xf({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=Xb.exec(i)||$b.exec(i);if(!t)return null;var e,s,r=Hf({h:(e=t[1],s=t[2],s===void 0&&(s="deg"),Number(e)*(Ub[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return zf(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 gr(t)&&gr(e)&&gr(s)?Xf({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(!gr(t)||!gr(e)||!gr(s))return null;var a=Hf({h:Number(t),s:Number(e),l:Number(s),a:Number(n)});return zf(a)},"hsl"],[function(i){var t=i.h,e=i.s,s=i.v,r=i.a,n=r===void 0?1:r;if(!gr(t)||!gr(e)||!gr(s))return null;var a=function(h){return{h:Gf(h.h),s:as(h.s,0,100),v:as(h.v,0,100),a:as(h.a)}}({h:Number(t),s:Number(e),v:Number(s),a:Number(n)});return Yf(a)},"hsv"]]},jf=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]},Wb=function(i){return typeof i=="string"?jf(i.trim(),_h.string):typeof i=="object"&&i!==null?jf(i,_h.object):[null,void 0]},yh=function(i,t){var e=to(i);return{h:e.h,s:as(e.s+100*t,0,100),l:e.l,a:e.a}},xh=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},qf=function(i,t){var e=to(i);return{h:e.h,s:e.s,l:as(e.l+100*t,0,100),a:e.a}},vh=function(){function i(t){this.parsed=Wb(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 fe(xh(this.rgba),2)},i.prototype.isDark=function(){return xh(this.rgba)<.5},i.prototype.isLight=function(){return xh(this.rgba)>=.5},i.prototype.toHex=function(){return t=gh(this.rgba),e=t.r,s=t.g,r=t.b,a=(n=t.a)<1?na(fe(255*n)):"","#"+na(e)+na(s)+na(r)+a;var t,e,s,r,n,a},i.prototype.toRgb=function(){return gh(this.rgba)},i.prototype.toRgbString=function(){return t=gh(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 Wf(to(this.rgba))},i.prototype.toHslString=function(){return t=Wf(to(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=$f(this.rgba),{h:fe(t.h),s:fe(t.s),v:fe(t.v),a:fe(t.a,3)};var t},i.prototype.invert=function(){return Ws({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),Ws(yh(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),Ws(yh(this.rgba,-t))},i.prototype.grayscale=function(){return Ws(yh(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),Ws(qf(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),Ws(qf(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"?Ws({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):fe(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=to(this.rgba);return typeof t=="number"?Ws({h:t,s:e.s,l:e.l,a:e.a}):fe(e.h)},i.prototype.isEqual=function(t){return this.toHex()===Ws(t).toHex()},i}(),Ws=function(i){return i instanceof vh?i:new vh(i)},Zf=[],zb=function(i){i.forEach(function(t){Zf.indexOf(t)<0&&(t(vh,_h),Zf.push(t))})};function jb(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 h,o,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=(h=u,o=n[p],Math.pow(h.r-o.r,2)+Math.pow(h.g-o.g,2)+Math.pow(h.b-o.b,2));m<c&&(c=m,d=p)}return d}},t.string.push([function(a){var h=a.toLowerCase(),o=h==="transparent"?"#0000":e[h];return o?new i(o).toRgb():null},"name"])}zb([jb]);const rn=class wl{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 wl)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}isSourceEqual(t,e){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??[],t[0]=Math.round(e*255),t[1]=Math.round(s*255),t[2]=Math.round(r*255),t}toRgbArray(t){t=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]=wl.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??[];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 h=wl.HEX_PATTERN.exec(t);h&&(t=`#${h[2]}`)}const a=Ws(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)}};rn.shared=new rn,rn.temp=new rn,rn.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Ct=rn;function Kf(i,t=[]){return ot("7.2.0","utils.hex2rgb is deprecated, use Color#toRgbArray instead"),Ct.shared.setValue(i).toRgbArray(t)}function qb(i){return ot("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Ct.shared.setValue(i).toHex()}function eo(i){return ot("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Ct.shared.setValue(i).toNumber()}function Zb(){const i=[],t=[];for(let s=0;s<32;s++)i[s]=s,t[s]=s;i[W.NORMAL_NPM]=W.NORMAL,i[W.ADD_NPM]=W.ADD,i[W.SCREEN_NPM]=W.SCREEN,t[W.NORMAL]=W.NORMAL_NPM,t[W.ADD]=W.ADD_NPM,t[W.SCREEN]=W.SCREEN_NPM;const e=[];return e.push(t),e.push(i),e}const Qf=Zb();function Jf(i,t){return Qf[t?1:0][i]}function Kb(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 tp(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}function oa(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 ep(i){return!(i&i-1)&&!!i}function sp(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 nn(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 Dr(i){return i===0?0:i<0?-1:1}let Qb=0;function gi(){return++Qb}const bh=class{constructor(i,t,e,s){this.left=i,this.top=t,this.right=e,this.bottom=s}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};bh.EMPTY=new bh(0,0,0,0);let rp=bh;const ip={},zs=Object.create(null),Or=Object.create(null);class Jb{constructor(t,e,s){this._canvas=z.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=s||z.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(){if(this._canvas===null)throw new TypeError("The CanvasRenderTarget has already been destroyed")}}function np(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 op(i,t,e,s,r){const n=4*t;for(let a=s,h=s*n+4*e;a<=r;++a,h+=n)if(i[h+3]!==0)return!1;return!0}function t1(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,h=t-1,o=e-1;for(;a<e&&np(r,t,a);)++a;if(a===e)return rp.EMPTY;for(;np(r,t,o);)--o;for(;op(r,t,n,a,o);)++n;for(;op(r,t,h,a,o);)--h;return++h,++o,new rp(n,a,h,o)}function e1(i){const t=t1(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 s1(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 _r(i,t=1){var s;const e=(s=z.RETINA_PREFIX)==null?void 0:s.exec(i);return e?parseFloat(e[1]):t}var Y=(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))(Y||{});const wh=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},ap=(i,t)=>wh(i).priority??t,K={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(wh).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(wh).forEach(t=>{t.type.forEach(e=>{var n,a;const s=this._addHandlers,r=this._queue;s[e]?(n=s[e])==null||n.call(s,t):(r[e]=r[e]||[],(a=r[e])==null||a.push(t))})}),this},handle(i,t,e){var a;const s=this._addHandlers,r=this._removeHandlers;if(s[i]||r[i])throw new Error(`Extension type ${i} already has a handler`);s[i]=t,r[i]=e;const n=this._queue;return n[i]&&((a=n[i])==null||a.forEach(h=>t(h)),delete n[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&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)=>ap(n,e)-ap(r,e)))},s=>{const r=t.indexOf(s.ref);r!==-1&&t.splice(r,1)})}};class Eh{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 r1=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
11
+ `);function i1(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
12
+ else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function n1(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=r1.replace(/%forloop%/gi,i1(i));if(t.shaderSource(e,s),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}return i}const Th=0,Ah=1,Sh=2,Ch=3,Ih=4,Ph=5;class js{constructor(){this.data=0,this.blendMode=W.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Th)}set blend(t){!!(this.data&1<<Th)!==t&&(this.data^=1<<Th)}get offsets(){return!!(this.data&1<<Ah)}set offsets(t){!!(this.data&1<<Ah)!==t&&(this.data^=1<<Ah)}get culling(){return!!(this.data&1<<Sh)}set culling(t){!!(this.data&1<<Sh)!==t&&(this.data^=1<<Sh)}get depthTest(){return!!(this.data&1<<Ch)}set depthTest(t){!!(this.data&1<<Ch)!==t&&(this.data^=1<<Ch)}get depthMask(){return!!(this.data&1<<Ph)}set depthMask(t){!!(this.data&1<<Ph)!==t&&(this.data^=1<<Ph)}get clockwiseFrontFace(){return!!(this.data&1<<Ih)}set clockwiseFrontFace(t){!!(this.data&1<<Ih)!==t&&(this.data^=1<<Ih)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==W.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new js;return t.depthTest=!1,t.blend=!0,t}}js.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const Rh=[];function lp(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=Rh.length-1;s>=0;--s){const r=Rh[s];if(r.test&&r.test(i,e))return new r(i,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class ws{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,s,r,n,a,h,o){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,h,o);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.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(ws.prototype,{dispatch:{value:ws.prototype.emit},run:{value:ws.prototype.emit}});class so{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new ws("setRealSize"),this.onUpdate=new ws("update"),this.onError=new ws("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 aa extends so{constructor(t,e){const{width:s,height:r}=e||{};if(!s||!r)throw new Error("BufferResource width or height invalid");super(s,r),this.data=t,this.unpackAlignment=e.unpackAlignment??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===Re.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}}const o1={scaleMode:je.NEAREST,alphaMode:Re.NPM},Mh=class On extends Xs{constructor(t=null,e=null){super(),e=Object.assign({},On.defaultOptions,e);const{alphaMode:s,mipmap:r,anisotropicLevel:n,scaleMode:a,width:h,height:o,wrapMode:l,format:u,type:c,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof so)&&(t=lp(t,p),t.internal=!0),this.resolution=f||z.RESOLUTION,this.width=Math.round((h||0)*this.resolution)/this.resolution,this.height=Math.round((o||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=gi(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=h>0&&o>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=ep(this.realWidth)&&ep(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 Or[this.cacheId],delete zs[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),On.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=z.STRICT_TEXTURE_CACHE){const r=typeof t=="string";let n=null;if(r)n=t;else{if(!t._pixiId){const h=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${h}_${gi()}`}n=t._pixiId}let a=Or[n];if(r&&s&&!a)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return a||(a=new On(t,e),a.cacheId=n,On.addToCache(a,n)),a}static fromBuffer(t,e,s,r){t=t||new Float32Array(e*s*4);const n=new aa(t,{width:e,height:s,...r==null?void 0:r.resourceOptions});let a,h;return t instanceof Float32Array?(a=G.RGBA,h=tt.FLOAT):t instanceof Int32Array?(a=G.RGBA_INTEGER,h=tt.INT):t instanceof Uint32Array?(a=G.RGBA_INTEGER,h=tt.UNSIGNED_INT):t instanceof Int16Array?(a=G.RGBA_INTEGER,h=tt.SHORT):t instanceof Uint16Array?(a=G.RGBA_INTEGER,h=tt.UNSIGNED_SHORT):t instanceof Int8Array?(a=G.RGBA,h=tt.BYTE):(a=G.RGBA,h=tt.UNSIGNED_BYTE),n.internal=!0,new On(n,Object.assign({},o1,{type:h,format:a},r))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Or[e]&&Or[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),Or[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Or[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete Or[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete Or[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Mh.defaultOptions={mipmap:vs.POW2,anisotropicLevel:0,scaleMode:je.LINEAR,wrapMode:Fr.CLAMP,alphaMode:Re.UNPACK,target:Wi.TEXTURE_2D,format:G.RGBA,type:tt.UNSIGNED_BYTE},Mh._globalBatch=0;let et=Mh;class Fh{constructor(){this.texArray=null,this.blend=0,this.type=xs.TRIANGLES,this.start=0,this.size=0,this.data=null}}let a1=0;class Jt{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=a1++,this.disposeRunner=new ws("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?Us.ELEMENT_ARRAY_BUFFER:Us.ARRAY_BUFFER}get index(){return this.type===Us.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new Jt(t)}}class la{constructor(t,e=0,s=!1,r=tt.FLOAT,n,a,h,o=1){this.buffer=t,this.size=e,this.normalized=s,this.type=r,this.stride=n,this.start=a,this.instance=h,this.divisor=o}destroy(){this.buffer=null}static from(t,e,s,r,n){return new la(t,e,s,r,n)}}const l1={Float32Array,Uint32Array,Int32Array,Uint8Array};function h1(i,t){let e=0,s=0;const r={};for(let o=0;o<i.length;o++)s+=t[o],e+=i[o].length;const n=new ArrayBuffer(e*4);let a=null,h=0;for(let o=0;o<i.length;o++){const l=t[o],u=i[o],c=tp(u);r[c]||(r[c]=new l1[c](n)),a=r[c];for(let d=0;d<u.length;d++){const f=(d/l|0)*s+h,p=d%l;a[f+p]=u[d]}h+=l}return new Float32Array(n)}const hp={5126:4,5123:2,5121:1};let c1=0;const u1={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class Lr{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=c1++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new ws("disposeGeometry"),this.refCount=0}addAttribute(t,e,s=0,r=!1,n,a,h,o=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof Jt||(e instanceof Array&&(e=new Float32Array(e)),e=new Jt(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 la(u,s,r,n,a,h,o),this.instanced=this.instanced||o,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof Jt||(t instanceof Array&&(t=new Uint16Array(t)),t=new Jt(t)),t.type=Us.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 Jt;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*hp[n.type]/4),n.buffer=0}for(s.data=h1(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 Lr;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new Jt(this.buffers[e].data.slice(0));for(const e in this.attributes){const s=this.attributes[e];t.attributes[e]=new la(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=Us.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new Lr,s=[],r=[],n=[];let a;for(let h=0;h<t.length;h++){a=t[h];for(let o=0;o<a.buffers.length;o++)r[o]=r[o]||0,r[o]+=a.buffers[o].data.length,n[o]=0}for(let h=0;h<a.buffers.length;h++)s[h]=new u1[tp(a.buffers[h].data)](r[h]),e.buffers[h]=new Jt(s[h]);for(let h=0;h<t.length;h++){a=t[h];for(let o=0;o<a.buffers.length;o++)s[o].set(a.buffers[o].data,n[o]),n[o]+=a.buffers[o].data.length}if(e.attributes=a.attributes,a.indexBuffer){e.indexBuffer=e.buffers[a.buffers.indexOf(a.indexBuffer)],e.indexBuffer.type=Us.ELEMENT_ARRAY_BUFFER;let h=0,o=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&&(o+=d.size*hp[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]+=h;h+=t[c].buffers[u].data.length/o,l+=d.length}}return e}}class cp extends Lr{constructor(t=!1){super(),this._buffer=new Jt(null,t,!1),this._indexBuffer=new Jt(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,tt.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,tt.FLOAT).addAttribute("aColor",this._buffer,4,!0,tt.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,tt.FLOAT).addIndex(this._indexBuffer)}}const ha=Math.PI*2,d1=180/Math.PI,kh=Math.PI/180;var xe=(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))(xe||{});class st{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new st(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}}st.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const ca=[new st,new st,new st,new st];let rt=class ud{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=xe.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 ud(0,0,0,0)}clone(){return new ud(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 T=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=T)return!1;const A=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>A}const s=this.left,r=this.right,n=this.top,a=this.bottom;if(r<=s||a<=n)return!1;const h=ca[0].set(t.left,t.top),o=ca[1].set(t.left,t.bottom),l=ca[2].set(t.right,t.top),u=ca[3].set(t.right,t.bottom);if(l.x<=h.x||o.y<=h.y)return!1;const c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(h,h),e.apply(o,o),e.apply(l,l),e.apply(u,u),Math.max(h.x,o.x,l.x,u.x)<=s||Math.min(h.x,o.x,l.x,u.x)>=r||Math.max(h.y,o.y,l.y,u.y)<=n||Math.min(h.y,o.y,l.y,u.y)>=a))return!1;const d=c*(o.y-h.y),f=c*(h.x-o.x),p=d*s+f*n,m=d*r+f*n,g=d*s+f*a,_=d*r+f*a;if(Math.max(p,m,g,_)<=d*h.x+f*h.y||Math.min(p,m,g,_)>=d*u.x+f*u.y)return!1;const x=c*(h.y-l.y),y=c*(l.x-h.x),v=x*s+y*n,b=x*r+y*n,w=x*s+y*a,E=x*r+y*a;return!(Math.max(v,b,w,E)<=x*h.x+y*h.y||Math.min(v,b,w,E)>=x*u.x+y*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}};rt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class ua{constructor(t=0,e=0,s=0){this.x=t,this.y=e,this.radius=s,this.type=xe.CIRC}clone(){return new ua(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 rt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}ua.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class da{constructor(t=0,e=0,s=0,r=0){this.x=t,this.y=e,this.width=s,this.height=r,this.type=xe.ELIP}clone(){return new da(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 rt(this.x-this.width,this.y-this.height,this.width,this.height)}}da.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Nr{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=xe.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new Nr(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 h=this.points[n*2],o=this.points[n*2+1],l=this.points[a*2],u=this.points[a*2+1];o>e!=u>e&&t<(l-h)*((e-o)/(u-o))+h&&(s=!s)}return s}}Nr.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((i,t)=>`${i}, ${t}`,"")}]`};class fa{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=xe.RREC}clone(){return new fa(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}}fa.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class Rt{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 st;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 st;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,h,o,l){return this.a=Math.cos(h+l)*n,this.b=Math.sin(h+l)*n,this.c=-Math.sin(h-o)*a,this.d=Math.cos(h-o)*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,h=-Math.atan2(-r,n),o=Math.atan2(s,e),l=Math.abs(h+o);return l<1e-5||Math.abs(ha-l)<1e-5?(t.rotation=o,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=h,t.skew.y=o),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 Rt;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 Rt}static get TEMP_MATRIX(){return new Rt}}Rt.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};const _i=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],yi=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],xi=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],vi=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Bh=[],up=[],pa=Math.sign;function f1(){for(let i=0;i<16;i++){const t=[];Bh.push(t);for(let e=0;e<16;e++){const s=pa(_i[i]*_i[e]+xi[i]*yi[e]),r=pa(yi[i]*_i[e]+vi[i]*yi[e]),n=pa(_i[i]*xi[e]+xi[i]*vi[e]),a=pa(yi[i]*xi[e]+vi[i]*vi[e]);for(let h=0;h<16;h++)if(_i[h]===s&&yi[h]===r&&xi[h]===n&&vi[h]===a){t.push(h);break}}}for(let i=0;i<16;i++){const t=new Rt;t.set(_i[i],yi[i],xi[i],vi[i],0,0),up.push(t)}}f1();const Nt={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=>_i[i],uY:i=>yi[i],vX:i=>xi[i],vY:i=>vi[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>Bh[i][t],sub:(i,t)=>Bh[i][Nt.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?Nt.S:Nt.N:Math.abs(t)*2<=Math.abs(i)?i>0?Nt.E:Nt.W:t>0?i>0?Nt.SE:Nt.SW:i>0?Nt.NE:Nt.NW,matrixAppendRotationInv:(i,t,e=0,s=0)=>{const r=up[Nt.inv(t)];r.tx=e,r.ty=s,i.append(r)}};class qs{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 qs(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))}}qs.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Dh=class{constructor(){this.worldTransform=new Rt,this.localTransform=new Rt,this.position=new qs(this.onChange,this,0,0),this.scale=new qs(this.onChange,this,1,1),this.pivot=new qs(this.onChange,this,0,0),this.skew=new qs(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 i=this.localTransform;this._localID!==this._currentLocalID&&(i.a=this._cx*this.scale.x,i.b=this._sx*this.scale.x,i.c=this._cy*this.scale.y,i.d=this._sy*this.scale.y,i.tx=this.position.x-(this.pivot.x*i.a+this.pivot.y*i.c),i.ty=this.position.y-(this.pivot.x*i.b+this.pivot.y*i.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(i){const t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==i._worldID){const e=i.worldTransform,s=this.worldTransform;s.a=t.a*e.a+t.b*e.c,s.b=t.a*e.b+t.b*e.d,s.c=t.c*e.a+t.d*e.c,s.d=t.c*e.b+t.d*e.d,s.tx=t.tx*e.a+t.ty*e.c+e.tx,s.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=i._worldID,this._worldID++}}setFromMatrix(i){i.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(i){this._rotation!==i&&(this._rotation=i,this.updateSkew())}};Dh.IDENTITY=new Dh;let ma=Dh;ma.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var p1=`varying vec2 vTextureCoord;
13
13
 
14
14
  uniform sampler2D uSampler;
15
15
 
16
16
  void main(void){
17
17
  gl_FragColor *= texture2D(uSampler, vTextureCoord);
18
- }`,f1=`attribute vec2 aVertexPosition;
18
+ }`,m1=`attribute vec2 aVertexPosition;
19
19
  attribute vec2 aTextureCoord;
20
20
 
21
21
  uniform mat3 projectionMatrix;
@@ -26,7 +26,7 @@ void main(void){
26
26
  gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
27
27
  vTextureCoord = aTextureCoord;
28
28
  }
29
- `;function _p(i,t,e){const s=i.createShader(t);return i.shaderSource(s,e),i.compileShader(s),s}function Vh(i){const t=new Array(i);for(let e=0;e<t.length;e++)t[e]=!1;return t}function yp(i,t){switch(i){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return Vh(2*t);case"bvec3":return Vh(3*t);case"bvec4":return Vh(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const on=[{test:i=>i.type==="float"&&i.size===1&&!i.isArray,code:i=>`
29
+ `;function dp(i,t,e){const s=i.createShader(t);return i.shaderSource(s,e),i.compileShader(s),s}function Oh(i){const t=new Array(i);for(let e=0;e<t.length;e++)t[e]=!1;return t}function fp(i,t){switch(i){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return Oh(2*t);case"bvec3":return Oh(3*t);case"bvec4":return Oh(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const on=[{test:i=>i.type==="float"&&i.size===1&&!i.isArray,code:i=>`
30
30
  if(uv["${i}"] !== ud["${i}"].value)
31
31
  {
32
32
  ud["${i}"].value = uv["${i}"]
@@ -146,7 +146,7 @@ void main(void){
146
146
  cv[3] = v[3];
147
147
 
148
148
  gl.uniform4f(ud["${i}"].location, v[0], v[1], v[2], v[3])
149
- }`}],p1={float:`
149
+ }`}],g1={float:`
150
150
  if (cv !== v)
151
151
  {
152
152
  cu.value = v;
@@ -282,7 +282,7 @@ void main(void){
282
282
  cu.value = v;
283
283
 
284
284
  gl.uniform1i(location, v);
285
- }`},m1={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 g1(i,t){var s;const e=[`
285
+ }`},_1={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 y1(i,t){var s;const e=[`
286
286
  var v = null;
287
287
  var cv = null;
288
288
  var cu = null;
@@ -292,18 +292,18 @@ void main(void){
292
292
  renderer.shader.syncUniformBufferGroup(uv.${r}, '${r}');
293
293
  `):e.push(`
294
294
  renderer.shader.syncUniformGroup(uv.${r}, syncData);
295
- `));continue}const a=i.uniforms[r];let h=!1;for(let o=0;o<on.length;o++)if(on[o].test(n,a)){e.push(on[o].code(r,a)),h=!0;break}if(!h){const o=(n.size===1&&!n.isArray?p1:m1)[n.type].replace("location",`ud["${r}"].location`);e.push(`
295
+ `));continue}const a=i.uniforms[r];let h=!1;for(let o=0;o<on.length;o++)if(on[o].test(n,a)){e.push(on[o].code(r,a)),h=!0;break}if(!h){const o=(n.size===1&&!n.isArray?g1:_1)[n.type].replace("location",`ud["${r}"].location`);e.push(`
296
296
  cu = ud["${r}"];
297
297
  cv = cu.value;
298
298
  v = uv["${r}"];
299
299
  ${o};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
300
- `))}const xp={};let an=xp;function _1(){if(an===xp||an!=null&&an.isContextLost()){const i=z.ADAPTER.createCanvas();let t;z.PREFER_ENV>=Ns.WEBGL2&&(t=i.getContext("webgl2",{})),t||(t=i.getContext("webgl",{})||i.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),an=t}return an}let ga;function y1(){if(!ga){ga=os.MEDIUM;const i=_1();if(i&&i.getShaderPrecisionFormat){const t=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT);t&&(ga=t.precision?os.HIGH:os.MEDIUM)}}return ga}function vp(i,t){const e=i.getShaderSource(t).split(`
300
+ `))}const pp={};let an=pp;function x1(){if(an===pp||an!=null&&an.isContextLost()){const i=z.ADAPTER.createCanvas();let t;z.PREFER_ENV>=Ns.WEBGL2&&(t=i.getContext("webgl2",{})),t||(t=i.getContext("webgl",{})||i.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),an=t}return an}let ga;function v1(){if(!ga){ga=os.MEDIUM;const i=x1();if(i&&i.getShaderPrecisionFormat){const t=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT);t&&(ga=t.precision?os.HIGH:os.MEDIUM)}}return ga}function mp(i,t){const e=i.getShaderSource(t).split(`
301
301
  `).map((l,u)=>`${u}: ${l}`),s=i.getShaderInfoLog(t),r=s.split(`
302
302
  `),n={},a=r.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!n[l]?(n[l]=!0,!0):!1),h=[""];a.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,h.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const o=e.join(`
303
- `);h[0]=o,console.error(s),console.groupCollapsed("click to view full shader code"),console.warn(...h),console.groupEnd()}function x1(i,t,e,s){i.getProgramParameter(t,i.LINK_STATUS)||(i.getShaderParameter(e,i.COMPILE_STATUS)||vp(i,e),i.getShaderParameter(s,i.COMPILE_STATUS)||vp(i,s),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(t)))}const v1={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 bp(i){return v1[i]}let _a=null;const wp={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 Ep(i,t){if(!_a){const e=Object.keys(wp);_a={};for(let s=0;s<e.length;++s){const r=e[s];_a[i[r]]=wp[r]}}return _a[t]}function Tp(i,t,e){if(i.substring(0,9)!=="precision"){let s=t;return t===os.HIGH&&e!==os.HIGH&&(s=os.MEDIUM),`precision ${s} float;
304
- ${i}`}else if(e!==os.HIGH&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}let ro;function b1(){if(typeof ro=="boolean")return ro;try{ro=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ro=!1}return ro}let w1=0;const ya={},Uh=class Ln{constructor(t,e,s="pixi-shader",r={}){this.extra={},this.id=w1++,this.vertexSrc=t||Ln.defaultVertexSrc,this.fragmentSrc=e||Ln.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,"-"),ya[s]?(ya[s]++,s+=`-${ya[s]}`):ya[s]=1,this.vertexSrc=`#define SHADER_NAME ${s}
303
+ `);h[0]=o,console.error(s),console.groupCollapsed("click to view full shader code"),console.warn(...h),console.groupEnd()}function b1(i,t,e,s){i.getProgramParameter(t,i.LINK_STATUS)||(i.getShaderParameter(e,i.COMPILE_STATUS)||mp(i,e),i.getShaderParameter(s,i.COMPILE_STATUS)||mp(i,s),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(t)))}const w1={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 gp(i){return w1[i]}let _a=null;const _p={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 yp(i,t){if(!_a){const e=Object.keys(_p);_a={};for(let s=0;s<e.length;++s){const r=e[s];_a[i[r]]=_p[r]}}return _a[t]}function xp(i,t,e){if(i.substring(0,9)!=="precision"){let s=t;return t===os.HIGH&&e!==os.HIGH&&(s=os.MEDIUM),`precision ${s} float;
304
+ ${i}`}else if(e!==os.HIGH&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}let ro;function E1(){if(typeof ro=="boolean")return ro;try{ro=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ro=!1}return ro}let T1=0;const ya={},Lh=class Ln{constructor(t,e,s="pixi-shader",r={}){this.extra={},this.id=T1++,this.vertexSrc=t||Ln.defaultVertexSrc,this.fragmentSrc=e||Ln.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,"-"),ya[s]?(ya[s]++,s+=`-${ya[s]}`):ya[s]=1,this.vertexSrc=`#define SHADER_NAME ${s}
305
305
  ${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${s}
306
- ${this.fragmentSrc}`,this.vertexSrc=Tp(this.vertexSrc,Ln.defaultVertexPrecision,os.HIGH),this.fragmentSrc=Tp(this.fragmentSrc,Ln.defaultFragmentPrecision,y1())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return f1}static get defaultFragmentSrc(){return d1}static from(t,e,s){const r=t+e;let n=hp[r];return n||(hp[r]=n=new Ln(t,e,s)),n}};Uh.defaultVertexPrecision=os.HIGH,Uh.defaultFragmentPrecision=fr.apple.device?os.HIGH:os.MEDIUM;let yr=Uh,E1=0;class Es{constructor(t,e,s){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=E1++,this.static=!!e,this.ubo=!!s,t instanceof Jt?(this.buffer=t,this.buffer.type=Us.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new Jt(new Float32Array(1)),this.buffer.type=Us.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 Es(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 Es(t,e,s)}static uboFrom(t,e){return new Es(t,e??!0,!0)}}class Zs{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof Es?this.uniformGroup=e:this.uniformGroup=new Es(e):this.uniformGroup=new Es({}),this.disposeRunner=new ws("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=yr.from(t,e);return new Zs(r,s)}}class T1{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]=Es.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 yr(this.vertexSrc,r)}const e={tint:new Float32Array([1,1,1,1]),translationMatrix:new Rt,default:this.defaultGroupCache[t]};return new Zs(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
306
+ ${this.fragmentSrc}`,this.vertexSrc=xp(this.vertexSrc,Ln.defaultVertexPrecision,os.HIGH),this.fragmentSrc=xp(this.fragmentSrc,Ln.defaultFragmentPrecision,v1())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return m1}static get defaultFragmentSrc(){return p1}static from(t,e,s){const r=t+e;let n=ip[r];return n||(ip[r]=n=new Ln(t,e,s)),n}};Lh.defaultVertexPrecision=os.HIGH,Lh.defaultFragmentPrecision=fr.apple.device?os.HIGH:os.MEDIUM;let yr=Lh,A1=0;class Es{constructor(t,e,s){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=A1++,this.static=!!e,this.ubo=!!s,t instanceof Jt?(this.buffer=t,this.buffer.type=Us.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new Jt(new Float32Array(1)),this.buffer.type=Us.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 Es(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 Es(t,e,s)}static uboFrom(t,e){return new Es(t,e??!0,!0)}}class Zs{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof Es?this.uniformGroup=e:this.uniformGroup=new Es(e):this.uniformGroup=new Es({}),this.disposeRunner=new ws("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=yr.from(t,e);return new Zs(r,s)}}class S1{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]=Es.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 yr(this.vertexSrc,r)}const e={tint:new Float32Array([1,1,1,1]),translationMatrix:new Rt,default:this.defaultGroupCache[t]};return new Zs(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
307
307
  `,e+=`
308
308
  `;for(let s=0;s<t;s++)s>0&&(e+=`
309
309
  else `),s<t-1&&(e+=`if(vTextureId < ${s}.5)`),e+=`
@@ -311,7 +311,7 @@ else `),s<t-1&&(e+=`if(vTextureId < ${s}.5)`),e+=`
311
311
  color = texture2D(uSamplers[${s}], vTextureCoord);`,e+=`
312
312
  }`;return e+=`
313
313
  `,e+=`
314
- `,e}}class Gh{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 A1(){return!fr.apple.device}function S1(i){let t=!0;const e=z.ADAPTER.getNavigator();if(fr.tablet||fr.phone){if(fr.apple.device){const s=e.userAgent.match(/OS (\d+)_(\d+)?/);s&&parseInt(s[1],10)<11&&(t=!1)}if(fr.android.device){const s=e.userAgent.match(/Android\s([0-9.]*)/);s&&parseInt(s[1],10)<7&&(t=!1)}}return t?i:4}class xa{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}var C1=`varying vec2 vTextureCoord;
314
+ `,e}}class Nh{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 C1(){return!fr.apple.device}function I1(i){let t=!0;const e=z.ADAPTER.getNavigator();if(fr.tablet||fr.phone){if(fr.apple.device){const s=e.userAgent.match(/OS (\d+)_(\d+)?/);s&&parseInt(s[1],10)<11&&(t=!1)}if(fr.android.device){const s=e.userAgent.match(/Android\s([0-9.]*)/);s&&parseInt(s[1],10)<7&&(t=!1)}}return t?i:4}class xa{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}var P1=`varying vec2 vTextureCoord;
315
315
  varying vec4 vColor;
316
316
  varying float vTextureId;
317
317
  uniform sampler2D uSamplers[%count%];
@@ -321,7 +321,7 @@ void main(void){
321
321
  %forloop%
322
322
  gl_FragColor = color * vColor;
323
323
  }
324
- `,I1=`precision highp float;
324
+ `,R1=`precision highp float;
325
325
  attribute vec2 aVertexPosition;
326
326
  attribute vec2 aTextureCoord;
327
327
  attribute vec4 aColor;
@@ -342,14 +342,14 @@ void main(void){
342
342
  vTextureId = aTextureId;
343
343
  vColor = aColor * tint;
344
344
  }
345
- `;const io=class ks extends xa{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=mp,this.vertexSize=6,this.state=js.for2d(),this.size=ks.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(){return this._defaultMaxTextures=this._defaultMaxTextures??S1(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??A1(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return ot("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return I1}static get defaultFragmentTemplate(){return C1}setShaderGenerator({vertex:t=ks.defaultVertexSrc,fragment:e=ks.defaultFragmentTemplate}={}){this.shaderGenerator=new T1(t,e)}contextChange(){const t=this.renderer.gl;z.PREFER_ENV===Ns.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),ks.defaultMaxTextures),this.maxTextures=r1(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}=ks,s=this.size/4,r=Math.floor(s/this.maxTextures)+1;for(;t.length<s;)t.push(new Dh);for(;e.length<r;)e.push(new Gh);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=ks._textureArrayPool,r=this.renderer.batch,n=this._tempBoundTextures,a=this.renderer.textureGC.count;let h=++et._globalBatch,o=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!==h&&(l.count>=e&&(r.boundArray(l,n,h,e),this.buildDrawCalls(l,u,c),u=c,l=s[++o],++h),d._batchEnabled=h,d.touched=a,l.elements[l.count++]=d)}l.count>0&&(r.boundArray(l,n,h,e),this.buildDrawCalls(l,u,this._bufferSize),++o,++h);for(let c=0;c<n.length;c++)n[c]=null;et._globalBatch=h}buildDrawCalls(t,e,s){const{_bufferedElements:r,_attributeBuffer:n,_indexBuffer:a,vertexSize:h}=this,o=ks._drawCallPool;let l=this._dcIndex,u=this._aIndex,c=this._iIndex,d=o[l];d.start=this._iIndex,d.texArray=t;for(let f=e;f<s;++f){const p=r[f],m=p._texture.baseTexture,g=rp[m.alphaMode?1:0][p.blendMode];r[f]=null,e<f&&d.blend!==g&&(d.size=c-d.start,e=f,d=o[++l],d.texArray=t,d.start=c),this.packInterleavedGeometry(p,n,a,u,c),u+=p.vertexData.length/2*h,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;ks.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=ks._drawCallPool;let n=null;for(let a=0;a<t;a++){const{texArray:h,type:o,size:l,start:u,blend:c}=r[a];n!==h&&(n=h,this.bindAndClearTexArray(h)),this.state.blendMode=c,s.set(this.state),e.drawElements(o,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),ks.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=oa(Math.ceil(t/8)),s=ap(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 Sh(r*this.vertexSize*4)),n}getIndexBuffer(t){const e=oa(Math.ceil(t/12)),s=ap(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:h}=e,o=r/this.vertexSize,l=t.uvs,u=t.indices,c=t.vertexData,d=t._texture.baseTexture._batchLocation,f=Math.min(t.worldAlpha,1),p=Ct.shared.setValue(t._tintRGB).toPremultiplied(f,t._texture.baseTexture.alphaMode>0);for(let m=0;m<c.length;m+=2)h[r++]=c[m],h[r++]=c[m+1],h[r++]=l[m],h[r++]=l[m+1],a[r++]=p,h[r++]=d;for(let m=0;m<u.length;m++)s[n++]=o+u[m]}};io.defaultBatchSize=4096,io.extension={name:"batch",type:Y.RendererPlugin},io._drawCallPool=[],io._textureArrayPool=[];let bi=io;K.add(bi);var P1=`varying vec2 vTextureCoord;
345
+ `;const io=class ks extends xa{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=cp,this.vertexSize=6,this.state=js.for2d(),this.size=ks.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(){return this._defaultMaxTextures=this._defaultMaxTextures??I1(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??C1(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return ot("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return R1}static get defaultFragmentTemplate(){return P1}setShaderGenerator({vertex:t=ks.defaultVertexSrc,fragment:e=ks.defaultFragmentTemplate}={}){this.shaderGenerator=new S1(t,e)}contextChange(){const t=this.renderer.gl;z.PREFER_ENV===Ns.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),ks.defaultMaxTextures),this.maxTextures=n1(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}=ks,s=this.size/4,r=Math.floor(s/this.maxTextures)+1;for(;t.length<s;)t.push(new Fh);for(;e.length<r;)e.push(new Nh);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=ks._textureArrayPool,r=this.renderer.batch,n=this._tempBoundTextures,a=this.renderer.textureGC.count;let h=++et._globalBatch,o=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!==h&&(l.count>=e&&(r.boundArray(l,n,h,e),this.buildDrawCalls(l,u,c),u=c,l=s[++o],++h),d._batchEnabled=h,d.touched=a,l.elements[l.count++]=d)}l.count>0&&(r.boundArray(l,n,h,e),this.buildDrawCalls(l,u,this._bufferSize),++o,++h);for(let c=0;c<n.length;c++)n[c]=null;et._globalBatch=h}buildDrawCalls(t,e,s){const{_bufferedElements:r,_attributeBuffer:n,_indexBuffer:a,vertexSize:h}=this,o=ks._drawCallPool;let l=this._dcIndex,u=this._aIndex,c=this._iIndex,d=o[l];d.start=this._iIndex,d.texArray=t;for(let f=e;f<s;++f){const p=r[f],m=p._texture.baseTexture,g=Qf[m.alphaMode?1:0][p.blendMode];r[f]=null,e<f&&d.blend!==g&&(d.size=c-d.start,e=f,d=o[++l],d.texArray=t,d.start=c),this.packInterleavedGeometry(p,n,a,u,c),u+=p.vertexData.length/2*h,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;ks.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=ks._drawCallPool;let n=null;for(let a=0;a<t;a++){const{texArray:h,type:o,size:l,start:u,blend:c}=r[a];n!==h&&(n=h,this.bindAndClearTexArray(h)),this.state.blendMode=c,s.set(this.state),e.drawElements(o,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),ks.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=oa(Math.ceil(t/8)),s=sp(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 Eh(r*this.vertexSize*4)),n}getIndexBuffer(t){const e=oa(Math.ceil(t/12)),s=sp(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:h}=e,o=r/this.vertexSize,l=t.uvs,u=t.indices,c=t.vertexData,d=t._texture.baseTexture._batchLocation,f=Math.min(t.worldAlpha,1),p=Ct.shared.setValue(t._tintRGB).toPremultiplied(f,t._texture.baseTexture.alphaMode>0);for(let m=0;m<c.length;m+=2)h[r++]=c[m],h[r++]=c[m+1],h[r++]=l[m],h[r++]=l[m+1],a[r++]=p,h[r++]=d;for(let m=0;m<u.length;m++)s[n++]=o+u[m]}};io.defaultBatchSize=4096,io.extension={name:"batch",type:Y.RendererPlugin},io._drawCallPool=[],io._textureArrayPool=[];let bi=io;K.add(bi);var M1=`varying vec2 vTextureCoord;
346
346
 
347
347
  uniform sampler2D uSampler;
348
348
 
349
349
  void main(void){
350
350
  gl_FragColor = texture2D(uSampler, vTextureCoord);
351
351
  }
352
- `,R1=`attribute vec2 aVertexPosition;
352
+ `,F1=`attribute vec2 aVertexPosition;
353
353
 
354
354
  uniform mat3 projectionMatrix;
355
355
 
@@ -375,7 +375,7 @@ void main(void)
375
375
  gl_Position = filterVertexPosition();
376
376
  vTextureCoord = filterTextureCoord();
377
377
  }
378
- `;const Xh=class Do extends Zs{constructor(t,e,s){const r=yr.from(t||Do.defaultVertexSrc,e||Do.defaultFragmentSrc);super(r,s),this.padding=0,this.resolution=Do.defaultResolution,this.multisample=Do.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new js}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 R1}static get defaultFragmentSrc(){return P1}};Xh.defaultResolution=1,Xh.defaultMultisample=re.NONE;let pe=Xh;class va{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Ct(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;const{backgroundColor:e,background:s,backgroundAlpha:r}=t,n=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(){}}va.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},va.extension={type:[Y.RendererSystem,Y.CanvasRendererSystem],name:"background"},K.add(va);class Ap{constructor(t){this.renderer=t,this.emptyRenderer=new xa(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:h}=t;let o=0;for(let l=0;l<h;l++){const u=n[l],c=u._batchLocation;if(c>=0&&c<r&&e[c]===u){a[l]=c;continue}for(;o<r;){const d=e[o];if(d&&d._batchEnabled===s&&d._batchLocation===o){o++;continue}a[l]=o,u._batchLocation=o,e[o]=u;break}}}destroy(){this.renderer=null}}Ap.extension={type:Y.RendererSystem,name:"batch"},K.add(Ap);let Sp=0;class ba{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=Sp++}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=Sp++,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(z.PREFER_ENV>=Ns.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"),bptc:t.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){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")}}ba.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},ba.extension={type:Y.RendererSystem,name:"context"},K.add(ba);class $h{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 ws("disposeFramebuffer"),this.multisample=re.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new et(null,{scaleMode:je.NEAREST,resolution:1,mipmap:vs.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new et(null,{scaleMode:je.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:vs.OFF,format:G.DEPTH_COMPONENT,type:tt.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 Cp extends et{constructor(t={}){if(typeof t=="number"){const e=arguments[0],s=arguments[1],r=arguments[2],n=arguments[3];t={width:e,height:s,scaleMode:r,resolution:n}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=re.NONE),super(null,t),this.mipmap=vs.OFF,this.valid=!0,this._clear=new Ct([0,0,0,0]),this.framebuffer=new $h(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 xr extends so{constructor(t){const e=t,s=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,r=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(s,r),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,s){s===void 0&&!e.startsWith("data:")?t.crossOrigin=t1(e):s!==!1&&(t.crossOrigin=typeof s=="string"?s:"anonymous")}upload(t,e,s,r){const n=t.gl,a=e.realWidth,h=e.realHeight;if(r=r||this.source,typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement){if(!r.complete||r.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement&&r.readyState<=1)return!1;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Re.UNPACK),!this.noSubImage&&e.target===n.TEXTURE_2D&&s.width===a&&s.height===h?n.texSubImage2D(n.TEXTURE_2D,0,0,0,e.format,s.type,r):(s.width=a,s.height=h,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 Ip extends xr{constructor(t,e){if(e=e||{},typeof t=="string"){const s=new Image;xr.crossOrigin(s,t,e.crossorigin),s.src=t,t=s}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=(e.createBitmap??z.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===Re.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 h=n[a];if(h!==s&&h.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<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}}class Yh{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,h=t.height/2/n,o=t.x/r+a,l=t.y/n+h;s=Nt.add(s,Nt.NW),this.x0=o+a*Nt.uX(s),this.y0=l+h*Nt.uY(s),s=Nt.add(s,2),this.x1=o+a*Nt.uX(s),this.y1=l+h*Nt.uY(s),s=Nt.add(s,2),this.x2=o+a*Nt.uX(s),this.y2=l+h*Nt.uY(s),s=Nt.add(s,2),this.x3=o+a*Nt.uX(s),this.y3=l+h*Nt.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}}Yh.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};const Pp=new Yh;function wa(i){i.destroy=function(){},i.on=function(){},i.once=function(){},i.emit=function(){}}class q extends Xs{constructor(t,e,s,r,n,a,h){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new rt(0,0,1,1)),t instanceof q&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=r,this.valid=!1,this.destroyed=!1,this._uvs=Pp,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 st(a.x,a.y):new st(0,0),this.defaultBorders=h,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&&zs[e.url]&&q.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,q.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var r;const t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),s=new q(this.baseTexture,!this.noFrame&&t,e,(r=this.trim)==null?void 0:r.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(s._frame=t),s}updateUvs(){this._uvs===Pp&&(this._uvs=new Yh),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},s=z.STRICT_TEXTURE_CACHE){const r=typeof t=="string";let n=null;if(r)n=t;else if(t instanceof et){if(!t.cacheId){const h=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${h}-${gi()}`,et.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const h=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${h}_${gi()}`}n=t._pixiId}let a=zs[n];if(r&&s&&!a)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!a&&!(t instanceof et)?(e.resolution||(e.resolution=_r(t)),a=new q(new et(t,e)),a.baseTexture.cacheId=n,et.addToCache(a.baseTexture,n),q.addToCache(a,n)):!a&&t instanceof et&&(a=new q(t),q.addToCache(a,n)),a}static fromURL(t,e){const s=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),r=q.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 q(et.fromBuffer(t,e,s,r))}static fromLoader(t,e,s,r){const n=new et(t,Object.assign({scaleMode:et.defaultOptions.scaleMode,resolution:_r(e)},r)),{resource:a}=n;a instanceof Ip&&(a.url=e);const h=new q(n);return s||(s=e),et.addToCache(h.baseTexture,s),q.addToCache(h,s),s!==e&&(et.addToCache(h.baseTexture,e),q.addToCache(h,e)),h.baseTexture.valid?Promise.resolve(h):new Promise(o=>{h.baseTexture.once("loaded",()=>o(h))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),zs[e]&&zs[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),zs[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=zs[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete zs[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)zs[t.textureCacheIds[e]]===t&&delete zs[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,h=s+n>this.baseTexture.height;if(a||h){const o=a&&h?"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} ${o} ${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 q._EMPTY||(q._EMPTY=new q(new et),wa(q._EMPTY),wa(q._EMPTY.baseTexture)),q._EMPTY}static get WHITE(){if(!q._WHITE){const t=z.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),q._WHITE=new q(et.from(t)),wa(q._WHITE),wa(q._WHITE.baseTexture)}return q._WHITE}}class wi extends q{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 wi(new Cp(t))}}class Rp{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,s=re.NONE){const r=new Cp(Object.assign({width:t,height:e,resolution:1,multisample:s},this.textureOptions));return new wi(r)}getOptimalTexture(t,e,s=1,r=re.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=oa(t),e=oa(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||re.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}}}Rp.SCREEN_KEY=-1;class M1 extends Lr{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class Mp extends Lr{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 Jt(this.vertices),this.uvBuffer=new Jt(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 F1{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=re.NONE,this.sourceFrame=new rt,this.destinationFrame=new rt,this.bindingSourceFrame=new rt,this.bindingDestinationFrame=new rt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const Ea=[new st,new st,new st,new st],Hh=new Rt;class Fp{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new Rp,this.statePool=[],this.quad=new M1,this.quadUv=new Mp,this.tempRect=new rt,this.activeState={},this.globalUniforms=new Es({outputFrame:new rt,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){const s=this.renderer,r=this.defaultFilterStack,n=this.statePool.pop()||new F1,a=s.renderTexture;let h,o;if(a.current){const g=a.current;h=g.resolution,o=g.multisample}else h=s.resolution,o=s.multisample;let l=e[0].resolution||h,u=e[0].multisample??o,c=e[0].padding,d=e[0].autoFit,f=e[0].legacy??!0;for(let g=1;g<e.length;g++){const _=e[g];l=Math.min(l,_.resolution||h),u=Math.min(u,_.multisample??o),c=this.useMaxPadding?Math.max(c,_.padding):c+_.padding,d=d&&_.autoFit,f=f||(_.legacy??!0)}r.length===1&&(this.defaultFilterStack[0].renderTexture=a.current),r.push(n),n.resolution=l,n.multisample=u,n.legacy=f,n.target=t,n.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),n.sourceFrame.pad(c);const p=this.tempRect.copyFrom(a.sourceFrame);s.projection.transform&&this.transformAABB(Hh.copyFrom(s.projection.transform).invert(),p),d?(n.sourceFrame.fit(p),(n.sourceFrame.width<=0||n.sourceFrame.height<=0)&&(n.sourceFrame.width=0,n.sourceFrame.height=0)):n.sourceFrame.intersects(p)||(n.sourceFrame.width=0,n.sourceFrame.height=0),this.roundFrame(n.sourceFrame,a.current?a.current.resolution:s.resolution,a.sourceFrame,a.destinationFrame,s.projection.transform),n.renderTexture=this.getOptimalFilterTexture(n.sourceFrame.width,n.sourceFrame.height,l,u),n.filters=e,n.destinationFrame.width=n.renderTexture.width,n.destinationFrame.height=n.renderTexture.height;const m=this.tempRect;m.x=0,m.y=0,m.width=n.sourceFrame.width,m.height=n.sourceFrame.height,n.renderTexture.filterFrame=n.sourceFrame,n.bindingSourceFrame.copyFrom(a.sourceFrame),n.bindingDestinationFrame.copyFrom(a.destinationFrame),n.transform=s.projection.transform,s.projection.transform=null,a.bind(n.renderTexture,n.sourceFrame,m),s.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,h=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],h[0]=.5*a[2],h[1]=.5*a[3],h[2]=e.sourceFrame.width*n[2]-.5*a[2],h[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 o=t[t.length-1];if(this.renderer.framebuffer.blit(),s.length===1)s[0].apply(this,e.renderTexture,o.renderTexture,Vs.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,Vs.CLEAR,e);const d=l;l=u,u=d}s[c].apply(this,l,o.renderTexture,Vs.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=Vs.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?void 0: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===Vs.CLEAR||e===Vs.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(xs.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(xs.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),h=e.worldTransform.copyTo(Rt.TEMP_MATRIX);return h.invert(),a.prepend(h),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=re.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||re.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=Ea[0],r=Ea[1],n=Ea[2],a=Ea[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 h=Math.min(s.x,r.x,n.x,a.x),o=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=h,e.y=o,e.width=l-h,e.height=u-o}roundFrame(t,e,s,r,n){if(!(t.width<=0||t.height<=0||s.width<=0||s.height<=0)){if(n){const{a,b:h,c:o,d:l}=n;if((Math.abs(h)>1e-4||Math.abs(o)>1e-4)&&(Math.abs(a)>1e-4||Math.abs(l)>1e-4))return}n=n?Hh.copyFrom(n):Hh.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)}}}Fp.extension={type:Y.RendererSystem,name:"filter"},K.add(Fp);class k1{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=re.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const B1=new rt;class kp{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new $h(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 rt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,s=this.renderer.context.extensions.depthTexture;z.PREFER_ENV===Ns.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 h=t.colorTextures[a];this.renderer.texture.unbind(h.parentTextureArray||h)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){const a=e.width>>s,h=e.height>>s,o=a/e.width;this.setViewport(e.x*o,e.y*o,a,h)}else{const a=t.width>>s,h=t.height>>s;this.setViewport(0,0,a,h)}}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=Cl.COLOR|Cl.DEPTH){const{gl:a}=this;a.clearColor(t,e,s,r),a.clear(n)}initFramebuffer(t){const{gl:e}=this,s=new k1(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 h=r[a],o=h.parentTextureArray||h;this.renderer.texture.bind(o,0),a===0&&s.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,s.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,s.multisample,o._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 h=[];for(let o=0;o<a;o++){const l=n[o],u=l.parentTextureArray||l;this.renderer.texture.bind(u,0),o===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+o,l.target,u._glTextures[this.CONTEXT_UID].texture,e),h.push(s.COLOR_ATTACHMENT0+o))}if(h.length>1&&s.drawBuffers(h),t.depthTexture&&this.writeDepthTexture){const o=t.depthTexture;this.renderer.texture.bind(o,0),s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,o._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){r.stencil=r.stencil||s.createRenderbuffer();let o,l;this.renderer.context.webGLVersion===1?(o=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH_STENCIL):t.depth&&t.stencil?(o=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH24_STENCIL8):t.depth?(o=s.DEPTH_ATTACHMENT,l=s.DEPTH_COMPONENT24):(o=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,o,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=re.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=re.NONE),s}blit(t,e,s){const{current:r,renderer:n,gl:a,CONTEXT_UID:h}=this;if(n.context.webGLVersion!==2||!r)return;const o=r.glFramebuffers[h];if(!o)return;if(!t){if(!o.msaaBuffer)return;const u=r.colorTextures[0];if(!u)return;o.blitFramebuffer||(o.blitFramebuffer=new $h(r.width,r.height),o.blitFramebuffer.addColorTexture(0,u)),t=o.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=B1,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,o.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 h,o;this.renderer.context.webGLVersion===1?(h=n.DEPTH_STENCIL_ATTACHMENT,o=n.DEPTH_STENCIL):t.depth?(h=n.DEPTH_STENCIL_ATTACHMENT,o=n.DEPTH24_STENCIL8):(h=n.STENCIL_ATTACHMENT,o=n.STENCIL_INDEX8),e.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,e.multisample,o,s,r):n.renderbufferStorage(n.RENDERBUFFER,o,s,r),n.framebufferRenderbuffer(n.FRAMEBUFFER,h,n.RENDERBUFFER,a)}reset(){this.current=this.unknownFramebuffer,this.viewport=new rt}destroy(){this.renderer=null}}kp.extension={type:Y.RendererSystem,name:"framebuffer"},K.add(kp);const Wh={5126:4,5123:2,5121:1};class Bp{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;z.PREFER_ENV===Ns.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,h,o)=>s.drawElementsInstancedANGLE(r,n,a,h,o),t.drawArraysInstanced=(r,n,a,h)=>s.drawArraysInstancedANGLE(r,n,a,h)):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,h=e.program;h.glPrograms[n]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,h);const o=this.getSignature(t,h),l=t.glVertexArrayObjects[this.CONTEXT_UID];let u=l[o];if(u)return l[h.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&&h.attributeData[m]?d[m].size=h.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*Wh[d[m].type];for(const m in d){const g=d[m],_=g.size;g.stride===void 0&&(f[g.buffer]===_*Wh[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=p[g.buffer],p[g.buffer]+=_*Wh[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,h),l[h.id]=u,l[o]=u,r.bindVertexArray(null),a.unbind(Us.ARRAY_BUFFER),u}disposeGeometry(t,e){var h;if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];const s=t.glVertexArrayObjects[this.CONTEXT_UID],r=this.gl,n=t.buffers,a=(h=this.renderer)==null?void 0:h.buffer;if(t.disposeRunner.remove(this),!!s){if(a)for(let o=0;o<n.length;o++){const l=n[o]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&a.dispose(n[o],e))}if(!e){for(const o in s)if(o[0]==="g"){const l=s[o];this._activeVao===l&&this.unbind(),r.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,h=t.attributes;t.indexBuffer&&n.bind(t.indexBuffer);let o=null;for(const l in h){const u=h[l],c=a[u.buffer],d=c._glBuffers[r];if(e.attributeData[l]){o!==d&&(n.bind(c),o=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 h=a.indexBuffer.data.BYTES_PER_ELEMENT,o=h===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;h===2||h===4&&this.canUseUInt32ElementIndex?a.instanced?n.drawElementsInstanced(t,e||a.indexBuffer.data.length,o,(s||0)*h,r||1):n.drawElements(t,e||a.indexBuffer.data.length,o,(s||0)*h):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}}Bp.extension={type:Y.RendererSystem,name:"geometry"},K.add(Bp);const Dp=new Rt;class Op{constructor(t,e){this._texture=t,this.mapCoord=new Rt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);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&&(Dp.set(r.width/n.width,0,0,r.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(Dp));const a=e.baseTexture,h=this.uClampFrame,o=this.clampMargin/a.resolution,l=this.clampOffset;return h[0]=(e._frame.x+o+l)/a.width,h[1]=(e._frame.y+o+l)/a.height,h[2]=(e._frame.x+e._frame.width-o+l)/a.width,h[3]=(e._frame.y+e._frame.height-o+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 D1=`varying vec2 vMaskCoord;
378
+ `;const Vh=class Do extends Zs{constructor(t,e,s){const r=yr.from(t||Do.defaultVertexSrc,e||Do.defaultFragmentSrc);super(r,s),this.padding=0,this.resolution=Do.defaultResolution,this.multisample=Do.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new js}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 F1}static get defaultFragmentSrc(){return M1}};Vh.defaultResolution=1,Vh.defaultMultisample=re.NONE;let pe=Vh;class va{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Ct(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;const{backgroundColor:e,background:s,backgroundAlpha:r}=t,n=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(){}}va.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},va.extension={type:[Y.RendererSystem,Y.CanvasRendererSystem],name:"background"},K.add(va);class vp{constructor(t){this.renderer=t,this.emptyRenderer=new xa(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:h}=t;let o=0;for(let l=0;l<h;l++){const u=n[l],c=u._batchLocation;if(c>=0&&c<r&&e[c]===u){a[l]=c;continue}for(;o<r;){const d=e[o];if(d&&d._batchEnabled===s&&d._batchLocation===o){o++;continue}a[l]=o,u._batchLocation=o,e[o]=u;break}}}destroy(){this.renderer=null}}vp.extension={type:Y.RendererSystem,name:"batch"},K.add(vp);let bp=0;class ba{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=bp++}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=bp++,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(z.PREFER_ENV>=Ns.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"),bptc:t.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){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")}}ba.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},ba.extension={type:Y.RendererSystem,name:"context"},K.add(ba);class Uh{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 ws("disposeFramebuffer"),this.multisample=re.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new et(null,{scaleMode:je.NEAREST,resolution:1,mipmap:vs.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new et(null,{scaleMode:je.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:vs.OFF,format:G.DEPTH_COMPONENT,type:tt.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 wp extends et{constructor(t={}){if(typeof t=="number"){const e=arguments[0],s=arguments[1],r=arguments[2],n=arguments[3];t={width:e,height:s,scaleMode:r,resolution:n}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=re.NONE),super(null,t),this.mipmap=vs.OFF,this.valid=!0,this._clear=new Ct([0,0,0,0]),this.framebuffer=new Uh(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 xr extends so{constructor(t){const e=t,s=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,r=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(s,r),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,s){s===void 0&&!e.startsWith("data:")?t.crossOrigin=s1(e):s!==!1&&(t.crossOrigin=typeof s=="string"?s:"anonymous")}upload(t,e,s,r){const n=t.gl,a=e.realWidth,h=e.realHeight;if(r=r||this.source,typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement){if(!r.complete||r.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement&&r.readyState<=1)return!1;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Re.UNPACK),!this.noSubImage&&e.target===n.TEXTURE_2D&&s.width===a&&s.height===h?n.texSubImage2D(n.TEXTURE_2D,0,0,0,e.format,s.type,r):(s.width=a,s.height=h,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 Ep extends xr{constructor(t,e){if(e=e||{},typeof t=="string"){const s=new Image;xr.crossOrigin(s,t,e.crossorigin),s.src=t,t=s}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=(e.createBitmap??z.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===Re.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 h=n[a];if(h!==s&&h.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<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}}class Gh{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,h=t.height/2/n,o=t.x/r+a,l=t.y/n+h;s=Nt.add(s,Nt.NW),this.x0=o+a*Nt.uX(s),this.y0=l+h*Nt.uY(s),s=Nt.add(s,2),this.x1=o+a*Nt.uX(s),this.y1=l+h*Nt.uY(s),s=Nt.add(s,2),this.x2=o+a*Nt.uX(s),this.y2=l+h*Nt.uY(s),s=Nt.add(s,2),this.x3=o+a*Nt.uX(s),this.y3=l+h*Nt.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}}Gh.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};const Tp=new Gh;function wa(i){i.destroy=function(){},i.on=function(){},i.once=function(){},i.emit=function(){}}class q extends Xs{constructor(t,e,s,r,n,a,h){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new rt(0,0,1,1)),t instanceof q&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=r,this.valid=!1,this.destroyed=!1,this._uvs=Tp,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 st(a.x,a.y):new st(0,0),this.defaultBorders=h,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&&zs[e.url]&&q.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,q.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var r;const t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),s=new q(this.baseTexture,!this.noFrame&&t,e,(r=this.trim)==null?void 0:r.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(s._frame=t),s}updateUvs(){this._uvs===Tp&&(this._uvs=new Gh),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},s=z.STRICT_TEXTURE_CACHE){const r=typeof t=="string";let n=null;if(r)n=t;else if(t instanceof et){if(!t.cacheId){const h=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${h}-${gi()}`,et.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const h=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${h}_${gi()}`}n=t._pixiId}let a=zs[n];if(r&&s&&!a)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!a&&!(t instanceof et)?(e.resolution||(e.resolution=_r(t)),a=new q(new et(t,e)),a.baseTexture.cacheId=n,et.addToCache(a.baseTexture,n),q.addToCache(a,n)):!a&&t instanceof et&&(a=new q(t),q.addToCache(a,n)),a}static fromURL(t,e){const s=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),r=q.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 q(et.fromBuffer(t,e,s,r))}static fromLoader(t,e,s,r){const n=new et(t,Object.assign({scaleMode:et.defaultOptions.scaleMode,resolution:_r(e)},r)),{resource:a}=n;a instanceof Ep&&(a.url=e);const h=new q(n);return s||(s=e),et.addToCache(h.baseTexture,s),q.addToCache(h,s),s!==e&&(et.addToCache(h.baseTexture,e),q.addToCache(h,e)),h.baseTexture.valid?Promise.resolve(h):new Promise(o=>{h.baseTexture.once("loaded",()=>o(h))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),zs[e]&&zs[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),zs[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=zs[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete zs[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)zs[t.textureCacheIds[e]]===t&&delete zs[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,h=s+n>this.baseTexture.height;if(a||h){const o=a&&h?"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} ${o} ${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 q._EMPTY||(q._EMPTY=new q(new et),wa(q._EMPTY),wa(q._EMPTY.baseTexture)),q._EMPTY}static get WHITE(){if(!q._WHITE){const t=z.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),q._WHITE=new q(et.from(t)),wa(q._WHITE),wa(q._WHITE.baseTexture)}return q._WHITE}}class wi extends q{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 wi(new wp(t))}}class Ap{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,s=re.NONE){const r=new wp(Object.assign({width:t,height:e,resolution:1,multisample:s},this.textureOptions));return new wi(r)}getOptimalTexture(t,e,s=1,r=re.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=oa(t),e=oa(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||re.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}}}Ap.SCREEN_KEY=-1;class k1 extends Lr{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class Sp extends Lr{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 Jt(this.vertices),this.uvBuffer=new Jt(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 B1{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=re.NONE,this.sourceFrame=new rt,this.destinationFrame=new rt,this.bindingSourceFrame=new rt,this.bindingDestinationFrame=new rt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const Ea=[new st,new st,new st,new st],Xh=new Rt;class Cp{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new Ap,this.statePool=[],this.quad=new k1,this.quadUv=new Sp,this.tempRect=new rt,this.activeState={},this.globalUniforms=new Es({outputFrame:new rt,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){const s=this.renderer,r=this.defaultFilterStack,n=this.statePool.pop()||new B1,a=s.renderTexture;let h,o;if(a.current){const g=a.current;h=g.resolution,o=g.multisample}else h=s.resolution,o=s.multisample;let l=e[0].resolution||h,u=e[0].multisample??o,c=e[0].padding,d=e[0].autoFit,f=e[0].legacy??!0;for(let g=1;g<e.length;g++){const _=e[g];l=Math.min(l,_.resolution||h),u=Math.min(u,_.multisample??o),c=this.useMaxPadding?Math.max(c,_.padding):c+_.padding,d=d&&_.autoFit,f=f||(_.legacy??!0)}r.length===1&&(this.defaultFilterStack[0].renderTexture=a.current),r.push(n),n.resolution=l,n.multisample=u,n.legacy=f,n.target=t,n.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),n.sourceFrame.pad(c);const p=this.tempRect.copyFrom(a.sourceFrame);s.projection.transform&&this.transformAABB(Xh.copyFrom(s.projection.transform).invert(),p),d?(n.sourceFrame.fit(p),(n.sourceFrame.width<=0||n.sourceFrame.height<=0)&&(n.sourceFrame.width=0,n.sourceFrame.height=0)):n.sourceFrame.intersects(p)||(n.sourceFrame.width=0,n.sourceFrame.height=0),this.roundFrame(n.sourceFrame,a.current?a.current.resolution:s.resolution,a.sourceFrame,a.destinationFrame,s.projection.transform),n.renderTexture=this.getOptimalFilterTexture(n.sourceFrame.width,n.sourceFrame.height,l,u),n.filters=e,n.destinationFrame.width=n.renderTexture.width,n.destinationFrame.height=n.renderTexture.height;const m=this.tempRect;m.x=0,m.y=0,m.width=n.sourceFrame.width,m.height=n.sourceFrame.height,n.renderTexture.filterFrame=n.sourceFrame,n.bindingSourceFrame.copyFrom(a.sourceFrame),n.bindingDestinationFrame.copyFrom(a.destinationFrame),n.transform=s.projection.transform,s.projection.transform=null,a.bind(n.renderTexture,n.sourceFrame,m),s.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,h=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],h[0]=.5*a[2],h[1]=.5*a[3],h[2]=e.sourceFrame.width*n[2]-.5*a[2],h[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 o=t[t.length-1];if(this.renderer.framebuffer.blit(),s.length===1)s[0].apply(this,e.renderTexture,o.renderTexture,Vs.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,Vs.CLEAR,e);const d=l;l=u,u=d}s[c].apply(this,l,o.renderTexture,Vs.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=Vs.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?void 0: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===Vs.CLEAR||e===Vs.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(xs.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(xs.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),h=e.worldTransform.copyTo(Rt.TEMP_MATRIX);return h.invert(),a.prepend(h),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=re.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||re.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=Ea[0],r=Ea[1],n=Ea[2],a=Ea[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 h=Math.min(s.x,r.x,n.x,a.x),o=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=h,e.y=o,e.width=l-h,e.height=u-o}roundFrame(t,e,s,r,n){if(!(t.width<=0||t.height<=0||s.width<=0||s.height<=0)){if(n){const{a,b:h,c:o,d:l}=n;if((Math.abs(h)>1e-4||Math.abs(o)>1e-4)&&(Math.abs(a)>1e-4||Math.abs(l)>1e-4))return}n=n?Xh.copyFrom(n):Xh.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)}}}Cp.extension={type:Y.RendererSystem,name:"filter"},K.add(Cp);class D1{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=re.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const O1=new rt;class Ip{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Uh(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 rt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,s=this.renderer.context.extensions.depthTexture;z.PREFER_ENV===Ns.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 h=t.colorTextures[a];this.renderer.texture.unbind(h.parentTextureArray||h)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){const a=e.width>>s,h=e.height>>s,o=a/e.width;this.setViewport(e.x*o,e.y*o,a,h)}else{const a=t.width>>s,h=t.height>>s;this.setViewport(0,0,a,h)}}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=Cl.COLOR|Cl.DEPTH){const{gl:a}=this;a.clearColor(t,e,s,r),a.clear(n)}initFramebuffer(t){const{gl:e}=this,s=new D1(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 h=r[a],o=h.parentTextureArray||h;this.renderer.texture.bind(o,0),a===0&&s.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,s.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,s.multisample,o._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 h=[];for(let o=0;o<a;o++){const l=n[o],u=l.parentTextureArray||l;this.renderer.texture.bind(u,0),o===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+o,l.target,u._glTextures[this.CONTEXT_UID].texture,e),h.push(s.COLOR_ATTACHMENT0+o))}if(h.length>1&&s.drawBuffers(h),t.depthTexture&&this.writeDepthTexture){const o=t.depthTexture;this.renderer.texture.bind(o,0),s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,o._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){r.stencil=r.stencil||s.createRenderbuffer();let o,l;this.renderer.context.webGLVersion===1?(o=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH_STENCIL):t.depth&&t.stencil?(o=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH24_STENCIL8):t.depth?(o=s.DEPTH_ATTACHMENT,l=s.DEPTH_COMPONENT24):(o=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,o,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=re.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=re.NONE),s}blit(t,e,s){const{current:r,renderer:n,gl:a,CONTEXT_UID:h}=this;if(n.context.webGLVersion!==2||!r)return;const o=r.glFramebuffers[h];if(!o)return;if(!t){if(!o.msaaBuffer)return;const u=r.colorTextures[0];if(!u)return;o.blitFramebuffer||(o.blitFramebuffer=new Uh(r.width,r.height),o.blitFramebuffer.addColorTexture(0,u)),t=o.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=O1,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,o.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 h,o;this.renderer.context.webGLVersion===1?(h=n.DEPTH_STENCIL_ATTACHMENT,o=n.DEPTH_STENCIL):t.depth?(h=n.DEPTH_STENCIL_ATTACHMENT,o=n.DEPTH24_STENCIL8):(h=n.STENCIL_ATTACHMENT,o=n.STENCIL_INDEX8),e.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,e.multisample,o,s,r):n.renderbufferStorage(n.RENDERBUFFER,o,s,r),n.framebufferRenderbuffer(n.FRAMEBUFFER,h,n.RENDERBUFFER,a)}reset(){this.current=this.unknownFramebuffer,this.viewport=new rt}destroy(){this.renderer=null}}Ip.extension={type:Y.RendererSystem,name:"framebuffer"},K.add(Ip);const $h={5126:4,5123:2,5121:1};class Pp{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;z.PREFER_ENV===Ns.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,h,o)=>s.drawElementsInstancedANGLE(r,n,a,h,o),t.drawArraysInstanced=(r,n,a,h)=>s.drawArraysInstancedANGLE(r,n,a,h)):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,h=e.program;h.glPrograms[n]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,h);const o=this.getSignature(t,h),l=t.glVertexArrayObjects[this.CONTEXT_UID];let u=l[o];if(u)return l[h.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&&h.attributeData[m]?d[m].size=h.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*$h[d[m].type];for(const m in d){const g=d[m],_=g.size;g.stride===void 0&&(f[g.buffer]===_*$h[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=p[g.buffer],p[g.buffer]+=_*$h[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,h),l[h.id]=u,l[o]=u,r.bindVertexArray(null),a.unbind(Us.ARRAY_BUFFER),u}disposeGeometry(t,e){var h;if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];const s=t.glVertexArrayObjects[this.CONTEXT_UID],r=this.gl,n=t.buffers,a=(h=this.renderer)==null?void 0:h.buffer;if(t.disposeRunner.remove(this),!!s){if(a)for(let o=0;o<n.length;o++){const l=n[o]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&a.dispose(n[o],e))}if(!e){for(const o in s)if(o[0]==="g"){const l=s[o];this._activeVao===l&&this.unbind(),r.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,h=t.attributes;t.indexBuffer&&n.bind(t.indexBuffer);let o=null;for(const l in h){const u=h[l],c=a[u.buffer],d=c._glBuffers[r];if(e.attributeData[l]){o!==d&&(n.bind(c),o=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 h=a.indexBuffer.data.BYTES_PER_ELEMENT,o=h===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;h===2||h===4&&this.canUseUInt32ElementIndex?a.instanced?n.drawElementsInstanced(t,e||a.indexBuffer.data.length,o,(s||0)*h,r||1):n.drawElements(t,e||a.indexBuffer.data.length,o,(s||0)*h):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}}Pp.extension={type:Y.RendererSystem,name:"geometry"},K.add(Pp);const Rp=new Rt;class Mp{constructor(t,e){this._texture=t,this.mapCoord=new Rt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);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&&(Rp.set(r.width/n.width,0,0,r.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(Rp));const a=e.baseTexture,h=this.uClampFrame,o=this.clampMargin/a.resolution,l=this.clampOffset;return h[0]=(e._frame.x+o+l)/a.width,h[1]=(e._frame.y+o+l)/a.height,h[2]=(e._frame.x+e._frame.width-o+l)/a.width,h[3]=(e._frame.y+e._frame.height-o+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 L1=`varying vec2 vMaskCoord;
379
379
  varying vec2 vTextureCoord;
380
380
 
381
381
  uniform sampler2D uSampler;
@@ -400,7 +400,7 @@ void main(void)
400
400
 
401
401
  gl_FragColor = original;
402
402
  }
403
- `,O1=`attribute vec2 aVertexPosition;
403
+ `,N1=`attribute vec2 aVertexPosition;
404
404
  attribute vec2 aTextureCoord;
405
405
 
406
406
  uniform mat3 projectionMatrix;
@@ -416,7 +416,7 @@ void main(void)
416
416
  vTextureCoord = aTextureCoord;
417
417
  vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
418
418
  }
419
- `;class L1 extends pe{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||O1,e||D1,s),this.maskSprite=r,this.maskMatrix=new Rt}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 Op(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 N1{constructor(t=null){this.type=ce.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=pe.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=ce.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 Lp{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 N1;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!==ce.SPRITE&&this.maskStack.push(s),s.enabled)switch(s.type){case ce.SCISSOR:this.renderer.scissor.push(s);break;case ce.STENCIL:this.renderer.stencil.push(s);break;case ce.SPRITE:s.copyCountersOrReset(null),this.pushSpriteMask(s);break;case ce.COLOR:this.pushColorMask(s);break}s.type===ce.SPRITE&&this.maskStack.push(s)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case ce.SCISSOR:this.renderer.scissor.pop(e);break;case ce.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case ce.SPRITE:this.popSpriteMask(e);break;case ce.COLOR:this.popColorMask(e);break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){const s=this.maskStack[this.maskStack.length-1];s.type===ce.SPRITE&&s._filters&&(s._filters[0].maskSprite=s.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=ce.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=ce.SCISSOR:t.type=ce.STENCIL:t.type=ce.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 L1])),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}}Lp.extension={type:Y.RendererSystem,name:"mask"},K.add(Lp);class Np{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 Vp=new Rt,Up=[],Gp=class El extends Np{constructor(t){super(t),this.glConst=z.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;const e=t._scissorRect,{maskObject:s}=t,{renderer:r}=this,n=r.renderTexture,a=s.getBounds(!0,Up.pop()??new rt);this.roundFrameToPixels(a,n.current?n.current.resolution:r.resolution,n.sourceFrame,n.destinationFrame,r.projection.transform),e&&a.fit(e),t._scissorRectLocal=a}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()||El.isMatrixRotated(e.worldTransform)||El.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){El.isMatrixRotated(n)||(n=n?Vp.copyFrom(n):Vp.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&&Up.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)}};Gp.extension={type:Y.RendererSystem,name:"scissor"};let V1=Gp;K.add(V1);class Xp extends Np{constructor(t){super(t),this.glConst=z.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)}}Xp.extension={type:Y.RendererSystem,name:"stencil"},K.add(Xp);class $p{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return ot("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return ot("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return ot("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events}}})}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}}$p.extension={type:[Y.RendererSystem,Y.CanvasRendererSystem],name:"_plugin"},K.add($p);class Yp{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Rt,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}}Yp.extension={type:Y.RendererSystem,name:"projection"},K.add(Yp);const U1=new ma,Hp=new rt;class Wp{constructor(t){this.renderer=t,this._tempMatrix=new Rt}generateTexture(t,e){const{region:s,...r}=e||{},n=(s==null?void 0:s.copyTo(Hp))||t.getLocalBounds(Hp,!0),a=r.resolution||this.renderer.resolution;n.width=Math.max(n.width,1/a),n.height=Math.max(n.height,1/a),r.width=n.width,r.height=n.height,r.resolution=a,r.multisample??(r.multisample=this.renderer.multisample);const h=wi.create(r);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const o=t.transform;return t.transform=U1,this.renderer.render(t,{renderTexture:h,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=o,h}destroy(){}}Wp.extension={type:[Y.RendererSystem,Y.CanvasRendererSystem],name:"textureGenerator"},K.add(Wp);const Ei=new rt,no=new rt;class zp{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new rt,this.destinationFrame=new rt,this.viewportFrame=new rt}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,s){const r=this.renderer;this.current=t;let n,a,h;t?(n=t.baseTexture,h=n.resolution,e||(Ei.width=t.frame.width,Ei.height=t.frame.height,e=Ei),s||(no.x=t.frame.x,no.y=t.frame.y,no.width=e.width,no.height=e.height,s=no),a=n.framebuffer):(h=r.resolution,e||(Ei.width=r._view.screen.width,Ei.height=r._view.screen.height,e=Ei),s||(s=Ei,s.width=e.width,s.height=e.height));const o=this.viewportFrame;o.x=s.x*h,o.y=s.y*h,o.width=s.width*h,o.height=s.height*h,t||(o.y=r.view.height-(o.y+o.height)),o.ceil(),this.renderer.framebuffer.bind(a,o),this.renderer.projection.update(s,e,h,!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=Ct.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,h=n.width!==a.width||n.height!==a.height;if(h){let{x:o,y:l,width:u,height:c}=this.viewportFrame;o=Math.round(o),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(o,l,u,c)}this.renderer.framebuffer.clear(r.red,r.green,r.blue,r.alpha,e),h&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}zp.extension={type:Y.RendererSystem,name:"renderTexture"},K.add(zp);class G1{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 X1(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=Ep(t,n.type),h={type:a,name:n.name,size:bp(a),location:t.getAttribLocation(i,n.name)};e[n.name]=h}return e}function $1(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(/\[.*?\]$/,""),h=!!n.name.match(/\[.*?\]$/),o=Ep(t,n.type);e[a]={name:a,index:r,type:o,size:n.size,isArray:h,value:yp(o,n.size)}}return e}function Y1(i,t){var h;const e=_p(i,i.VERTEX_SHADER,t.vertexSrc),s=_p(i,i.FRAGMENT_SHADER,t.fragmentSrc),r=i.createProgram();i.attachShader(r,e),i.attachShader(r,s);const n=(h=t.extra)==null?void 0:h.transformFeedbackVaryings;if(n&&(typeof i.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):i.transformFeedbackVaryings(r,n.names,n.bufferMode==="separate"?i.SEPARATE_ATTRIBS:i.INTERLEAVED_ATTRIBS)),i.linkProgram(r),i.getProgramParameter(r,i.LINK_STATUS)||x1(i,r,e,s),t.attributeData=X1(r,i),t.uniformData=$1(r,i),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){const o=Object.keys(t.attributeData);o.sort((l,u)=>l>u?1:-1);for(let l=0;l<o.length;l++)t.attributeData[o[l]].location=l,i.bindAttribLocation(r,l,o[l]);i.linkProgram(r)}i.deleteShader(e),i.deleteShader(s);const a={};for(const o in t.uniformData){const l=t.uniformData[o];a[o]={location:i.getUniformLocation(r,o),value:yp(l.type,l.size)}}return new G1(r,a)}function H1(i,t,e,s,r){e.buffer.update(r)}const W1={float:`
419
+ `;class V1 extends pe{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||N1,e||L1,s),this.maskSprite=r,this.maskMatrix=new Rt}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 Mp(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 U1{constructor(t=null){this.type=ce.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=pe.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=ce.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 Fp{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 U1;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!==ce.SPRITE&&this.maskStack.push(s),s.enabled)switch(s.type){case ce.SCISSOR:this.renderer.scissor.push(s);break;case ce.STENCIL:this.renderer.stencil.push(s);break;case ce.SPRITE:s.copyCountersOrReset(null),this.pushSpriteMask(s);break;case ce.COLOR:this.pushColorMask(s);break}s.type===ce.SPRITE&&this.maskStack.push(s)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case ce.SCISSOR:this.renderer.scissor.pop(e);break;case ce.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case ce.SPRITE:this.popSpriteMask(e);break;case ce.COLOR:this.popColorMask(e);break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){const s=this.maskStack[this.maskStack.length-1];s.type===ce.SPRITE&&s._filters&&(s._filters[0].maskSprite=s.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=ce.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=ce.SCISSOR:t.type=ce.STENCIL:t.type=ce.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 V1])),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}}Fp.extension={type:Y.RendererSystem,name:"mask"},K.add(Fp);class kp{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 Bp=new Rt,Dp=[],Op=class El extends kp{constructor(t){super(t),this.glConst=z.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;const e=t._scissorRect,{maskObject:s}=t,{renderer:r}=this,n=r.renderTexture,a=s.getBounds(!0,Dp.pop()??new rt);this.roundFrameToPixels(a,n.current?n.current.resolution:r.resolution,n.sourceFrame,n.destinationFrame,r.projection.transform),e&&a.fit(e),t._scissorRectLocal=a}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()||El.isMatrixRotated(e.worldTransform)||El.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){El.isMatrixRotated(n)||(n=n?Bp.copyFrom(n):Bp.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&&Dp.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)}};Op.extension={type:Y.RendererSystem,name:"scissor"};let G1=Op;K.add(G1);class Lp extends kp{constructor(t){super(t),this.glConst=z.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)}}Lp.extension={type:Y.RendererSystem,name:"stencil"},K.add(Lp);class Np{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return ot("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return ot("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return ot("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events}}})}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}}Np.extension={type:[Y.RendererSystem,Y.CanvasRendererSystem],name:"_plugin"},K.add(Np);class Vp{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Rt,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}}Vp.extension={type:Y.RendererSystem,name:"projection"},K.add(Vp);const X1=new ma,Up=new rt;class Gp{constructor(t){this.renderer=t,this._tempMatrix=new Rt}generateTexture(t,e){const{region:s,...r}=e||{},n=(s==null?void 0:s.copyTo(Up))||t.getLocalBounds(Up,!0),a=r.resolution||this.renderer.resolution;n.width=Math.max(n.width,1/a),n.height=Math.max(n.height,1/a),r.width=n.width,r.height=n.height,r.resolution=a,r.multisample??(r.multisample=this.renderer.multisample);const h=wi.create(r);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const o=t.transform;return t.transform=X1,this.renderer.render(t,{renderTexture:h,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=o,h}destroy(){}}Gp.extension={type:[Y.RendererSystem,Y.CanvasRendererSystem],name:"textureGenerator"},K.add(Gp);const Ei=new rt,no=new rt;class Xp{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new rt,this.destinationFrame=new rt,this.viewportFrame=new rt}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,s){const r=this.renderer;this.current=t;let n,a,h;t?(n=t.baseTexture,h=n.resolution,e||(Ei.width=t.frame.width,Ei.height=t.frame.height,e=Ei),s||(no.x=t.frame.x,no.y=t.frame.y,no.width=e.width,no.height=e.height,s=no),a=n.framebuffer):(h=r.resolution,e||(Ei.width=r._view.screen.width,Ei.height=r._view.screen.height,e=Ei),s||(s=Ei,s.width=e.width,s.height=e.height));const o=this.viewportFrame;o.x=s.x*h,o.y=s.y*h,o.width=s.width*h,o.height=s.height*h,t||(o.y=r.view.height-(o.y+o.height)),o.ceil(),this.renderer.framebuffer.bind(a,o),this.renderer.projection.update(s,e,h,!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=Ct.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,h=n.width!==a.width||n.height!==a.height;if(h){let{x:o,y:l,width:u,height:c}=this.viewportFrame;o=Math.round(o),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(o,l,u,c)}this.renderer.framebuffer.clear(r.red,r.green,r.blue,r.alpha,e),h&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}Xp.extension={type:Y.RendererSystem,name:"renderTexture"},K.add(Xp);class $1{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 Y1(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=yp(t,n.type),h={type:a,name:n.name,size:gp(a),location:t.getAttribLocation(i,n.name)};e[n.name]=h}return e}function H1(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(/\[.*?\]$/,""),h=!!n.name.match(/\[.*?\]$/),o=yp(t,n.type);e[a]={name:a,index:r,type:o,size:n.size,isArray:h,value:fp(o,n.size)}}return e}function W1(i,t){var h;const e=dp(i,i.VERTEX_SHADER,t.vertexSrc),s=dp(i,i.FRAGMENT_SHADER,t.fragmentSrc),r=i.createProgram();i.attachShader(r,e),i.attachShader(r,s);const n=(h=t.extra)==null?void 0:h.transformFeedbackVaryings;if(n&&(typeof i.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):i.transformFeedbackVaryings(r,n.names,n.bufferMode==="separate"?i.SEPARATE_ATTRIBS:i.INTERLEAVED_ATTRIBS)),i.linkProgram(r),i.getProgramParameter(r,i.LINK_STATUS)||b1(i,r,e,s),t.attributeData=Y1(r,i),t.uniformData=H1(r,i),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){const o=Object.keys(t.attributeData);o.sort((l,u)=>l>u?1:-1);for(let l=0;l<o.length;l++)t.attributeData[o[l]].location=l,i.bindAttribLocation(r,l,o[l]);i.linkProgram(r)}i.deleteShader(e),i.deleteShader(s);const a={};for(const o in t.uniformData){const l=t.uniformData[o];a[o]={location:i.getUniformLocation(r,o),value:fp(l.type,l.size)}}return new $1(r,a)}function z1(i,t,e,s,r){e.buffer.update(r)}const j1={float:`
420
420
  data[offset] = v;
421
421
  `,vec2:`
422
422
  data[offset] = v[0];
@@ -454,7 +454,7 @@ void main(void)
454
454
  {
455
455
  data[offset + i] = v[i];
456
456
  }
457
- `},jp={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 z1(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=jp[a.data.type],a.data.size>1&&(e=Math.max(e,16)*a.data.size),a.dataLen=e,s%e!==0&&s<16){const h=s%e%16;s+=h,r+=h}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 j1(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 q1(i,t){if(!i.autoManage)return{size:0,syncFunc:H1};const e=j1(i.uniforms,t),{uboElements:s,size:r}=z1(e),n=[`
457
+ `},$p={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 q1(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=$p[a.data.type],a.data.size>1&&(e=Math.max(e,16)*a.data.size),a.dataLen=e,s%e!==0&&s<16){const h=s%e%16;s+=h,r+=h}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 Z1(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 K1(i,t){if(!i.autoManage)return{size:0,syncFunc:z1};const e=Z1(i.uniforms,t),{uboElements:s,size:r}=q1(e),n=[`
458
458
  var v = null;
459
459
  var v2 = null;
460
460
  var cv = null;
@@ -462,7 +462,7 @@ void main(void)
462
462
  var gl = renderer.gl
463
463
  var index = 0;
464
464
  var data = buffer.data;
465
- `];for(let a=0;a<s.length;a++){const h=s[a],o=i.uniforms[h.data.name],l=h.data.name;let u=!1;for(let c=0;c<on.length;c++){const d=on[c];if(d.codeUbo&&d.test(h.data,o)){n.push(`offset = ${h.offset/4};`,on[c].codeUbo(h.data.name,o)),u=!0;break}}if(!u)if(h.data.size>1){const c=bp(h.data.type),d=Math.max(jp[h.data.type]/16,1),f=c/d,p=(4-f%4)%4;n.push(`
465
+ `];for(let a=0;a<s.length;a++){const h=s[a],o=i.uniforms[h.data.name],l=h.data.name;let u=!1;for(let c=0;c<on.length;c++){const d=on[c];if(d.codeUbo&&d.test(h.data,o)){n.push(`offset = ${h.offset/4};`,on[c].codeUbo(h.data.name,o)),u=!0;break}}if(!u)if(h.data.size>1){const c=gp(h.data.type),d=Math.max($p[h.data.type]/16,1),f=c/d,p=(4-f%4)%4;n.push(`
466
466
  cv = ud.${l}.value;
467
467
  v = uv.${l};
468
468
  offset = ${h.offset/4};
@@ -478,7 +478,7 @@ void main(void)
478
478
  offset += ${p};
479
479
  }
480
480
 
481
- `)}else{const c=W1[h.data.type];n.push(`
481
+ `)}else{const c=j1[h.data.type];n.push(`
482
482
  cv = ud.${l}.value;
483
483
  v = uv.${l};
484
484
  offset = ${h.offset/4};
@@ -486,7 +486,7 @@ void main(void)
486
486
  `)}}return n.push(`
487
487
  renderer.buffer.update(buffer);
488
488
  `),{size:r,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(`
489
- `))}}let Z1=0;const Ta={textureCount:0,uboCount:0};class qp{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=Z1++}systemCheck(){if(!b1())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||(Ta.textureCount=0,Ta.uboCount=0,this.syncUniformGroup(t.uniformGroup,Ta)),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]=g1(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,Ta,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 h=this._uboCache[a];if(h||(h=this._uboCache[a]=q1(t,this.shader.program.uniformData)),t.autoManage){const o=new Float32Array(h.size/4);t.buffer.update(o)}return e.uniformGroups[t.id]=h.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=Y1(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}}qp.extension={type:Y.RendererSystem,name:"shader"},K.add(qp);class Aa{constructor(t){this.renderer=t}run(t){const{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.2 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}Aa.defaultOptions={hello:!1},Aa.extension={type:[Y.RendererSystem,Y.CanvasRendererSystem],name:"startup"},K.add(Aa);function K1(i,t=[]){return t[W.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.ADD]=[i.ONE,i.ONE],t[W.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.SCREEN]=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.NONE]=[0,0],t[W.NORMAL_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.ADD_NPM]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t[W.SCREEN_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.SRC_IN]=[i.DST_ALPHA,i.ZERO],t[W.SRC_OUT]=[i.ONE_MINUS_DST_ALPHA,i.ZERO],t[W.SRC_ATOP]=[i.DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[W.DST_OVER]=[i.ONE_MINUS_DST_ALPHA,i.ONE],t[W.DST_IN]=[i.ZERO,i.SRC_ALPHA],t[W.DST_OUT]=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],t[W.DST_ATOP]=[i.ONE_MINUS_DST_ALPHA,i.SRC_ALPHA],t[W.XOR]=[i.ONE_MINUS_DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[W.SUBTRACT]=[i.ONE,i.ONE,i.ONE,i.ONE,i.FUNC_REVERSE_SUBTRACT,i.FUNC_ADD],t}const Q1=0,J1=1,tw=2,ew=3,sw=4,rw=5,Zp=class md{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=W.NONE,this._blendEq=!1,this.map=[],this.map[Q1]=this.setBlend,this.map[J1]=this.setOffset,this.map[tw]=this.setCullFace,this.map[ew]=this.setDepthTest,this.map[sw]=this.setFrontFace,this.map[rw]=this.setDepthMask,this.checks=[],this.defaultState=new js,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=K1(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(md.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(md.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}};Zp.extension={type:Y.RendererSystem,name:"state"};let iw=Zp;K.add(iw);class nw extends Xs{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);const e=(t.priority??[]).filter(r=>t.systems[r]),s=[...e,...Object.keys(t.systems).filter(r=>!e.includes(r))];for(const r of s)this.addSystem(t.systems[r],r)}addRunners(...t){t.forEach(e=>{this.runners[e]=new ws(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 oo=class Tl{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=Tl.defaultMaxIdle,this.checkCountMax=Tl.defaultCheckCountMax,this.mode=Tl.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Il.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}};oo.defaultMode=Il.AUTO,oo.defaultMaxIdle=60*60,oo.defaultCheckCountMax=60*10,oo.extension={type:Y.RendererSystem,name:"textureGC"};let Ti=oo;K.add(Ti);class zh{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=tt.UNSIGNED_BYTE,this.internalFormat=G.RGBA,this.samplerType=0}}function ow(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[i.RGB]:j.FLOAT,[i.RGBA]:j.FLOAT,[i.ALPHA]:j.FLOAT,[i.LUMINANCE]:j.FLOAT,[i.LUMINANCE_ALPHA]:j.FLOAT,[i.R8]:j.FLOAT,[i.R8_SNORM]:j.FLOAT,[i.RG8]:j.FLOAT,[i.RG8_SNORM]:j.FLOAT,[i.RGB8]:j.FLOAT,[i.RGB8_SNORM]:j.FLOAT,[i.RGB565]:j.FLOAT,[i.RGBA4]:j.FLOAT,[i.RGB5_A1]:j.FLOAT,[i.RGBA8]:j.FLOAT,[i.RGBA8_SNORM]:j.FLOAT,[i.RGB10_A2]:j.FLOAT,[i.RGB10_A2UI]:j.FLOAT,[i.SRGB8]:j.FLOAT,[i.SRGB8_ALPHA8]:j.FLOAT,[i.R16F]:j.FLOAT,[i.RG16F]:j.FLOAT,[i.RGB16F]:j.FLOAT,[i.RGBA16F]:j.FLOAT,[i.R32F]:j.FLOAT,[i.RG32F]:j.FLOAT,[i.RGB32F]:j.FLOAT,[i.RGBA32F]:j.FLOAT,[i.R11F_G11F_B10F]:j.FLOAT,[i.RGB9_E5]:j.FLOAT,[i.R8I]:j.INT,[i.R8UI]:j.UINT,[i.R16I]:j.INT,[i.R16UI]:j.UINT,[i.R32I]:j.INT,[i.R32UI]:j.UINT,[i.RG8I]:j.INT,[i.RG8UI]:j.UINT,[i.RG16I]:j.INT,[i.RG16UI]:j.UINT,[i.RG32I]:j.INT,[i.RG32UI]:j.UINT,[i.RGB8I]:j.INT,[i.RGB8UI]:j.UINT,[i.RGB16I]:j.INT,[i.RGB16UI]:j.UINT,[i.RGB32I]:j.INT,[i.RGB32UI]:j.UINT,[i.RGBA8I]:j.INT,[i.RGBA8UI]:j.UINT,[i.RGBA16I]:j.INT,[i.RGBA16UI]:j.UINT,[i.RGBA32I]:j.INT,[i.RGBA32UI]:j.UINT,[i.DEPTH_COMPONENT16]:j.FLOAT,[i.DEPTH_COMPONENT24]:j.FLOAT,[i.DEPTH_COMPONENT32F]:j.FLOAT,[i.DEPTH_STENCIL]:j.FLOAT,[i.DEPTH24_STENCIL8]:j.FLOAT,[i.DEPTH32F_STENCIL8]:j.FLOAT}:t={[i.RGB]:j.FLOAT,[i.RGBA]:j.FLOAT,[i.ALPHA]:j.FLOAT,[i.LUMINANCE]:j.FLOAT,[i.LUMINANCE_ALPHA]:j.FLOAT,[i.DEPTH_STENCIL]:j.FLOAT},t}function aw(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[tt.UNSIGNED_BYTE]:{[G.RGBA]:i.RGBA8,[G.RGB]:i.RGB8,[G.RG]:i.RG8,[G.RED]:i.R8,[G.RGBA_INTEGER]:i.RGBA8UI,[G.RGB_INTEGER]:i.RGB8UI,[G.RG_INTEGER]:i.RG8UI,[G.RED_INTEGER]:i.R8UI,[G.ALPHA]:i.ALPHA,[G.LUMINANCE]:i.LUMINANCE,[G.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[tt.BYTE]:{[G.RGBA]:i.RGBA8_SNORM,[G.RGB]:i.RGB8_SNORM,[G.RG]:i.RG8_SNORM,[G.RED]:i.R8_SNORM,[G.RGBA_INTEGER]:i.RGBA8I,[G.RGB_INTEGER]:i.RGB8I,[G.RG_INTEGER]:i.RG8I,[G.RED_INTEGER]:i.R8I},[tt.UNSIGNED_SHORT]:{[G.RGBA_INTEGER]:i.RGBA16UI,[G.RGB_INTEGER]:i.RGB16UI,[G.RG_INTEGER]:i.RG16UI,[G.RED_INTEGER]:i.R16UI,[G.DEPTH_COMPONENT]:i.DEPTH_COMPONENT16},[tt.SHORT]:{[G.RGBA_INTEGER]:i.RGBA16I,[G.RGB_INTEGER]:i.RGB16I,[G.RG_INTEGER]:i.RG16I,[G.RED_INTEGER]:i.R16I},[tt.UNSIGNED_INT]:{[G.RGBA_INTEGER]:i.RGBA32UI,[G.RGB_INTEGER]:i.RGB32UI,[G.RG_INTEGER]:i.RG32UI,[G.RED_INTEGER]:i.R32UI,[G.DEPTH_COMPONENT]:i.DEPTH_COMPONENT24},[tt.INT]:{[G.RGBA_INTEGER]:i.RGBA32I,[G.RGB_INTEGER]:i.RGB32I,[G.RG_INTEGER]:i.RG32I,[G.RED_INTEGER]:i.R32I},[tt.FLOAT]:{[G.RGBA]:i.RGBA32F,[G.RGB]:i.RGB32F,[G.RG]:i.RG32F,[G.RED]:i.R32F,[G.DEPTH_COMPONENT]:i.DEPTH_COMPONENT32F},[tt.HALF_FLOAT]:{[G.RGBA]:i.RGBA16F,[G.RGB]:i.RGB16F,[G.RG]:i.RG16F,[G.RED]:i.R16F},[tt.UNSIGNED_SHORT_5_6_5]:{[G.RGB]:i.RGB565},[tt.UNSIGNED_SHORT_4_4_4_4]:{[G.RGBA]:i.RGBA4},[tt.UNSIGNED_SHORT_5_5_5_1]:{[G.RGBA]:i.RGB5_A1},[tt.UNSIGNED_INT_2_10_10_10_REV]:{[G.RGBA]:i.RGB10_A2,[G.RGBA_INTEGER]:i.RGB10_A2UI},[tt.UNSIGNED_INT_10F_11F_11F_REV]:{[G.RGB]:i.R11F_G11F_B10F},[tt.UNSIGNED_INT_5_9_9_9_REV]:{[G.RGB]:i.RGB9_E5},[tt.UNSIGNED_INT_24_8]:{[G.DEPTH_STENCIL]:i.DEPTH24_STENCIL8},[tt.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[G.DEPTH_STENCIL]:i.DEPTH32F_STENCIL8}}:t={[tt.UNSIGNED_BYTE]:{[G.RGBA]:i.RGBA,[G.RGB]:i.RGB,[G.ALPHA]:i.ALPHA,[G.LUMINANCE]:i.LUMINANCE,[G.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[tt.UNSIGNED_SHORT_5_6_5]:{[G.RGB]:i.RGB},[tt.UNSIGNED_SHORT_4_4_4_4]:{[G.RGBA]:i.RGBA},[tt.UNSIGNED_SHORT_5_5_5_1]:{[G.RGBA]:i.RGBA}},t}class Kp{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new et,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=aw(t),this.samplerTypes=ow(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 zh(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 zh(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?void 0: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!==j.FLOAT&&this.renderer.texture.unbind(a)}}initTexture(t){const e=new zh(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;e.internalFormat=((s=this.internalFormats[t.type])==null?void 0:s[t.format])??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??j.FLOAT,this.webGLVersion===2&&t.type===tt.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){var r;const e=t._glTextures[this.CONTEXT_UID];if(!e)return;const s=this.renderer;if(this.initTextureType(t,e),(r=t.resource)==null?void 0:r.upload(s,t,e))e.samplerType!==j.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,a=t.realHeight,h=s.gl;(e.width!==n||e.height!==a||e.dirtyId<0)&&(e.width=n,e.height=a,h.texImage2D(t.target,0,e.internalFormat,n,a,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.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&&nn(this.managedTextures,r,1)}}updateTextureStyle(t){var s;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===vs.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Fr.CLAMP:e.wrapMode=t.wrapMode,(s=t.resource)!=null&&s.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const s=this.gl;if(e.mipmap&&t.mipmap!==vs.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===je.LINEAR?s.LINEAR_MIPMAP_LINEAR:s.NEAREST_MIPMAP_NEAREST);const r=this.renderer.context.extensions.anisotropicFiltering;if(r&&t.anisotropicLevel>0&&t.scaleMode===je.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===je.LINEAR?s.LINEAR:s.NEAREST);s.texParameteri(t.target,s.TEXTURE_MAG_FILTER,t.scaleMode===je.LINEAR?s.LINEAR:s.NEAREST)}destroy(){this.renderer=null}}Kp.extension={type:Y.RendererSystem,name:"texture"},K.add(Kp);class Qp{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 h=t.buffers[a];h&&(s.buffer.update(h),h._glBuffers[r].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,a,h._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 h=t.buffers[a];if(!h)continue;const o=h._glBuffers[this.CONTEXT_UID];o&&(o.refCount--,o.refCount===0&&!e&&n.dispose(h,e))}s&&(e||r.deleteTransformFeedback(s),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}Qp.extension={type:Y.RendererSystem,name:"transformFeedback"},K.add(Qp);class Sa{constructor(t){this.renderer=t}init(t){this.screen=new rt(0,0,t.width,t.height),this.element=t.view||z.ADAPTER.createCanvas(),this.resolution=t.resolution||z.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}}Sa.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Sa.extension={type:[Y.RendererSystem,Y.CanvasRendererSystem],name:"_view"},K.add(Sa),z.PREFER_ENV=Ns.WEBGL2,z.STRICT_TEXTURE_CACHE=!1,z.RENDER_OPTIONS={...ba.defaultOptions,...va.defaultOptions,...Sa.defaultOptions,...Aa.defaultOptions},Object.defineProperties(z,{WRAP_MODE:{get(){return et.defaultOptions.wrapMode},set(i){ot("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),et.defaultOptions.wrapMode=i}},SCALE_MODE:{get(){return et.defaultOptions.scaleMode},set(i){ot("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),et.defaultOptions.scaleMode=i}},MIPMAP_TEXTURES:{get(){return et.defaultOptions.mipmap},set(i){ot("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),et.defaultOptions.mipmap=i}},ANISOTROPIC_LEVEL:{get(){return et.defaultOptions.anisotropicLevel},set(i){ot("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),et.defaultOptions.anisotropicLevel=i}},FILTER_RESOLUTION:{get(){return ot("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),pe.defaultResolution},set(i){pe.defaultResolution=i}},FILTER_MULTISAMPLE:{get(){return ot("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),pe.defaultMultisample},set(i){pe.defaultMultisample=i}},SPRITE_MAX_TEXTURES:{get(){return bi.defaultMaxTextures},set(i){ot("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),bi.defaultMaxTextures=i}},SPRITE_BATCH_SIZE:{get(){return bi.defaultBatchSize},set(i){ot("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),bi.defaultBatchSize=i}},CAN_UPLOAD_SAME_BUFFER:{get(){return bi.canUploadSameBuffer},set(i){ot("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),bi.canUploadSameBuffer=i}},GC_MODE:{get(){return Ti.defaultMode},set(i){ot("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Ti.defaultMode=i}},GC_MAX_IDLE:{get(){return Ti.defaultMaxIdle},set(i){ot("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Ti.defaultMaxIdle=i}},GC_MAX_CHECK_COUNT:{get(){return Ti.defaultCheckCountMax},set(i){ot("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Ti.defaultCheckCountMax=i}},PRECISION_VERTEX:{get(){return yr.defaultVertexPrecision},set(i){ot("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),yr.defaultVertexPrecision=i}},PRECISION_FRAGMENT:{get(){return yr.defaultFragmentPrecision},set(i){ot("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),yr.defaultFragmentPrecision=i}}});var Vr=(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))(Vr||{});class jh{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 Jp=class ns{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 jh(null,null,1/0),this.deltaMS=1/ns.targetFPMS,this.elapsedMS=1/ns.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=Vr.NORMAL){return this._addListener(new jh(t,e,s))}addOnce(t,e,s=Vr.NORMAL){return this._addListener(new jh(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*ns.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,ns.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(!ns._shared){const t=ns._shared=new ns;t.autoStart=!0,t._protected=!0}return ns._shared}static get system(){if(!ns._system){const t=ns._system=new ns;t.autoStart=!0,t._protected=!0}return ns._system}};Jp.targetFPMS=.06;let wt=Jp;Object.defineProperties(z,{TARGET_FPMS:{get(){return wt.targetFPMS},set(i){ot("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),wt.targetFPMS=i}}});class tm{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,Vr.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?wt.shared:new wt,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}tm.extension=Y.Application,K.add(tm);const em=[];K.handleByList(Y.Renderer,em);function lw(i){for(const t of em)if(t.test(i))return new t(i);throw new Error("Unable to auto-detect a suitable renderer.")}var hw=`attribute vec2 aVertexPosition;
489
+ `))}}let Q1=0;const Ta={textureCount:0,uboCount:0};class Yp{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=Q1++}systemCheck(){if(!E1())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||(Ta.textureCount=0,Ta.uboCount=0,this.syncUniformGroup(t.uniformGroup,Ta)),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]=y1(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,Ta,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 h=this._uboCache[a];if(h||(h=this._uboCache[a]=K1(t,this.shader.program.uniformData)),t.autoManage){const o=new Float32Array(h.size/4);t.buffer.update(o)}return e.uniformGroups[t.id]=h.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=W1(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}}Yp.extension={type:Y.RendererSystem,name:"shader"},K.add(Yp);class Aa{constructor(t){this.renderer=t}run(t){const{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.2 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}Aa.defaultOptions={hello:!1},Aa.extension={type:[Y.RendererSystem,Y.CanvasRendererSystem],name:"startup"},K.add(Aa);function J1(i,t=[]){return t[W.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.ADD]=[i.ONE,i.ONE],t[W.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.SCREEN]=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.NONE]=[0,0],t[W.NORMAL_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.ADD_NPM]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t[W.SCREEN_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[W.SRC_IN]=[i.DST_ALPHA,i.ZERO],t[W.SRC_OUT]=[i.ONE_MINUS_DST_ALPHA,i.ZERO],t[W.SRC_ATOP]=[i.DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[W.DST_OVER]=[i.ONE_MINUS_DST_ALPHA,i.ONE],t[W.DST_IN]=[i.ZERO,i.SRC_ALPHA],t[W.DST_OUT]=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],t[W.DST_ATOP]=[i.ONE_MINUS_DST_ALPHA,i.SRC_ALPHA],t[W.XOR]=[i.ONE_MINUS_DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[W.SUBTRACT]=[i.ONE,i.ONE,i.ONE,i.ONE,i.FUNC_REVERSE_SUBTRACT,i.FUNC_ADD],t}const tw=0,ew=1,sw=2,rw=3,iw=4,nw=5,Hp=class dd{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=W.NONE,this._blendEq=!1,this.map=[],this.map[tw]=this.setBlend,this.map[ew]=this.setOffset,this.map[sw]=this.setCullFace,this.map[rw]=this.setDepthTest,this.map[iw]=this.setFrontFace,this.map[nw]=this.setDepthMask,this.checks=[],this.defaultState=new js,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=J1(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(dd.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(dd.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}};Hp.extension={type:Y.RendererSystem,name:"state"};let ow=Hp;K.add(ow);class aw extends Xs{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);const e=(t.priority??[]).filter(r=>t.systems[r]),s=[...e,...Object.keys(t.systems).filter(r=>!e.includes(r))];for(const r of s)this.addSystem(t.systems[r],r)}addRunners(...t){t.forEach(e=>{this.runners[e]=new ws(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 oo=class Tl{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=Tl.defaultMaxIdle,this.checkCountMax=Tl.defaultCheckCountMax,this.mode=Tl.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Il.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}};oo.defaultMode=Il.AUTO,oo.defaultMaxIdle=60*60,oo.defaultCheckCountMax=60*10,oo.extension={type:Y.RendererSystem,name:"textureGC"};let Ti=oo;K.add(Ti);class Yh{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=tt.UNSIGNED_BYTE,this.internalFormat=G.RGBA,this.samplerType=0}}function lw(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[i.RGB]:j.FLOAT,[i.RGBA]:j.FLOAT,[i.ALPHA]:j.FLOAT,[i.LUMINANCE]:j.FLOAT,[i.LUMINANCE_ALPHA]:j.FLOAT,[i.R8]:j.FLOAT,[i.R8_SNORM]:j.FLOAT,[i.RG8]:j.FLOAT,[i.RG8_SNORM]:j.FLOAT,[i.RGB8]:j.FLOAT,[i.RGB8_SNORM]:j.FLOAT,[i.RGB565]:j.FLOAT,[i.RGBA4]:j.FLOAT,[i.RGB5_A1]:j.FLOAT,[i.RGBA8]:j.FLOAT,[i.RGBA8_SNORM]:j.FLOAT,[i.RGB10_A2]:j.FLOAT,[i.RGB10_A2UI]:j.FLOAT,[i.SRGB8]:j.FLOAT,[i.SRGB8_ALPHA8]:j.FLOAT,[i.R16F]:j.FLOAT,[i.RG16F]:j.FLOAT,[i.RGB16F]:j.FLOAT,[i.RGBA16F]:j.FLOAT,[i.R32F]:j.FLOAT,[i.RG32F]:j.FLOAT,[i.RGB32F]:j.FLOAT,[i.RGBA32F]:j.FLOAT,[i.R11F_G11F_B10F]:j.FLOAT,[i.RGB9_E5]:j.FLOAT,[i.R8I]:j.INT,[i.R8UI]:j.UINT,[i.R16I]:j.INT,[i.R16UI]:j.UINT,[i.R32I]:j.INT,[i.R32UI]:j.UINT,[i.RG8I]:j.INT,[i.RG8UI]:j.UINT,[i.RG16I]:j.INT,[i.RG16UI]:j.UINT,[i.RG32I]:j.INT,[i.RG32UI]:j.UINT,[i.RGB8I]:j.INT,[i.RGB8UI]:j.UINT,[i.RGB16I]:j.INT,[i.RGB16UI]:j.UINT,[i.RGB32I]:j.INT,[i.RGB32UI]:j.UINT,[i.RGBA8I]:j.INT,[i.RGBA8UI]:j.UINT,[i.RGBA16I]:j.INT,[i.RGBA16UI]:j.UINT,[i.RGBA32I]:j.INT,[i.RGBA32UI]:j.UINT,[i.DEPTH_COMPONENT16]:j.FLOAT,[i.DEPTH_COMPONENT24]:j.FLOAT,[i.DEPTH_COMPONENT32F]:j.FLOAT,[i.DEPTH_STENCIL]:j.FLOAT,[i.DEPTH24_STENCIL8]:j.FLOAT,[i.DEPTH32F_STENCIL8]:j.FLOAT}:t={[i.RGB]:j.FLOAT,[i.RGBA]:j.FLOAT,[i.ALPHA]:j.FLOAT,[i.LUMINANCE]:j.FLOAT,[i.LUMINANCE_ALPHA]:j.FLOAT,[i.DEPTH_STENCIL]:j.FLOAT},t}function hw(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[tt.UNSIGNED_BYTE]:{[G.RGBA]:i.RGBA8,[G.RGB]:i.RGB8,[G.RG]:i.RG8,[G.RED]:i.R8,[G.RGBA_INTEGER]:i.RGBA8UI,[G.RGB_INTEGER]:i.RGB8UI,[G.RG_INTEGER]:i.RG8UI,[G.RED_INTEGER]:i.R8UI,[G.ALPHA]:i.ALPHA,[G.LUMINANCE]:i.LUMINANCE,[G.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[tt.BYTE]:{[G.RGBA]:i.RGBA8_SNORM,[G.RGB]:i.RGB8_SNORM,[G.RG]:i.RG8_SNORM,[G.RED]:i.R8_SNORM,[G.RGBA_INTEGER]:i.RGBA8I,[G.RGB_INTEGER]:i.RGB8I,[G.RG_INTEGER]:i.RG8I,[G.RED_INTEGER]:i.R8I},[tt.UNSIGNED_SHORT]:{[G.RGBA_INTEGER]:i.RGBA16UI,[G.RGB_INTEGER]:i.RGB16UI,[G.RG_INTEGER]:i.RG16UI,[G.RED_INTEGER]:i.R16UI,[G.DEPTH_COMPONENT]:i.DEPTH_COMPONENT16},[tt.SHORT]:{[G.RGBA_INTEGER]:i.RGBA16I,[G.RGB_INTEGER]:i.RGB16I,[G.RG_INTEGER]:i.RG16I,[G.RED_INTEGER]:i.R16I},[tt.UNSIGNED_INT]:{[G.RGBA_INTEGER]:i.RGBA32UI,[G.RGB_INTEGER]:i.RGB32UI,[G.RG_INTEGER]:i.RG32UI,[G.RED_INTEGER]:i.R32UI,[G.DEPTH_COMPONENT]:i.DEPTH_COMPONENT24},[tt.INT]:{[G.RGBA_INTEGER]:i.RGBA32I,[G.RGB_INTEGER]:i.RGB32I,[G.RG_INTEGER]:i.RG32I,[G.RED_INTEGER]:i.R32I},[tt.FLOAT]:{[G.RGBA]:i.RGBA32F,[G.RGB]:i.RGB32F,[G.RG]:i.RG32F,[G.RED]:i.R32F,[G.DEPTH_COMPONENT]:i.DEPTH_COMPONENT32F},[tt.HALF_FLOAT]:{[G.RGBA]:i.RGBA16F,[G.RGB]:i.RGB16F,[G.RG]:i.RG16F,[G.RED]:i.R16F},[tt.UNSIGNED_SHORT_5_6_5]:{[G.RGB]:i.RGB565},[tt.UNSIGNED_SHORT_4_4_4_4]:{[G.RGBA]:i.RGBA4},[tt.UNSIGNED_SHORT_5_5_5_1]:{[G.RGBA]:i.RGB5_A1},[tt.UNSIGNED_INT_2_10_10_10_REV]:{[G.RGBA]:i.RGB10_A2,[G.RGBA_INTEGER]:i.RGB10_A2UI},[tt.UNSIGNED_INT_10F_11F_11F_REV]:{[G.RGB]:i.R11F_G11F_B10F},[tt.UNSIGNED_INT_5_9_9_9_REV]:{[G.RGB]:i.RGB9_E5},[tt.UNSIGNED_INT_24_8]:{[G.DEPTH_STENCIL]:i.DEPTH24_STENCIL8},[tt.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[G.DEPTH_STENCIL]:i.DEPTH32F_STENCIL8}}:t={[tt.UNSIGNED_BYTE]:{[G.RGBA]:i.RGBA,[G.RGB]:i.RGB,[G.ALPHA]:i.ALPHA,[G.LUMINANCE]:i.LUMINANCE,[G.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[tt.UNSIGNED_SHORT_5_6_5]:{[G.RGB]:i.RGB},[tt.UNSIGNED_SHORT_4_4_4_4]:{[G.RGBA]:i.RGBA},[tt.UNSIGNED_SHORT_5_5_5_1]:{[G.RGBA]:i.RGBA}},t}class Wp{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new et,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=hw(t),this.samplerTypes=lw(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 Yh(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 Yh(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?void 0: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!==j.FLOAT&&this.renderer.texture.unbind(a)}}initTexture(t){const e=new Yh(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;e.internalFormat=((s=this.internalFormats[t.type])==null?void 0:s[t.format])??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??j.FLOAT,this.webGLVersion===2&&t.type===tt.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){var r;const e=t._glTextures[this.CONTEXT_UID];if(!e)return;const s=this.renderer;if(this.initTextureType(t,e),(r=t.resource)==null?void 0:r.upload(s,t,e))e.samplerType!==j.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,a=t.realHeight,h=s.gl;(e.width!==n||e.height!==a||e.dirtyId<0)&&(e.width=n,e.height=a,h.texImage2D(t.target,0,e.internalFormat,n,a,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.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&&nn(this.managedTextures,r,1)}}updateTextureStyle(t){var s;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===vs.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Fr.CLAMP:e.wrapMode=t.wrapMode,(s=t.resource)!=null&&s.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const s=this.gl;if(e.mipmap&&t.mipmap!==vs.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===je.LINEAR?s.LINEAR_MIPMAP_LINEAR:s.NEAREST_MIPMAP_NEAREST);const r=this.renderer.context.extensions.anisotropicFiltering;if(r&&t.anisotropicLevel>0&&t.scaleMode===je.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===je.LINEAR?s.LINEAR:s.NEAREST);s.texParameteri(t.target,s.TEXTURE_MAG_FILTER,t.scaleMode===je.LINEAR?s.LINEAR:s.NEAREST)}destroy(){this.renderer=null}}Wp.extension={type:Y.RendererSystem,name:"texture"},K.add(Wp);class zp{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 h=t.buffers[a];h&&(s.buffer.update(h),h._glBuffers[r].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,a,h._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 h=t.buffers[a];if(!h)continue;const o=h._glBuffers[this.CONTEXT_UID];o&&(o.refCount--,o.refCount===0&&!e&&n.dispose(h,e))}s&&(e||r.deleteTransformFeedback(s),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}zp.extension={type:Y.RendererSystem,name:"transformFeedback"},K.add(zp);class Sa{constructor(t){this.renderer=t}init(t){this.screen=new rt(0,0,t.width,t.height),this.element=t.view||z.ADAPTER.createCanvas(),this.resolution=t.resolution||z.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}}Sa.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Sa.extension={type:[Y.RendererSystem,Y.CanvasRendererSystem],name:"_view"},K.add(Sa),z.PREFER_ENV=Ns.WEBGL2,z.STRICT_TEXTURE_CACHE=!1,z.RENDER_OPTIONS={...ba.defaultOptions,...va.defaultOptions,...Sa.defaultOptions,...Aa.defaultOptions},Object.defineProperties(z,{WRAP_MODE:{get(){return et.defaultOptions.wrapMode},set(i){ot("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),et.defaultOptions.wrapMode=i}},SCALE_MODE:{get(){return et.defaultOptions.scaleMode},set(i){ot("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),et.defaultOptions.scaleMode=i}},MIPMAP_TEXTURES:{get(){return et.defaultOptions.mipmap},set(i){ot("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),et.defaultOptions.mipmap=i}},ANISOTROPIC_LEVEL:{get(){return et.defaultOptions.anisotropicLevel},set(i){ot("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),et.defaultOptions.anisotropicLevel=i}},FILTER_RESOLUTION:{get(){return ot("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),pe.defaultResolution},set(i){pe.defaultResolution=i}},FILTER_MULTISAMPLE:{get(){return ot("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),pe.defaultMultisample},set(i){pe.defaultMultisample=i}},SPRITE_MAX_TEXTURES:{get(){return bi.defaultMaxTextures},set(i){ot("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),bi.defaultMaxTextures=i}},SPRITE_BATCH_SIZE:{get(){return bi.defaultBatchSize},set(i){ot("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),bi.defaultBatchSize=i}},CAN_UPLOAD_SAME_BUFFER:{get(){return bi.canUploadSameBuffer},set(i){ot("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),bi.canUploadSameBuffer=i}},GC_MODE:{get(){return Ti.defaultMode},set(i){ot("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Ti.defaultMode=i}},GC_MAX_IDLE:{get(){return Ti.defaultMaxIdle},set(i){ot("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Ti.defaultMaxIdle=i}},GC_MAX_CHECK_COUNT:{get(){return Ti.defaultCheckCountMax},set(i){ot("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Ti.defaultCheckCountMax=i}},PRECISION_VERTEX:{get(){return yr.defaultVertexPrecision},set(i){ot("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),yr.defaultVertexPrecision=i}},PRECISION_FRAGMENT:{get(){return yr.defaultFragmentPrecision},set(i){ot("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),yr.defaultFragmentPrecision=i}}});var Vr=(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))(Vr||{});class Hh{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 jp=class ns{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 Hh(null,null,1/0),this.deltaMS=1/ns.targetFPMS,this.elapsedMS=1/ns.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=Vr.NORMAL){return this._addListener(new Hh(t,e,s))}addOnce(t,e,s=Vr.NORMAL){return this._addListener(new Hh(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*ns.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,ns.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(!ns._shared){const t=ns._shared=new ns;t.autoStart=!0,t._protected=!0}return ns._shared}static get system(){if(!ns._system){const t=ns._system=new ns;t.autoStart=!0,t._protected=!0}return ns._system}};jp.targetFPMS=.06;let wt=jp;Object.defineProperties(z,{TARGET_FPMS:{get(){return wt.targetFPMS},set(i){ot("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),wt.targetFPMS=i}}});class qp{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,Vr.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?wt.shared:new wt,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}qp.extension=Y.Application,K.add(qp);const Zp=[];K.handleByList(Y.Renderer,Zp);function cw(i){for(const t of Zp)if(t.test(i))return new t(i);throw new Error("Unable to auto-detect a suitable renderer.")}var uw=`attribute vec2 aVertexPosition;
490
490
  attribute vec2 aTextureCoord;
491
491
 
492
492
  uniform mat3 projectionMatrix;
@@ -497,7 +497,7 @@ void main(void)
497
497
  {
498
498
  gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
499
499
  vTextureCoord = aTextureCoord;
500
- }`,cw=`attribute vec2 aVertexPosition;
500
+ }`,dw=`attribute vec2 aVertexPosition;
501
501
 
502
502
  uniform mat3 projectionMatrix;
503
503
 
@@ -523,7 +523,7 @@ void main(void)
523
523
  gl_Position = filterVertexPosition();
524
524
  vTextureCoord = filterTextureCoord();
525
525
  }
526
- `;const uw=hw,sm=cw;class rm{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>=re.HIGH?this.multisample=re.HIGH:e>=re.MEDIUM?this.multisample=re.MEDIUM:e>=re.LOW?this.multisample=re.LOW:this.multisample=re.NONE}destroy(){}}rm.extension={type:Y.RendererSystem,name:"_multisample"},K.add(rm);class dw{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class im{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 dw(s.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}im.extension={type:Y.RendererSystem,name:"buffer"},K.add(im);class nm{constructor(t){this.renderer=t}render(t,e){const s=this.renderer;let r,n,a,h;if(e&&(r=e.renderTexture,n=e.clear,a=e.transform,h=e.skipUpdateTransform),this.renderingToScreen=!r,s.runners.prerender.emit(),s.emit("prerender"),s.projection.transform=a,!s.context.isLost){if(r||(this.lastObjectRendered=t),!h){const o=t.enableTempParent();t.updateTransform(),t.disableTempParent(o)}s.renderTexture.bind(r),s.batch.currentRenderer.start(),(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}}nm.extension={type:Y.RendererSystem,name:"objectRenderer"},K.add(nm);const Ca=class gd extends nw{constructor(t){super(),this.type=Ed.WEBGL,t=Object.assign({},z.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new Es({projectionMatrix:new Rt},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:gd.__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&&(ot("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=gd.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:Lb()}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 ot("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return ot("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return ot("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return ot("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){ot("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return ot("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){ot("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return ot("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};Ca.extension={type:Y.Renderer,priority:1},Ca.__plugins={},Ca.__systems={};let qh=Ca;K.handleByMap(Y.RendererPlugin,qh.__plugins),K.handleByMap(Y.RendererSystem,qh.__systems),K.add(qh);class om extends so{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 et;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 so?this.addResourceAt(t[s],s):this.addResourceAt(fp(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 fw extends om{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=Wi.TEXTURE_2D_ARRAY}upload(t,e,s){const{length:r,itemDirtyIds:n,items:a}=this,{gl:h}=t;s.dirtyId<0&&h.texImage3D(h.TEXTURE_2D_ARRAY,0,s.internalFormat,this._width,this._height,r,0,e.format,s.type,null);for(let o=0;o<r;o++){const l=a[o];n[o]<l.dirtyId&&(n[o]=l.dirtyId,l.valid&&h.texSubImage3D(h.TEXTURE_2D_ARRAY,0,0,0,o,l.resource.width,l.resource.height,1,e.format,s.type,l.resource.source))}return!0}}class pw extends xr{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const am=class Oo extends om{constructor(t,e){const{width:s,height:r,autoLoad:n,linkBaseTexture:a}=e||{};if(t&&t.length!==Oo.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:s,height:r});for(let h=0;h<Oo.SIDES;h++)this.items[h].target=Wi.TEXTURE_CUBE_MAP_POSITIVE_X+h;this.linkBaseTexture=a!==!1,t&&this.initFromArray(t,e),n!==!1&&this.load()}bind(t){super.bind(t),t.target=Wi.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=Wi.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<Oo.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===Oo.SIDES}};am.SIDES=6;let mw=am;class ln extends xr{constructor(t,e){e=e||{};let s,r,n;typeof t=="string"?(s=ln.EMPTY,r=t,n=!0):(s=t,r=null,n=!1),super(s),this.url=r,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??n,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 z.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===Re.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<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return ln._EMPTY=ln._EMPTY??z.ADAPTER.createCanvas(0,0),ln._EMPTY}}const Zh=class Al extends xr{constructor(t,e){e=e||{},super(z.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)},Al.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;xr.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_${gi()}`,a.getContext("2d").drawImage(t,0,0,e,s,0,0,r,n),this._resolve(),this._resolve=null}}static getSize(t){const e=Al.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"&&Al.SVG_XML.test(t)}};Zh.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Zh.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Kh=Zh;class gw extends xr{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}}const Qh=class _d extends xr{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];xr.crossOrigin(s,r,e.crossorigin);for(let n=0;n<t.length;++n){const a=document.createElement("source");let{src:h,mime:o}=t[n];if(h=h||t[n],h.startsWith("data:"))o=h.slice(5,h.indexOf(";"));else if(!h.startsWith("blob:")){const l=h.split("?").shift().toLowerCase(),u=l.slice(l.lastIndexOf(".")+1);o=o||_d.MIME_TYPES[u]||`video/${u}`}a.src=h,o&&(a.type=o),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=wt.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&&(wt.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||(wt.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(wt.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||_d.TYPES.includes(e)}};Qh.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Qh.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let lm=Qh;kh.push(ln,Ip,pw,lm,gw,Kh,aa,mw,fw);class Ia{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?rt.EMPTY:(t=t||new rt(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:h,ty:o}=t,l=s*e.x+n*e.y+h,u=r*e.x+a*e.y+o;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],h=t[1];e=a<e?a:e,s=h<s?h:s,r=a>r?a:r,n=h>n?h:n,a=t[2],h=t[3],e=a<e?a:e,s=h<s?h:s,r=a>r?a:r,n=h>n?h:n,a=t[4],h=t[5],e=a<e?a:e,s=h<s?h:s,r=a>r?a:r,n=h>n?h:n,a=t[6],h=t[7],e=a<e?a:e,s=h<s?h:s,r=a>r?a:r,n=h>n?h: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,h=t.b,o=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+o*s+u,_=h*e+l*s+c;d=g<d?g:d,f=_<f?_:f,p=g>p?g:p,m=_>m?_:m,g=a*r+o*s+u,_=h*r+l*s+c,d=g<d?g:d,f=_<f?_:f,p=g>p?g:p,m=_>m?_:m,g=a*e+o*n+u,_=h*e+l*n+c,d=g<d?g:d,f=_<f?_:f,p=g>p?g:p,m=_>m?_:m,g=a*r+o*n+u,_=h*r+l*n+c,d=g<d?g:d,f=_<f?_:f,p=g>p?g:p,m=_>m?_: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,h=this.maxY;for(let o=e;o<s;o+=2){const l=t[o],u=t[o+1];r=l<r?l:r,n=u<n?u:n,a=l>a?l:a,h=u>h?u:h}this.minX=r,this.minY=n,this.maxX=a,this.maxY=h}addVertices(t,e,s,r){this.addVerticesMatrix(t.worldTransform,e,s,r)}addVerticesMatrix(t,e,s,r,n=0,a=n){const h=t.a,o=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 _=s;_<r;_+=2){const x=e[_],y=e[_+1],v=h*x+l*y+c,b=u*y+o*x+d;f=Math.min(f,v-n),m=Math.max(m,v+n),p=Math.min(p,b-a),g=Math.max(g,b+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 h=this.minX,o=this.minY,l=this.maxX,u=this.maxY;this.minX=s<h?s:h,this.minY=r<o?r:o,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 h=this.minX,o=this.minY,l=this.maxX,u=this.maxY;this.minX=s<h?s:h,this.minY=r<o?r:o,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 Vt extends Xs{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new ma,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 Ia,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(Vt.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 rt),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new rt),t=this._localBoundsRect),this._localBounds||(this._localBounds=new Ia);const e=this.transform,s=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=(s==null?void 0:s.worldAlpha)??1,this.transform=this._tempDisplayObjectParent.transform;const r=this._bounds,n=this._boundsID;this._bounds=this._localBounds;const a=this.getBounds(!1,t);return this.parent=s,this.transform=e,this._bounds=r,this._bounds.updateID+=this._boundsID-n,a}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,h=0,o=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=h,this.pivot.x=o,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 _w),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*c1}set angle(t){this.transform.rotation=t*Oh}get zIndex(){return this._zIndex}set zIndex(t){this._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 _w extends Vt{constructor(){super(...arguments),this.sortDirty=null}}Vt.prototype.displayObjectUpdateTransform=Vt.prototype.updateTransform;const yw=new Rt;function xw(i,t){return i.zIndex===t.zIndex?i._lastSortedIndex-t._lastSortedIndex:i.zIndex-t.zIndex}const hm=class yd extends Vt{constructor(){super(),this.children=[],this.sortableChildren=yd.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);nn(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,nn(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,nn(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 h=0;h<a.length;++h)a[h].parent=null,a[h].transform&&(a[h].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let h=0;h<a.length;++h)a[h].emit("removed",this),this.emit("childRemoved",a[h],this,h);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(xw),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!==yd.prototype._render&&(s=this.getBounds(!0));const n=t.projection.transform;if(n&&(r?(r=yw.copyFrom(r),r.prepend(n)):r=n),s&&e.intersects(s,r))this._render(t);else if(this.cullArea)return;for(let a=0,h=this.children.length;a<h;++a){const o=this.children[a],l=o.cullable;o.cullable=l||!this.cullArea,o.render(t),o.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 n,a,h;const e=this.filters,s=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let o=0;o<e.length;o++)e[o].enabled&&this._enabledFilters.push(e[o])}const r=e&&((n=this._enabledFilters)==null?void 0:n.length)||s&&(!s.isMaskData||s.enabled&&(s.autoDetect||s.type!==ce.NONE));if(r&&t.batch.flush(),e&&((a=this._enabledFilters)!=null&&a.length)&&t.filter.push(this,this._enabledFilters),s&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let o=0,l=this.children.length;o<l;++o)this.children[o].render(t)}r&&t.batch.flush(),s&&t.mask.pop(this),e&&((h=this._enabledFilters)!=null&&h.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}};hm.defaultSortableChildren=!1;let Bt=hm;Bt.prototype.containerUpdateTransform=Bt.prototype.updateTransform,Object.defineProperties(z,{SORTABLE_CHILDREN:{get(){return Bt.defaultSortableChildren},set(i){ot("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),Bt.defaultSortableChildren=i}}});const ao=new st,vw=new Uint16Array([0,1,2,0,2,3]);class qe extends Bt{constructor(t){super(),this._anchor=new qs(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 Ct(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=W.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||q.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=vw,this.pluginName="batch",this.isSprite=!0,this._roundPixels=z.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=Dr(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=Dr(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,h=e.tx,o=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+h,l[1]=a*g+r*p+o,l[2]=s*f+n*g+h,l[3]=a*g+r*f+o,l[4]=s*f+n*m+h,l[5]=a*m+r*f+o,l[6]=s*p+n*m+h,l[7]=a*m+r*p+o,this._roundPixels){const _=z.RESOLUTION;for(let x=0;x<l.length;++x)l[x]=Math.round(l[x]*_)/_}}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,h=n.b,o=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+o*p+u,e[1]=l*p+h*d+c,e[2]=a*f+o*p+u,e[3]=l*p+h*f+c,e[4]=a*f+o*m+u,e[5]=l*m+h*f+c,e[6]=a*d+o*m+u,e[7]=l*m+h*d+c,this._roundPixels){const g=z.RESOLUTION;for(let _=0;_<e.length;++_)e[_]=Math.round(e[_]*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 Ia),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 rt),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,ao);const e=this._texture.orig.width,s=this._texture.orig.height,r=-e*this.anchor.x;let n=0;return ao.x>=r&&ao.x<r+e&&(n=-s*this.anchor.y,ao.y>=n&&ao.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 q?t:q.from(t,e);return new qe(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=Dr(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=Dr(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||q.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const cm=new Rt;Vt.prototype._cacheAsBitmap=!1,Vt.prototype._cacheData=null,Vt.prototype._cacheAsBitmapResolution=null,Vt.prototype._cacheAsBitmapMultisample=null;class bw{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(Vt.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 bw),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)}}}),Vt.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))},Vt.prototype._initCachedDisplayObject=function(i){var d,f;if((d=this._cacheData)!=null&&d.sprite)return;const t=this.alpha;this.alpha=1,i.batch.flush();const e=this.getLocalBounds(new rt,!0);if((f=this.filters)!=null&&f.length){const p=this.filters[0].padding;e.pad(p)}const s=this.cacheAsBitmapResolution||i.resolution;e.ceil(s),e.width=Math.max(e.width,1/s),e.height=Math.max(e.height,1/s);const r=i.renderTexture.current,n=i.renderTexture.sourceFrame.clone(),a=i.renderTexture.destinationFrame.clone(),h=i.projection.transform,o=wi.create({width:e.width,height:e.height,resolution:s,multisample:this.cacheAsBitmapMultisample??i.multisample}),l=`cacheAsBitmap_${gi()}`;this._cacheData.textureCacheId=l,et.addToCache(o.baseTexture,l),q.addToCache(o,l);const u=this.transform.localTransform.copyTo(cm).invert().translate(-e.x,-e.y);this.render=this._cacheData.originalRender,i.render(this,{renderTexture:o,clear:!0,transform:u,skipUpdateTransform:!1}),i.framebuffer.blit(),i.projection.transform=h,i.renderTexture.bind(r,n,a),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=t;const c=new qe(o);c.transform.worldTransform=this.transform.worldTransform,c.anchor.x=-(e.x/e.width),c.anchor.y=-(e.y/e.height),c.alpha=t,c._bounds=this._bounds,this._cacheData.sprite=c,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=c.containsPoint.bind(c)},Vt.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))},Vt.prototype._initCachedDisplayObjectCanvas=function(i){var u;if((u=this._cacheData)!=null&&u.sprite)return;const t=this.getLocalBounds(new rt,!0),e=this.alpha;this.alpha=1;const s=i.canvasContext.activeContext,r=i._projTransform,n=this.cacheAsBitmapResolution||i.resolution;t.ceil(n),t.width=Math.max(t.width,1/n),t.height=Math.max(t.height,1/n);const a=wi.create({width:t.width,height:t.height,resolution:n}),h=`cacheAsBitmap_${gi()}`;this._cacheData.textureCacheId=h,et.addToCache(a.baseTexture,h),q.addToCache(a,h);const o=cm;this.transform.localTransform.copyTo(o),o.invert(),o.tx-=t.x,o.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,i.render(this,{renderTexture:a,clear:!0,transform:o,skipUpdateTransform:!1}),i.canvasContext.activeContext=s,i._projTransform=r,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;const l=new qe(a);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(t.x/t.width),l.anchor.y=-(t.y/t.height),l.alpha=e,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=i._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)},Vt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Vt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Vt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,et.removeFromCache(this._cacheData.textureCacheId),q.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Vt.prototype._cacheAsBitmapDestroy=function(i){this.cacheAsBitmap=!1,this.destroy(i)},Vt.prototype.name=null,Bt.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},Vt.prototype.getGlobalPosition=function(i=new st,t=!1){return this.parent?this.parent.toGlobal(this.position,i,t):(i.x=this.position.x,i.y=this.position.y),i};var ww=`varying vec2 vTextureCoord;
526
+ `;const fw=uw,Kp=dw;class Qp{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>=re.HIGH?this.multisample=re.HIGH:e>=re.MEDIUM?this.multisample=re.MEDIUM:e>=re.LOW?this.multisample=re.LOW:this.multisample=re.NONE}destroy(){}}Qp.extension={type:Y.RendererSystem,name:"_multisample"},K.add(Qp);class pw{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Jp{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 pw(s.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}Jp.extension={type:Y.RendererSystem,name:"buffer"},K.add(Jp);class tm{constructor(t){this.renderer=t}render(t,e){const s=this.renderer;let r,n,a,h;if(e&&(r=e.renderTexture,n=e.clear,a=e.transform,h=e.skipUpdateTransform),this.renderingToScreen=!r,s.runners.prerender.emit(),s.emit("prerender"),s.projection.transform=a,!s.context.isLost){if(r||(this.lastObjectRendered=t),!h){const o=t.enableTempParent();t.updateTransform(),t.disableTempParent(o)}s.renderTexture.bind(r),s.batch.currentRenderer.start(),(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}}tm.extension={type:Y.RendererSystem,name:"objectRenderer"},K.add(tm);const Ca=class fd extends aw{constructor(t){super(),this.type=vd.WEBGL,t=Object.assign({},z.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new Es({projectionMatrix:new Rt},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:fd.__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&&(ot("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=fd.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:Vb()}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 ot("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return ot("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return ot("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return ot("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){ot("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return ot("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){ot("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return ot("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};Ca.extension={type:Y.Renderer,priority:1},Ca.__plugins={},Ca.__systems={};let Wh=Ca;K.handleByMap(Y.RendererPlugin,Wh.__plugins),K.handleByMap(Y.RendererSystem,Wh.__systems),K.add(Wh);class em extends so{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 et;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 so?this.addResourceAt(t[s],s):this.addResourceAt(lp(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 mw extends em{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=Wi.TEXTURE_2D_ARRAY}upload(t,e,s){const{length:r,itemDirtyIds:n,items:a}=this,{gl:h}=t;s.dirtyId<0&&h.texImage3D(h.TEXTURE_2D_ARRAY,0,s.internalFormat,this._width,this._height,r,0,e.format,s.type,null);for(let o=0;o<r;o++){const l=a[o];n[o]<l.dirtyId&&(n[o]=l.dirtyId,l.valid&&h.texSubImage3D(h.TEXTURE_2D_ARRAY,0,0,0,o,l.resource.width,l.resource.height,1,e.format,s.type,l.resource.source))}return!0}}class gw extends xr{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const sm=class Oo extends em{constructor(t,e){const{width:s,height:r,autoLoad:n,linkBaseTexture:a}=e||{};if(t&&t.length!==Oo.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:s,height:r});for(let h=0;h<Oo.SIDES;h++)this.items[h].target=Wi.TEXTURE_CUBE_MAP_POSITIVE_X+h;this.linkBaseTexture=a!==!1,t&&this.initFromArray(t,e),n!==!1&&this.load()}bind(t){super.bind(t),t.target=Wi.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=Wi.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<Oo.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===Oo.SIDES}};sm.SIDES=6;let _w=sm;class ln extends xr{constructor(t,e){e=e||{};let s,r,n;typeof t=="string"?(s=ln.EMPTY,r=t,n=!0):(s=t,r=null,n=!1),super(s),this.url=r,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??n,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 z.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===Re.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<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return ln._EMPTY=ln._EMPTY??z.ADAPTER.createCanvas(0,0),ln._EMPTY}}const zh=class Al extends xr{constructor(t,e){e=e||{},super(z.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)},Al.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;xr.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_${gi()}`,a.getContext("2d").drawImage(t,0,0,e,s,0,0,r,n),this._resolve(),this._resolve=null}}static getSize(t){const e=Al.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"&&Al.SVG_XML.test(t)}};zh.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,zh.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let jh=zh;class yw extends xr{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}}const qh=class pd extends xr{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];xr.crossOrigin(s,r,e.crossorigin);for(let n=0;n<t.length;++n){const a=document.createElement("source");let{src:h,mime:o}=t[n];if(h=h||t[n],h.startsWith("data:"))o=h.slice(5,h.indexOf(";"));else if(!h.startsWith("blob:")){const l=h.split("?").shift().toLowerCase(),u=l.slice(l.lastIndexOf(".")+1);o=o||pd.MIME_TYPES[u]||`video/${u}`}a.src=h,o&&(a.type=o),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=wt.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&&(wt.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||(wt.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(wt.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||pd.TYPES.includes(e)}};qh.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],qh.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let rm=qh;Rh.push(ln,Ep,gw,rm,yw,jh,aa,_w,mw);class Ia{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?rt.EMPTY:(t=t||new rt(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:h,ty:o}=t,l=s*e.x+n*e.y+h,u=r*e.x+a*e.y+o;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],h=t[1];e=a<e?a:e,s=h<s?h:s,r=a>r?a:r,n=h>n?h:n,a=t[2],h=t[3],e=a<e?a:e,s=h<s?h:s,r=a>r?a:r,n=h>n?h:n,a=t[4],h=t[5],e=a<e?a:e,s=h<s?h:s,r=a>r?a:r,n=h>n?h:n,a=t[6],h=t[7],e=a<e?a:e,s=h<s?h:s,r=a>r?a:r,n=h>n?h: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,h=t.b,o=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+o*s+u,_=h*e+l*s+c;d=g<d?g:d,f=_<f?_:f,p=g>p?g:p,m=_>m?_:m,g=a*r+o*s+u,_=h*r+l*s+c,d=g<d?g:d,f=_<f?_:f,p=g>p?g:p,m=_>m?_:m,g=a*e+o*n+u,_=h*e+l*n+c,d=g<d?g:d,f=_<f?_:f,p=g>p?g:p,m=_>m?_:m,g=a*r+o*n+u,_=h*r+l*n+c,d=g<d?g:d,f=_<f?_:f,p=g>p?g:p,m=_>m?_: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,h=this.maxY;for(let o=e;o<s;o+=2){const l=t[o],u=t[o+1];r=l<r?l:r,n=u<n?u:n,a=l>a?l:a,h=u>h?u:h}this.minX=r,this.minY=n,this.maxX=a,this.maxY=h}addVertices(t,e,s,r){this.addVerticesMatrix(t.worldTransform,e,s,r)}addVerticesMatrix(t,e,s,r,n=0,a=n){const h=t.a,o=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 _=s;_<r;_+=2){const x=e[_],y=e[_+1],v=h*x+l*y+c,b=u*y+o*x+d;f=Math.min(f,v-n),m=Math.max(m,v+n),p=Math.min(p,b-a),g=Math.max(g,b+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 h=this.minX,o=this.minY,l=this.maxX,u=this.maxY;this.minX=s<h?s:h,this.minY=r<o?r:o,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 h=this.minX,o=this.minY,l=this.maxX,u=this.maxY;this.minX=s<h?s:h,this.minY=r<o?r:o,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 Vt extends Xs{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new ma,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 Ia,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(Vt.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 rt),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new rt),t=this._localBoundsRect),this._localBounds||(this._localBounds=new Ia);const e=this.transform,s=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=(s==null?void 0:s.worldAlpha)??1,this.transform=this._tempDisplayObjectParent.transform;const r=this._bounds,n=this._boundsID;this._bounds=this._localBounds;const a=this.getBounds(!1,t);return this.parent=s,this.transform=e,this._bounds=r,this._bounds.updateID+=this._boundsID-n,a}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,h=0,o=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=h,this.pivot.x=o,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 xw),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*d1}set angle(t){this.transform.rotation=t*kh}get zIndex(){return this._zIndex}set zIndex(t){this._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 xw extends Vt{constructor(){super(...arguments),this.sortDirty=null}}Vt.prototype.displayObjectUpdateTransform=Vt.prototype.updateTransform;const vw=new Rt;function bw(i,t){return i.zIndex===t.zIndex?i._lastSortedIndex-t._lastSortedIndex:i.zIndex-t.zIndex}const im=class md extends Vt{constructor(){super(),this.children=[],this.sortableChildren=md.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);nn(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,nn(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,nn(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 h=0;h<a.length;++h)a[h].parent=null,a[h].transform&&(a[h].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let h=0;h<a.length;++h)a[h].emit("removed",this),this.emit("childRemoved",a[h],this,h);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(bw),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!==md.prototype._render&&(s=this.getBounds(!0));const n=t.projection.transform;if(n&&(r?(r=vw.copyFrom(r),r.prepend(n)):r=n),s&&e.intersects(s,r))this._render(t);else if(this.cullArea)return;for(let a=0,h=this.children.length;a<h;++a){const o=this.children[a],l=o.cullable;o.cullable=l||!this.cullArea,o.render(t),o.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 n,a,h;const e=this.filters,s=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let o=0;o<e.length;o++)e[o].enabled&&this._enabledFilters.push(e[o])}const r=e&&((n=this._enabledFilters)==null?void 0:n.length)||s&&(!s.isMaskData||s.enabled&&(s.autoDetect||s.type!==ce.NONE));if(r&&t.batch.flush(),e&&((a=this._enabledFilters)!=null&&a.length)&&t.filter.push(this,this._enabledFilters),s&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let o=0,l=this.children.length;o<l;++o)this.children[o].render(t)}r&&t.batch.flush(),s&&t.mask.pop(this),e&&((h=this._enabledFilters)!=null&&h.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}};im.defaultSortableChildren=!1;let Bt=im;Bt.prototype.containerUpdateTransform=Bt.prototype.updateTransform,Object.defineProperties(z,{SORTABLE_CHILDREN:{get(){return Bt.defaultSortableChildren},set(i){ot("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),Bt.defaultSortableChildren=i}}});const ao=new st,ww=new Uint16Array([0,1,2,0,2,3]);class qe extends Bt{constructor(t){super(),this._anchor=new qs(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 Ct(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=W.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||q.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=ww,this.pluginName="batch",this.isSprite=!0,this._roundPixels=z.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=Dr(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=Dr(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,h=e.tx,o=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+h,l[1]=a*g+r*p+o,l[2]=s*f+n*g+h,l[3]=a*g+r*f+o,l[4]=s*f+n*m+h,l[5]=a*m+r*f+o,l[6]=s*p+n*m+h,l[7]=a*m+r*p+o,this._roundPixels){const _=z.RESOLUTION;for(let x=0;x<l.length;++x)l[x]=Math.round(l[x]*_)/_}}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,h=n.b,o=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+o*p+u,e[1]=l*p+h*d+c,e[2]=a*f+o*p+u,e[3]=l*p+h*f+c,e[4]=a*f+o*m+u,e[5]=l*m+h*f+c,e[6]=a*d+o*m+u,e[7]=l*m+h*d+c,this._roundPixels){const g=z.RESOLUTION;for(let _=0;_<e.length;++_)e[_]=Math.round(e[_]*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 Ia),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 rt),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,ao);const e=this._texture.orig.width,s=this._texture.orig.height,r=-e*this.anchor.x;let n=0;return ao.x>=r&&ao.x<r+e&&(n=-s*this.anchor.y,ao.y>=n&&ao.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 q?t:q.from(t,e);return new qe(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=Dr(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=Dr(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||q.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const nm=new Rt;Vt.prototype._cacheAsBitmap=!1,Vt.prototype._cacheData=null,Vt.prototype._cacheAsBitmapResolution=null,Vt.prototype._cacheAsBitmapMultisample=null;class Ew{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(Vt.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 Ew),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)}}}),Vt.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))},Vt.prototype._initCachedDisplayObject=function(i){var d,f;if((d=this._cacheData)!=null&&d.sprite)return;const t=this.alpha;this.alpha=1,i.batch.flush();const e=this.getLocalBounds(new rt,!0);if((f=this.filters)!=null&&f.length){const p=this.filters[0].padding;e.pad(p)}const s=this.cacheAsBitmapResolution||i.resolution;e.ceil(s),e.width=Math.max(e.width,1/s),e.height=Math.max(e.height,1/s);const r=i.renderTexture.current,n=i.renderTexture.sourceFrame.clone(),a=i.renderTexture.destinationFrame.clone(),h=i.projection.transform,o=wi.create({width:e.width,height:e.height,resolution:s,multisample:this.cacheAsBitmapMultisample??i.multisample}),l=`cacheAsBitmap_${gi()}`;this._cacheData.textureCacheId=l,et.addToCache(o.baseTexture,l),q.addToCache(o,l);const u=this.transform.localTransform.copyTo(nm).invert().translate(-e.x,-e.y);this.render=this._cacheData.originalRender,i.render(this,{renderTexture:o,clear:!0,transform:u,skipUpdateTransform:!1}),i.framebuffer.blit(),i.projection.transform=h,i.renderTexture.bind(r,n,a),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=t;const c=new qe(o);c.transform.worldTransform=this.transform.worldTransform,c.anchor.x=-(e.x/e.width),c.anchor.y=-(e.y/e.height),c.alpha=t,c._bounds=this._bounds,this._cacheData.sprite=c,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=c.containsPoint.bind(c)},Vt.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))},Vt.prototype._initCachedDisplayObjectCanvas=function(i){var u;if((u=this._cacheData)!=null&&u.sprite)return;const t=this.getLocalBounds(new rt,!0),e=this.alpha;this.alpha=1;const s=i.canvasContext.activeContext,r=i._projTransform,n=this.cacheAsBitmapResolution||i.resolution;t.ceil(n),t.width=Math.max(t.width,1/n),t.height=Math.max(t.height,1/n);const a=wi.create({width:t.width,height:t.height,resolution:n}),h=`cacheAsBitmap_${gi()}`;this._cacheData.textureCacheId=h,et.addToCache(a.baseTexture,h),q.addToCache(a,h);const o=nm;this.transform.localTransform.copyTo(o),o.invert(),o.tx-=t.x,o.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,i.render(this,{renderTexture:a,clear:!0,transform:o,skipUpdateTransform:!1}),i.canvasContext.activeContext=s,i._projTransform=r,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;const l=new qe(a);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(t.x/t.width),l.anchor.y=-(t.y/t.height),l.alpha=e,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=i._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)},Vt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Vt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Vt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,et.removeFromCache(this._cacheData.textureCacheId),q.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Vt.prototype._cacheAsBitmapDestroy=function(i){this.cacheAsBitmap=!1,this.destroy(i)},Vt.prototype.name=null,Bt.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},Vt.prototype.getGlobalPosition=function(i=new st,t=!1){return this.parent?this.parent.toGlobal(this.position,i,t):(i.x=this.position.x,i.y=this.position.y),i};var Tw=`varying vec2 vTextureCoord;
527
527
 
528
528
  uniform sampler2D uSampler;
529
529
  uniform float uAlpha;
@@ -532,9 +532,9 @@ void main(void)
532
532
  {
533
533
  gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;
534
534
  }
535
- `;class Ew extends pe{constructor(t=1){super(uw,ww,{uAlpha:1}),this.alpha=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}const Tw={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]},Aw=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
536
- `);function Sw(i){const t=Tw[i],e=t.length;let s=Aw,r="";const n="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;";let a;for(let h=0;h<i;h++){let o=n.replace("%index%",h.toString());a=h,h>=e&&(a=i-h-1),o=o.replace("%value%",t[a].toString()),r+=o,r+=`
537
- `}return s=s.replace("%blur%",r),s=s.replace("%size%",i.toString()),s}const Cw=`
535
+ `;class Aw extends pe{constructor(t=1){super(fw,Tw,{uAlpha:1}),this.alpha=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}const Sw={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]},Cw=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
536
+ `);function Iw(i){const t=Sw[i],e=t.length;let s=Cw,r="";const n="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;";let a;for(let h=0;h<i;h++){let o=n.replace("%index%",h.toString());a=h,h>=e&&(a=i-h-1),o=o.replace("%value%",t[a].toString()),r+=o,r+=`
537
+ `}return s=s.replace("%blur%",r),s=s.replace("%size%",i.toString()),s}const Pw=`
538
538
  attribute vec2 aVertexPosition;
539
539
 
540
540
  uniform mat3 projectionMatrix;
@@ -564,8 +564,8 @@ void main(void)
564
564
 
565
565
  vec2 textureCoord = filterTextureCoord();
566
566
  %blur%
567
- }`;function Iw(i,t){const e=Math.ceil(i/2);let s=Cw,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 h=n.replace("%index%",a.toString());h=h.replace("%sampleIndex%",`${a-(e-1)}.0`),r+=h,r+=`
568
- `}return s=s.replace("%blur%",r),s=s.replace("%size%",i.toString()),s}class Jh extends pe{constructor(t,e=8,s=4,r=pe.defaultResolution,n=5){const a=Iw(n,t),h=Sw(n);super(a,h),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 h=e,o=n;this.state.blend=!1,t.applyFilter(this,h,o,Vs.CLEAR);for(let l=1;l<this.passes-1;l++){t.bindAndClear(h,Vs.BLIT),this.uniforms.uSampler=o;const u=o;o=h,h=u,a.shader.bind(this),a.geometry.draw(5)}this.state.blend=!0,t.applyFilter(this,o,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 um extends pe{constructor(t=8,e=4,s=pe.defaultResolution,r=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new Jh(!0,t,e,s,r),this.blurYFilter=new Jh(!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 h=t.getFilterTexture();this.blurXFilter.apply(t,e,h,Vs.CLEAR),this.blurYFilter.apply(t,h,s,r),t.returnFilterTexture(h)}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 Pw=`varying vec2 vTextureCoord;
567
+ }`;function Rw(i,t){const e=Math.ceil(i/2);let s=Pw,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 h=n.replace("%index%",a.toString());h=h.replace("%sampleIndex%",`${a-(e-1)}.0`),r+=h,r+=`
568
+ `}return s=s.replace("%blur%",r),s=s.replace("%size%",i.toString()),s}class Zh extends pe{constructor(t,e=8,s=4,r=pe.defaultResolution,n=5){const a=Rw(n,t),h=Iw(n);super(a,h),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 h=e,o=n;this.state.blend=!1,t.applyFilter(this,h,o,Vs.CLEAR);for(let l=1;l<this.passes-1;l++){t.bindAndClear(h,Vs.BLIT),this.uniforms.uSampler=o;const u=o;o=h,h=u,a.shader.bind(this),a.geometry.draw(5)}this.state.blend=!0,t.applyFilter(this,o,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 om extends pe{constructor(t=8,e=4,s=pe.defaultResolution,r=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new Zh(!0,t,e,s,r),this.blurYFilter=new Zh(!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 h=t.getFilterTexture();this.blurXFilter.apply(t,e,h,Vs.CLEAR),this.blurYFilter.apply(t,h,s,r),t.returnFilterTexture(h)}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 Mw=`varying vec2 vTextureCoord;
569
569
  uniform sampler2D uSampler;
570
570
  uniform float m[20];
571
571
  uniform float uAlpha;
@@ -617,7 +617,7 @@ void main(void)
617
617
 
618
618
  gl_FragColor = vec4(rgb, result.a);
619
619
  }
620
- `;class hn extends pe{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(sm,Pw,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]=Ct.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,h=n(a),o=s+(1-s)*a,l=a*(1-s)-h*r,u=a*(1-s)+h*r,c=a*(1-s)+h*r,d=s+a*(1-s),f=a*(1-s)-h*r,p=a*(1-s)-h*r,m=a*(1-s)+h*r,g=s+a*(1-s),_=[o,l,u,0,0,c,d,f,0,0,p,m,g,0,0,0,0,0,1,0];this._loadMatrix(_,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=Ct.shared,[h,o,l]=a.setValue(s).toArray(),[u,c,d]=a.setValue(r).toArray(),f=[.3,.59,.11,0,0,h,o,l,t,0,u,c,d,e,0,h-u,o-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}}hn.prototype.grayscale=hn.prototype.greyscale;var Rw=`varying vec2 vFilterCoord;
620
+ `;class hn extends pe{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(Kp,Mw,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]=Ct.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,h=n(a),o=s+(1-s)*a,l=a*(1-s)-h*r,u=a*(1-s)+h*r,c=a*(1-s)+h*r,d=s+a*(1-s),f=a*(1-s)-h*r,p=a*(1-s)-h*r,m=a*(1-s)+h*r,g=s+a*(1-s),_=[o,l,u,0,0,c,d,f,0,0,p,m,g,0,0,0,0,0,1,0];this._loadMatrix(_,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=Ct.shared,[h,o,l]=a.setValue(s).toArray(),[u,c,d]=a.setValue(r).toArray(),f=[.3,.59,.11,0,0,h,o,l,t,0,u,c,d,e,0,h-u,o-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}}hn.prototype.grayscale=hn.prototype.greyscale;var Fw=`varying vec2 vFilterCoord;
621
621
  varying vec2 vTextureCoord;
622
622
 
623
623
  uniform vec2 scale;
@@ -637,7 +637,7 @@ void main(void)
637
637
 
638
638
  gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));
639
639
  }
640
- `,Mw=`attribute vec2 aVertexPosition;
640
+ `,kw=`attribute vec2 aVertexPosition;
641
641
 
642
642
  uniform mat3 projectionMatrix;
643
643
  uniform mat3 filterMatrix;
@@ -666,7 +666,7 @@ void main(void)
666
666
  vTextureCoord = filterTextureCoord();
667
667
  vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;
668
668
  }
669
- `;class Fw extends pe{constructor(t,e){const s=new Rt;t.renderable=!1,super(Mw,Rw,{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 st(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),h=Math.sqrt(n.c*n.c+n.d*n.d);a!==0&&h!==0&&(this.uniforms.rotation[0]=n.a/a,this.uniforms.rotation[1]=n.b/a,this.uniforms.rotation[2]=n.c/h,this.uniforms.rotation[3]=n.d/h),t.applyFilter(this,e,s,r)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}}var kw=`varying vec2 v_rgbNW;
669
+ `;class Bw extends pe{constructor(t,e){const s=new Rt;t.renderable=!1,super(kw,Fw,{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 st(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),h=Math.sqrt(n.c*n.c+n.d*n.d);a!==0&&h!==0&&(this.uniforms.rotation[0]=n.a/a,this.uniforms.rotation[1]=n.b/a,this.uniforms.rotation[2]=n.c/h,this.uniforms.rotation[3]=n.d/h),t.applyFilter(this,e,s,r)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}}var Dw=`varying vec2 v_rgbNW;
670
670
  varying vec2 v_rgbNE;
671
671
  varying vec2 v_rgbSW;
672
672
  varying vec2 v_rgbSE;
@@ -787,7 +787,7 @@ void main() {
787
787
 
788
788
  gl_FragColor = color;
789
789
  }
790
- `,Bw=`
790
+ `,Ow=`
791
791
  attribute vec2 aVertexPosition;
792
792
 
793
793
  uniform mat3 projectionMatrix;
@@ -829,7 +829,7 @@ void main(void) {
829
829
 
830
830
  texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
831
831
  }
832
- `;class Dw extends pe{constructor(){super(Bw,kw)}}var Ow=`precision highp float;
832
+ `;class Lw extends pe{constructor(){super(Ow,Dw)}}var Nw=`precision highp float;
833
833
 
834
834
  varying vec2 vTextureCoord;
835
835
  varying vec4 vColor;
@@ -863,8 +863,8 @@ void main()
863
863
 
864
864
  gl_FragColor = color;
865
865
  }
866
- `;class Lw extends pe{constructor(t=.5,e=Math.random()){super(sm,Ow,{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 dm={AlphaFilter:Ew,BlurFilter:um,BlurFilterPass:Jh,ColorMatrixFilter:hn,DisplacementFilter:Fw,FXAAFilter:Dw,NoiseFilter:Lw};Object.entries(dm).forEach(([i,t])=>{Object.defineProperty(dm,i,{get(){return ot("7.1.0",`filters.${i} has moved to ${i}`),t}})});class Nw{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||(wt.system.add(this.tickerUpdate,this,Vr.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(wt.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 Ur=new Nw;class lo{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=lo.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new st,this.page=new st,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 Pa extends lo{constructor(){super(...arguments),this.client=new st,this.movement=new st,this.offset=new st,this.global=new st,this.screen=new st}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,h,o,l,u,c,d,f,p,m){throw new Error("Method not implemented.")}}class Ts extends Pa{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 cn extends Pa{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}cn.DOM_DELTA_PIXEL=0,cn.DOM_DELTA_LINE=1,cn.DOM_DELTA_PAGE=2;const Vw=2048,Uw=new st,tc=new st;class Gw{constructor(t){this.dispatch=new Xs,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){Ur.pauseUpdate=!0;const s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",r=this[s](this.rootTarget,this.rootTarget.eventMode,Uw.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<Vw&&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 h=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ur.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),h=!0}}}const o=this._isInteractive(e),l=t.isInteractive();return o&&l&&this._allInteractiveElements.push(t),a||this._hitElements.length>0?null:h?this._hitElements:o&&!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")&&(Ur.pauseUpdate=!1),t.interactiveChildren&&t.children){const o=t.children;for(let l=o.length-1;l>=0;l--){const u=o[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),h=t.isInteractive();return a&&r(t,s)?h?[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,tc),!t.hitArea.contains(tc.x,tc.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 n,a;e=e??t.type;const s=`on${e}`;(a=(n=t.currentTarget)[s])==null||a.call(n,t);const r=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,r),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Ts)){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 o,l;if(!(t instanceof Ts)){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 e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const s=e.pointerType==="mouse"||e.pointerType==="pen",r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.overTargets);if(((o=r.overTargets)==null?void 0:o.length)>0&&n!==e.target){const u=t.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(t,u,n);if(this.dispatchEvent(c,"pointerout"),s&&this.dispatchEvent(c,"mouseout"),!e.composedPath().includes(n)){const d=this.createPointerEvent(t,"pointerleave",n);for(d.eventPhase=d.AT_TARGET;d.target&&!e.composedPath().includes(d.target);)d.currentTarget=d.target,this.notifyTarget(d),s&&this.notifyTarget(d,"mouseleave"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(c)}if(n!==e.target){const u=t.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(e,u);this.dispatchEvent(c,"pointerover"),s&&this.dispatchEvent(c,"mouseover");let d=n==null?void 0:n.parent;for(;d&&d!==this.rootTarget.parent&&d!==e.target;)d=d.parent;if(!d||d===this.rootTarget.parent){const f=this.clonePointerEvent(e,"pointerenter");for(f.eventPhase=f.AT_TARGET;f.target&&f.target!==n&&f.target!==this.rootTarget.parent;)f.currentTarget=f.target,this.notifyTarget(f),s&&this.notifyTarget(f,"mouseenter"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(c)}const a=[],h=this.enableGlobalMoveEvents??!0;this.moveOnAll?a.push("pointermove"):this.dispatchEvent(e,"pointermove"),h&&a.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?a.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),h&&a.push("globaltouchmove")),s&&(this.moveOnAll?a.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),h&&a.push("globalmousemove"),this.cursor=(l=e.target)==null?void 0:l.cursor),a.length>0&&this.all(e,a),this._allInteractiveElements.length=0,this._hitElements.length=0,r.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){var a;if(!(t instanceof Ts)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),s=this.createPointerEvent(t),r=s.pointerType==="mouse"||s.pointerType==="pen";this.dispatchEvent(s,"pointerover"),r&&this.dispatchEvent(s,"mouseover"),s.pointerType==="mouse"&&(this.cursor=(a=s.target)==null?void 0:a.cursor);const n=this.clonePointerEvent(s,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=s.composedPath(),this.freeEvent(s),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof Ts)){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 Ts)){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 h=s.button===2;this.dispatchEvent(s,h?"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 h=n;for(;h&&!s.composedPath().includes(h);){if(s.currentTarget=h,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")this.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const o=s.button===2;this.notifyTarget(s,o?"rightupoutside":"mouseupoutside")}h=h.parent}delete r.pressTargetsByButton[t.button],a=h}if(a){const h=this.clonePointerEvent(s,"click");h.target=a,h.path=null,r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:h.target,timeStamp:e});const o=r.clicksByButton[t.button];if(o.target===h.target&&e-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=h.target,o.timeStamp=e,h.detail=o.clickCount,h.pointerType==="mouse"){const l=h.button===2;this.dispatchEvent(h,l?"rightclick":"click")}else h.pointerType==="touch"&&this.dispatchEvent(h,"tap");this.dispatchEvent(h,"pointertap"),this.freeEvent(h)}this.freeEvent(s)}mapPointerUpOutside(t){if(!(t instanceof Ts)){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 cn)){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){const r=this.allocateEvent(Ts);return this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.nativeEvent=t.nativeEvent,r.originalEvent=t,r.target=s??this.hitTest(r.global.x,r.global.y)??this._hitElements[0],typeof e=="string"&&(r.type=e),r}createWheelEvent(t){const e=this.allocateEvent(cn);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(Ts);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??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 Ts&&e instanceof Ts&&(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 Pa&&e instanceof Pa&&(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)}}const Xw=1,$w={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},ec=class xd{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Gw(null),Ur.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new Ts(null),this.rootWheelEvent=new cn(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...xd.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){const{view:e,resolution:s}=this.renderer;this.setTargetElement(e),this.resolution=s,xd._defaultEventMode=t.eventMode??"auto",Object.assign(this.features,t.eventFeatures??{}),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,Ur.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 h=this.bootstrapEvent(this.rootPointerEvent,r[n]);h.type+=s,this.rootBoundary.mapEvent(h)}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,Ur.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;Ur.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;Ur.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>"u"&&(n.button=0),typeof n.buttons>"u"&&(n.buttons=1),typeof n.isPrimary>"u"&&(n.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof n.width>"u"&&(n.width=n.radiusX||1),typeof n.height>"u"&&(n.height=n.radiusY||1),typeof n.tiltX>"u"&&(n.tiltX=0),typeof n.tiltY>"u"&&(n.tiltY=0),typeof n.pointerType>"u"&&(n.pointerType="touch"),typeof n.pointerId>"u"&&(n.pointerId=n.identifier||0),typeof n.pressure>"u"&&(n.pressure=n.force||.5),typeof n.twist>"u"&&(n.twist=0),typeof n.tangentialPressure>"u"&&(n.tangentialPressure=0),typeof n.layerX>"u"&&(n.layerX=n.offsetX=n.clientX),typeof n.layerY>"u"&&(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>"u"&&(s.isPrimary=!0),typeof s.width>"u"&&(s.width=1),typeof s.height>"u"&&(s.height=1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="mouse"),typeof s.pointerId>"u"&&(s.pointerId=Xw),typeof s.pressure>"u"&&(s.pressure=.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(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=$w[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}};ec.extension={name:"events",type:[Y.RendererSystem,Y.CanvasRendererSystem]},ec.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let sc=ec;K.add(sc);function fm(i){return i==="dynamic"||i==="static"}const Yw={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(){return this._internalInteractive??fm(sc.defaultEventMode)},set interactive(i){ot("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=i,this.eventMode=i?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??sc.defaultEventMode},set eventMode(i){this._internalInteractive=fm(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 e=="object"?e.signal:void 0,n=typeof e=="object"?e.once===!0:!1,a=typeof t=="function"?void 0:t;i=s?`${i}capture`:i;const h=typeof t=="function"?t:t.handleEvent,o=this;r&&r.addEventListener("abort",()=>{o.off(i,h,a)}),n?o.once(i,h,a):o.on(i,h,a)},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 lo))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}};Vt.mixin(Yw);const Hw={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Vt.mixin(Hw);const Ww=9,Ra=100,zw=0,jw=0,pm=2,mm=1,qw=-1e3,Zw=-1e3,Kw=2;class gm{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,(fr.tablet||fr.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${Ra}px`,e.style.height=`${Ra}px`,e.style.position="absolute",e.style.top=`${zw}px`,e.style.left=`${jw}px`,e.style.zIndex=pm.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=`${mm}px`,t.style.height=`${mm}px`,t.style.position="absolute",t.style.top=`${qw}px`,t.style.left=`${Zw}px`,t.style.zIndex=Kw.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(fr.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:h,resolution:o}=this.renderer,l=r/a*o,u=n/h*o;let c=this.div;c.style.left=`${e}px`,c.style.top=`${s}px`,c.style.width=`${a}px`,c.style.height=`${h}px`;for(let d=0;d<this.children.length;d++){const f=this.children[d];if(f.renderId!==this.renderId)f._accessibleActive=!1,nn(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=`${Ra}px`,e.style.height=`${Ra}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=pm.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 lo(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===Ww&&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}}gm.extension={name:"accessibility",type:[Y.RendererPlugin,Y.CanvasRendererPlugin]},K.add(gm);const _m=class vd{constructor(t){this.stage=new Bt,t=Object.assign({forceCanvas:!1},t),this.renderer=lw(t),vd._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=vd._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}};_m._plugins=[];let Qw=_m;K.handleByList(Y.Application,Qw._plugins);class ym{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}}ym.extension=Y.Application,K.add(ym);const xm={loader:Y.LoadParser,resolver:Y.ResolveParser,cache:Y.CacheParser,detection:Y.DetectionParser};K.handle(Y.Asset,i=>{const t=i.ref;Object.entries(xm).filter(([e])=>!!t[e]).forEach(([e,s])=>K.add(Object.assign(t[e],{extension:t[e].extension??s})))},i=>{const t=i.ref;Object.keys(xm).filter(e=>!!t[e]).forEach(e=>K.remove(t[e]))});class Jw{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 un(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 Le(i,t){const e=i.split("?")[0],s=bt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(s):s===t}const As=(i,t,e=!1)=>(Array.isArray(i)||(i=[i]),t?i.map(s=>typeof s=="string"||e?t(s):s):i),rc=(i,t)=>{const e=t.split("?")[1];return e&&(i+=`?${e}`),i};function vm(i,t,e,s,r){const n=t[e];for(let a=0;a<n.length;a++){const h=n[a];e<t.length-1?vm(i.replace(s[e],h),t,e+1,s,r):r.push(i.replace(s[e],h))}}function tE(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)}),vm(i,r,0,e,s)}else s.push(i);return s}const Ma=i=>!Array.isArray(i);class eE{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){const e=this._cache.get(t);return e||console.warn(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const s=As(t);let r;for(let h=0;h<this.parsers.length;h++){const o=this.parsers[h];if(o.test(e)){r=o.getCacheableAssets(s,e);break}}r||(r={},s.forEach(h=>{r[h]=e}));const n=Object.keys(r),a={cacheKeys:n,keys:s};if(s.forEach(h=>{this._cacheMap.set(h,a)}),n.forEach(h=>{this._cache.has(h)&&this._cache.get(h)!==e&&console.warn("[Cache] already has key:",h),this._cache.set(h,r[h])}),e instanceof q){const h=e;s.forEach(o=>{h.baseTexture!==q.EMPTY.baseTexture&&et.addToCache(h.baseTexture,o),q.addToCache(h,o)})}}remove(t){if(!this._cacheMap.has(t)){console.warn(`[Assets] Asset id ${t} was not found in the Cache`);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 Ai=new eE;class sE{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 a,h;let r=null,n=null;if(e.loadParser&&(n=this._parserHash[e.loadParser],n||console.warn(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!n){for(let o=0;o<this.parsers.length;o++){const l=this.parsers[o];if(l.load&&((a=l.test)!=null&&a.call(l,t,e,this))){n=l;break}}if(!n)return console.warn(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}r=await n.load(t,e,this),s.parser=n;for(let o=0;o<this.parsers.length;o++){const l=this.parsers[o];l.parse&&l.parse&&await((h=l.testParse)==null?void 0:h.call(l,r,e,this))&&(r=await l.parse(r,e,this)||r,s.parser=l)}return r})(),s}async load(t,e){this._parsersValidated||this._validateParsers();let s=0;const r={},n=Ma(t),a=As(t,l=>({alias:[l],src:l})),h=a.length,o=a.map(async l=>{const u=bt.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/h)}catch(c){throw delete this.promiseCache[u],delete r[l.src],new Error(`[Loader.load] Failed to load ${u}.
867
- ${c}`)}});return await Promise.all(o),n?r[a[0].src]:r}async unload(t){const e=As(t,s=>({alias:[s],src:s})).map(async s=>{var a,h;const r=bt.toAbsolute(s.src),n=this.promiseCache[r];if(n){const o=await n.promise;delete this.promiseCache[r],(h=(a=n.parser)==null?void 0:a.unload)==null||h.call(a,o,s,this)}});await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(t[e.name]&&console.warn(`[Assets] loadParser name conflict "${e.name}"`),{...t,[e.name]:e}),{})}}var Ne=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Ne||{});const rE=".json",iE="application/json",nE={extension:{type:Y.LoadParser,priority:Ne.Low},name:"loadJson",test(i){return un(i,iE)||Le(i,rE)},async load(i){return await(await z.ADAPTER.fetch(i)).json()}};K.add(nE);const oE=".txt",aE="text/plain",lE={name:"loadTxt",extension:{type:Y.LoadParser,priority:Ne.Low},test(i){return un(i,aE)||Le(i,oE)},async load(i){return await(await z.ADAPTER.fetch(i)).text()}};K.add(lE);const hE=["normal","bold","100","200","300","400","500","600","700","800","900"],cE=[".ttf",".otf",".woff",".woff2"],uE=["font/ttf","font/otf","font/woff","font/woff2"],dE=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function fE(i){const t=bt.extname(i),e=bt.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(dE)){s=!1;break}let r=e.join(" ");return s||(r=`"${r.replace(/[\\"]/g,"\\$&")}"`),r}const pE=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function mE(i){return pE.test(i)?i:encodeURI(i)}const gE={extension:{type:Y.LoadParser,priority:Ne.Low},name:"loadWebFont",test(i){return un(i,uE)||Le(i,cE)},async load(i,t){var s,r,n;const e=z.ADAPTER.getFontFaceSet();if(e){const a=[],h=((s=t.data)==null?void 0:s.family)??fE(i),o=((n=(r=t.data)==null?void 0:r.weights)==null?void 0:n.filter(u=>hE.includes(u)))??["normal"],l=t.data??{};for(let u=0;u<o.length;u++){const c=o[u],d=new FontFace(h,`url(${mE(i)})`,{...l,weight:c});await d.load(),e.add(d),a.push(d)}return a.length===1?a[0]:a}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(i){(Array.isArray(i)?i:[i]).forEach(t=>z.ADAPTER.getFontFaceSet().delete(t))}};K.add(gE);const _E=`(function() {
866
+ `;class Vw extends pe{constructor(t=.5,e=Math.random()){super(Kp,Nw,{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 am={AlphaFilter:Aw,BlurFilter:om,BlurFilterPass:Zh,ColorMatrixFilter:hn,DisplacementFilter:Bw,FXAAFilter:Lw,NoiseFilter:Vw};Object.entries(am).forEach(([i,t])=>{Object.defineProperty(am,i,{get(){return ot("7.1.0",`filters.${i} has moved to ${i}`),t}})});class Uw{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||(wt.system.add(this.tickerUpdate,this,Vr.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(wt.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 Ur=new Uw;class lo{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=lo.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new st,this.page=new st,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 Pa extends lo{constructor(){super(...arguments),this.client=new st,this.movement=new st,this.offset=new st,this.global=new st,this.screen=new st}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,h,o,l,u,c,d,f,p,m){throw new Error("Method not implemented.")}}class Ts extends Pa{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 cn extends Pa{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}cn.DOM_DELTA_PIXEL=0,cn.DOM_DELTA_LINE=1,cn.DOM_DELTA_PAGE=2;const Gw=2048,Xw=new st,Kh=new st;class $w{constructor(t){this.dispatch=new Xs,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){Ur.pauseUpdate=!0;const s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",r=this[s](this.rootTarget,this.rootTarget.eventMode,Xw.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<Gw&&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 h=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ur.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),h=!0}}}const o=this._isInteractive(e),l=t.isInteractive();return o&&l&&this._allInteractiveElements.push(t),a||this._hitElements.length>0?null:h?this._hitElements:o&&!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")&&(Ur.pauseUpdate=!1),t.interactiveChildren&&t.children){const o=t.children;for(let l=o.length-1;l>=0;l--){const u=o[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),h=t.isInteractive();return a&&r(t,s)?h?[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,Kh),!t.hitArea.contains(Kh.x,Kh.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 n,a;e=e??t.type;const s=`on${e}`;(a=(n=t.currentTarget)[s])==null||a.call(n,t);const r=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,r),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Ts)){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 o,l;if(!(t instanceof Ts)){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 e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const s=e.pointerType==="mouse"||e.pointerType==="pen",r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.overTargets);if(((o=r.overTargets)==null?void 0:o.length)>0&&n!==e.target){const u=t.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(t,u,n);if(this.dispatchEvent(c,"pointerout"),s&&this.dispatchEvent(c,"mouseout"),!e.composedPath().includes(n)){const d=this.createPointerEvent(t,"pointerleave",n);for(d.eventPhase=d.AT_TARGET;d.target&&!e.composedPath().includes(d.target);)d.currentTarget=d.target,this.notifyTarget(d),s&&this.notifyTarget(d,"mouseleave"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(c)}if(n!==e.target){const u=t.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(e,u);this.dispatchEvent(c,"pointerover"),s&&this.dispatchEvent(c,"mouseover");let d=n==null?void 0:n.parent;for(;d&&d!==this.rootTarget.parent&&d!==e.target;)d=d.parent;if(!d||d===this.rootTarget.parent){const f=this.clonePointerEvent(e,"pointerenter");for(f.eventPhase=f.AT_TARGET;f.target&&f.target!==n&&f.target!==this.rootTarget.parent;)f.currentTarget=f.target,this.notifyTarget(f),s&&this.notifyTarget(f,"mouseenter"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(c)}const a=[],h=this.enableGlobalMoveEvents??!0;this.moveOnAll?a.push("pointermove"):this.dispatchEvent(e,"pointermove"),h&&a.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?a.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),h&&a.push("globaltouchmove")),s&&(this.moveOnAll?a.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),h&&a.push("globalmousemove"),this.cursor=(l=e.target)==null?void 0:l.cursor),a.length>0&&this.all(e,a),this._allInteractiveElements.length=0,this._hitElements.length=0,r.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){var a;if(!(t instanceof Ts)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),s=this.createPointerEvent(t),r=s.pointerType==="mouse"||s.pointerType==="pen";this.dispatchEvent(s,"pointerover"),r&&this.dispatchEvent(s,"mouseover"),s.pointerType==="mouse"&&(this.cursor=(a=s.target)==null?void 0:a.cursor);const n=this.clonePointerEvent(s,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=s.composedPath(),this.freeEvent(s),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof Ts)){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 Ts)){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 h=s.button===2;this.dispatchEvent(s,h?"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 h=n;for(;h&&!s.composedPath().includes(h);){if(s.currentTarget=h,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")this.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const o=s.button===2;this.notifyTarget(s,o?"rightupoutside":"mouseupoutside")}h=h.parent}delete r.pressTargetsByButton[t.button],a=h}if(a){const h=this.clonePointerEvent(s,"click");h.target=a,h.path=null,r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:h.target,timeStamp:e});const o=r.clicksByButton[t.button];if(o.target===h.target&&e-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=h.target,o.timeStamp=e,h.detail=o.clickCount,h.pointerType==="mouse"){const l=h.button===2;this.dispatchEvent(h,l?"rightclick":"click")}else h.pointerType==="touch"&&this.dispatchEvent(h,"tap");this.dispatchEvent(h,"pointertap"),this.freeEvent(h)}this.freeEvent(s)}mapPointerUpOutside(t){if(!(t instanceof Ts)){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 cn)){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){const r=this.allocateEvent(Ts);return this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.nativeEvent=t.nativeEvent,r.originalEvent=t,r.target=s??this.hitTest(r.global.x,r.global.y)??this._hitElements[0],typeof e=="string"&&(r.type=e),r}createWheelEvent(t){const e=this.allocateEvent(cn);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(Ts);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??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 Ts&&e instanceof Ts&&(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 Pa&&e instanceof Pa&&(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)}}const Yw=1,Hw={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Qh=class gd{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new $w(null),Ur.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new Ts(null),this.rootWheelEvent=new cn(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...gd.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){const{view:e,resolution:s}=this.renderer;this.setTargetElement(e),this.resolution=s,gd._defaultEventMode=t.eventMode??"auto",Object.assign(this.features,t.eventFeatures??{}),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,Ur.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 h=this.bootstrapEvent(this.rootPointerEvent,r[n]);h.type+=s,this.rootBoundary.mapEvent(h)}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,Ur.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;Ur.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;Ur.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>"u"&&(n.button=0),typeof n.buttons>"u"&&(n.buttons=1),typeof n.isPrimary>"u"&&(n.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof n.width>"u"&&(n.width=n.radiusX||1),typeof n.height>"u"&&(n.height=n.radiusY||1),typeof n.tiltX>"u"&&(n.tiltX=0),typeof n.tiltY>"u"&&(n.tiltY=0),typeof n.pointerType>"u"&&(n.pointerType="touch"),typeof n.pointerId>"u"&&(n.pointerId=n.identifier||0),typeof n.pressure>"u"&&(n.pressure=n.force||.5),typeof n.twist>"u"&&(n.twist=0),typeof n.tangentialPressure>"u"&&(n.tangentialPressure=0),typeof n.layerX>"u"&&(n.layerX=n.offsetX=n.clientX),typeof n.layerY>"u"&&(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>"u"&&(s.isPrimary=!0),typeof s.width>"u"&&(s.width=1),typeof s.height>"u"&&(s.height=1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="mouse"),typeof s.pointerId>"u"&&(s.pointerId=Yw),typeof s.pressure>"u"&&(s.pressure=.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(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=Hw[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}};Qh.extension={name:"events",type:[Y.RendererSystem,Y.CanvasRendererSystem]},Qh.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let Jh=Qh;K.add(Jh);function lm(i){return i==="dynamic"||i==="static"}const Ww={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(){return this._internalInteractive??lm(Jh.defaultEventMode)},set interactive(i){ot("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=i,this.eventMode=i?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Jh.defaultEventMode},set eventMode(i){this._internalInteractive=lm(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 e=="object"?e.signal:void 0,n=typeof e=="object"?e.once===!0:!1,a=typeof t=="function"?void 0:t;i=s?`${i}capture`:i;const h=typeof t=="function"?t:t.handleEvent,o=this;r&&r.addEventListener("abort",()=>{o.off(i,h,a)}),n?o.once(i,h,a):o.on(i,h,a)},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 lo))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}};Vt.mixin(Ww);const zw={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Vt.mixin(zw);const jw=9,Ra=100,qw=0,Zw=0,hm=2,cm=1,Kw=-1e3,Qw=-1e3,Jw=2;class um{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,(fr.tablet||fr.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${Ra}px`,e.style.height=`${Ra}px`,e.style.position="absolute",e.style.top=`${qw}px`,e.style.left=`${Zw}px`,e.style.zIndex=hm.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=`${cm}px`,t.style.height=`${cm}px`,t.style.position="absolute",t.style.top=`${Kw}px`,t.style.left=`${Qw}px`,t.style.zIndex=Jw.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(fr.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:h,resolution:o}=this.renderer,l=r/a*o,u=n/h*o;let c=this.div;c.style.left=`${e}px`,c.style.top=`${s}px`,c.style.width=`${a}px`,c.style.height=`${h}px`;for(let d=0;d<this.children.length;d++){const f=this.children[d];if(f.renderId!==this.renderId)f._accessibleActive=!1,nn(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=`${Ra}px`,e.style.height=`${Ra}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=hm.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 lo(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===jw&&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}}um.extension={name:"accessibility",type:[Y.RendererPlugin,Y.CanvasRendererPlugin]},K.add(um);const dm=class _d{constructor(t){this.stage=new Bt,t=Object.assign({forceCanvas:!1},t),this.renderer=cw(t),_d._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=_d._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}};dm._plugins=[];let tE=dm;K.handleByList(Y.Application,tE._plugins);class fm{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}}fm.extension=Y.Application,K.add(fm);const pm={loader:Y.LoadParser,resolver:Y.ResolveParser,cache:Y.CacheParser,detection:Y.DetectionParser};K.handle(Y.Asset,i=>{const t=i.ref;Object.entries(pm).filter(([e])=>!!t[e]).forEach(([e,s])=>K.add(Object.assign(t[e],{extension:t[e].extension??s})))},i=>{const t=i.ref;Object.keys(pm).filter(e=>!!t[e]).forEach(e=>K.remove(t[e]))});class eE{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 un(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 Le(i,t){const e=i.split("?")[0],s=bt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(s):s===t}const As=(i,t,e=!1)=>(Array.isArray(i)||(i=[i]),t?i.map(s=>typeof s=="string"||e?t(s):s):i),tc=(i,t)=>{const e=t.split("?")[1];return e&&(i+=`?${e}`),i};function mm(i,t,e,s,r){const n=t[e];for(let a=0;a<n.length;a++){const h=n[a];e<t.length-1?mm(i.replace(s[e],h),t,e+1,s,r):r.push(i.replace(s[e],h))}}function sE(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)}),mm(i,r,0,e,s)}else s.push(i);return s}const Ma=i=>!Array.isArray(i);class rE{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){const e=this._cache.get(t);return e||console.warn(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const s=As(t);let r;for(let h=0;h<this.parsers.length;h++){const o=this.parsers[h];if(o.test(e)){r=o.getCacheableAssets(s,e);break}}r||(r={},s.forEach(h=>{r[h]=e}));const n=Object.keys(r),a={cacheKeys:n,keys:s};if(s.forEach(h=>{this._cacheMap.set(h,a)}),n.forEach(h=>{this._cache.has(h)&&this._cache.get(h)!==e&&console.warn("[Cache] already has key:",h),this._cache.set(h,r[h])}),e instanceof q){const h=e;s.forEach(o=>{h.baseTexture!==q.EMPTY.baseTexture&&et.addToCache(h.baseTexture,o),q.addToCache(h,o)})}}remove(t){if(!this._cacheMap.has(t)){console.warn(`[Assets] Asset id ${t} was not found in the Cache`);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 Ai=new rE;class iE{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 a,h;let r=null,n=null;if(e.loadParser&&(n=this._parserHash[e.loadParser],n||console.warn(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!n){for(let o=0;o<this.parsers.length;o++){const l=this.parsers[o];if(l.load&&((a=l.test)!=null&&a.call(l,t,e,this))){n=l;break}}if(!n)return console.warn(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}r=await n.load(t,e,this),s.parser=n;for(let o=0;o<this.parsers.length;o++){const l=this.parsers[o];l.parse&&l.parse&&await((h=l.testParse)==null?void 0:h.call(l,r,e,this))&&(r=await l.parse(r,e,this)||r,s.parser=l)}return r})(),s}async load(t,e){this._parsersValidated||this._validateParsers();let s=0;const r={},n=Ma(t),a=As(t,l=>({alias:[l],src:l})),h=a.length,o=a.map(async l=>{const u=bt.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/h)}catch(c){throw delete this.promiseCache[u],delete r[l.src],new Error(`[Loader.load] Failed to load ${u}.
867
+ ${c}`)}});return await Promise.all(o),n?r[a[0].src]:r}async unload(t){const e=As(t,s=>({alias:[s],src:s})).map(async s=>{var a,h;const r=bt.toAbsolute(s.src),n=this.promiseCache[r];if(n){const o=await n.promise;delete this.promiseCache[r],(h=(a=n.parser)==null?void 0:a.unload)==null||h.call(a,o,s,this)}});await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(t[e.name]&&console.warn(`[Assets] loadParser name conflict "${e.name}"`),{...t,[e.name]:e}),{})}}var Ne=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Ne||{});const nE=".json",oE="application/json",aE={extension:{type:Y.LoadParser,priority:Ne.Low},name:"loadJson",test(i){return un(i,oE)||Le(i,nE)},async load(i){return await(await z.ADAPTER.fetch(i)).json()}};K.add(aE);const lE=".txt",hE="text/plain",cE={name:"loadTxt",extension:{type:Y.LoadParser,priority:Ne.Low},test(i){return un(i,hE)||Le(i,lE)},async load(i){return await(await z.ADAPTER.fetch(i)).text()}};K.add(cE);const uE=["normal","bold","100","200","300","400","500","600","700","800","900"],dE=[".ttf",".otf",".woff",".woff2"],fE=["font/ttf","font/otf","font/woff","font/woff2"],pE=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function mE(i){const t=bt.extname(i),e=bt.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(pE)){s=!1;break}let r=e.join(" ");return s||(r=`"${r.replace(/[\\"]/g,"\\$&")}"`),r}const gE=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function _E(i){return gE.test(i)?i:encodeURI(i)}const yE={extension:{type:Y.LoadParser,priority:Ne.Low},name:"loadWebFont",test(i){return un(i,fE)||Le(i,dE)},async load(i,t){var s,r,n;const e=z.ADAPTER.getFontFaceSet();if(e){const a=[],h=((s=t.data)==null?void 0:s.family)??mE(i),o=((n=(r=t.data)==null?void 0:r.weights)==null?void 0:n.filter(u=>uE.includes(u)))??["normal"],l=t.data??{};for(let u=0;u<o.length;u++){const c=o[u],d=new FontFace(h,`url(${_E(i)})`,{...l,weight:c});await d.load(),e.add(d),a.push(d)}return a.length===1?a[0]:a}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(i){(Array.isArray(i)?i:[i]).forEach(t=>z.ADAPTER.getFontFaceSet().delete(t))}};K.add(yE);const xE=`(function() {
868
868
  "use strict";
869
869
  const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
870
870
  async function checkImageBitmap() {
@@ -881,7 +881,7 @@ ${c}`)}});return await Promise.all(o),n?r[a[0].src]:r}async unload(t){const e=As
881
881
  self.postMessage(result);
882
882
  });
883
883
  })();
884
- `;let dn=null,ic=class{constructor(){dn||(dn=URL.createObjectURL(new Blob([_E],{type:"application/javascript"}))),this.worker=new Worker(dn)}};ic.revokeObjectURL=function(){dn&&(URL.revokeObjectURL(dn),dn=null)};const yE=`(function() {
884
+ `;let dn=null,ec=class{constructor(){dn||(dn=URL.createObjectURL(new Blob([xE],{type:"application/javascript"}))),this.worker=new Worker(dn)}};ec.revokeObjectURL=function(){dn&&(URL.revokeObjectURL(dn),dn=null)};const vE=`(function() {
885
885
  "use strict";
886
886
  async function loadImageBitmap(url) {
887
887
  const response = await fetch(url);
@@ -907,8 +907,8 @@ ${c}`)}});return await Promise.all(o),n?r[a[0].src]:r}async unload(t){const e=As
907
907
  }
908
908
  };
909
909
  })();
910
- `;let fn=null;class bm{constructor(){fn||(fn=URL.createObjectURL(new Blob([yE],{type:"application/javascript"}))),this.worker=new Worker(fn)}}bm.revokeObjectURL=function(){fn&&(URL.revokeObjectURL(fn),fn=null)};let wm=0,nc;class xE{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const{worker:e}=new ic;e.addEventListener("message",s=>{e.terminate(),ic.revokeObjectURL(),t(s.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){nc===void 0&&(nc=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<nc&&(this._createdWorkers++,t=new bm().worker,t.addEventListener("message",e=>{this.complete(e.data),this.returnWorker(e.target),this.next()})),t}returnWorker(t){this.workerPool.push(t)}complete(t){t.error!==void 0?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const 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[wm]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:wm++,id:s})}}const Em=new xE;function ho(i,t,e){i.resource.internal=!0;const s=new q(i),r=()=>{delete t.promiseCache[e],Ai.has(e)&&Ai.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}const vE=[".jpeg",".jpg",".png",".webp",".avif"],bE=["image/jpeg","image/png","image/webp","image/avif"];async function wE(i){const t=await z.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 Fa={name:"loadTextures",extension:{type:Y.LoadParser,priority:Ne.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return un(i,bE)||Le(i,vE)},async load(i,t,e){var h;const s=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let r;s?this.config.preferWorkers&&await Em.isImageBitmapSupported()?r=await Em.loadImageBitmap(i):r=await wE(i):r=await new Promise((o,l)=>{const u=new Image;u.crossOrigin=this.config.crossOrigin,u.src=i,u.complete?o(u):(u.onload=()=>o(u),u.onerror=c=>l(c))});const n={...t.data};n.resolution??(n.resolution=_r(i)),s&&((h=n.resourceOptions)==null?void 0:h.ownsImageBitmap)===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const a=new et(r,n);return a.resource.src=i,ho(a,e,i)},unload(i){i.destroy(!0)}};K.add(Fa);const EE=".svg",TE="image/svg+xml",AE={extension:{type:Y.LoadParser,priority:Ne.High},name:"loadSVG",test(i){return un(i,TE)||Le(i,EE)},async testParse(i){return Kh.test(i)},async parse(i,t,e){var n;const s=new Kh(i,(n=t==null?void 0:t.data)==null?void 0:n.resourceOptions);await s.load();const r=new et(s,{resolution:_r(i),...t==null?void 0:t.data});return r.resource.src=t.src,ho(r,e,t.src)},async load(i,t){return(await z.ADAPTER.fetch(i)).text()},unload:Fa.unload};K.add(AE);const SE=[".mp4",".m4v",".webm",".ogv"],CE=["video/mp4","video/webm","video/ogg"],IE={name:"loadVideo",extension:{type:Y.LoadParser,priority:Ne.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test(i){return un(i,CE)||Le(i,SE)},async load(i,t,e){var a;let s;const r=await(await z.ADAPTER.fetch(i)).blob(),n=URL.createObjectURL(r);try{const h={autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline,...(a=t==null?void 0:t.data)==null?void 0:a.resourceOptions,autoLoad:!0},o=new lm(n,h);await o.load();const l=new et(o,{alphaMode:await Ob(),resolution:_r(i),...t==null?void 0:t.data});l.resource.src=i,s=ho(l,e,i),s.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(h){throw URL.revokeObjectURL(n),h}return s},unload(i){i.destroy(!0)}};K.add(IE);class PE{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{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 As(e||s||r||n,a=>typeof a=="string"?a:Array.isArray(a)?a.map(h=>(h==null?void 0:h.src)??(h==null?void 0:h.srcs)??h):a!=null&&a.src||a!=null&&a.srcs?a.src??a.srcs:a,!0)}addManifest(t){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const s=[];Array.isArray(e)?e.forEach(r=>{const n=r.src??r.srcs,a=r.alias??r.name;let h;if(typeof a=="string"){const o=this._createBundleAssetId(t,a);s.push(o),h=[a,o]}else{const o=a.map(l=>this._createBundleAssetId(t,l));s.push(...o),h=[...a,...o]}this.add({...r,alias:h,src:n})}):Object.keys(e).forEach(r=>{const n=[r,this._createBundleAssetId(t,r)];if(typeof e[r]=="string")this.add({alias:n,src:e[r]});else if(Array.isArray(e[r]))this.add({alias:n,src:e[r]});else{const a=e[r],h=a.src??a.srcs;this.add({...a,alias:n,src:Array.isArray(h)?h:[h]})}s.push(...n)}),this._bundles[t]=s}add(t,e,s,r,n){const a=[];typeof t=="string"||Array.isArray(t)&&typeof t[0]=="string"?(ot("7.2.0",`Assets.add now uses an object instead of individual parameters.
911
- Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),a.push({alias:t,src:e,data:s,format:r,loadParser:n})):Array.isArray(t)?a.push(...t):a.push(t);let h;h=o=>{this.hasKey(o)&&console.warn(`[Resolver] already has key: ${o} overwriting`)},As(a).forEach(o=>{const{src:l,srcs:u}=o;let{data:c,format:d,loadParser:f}=o;const p=As(l||u).map(_=>typeof _=="string"?tE(_):Array.isArray(_)?_:[_]),m=this.getAlias(o);Array.isArray(m)?m.forEach(h):h(m);const g=[];p.forEach(_=>{_.forEach(x=>{let y={};if(typeof x!="object"){y.src=x;for(let v=0;v<this._parsers.length;v++){const b=this._parsers[v];if(b.test(x)){y=b.parse(x);break}}}else c=x.data??c,d=x.format??d,f=x.loadParser??f,y={...y,...x};if(!m)throw new Error(`[Resolver] alias is undefined for this asset: ${y.src}`);y=this.buildResolvedAsset(y,{aliases:m,data:c,format:d,loadParser:f}),g.push(y)})}),m.forEach(_=>{this._assetMap[_]=g})})}resolveBundle(t){const e=Ma(t);t=As(t);const s={};return t.forEach(r=>{const n=this._bundles[r];if(n){const a=this.resolve(n),h={};for(const o in a){const l=a[o];h[this._extractAssetIdFromBundle(r,o)]=l}s[r]=h}}),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=Ma(t);t=As(t);const s={};return t.forEach(r=>{if(!this._resolverHash[r])if(this._assetMap[r]){let n=this._assetMap[r];const a=n[0],h=this._getPreferredOrder(n);h==null||h.priority.forEach(o=>{h.params[o].forEach(l=>{const u=n.filter(c=>c[o]?c[o]===l:!1);u.length&&(n=u)})}),this._resolverHash[r]=n[0]??a}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){const{aliases:s,data:r,loadParser:n,format:a}=e;return(this._basePath||this._rootPath)&&(t.src=bt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=s??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...r||{},...t.data},t.loadParser=n??t.loadParser,t.format=a??t.format??bt.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class RE{constructor(){this._detections=[],this._initialized=!1,this.resolver=new PE,this.loader=new sE,this.cache=Ai,this._backgroundLoader=new Jw(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var n,a;if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let h=t.manifest;typeof h=="string"&&(h=await this.load(h)),this.resolver.addManifest(h)}const e=((n=t.texturePreference)==null?void 0:n.resolution)??1,s=typeof e=="number"?[e]:e,r=await this._detectFormats({preferredFormats:(a=t.texturePreference)==null?void 0:a.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:r,resolution:s}}),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=Ma(t),r=As(t).map(h=>{if(typeof h!="string"){const o=this.resolver.getAlias(h);return o.some(l=>!this.resolver.hasKey(l))&&this.add(h),Array.isArray(o)?o[0]:o}return this.resolver.hasKey(h)||this.add({alias:h,src:h}),h}),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 h=0,o=0;const l=()=>{e==null||e(++h/o)},u=a.map(c=>{const d=r[c];return o+=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 Ai.get(t);const e={};for(let s=0;s<t.length;s++)e[s]=Ai.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((h,o)=>{const l=n[h.src],u=[h.src];h.alias&&u.push(...h.alias),a[r[o]]=l,Ai.set(u,l)}),a}async unload(t){this._initialized||await this.init();const e=As(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=As(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=>{Ai.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 Fa.config.preferWorkers}set preferWorkers(t){ot("7.2.0","Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."),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 Gr=new RE;K.handleByList(Y.LoadParser,Gr.loader.parsers).handleByList(Y.ResolveParser,Gr.resolver.parsers).handleByList(Y.CacheParser,Gr.cache.parsers).handleByList(Y.DetectionParser,Gr.detections);const ME={extension:Y.CacheParser,test:i=>Array.isArray(i)&&i.every(t=>t instanceof q),getCacheableAssets:(i,t)=>{const e={};return i.forEach(s=>{t.forEach((r,n)=>{e[s+(n===0?"":n+1)]=r})}),e}};K.add(ME);async function Tm(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{return!1}return!0}return!1}const FE={extension:{type:Y.DetectionParser,priority:1},test:async()=>Tm("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};K.add(FE);const kE={extension:{type:Y.DetectionParser,priority:0},test:async()=>Tm("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};K.add(kE);const Am=["png","jpg","jpeg"],BE={extension:{type:Y.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...Am],remove:async i=>i.filter(t=>!Am.includes(t))};K.add(BE);const DE="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function oc(i){return DE?!1:document.createElement("video").canPlayType(i)!==""}const OE={extension:{type:Y.DetectionParser,priority:0},test:async()=>oc("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};K.add(OE);const LE={extension:{type:Y.DetectionParser,priority:0},test:async()=>oc("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};K.add(LE);const NE={extension:{type:Y.DetectionParser,priority:0},test:async()=>oc("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};K.add(NE);const VE={extension:Y.ResolveParser,test:Fa.test,parse:i=>{var t;return{resolution:parseFloat(((t=z.RETINA_PREFIX.exec(i))==null?void 0:t[1])??"1"),format:bt.extname(i).slice(1),src:i}}};K.add(VE);var ve=(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=35987]="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[i.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",i[i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",i[i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",i[i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",i))(ve||{});const ka={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,35987:1,34798:1,37808:1,36492:1,36493:1,36494:1,36495:1};let Ks,pn;function Sm(){pn={bptc:Ks.getExtension("EXT_texture_compression_bptc"),astc:Ks.getExtension("WEBGL_compressed_texture_astc"),etc:Ks.getExtension("WEBGL_compressed_texture_etc"),s3tc:Ks.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:Ks.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:Ks.getExtension("WEBGL_compressed_texture_pvrtc")||Ks.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:Ks.getExtension("WEBGL_compressed_texture_etc1"),atc:Ks.getExtension("WEBGL_compressed_texture_atc")}}const UE={extension:{type:Y.DetectionParser,priority:2},test:async()=>{const i=z.ADAPTER.createCanvas().getContext("webgl");return i?(Ks=i,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async i=>{pn||Sm();const t=[];for(const e in pn)pn[e]&&t.push(e);return[...t,...i]},remove:async i=>(pn||Sm(),i.filter(t=>!(t in pn)))};K.add(UE);class GE extends aa{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 Sh(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 Sh(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class Si extends GE{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=Si._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||Si._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:h,levelWidth:o,levelHeight:l,levelBuffer:u}=this._levelBuffers[n];r.compressedTexImage2D(r.TEXTURE_2D,h,this.format,o,l,0,u)}return!0}onBlobLoaded(){this._levelBuffers=Si._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>=35916&&t<=35919)return"s3tc_sRGB";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(t===36196)return"etc1";if(t===35986||t===35987||t===34798)return"atc";if(t>=36492&&t<=36495)return"bptc";if(t===37808)return"astc";throw new Error(`Invalid (compressed) texture format given: ${t}`)}static _createLevelBuffers(t,e,s,r,n,a,h){const o=new Array(s);let l=t.byteOffset,u=a,c=h,d=u+r-1&~(r-1),f=c+n-1&~(n-1),p=d*f*ka[e];for(let m=0;m<s;m++)o[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*ka[e];return o}}const ac=4,Ba=124,XE=32,Cm=20,$E=542327876,Da={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},YE={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},Oa={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},HE=1,WE=2,zE=4,jE=64,qE=512,ZE=131072,KE=827611204,QE=861165636,JE=894720068,tT=808540228,eT=4,sT={[KE]:ve.COMPRESSED_RGBA_S3TC_DXT1_EXT,[QE]:ve.COMPRESSED_RGBA_S3TC_DXT3_EXT,[JE]:ve.COMPRESSED_RGBA_S3TC_DXT5_EXT},rT={70:ve.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:ve.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:ve.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:ve.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:ve.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:ve.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:ve.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:ve.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:ve.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:ve.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:ve.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:ve.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:ve.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function iT(i){const t=new Uint32Array(i);if(t[0]!==$E)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(i,0,Ba/Uint32Array.BYTES_PER_ELEMENT),s=e[Da.HEIGHT],r=e[Da.WIDTH],n=e[Da.MIPMAP_COUNT],a=new Uint32Array(i,Da.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,XE/Uint32Array.BYTES_PER_ELEMENT),h=a[HE];if(h&zE){const o=a[YE.FOURCC];if(o!==tT){const x=sT[o],y=ac+Ba,v=new Uint8Array(i,y);return[new Si(v,{format:x,width:r,height:s,levels:n})]}const l=ac+Ba,u=new Uint32Array(t.buffer,l,Cm/Uint32Array.BYTES_PER_ELEMENT),c=u[Oa.DXGI_FORMAT],d=u[Oa.RESOURCE_DIMENSION],f=u[Oa.MISC_FLAG],p=u[Oa.ARRAY_SIZE],m=rT[c];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${c}`);if(f===eT)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,_=ac+Ba+Cm;if(p===1)g.push(new Uint8Array(i,_));else{const x=ka[m];let y=0,v=r,b=s;for(let E=0;E<n;E++){const T=Math.max(1,v+3&-4),A=Math.max(1,b+3&-4),I=T*A*x;y+=I,v=v>>>1,b=b>>>1}let w=_;for(let E=0;E<p;E++)g.push(new Uint8Array(i,w,y)),w+=y}return g.map(x=>new Si(x,{format:m,width:r,height:s,levels:n}))}throw h&jE?new Error("DDSParser does not support uncompressed texture data."):h&qE?new Error("DDSParser does not supported YUV uncompressed texture data."):h&ZE?new Error("DDSParser does not support single-channel (lumninance) texture data!"):h&WE?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 Im=[171,75,84,88,32,49,49,187,13,10,26,10],nT=67305985,Ss={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},lc=64,Pm={[tt.UNSIGNED_BYTE]:1,[tt.UNSIGNED_SHORT]:2,[tt.INT]:4,[tt.UNSIGNED_INT]:4,[tt.FLOAT]:4,[tt.HALF_FLOAT]:8},oT={[G.RGBA]:4,[G.RGB]:3,[G.RG]:2,[G.RED]:1,[G.LUMINANCE]:1,[G.LUMINANCE_ALPHA]:2,[G.ALPHA]:1},aT={[tt.UNSIGNED_SHORT_4_4_4_4]:2,[tt.UNSIGNED_SHORT_5_5_5_1]:2,[tt.UNSIGNED_SHORT_5_6_5]:2};function lT(i,t,e=!1){const s=new DataView(t);if(!hT(i,s))return null;const r=s.getUint32(Ss.ENDIANNESS,!0)===nT,n=s.getUint32(Ss.GL_TYPE,r),a=s.getUint32(Ss.GL_FORMAT,r),h=s.getUint32(Ss.GL_INTERNAL_FORMAT,r),o=s.getUint32(Ss.PIXEL_WIDTH,r),l=s.getUint32(Ss.PIXEL_HEIGHT,r)||1,u=s.getUint32(Ss.PIXEL_DEPTH,r)||1,c=s.getUint32(Ss.NUMBER_OF_ARRAY_ELEMENTS,r)||1,d=s.getUint32(Ss.NUMBER_OF_FACES,r),f=s.getUint32(Ss.NUMBER_OF_MIPMAP_LEVELS,r),p=s.getUint32(Ss.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,_=o+3&-4,x=l+3&-4,y=new Array(c);let v=o*l;n===0&&(v=_*x);let b;if(n!==0?Pm[n]?b=Pm[n]*oT[a]:b=aT[n]:b=ka[h],b===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const w=e?uT(s,p,r):null;let E=v*b,T=o,A=l,I=_,M=x,R=lc+p;for(let C=0;C<f;C++){const P=s.getUint32(R,r);let k=R+4;for(let U=0;U<c;U++){let V=y[U];V||(V=y[U]=new Array(f)),V[C]={levelID:C,levelWidth:f>1||n!==0?T:I,levelHeight:f>1||n!==0?A:M,levelBuffer:new Uint8Array(t,k,E)},k+=E}R+=P+4,R=R%4!==0?R+4-R%4:R,T=T>>1||1,A=A>>1||1,I=T+m-1&~(m-1),M=A+g-1&~(g-1),E=I*M*b}return n!==0?{uncompressed:y.map(C=>{let P=C[0].levelBuffer,k=!1;return n===tt.FLOAT?P=new Float32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4):n===tt.UNSIGNED_INT?(k=!0,P=new Uint32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4)):n===tt.INT&&(k=!0,P=new Int32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4)),{resource:new aa(P,{width:C[0].levelWidth,height:C[0].levelHeight}),type:n,format:k?cT(a):a}}),kvData:w}:{compressed:y.map(C=>new Si(null,{format:h,width:o,height:l,levels:f,levelBuffers:C})),kvData:w}}function hT(i,t){for(let e=0;e<Im.length;e++)if(t.getUint8(e)!==Im[e])return console.error(`${i} is not a valid *.ktx file!`),!1;return!0}function cT(i){switch(i){case G.RGBA:return G.RGBA_INTEGER;case G.RGB:return G.RGB_INTEGER;case G.RG:return G.RG_INTEGER;case G.RED:return G.RED_INTEGER;default:return i}}function uT(i,t,e){const s=new Map;let r=0;for(;r<t;){const n=i.getUint32(lc+r,e),a=lc+r+4,h=3-(n+3)%4;if(n===0||n>t-r){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let o=0;for(;o<n&&i.getUint8(a+o)!==0;o++);if(o===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const l=new TextDecoder().decode(new Uint8Array(i.buffer,a,o)),u=new DataView(i.buffer,a+o+1,n-o-1);s.set(l,u),r+=4+n+h}return s}const dT={extension:{type:Y.LoadParser,priority:Ne.High},name:"loadDDS",test(i){return Le(i,".dds")},async load(i,t,e){const s=await(await z.ADAPTER.fetch(i)).arrayBuffer(),r=iT(s).map(n=>{const a=new et(n,{mipmap:vs.OFF,alphaMode:Re.NO_PREMULTIPLIED_ALPHA,resolution:_r(i),...t.data});return ho(a,e,i)});return r.length===1?r[0]:r},unload(i){Array.isArray(i)?i.forEach(t=>t.destroy(!0)):i.destroy(!0)}};K.add(dT);const fT={extension:{type:Y.LoadParser,priority:Ne.High},name:"loadKTX",test(i){return Le(i,".ktx")},async load(i,t,e){const s=await(await z.ADAPTER.fetch(i)).arrayBuffer(),{compressed:r,uncompressed:n,kvData:a}=lT(i,s),h=r??n,o={mipmap:vs.OFF,alphaMode:Re.NO_PREMULTIPLIED_ALPHA,resolution:_r(i),...t.data},l=h.map(u=>{h===n&&Object.assign(o,{type:u.type,format:u.format});const c=u.resource??u,d=new et(c,o);return d.ktxKeyValueData=a,ho(d,e,i)});return l.length===1?l[0]:l},unload(i){Array.isArray(i)?i.forEach(t=>t.destroy(!0)):i.destroy(!0)}};K.add(fT);const pT=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],mT={extension:Y.ResolveParser,test:i=>{const t=bt.extname(i).slice(1);return["basis","ktx","dds"].includes(t)},parse:i=>{var s,r;const t=i.split("."),e=t.pop();if(["ktx","dds"].includes(e)){const n=t.pop();if(pT.includes(n))return{resolution:parseFloat(((s=z.RETINA_PREFIX.exec(i))==null?void 0:s[1])??"1"),format:n,src:i}}return{resolution:parseFloat(((r=z.RETINA_PREFIX.exec(i))==null?void 0:r[1])??"1"),format:e,src:i}}};K.add(mT);const La=new rt,gT=4,Rm=class Lo{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.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,h)=>{n.toBlob(o=>{if(!o){h(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>a(l.result),l.onerror=h,l.readAsDataURL(o)},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((h,o)=>{const l=new FileReader;l.onload=()=>h(l.result),l.onerror=o,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:h}=this._rawPixels(t,e);a&&Lo._flipY(s,r,n),h&&Lo._unpremultiplyAlpha(s);const o=new Kb(r,n,1),l=new ImageData(new Uint8ClampedArray(s.buffer),r,n);return o.context.putImageData(l,0,0),o.canvas}pixels(t,e){const{pixels:s,width:r,height:n,flipY:a,premultipliedAlpha:h}=this._rawPixels(t,e);return a&&Lo._flipY(s,r,n),h&&Lo._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,h,o=!1;t&&(t instanceof wi?h=t:(h=s.generateTexture(t,{region:e,resolution:s.resolution,multisample:s.multisample}),o=!0,e&&(La.width=e.width,La.height=e.height,e=La)));const l=s.gl;if(h){if(r=h.baseTexture.resolution,e=e??h.frame,n=!1,a=h.baseTexture.alphaMode>0&&h.baseTexture.format===G.RGBA,!o){s.renderTexture.bind(h);const f=h.framebuffer.glFramebuffers[s.CONTEXT_UID];f.blitFramebuffer&&s.framebuffer.bind(f.blitFramebuffer)}}else r=s.resolution,e||(e=La,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(gT*u*c);return l.readPixels(Math.round(e.x*r),Math.round(e.y*r),u,c,l.RGBA,l.UNSIGNED_BYTE,d),o&&(h==null||h.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 h=0;h<n;h++){const o=h*r,l=(s-h-1)*r;a.set(t.subarray(o,o+r)),t.copyWithin(o,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}}}};Rm.extension={name:"extract",type:Y.RendererSystem};let _T=Rm;K.add(_T);const Na={build(i){const t=i.points;let e,s,r,n,a,h;if(i.type===xe.CIRC){const p=i.shape;e=p.x,s=p.y,a=h=p.radius,r=n=0}else if(i.type===xe.ELIP){const p=i.shape;e=p.x,s=p.y,a=p.width,h=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=h=Math.max(0,Math.min(p.radius,Math.min(m,g))),r=m-a,n=g-h}if(!(a>=0&&h>=0&&r>=0&&n>=0)){t.length=0;return}const o=Math.ceil(2.3*Math.sqrt(a+h)),l=o*8+(r?4:0)+(n?4:0);if(t.length=l,l===0)return;if(o===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=o*4+(r?2:0)+2,d=c,f=l;{const p=r+a,m=n,g=e+p,_=e-p,x=s+m;if(t[u++]=g,t[u++]=x,t[--c]=x,t[--c]=_,n){const y=s-m;t[d++]=_,t[d++]=y,t[--f]=y,t[--f]=g}}for(let p=1;p<o;p++){const m=Math.PI/2*(p/o),g=r+Math.cos(m)*a,_=n+Math.sin(m)*h,x=e+g,y=e-g,v=s+_,b=s-_;t[u++]=x,t[u++]=v,t[--c]=v,t[--c]=y,t[d++]=y,t[d++]=b,t[--f]=b,t[--f]=x}{const p=r,m=n+h,g=e+p,_=e-p,x=s+m,y=s-m;t[u++]=g,t[u++]=x,t[--f]=y,t[--f]=g,r&&(t[u++]=_,t[u++]=x,t[--f]=y,t[--f]=_)}},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 h,o;if(i.type!==xe.RREC){const u=i.shape;h=u.x,o=u.y}else{const u=i.shape;h=u.x+u.width/2,o=u.y+u.height/2}const l=i.matrix;s.push(i.matrix?l.a*h+l.c*o+l.tx:h,i.matrix?l.b*h+l.d*o+l.ty:o),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 Mm(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 h=i[r],o=i[r+1];s+=(h-n)*(o+a),n=h,a=o}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,h=e-n-1,o=n,l=n+1;[i[a],i[o]]=[i[o],i[a]],[i[h],i[l]]=[i[l],i[h]]}}}const Fm={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){Mm(e,!1);const a=[];for(let l=0;l<s.length;l++){const u=s[l];Mm(u.points,!0),a.push(e.length/2),e=e.concat(u.points)}const h=My(e,a,2);if(!h)return;const o=r.length/2;for(let l=0;l<h.length;l+=3)n.push(h[l]+o),n.push(h[l+1]+o),n.push(h[l+2]+o);for(let l=0;l<e.length;l++)r.push(e[l])}}},yT={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)}},xT={build(i){Na.build(i)},triangulate(i,t){Na.triangulate(i,t)}};var ls=(i=>(i.MITER="miter",i.BEVEL="bevel",i.ROUND="round",i))(ls||{}),Xr=(i=>(i.BUTT="butt",i.ROUND="round",i.SQUARE="square",i))(Xr||{});const mn={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}};class km{static curveTo(t,e,s,r,n,a){const h=a[a.length-2],o=a[a.length-1]-e,l=h-t,u=r-e,c=s-t,d=Math.abs(o*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=o*o+l*l,p=u*u+c*c,m=o*u+l*c,g=n*Math.sqrt(f)/d,_=n*Math.sqrt(p)/d,x=g*m/f,y=_*m/p,v=g*c+_*l,b=g*u+_*o,w=l*(_+x),E=o*(_+x),T=c*(g+y),A=u*(g+y),I=Math.atan2(E-b,w-v),M=Math.atan2(A-b,T-v);return{cx:v+t,cy:b+e,radius:n,startAngle:I,endAngle:M,anticlockwise:l*u>c*o}}static arc(t,e,s,r,n,a,h,o,l){const u=h-a,c=mn._segmentsCount(Math.abs(u)*n,Math.ceil(Math.abs(u)/ha)*40),d=u/(c*2),f=d*2,p=Math.cos(d),m=Math.sin(d),g=c-1,_=g%1/g;for(let x=0;x<=g;++x){const y=x+_*x,v=d+a+f*y,b=Math.cos(v),w=-Math.sin(v);l.push((p*b+m*w)*n+s,(p*-w+m*b)*n+r)}}}class vT{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 hc{static curveLength(t,e,s,r,n,a,h,o){let l=0,u=0,c=0,d=0,f=0,p=0,m=0,g=0,_=0,x=0,y=0,v=t,b=e;for(let w=1;w<=10;++w)u=w/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*h,_=m*e+3*p*u*r+3*f*c*a+d*o,x=v-g,y=b-_,v=g,b=_,l+=Math.sqrt(x*x+y*y);return l}static curveTo(t,e,s,r,n,a,h){const o=h[h.length-2],l=h[h.length-1];h.length-=2;const u=mn._segmentsCount(hc.curveLength(o,l,t,e,s,r,n,a));let c=0,d=0,f=0,p=0,m=0;h.push(o,l);for(let g=1,_=0;g<=u;++g)_=g/u,c=1-_,d=c*c,f=d*c,p=_*_,m=p*_,h.push(f*o+3*d*_*t+3*c*p*s+m*n,f*l+3*d*_*e+3*c*p*r+m*a)}}function Bm(i,t,e,s,r,n,a,h){const o=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=o+d,m=l+f,g=u+d,_=c+f;return h.push(p,m,g,_),2}function Ci(i,t,e,s,r,n,a,h){const o=e-i,l=s-t;let u=Math.atan2(o,l),c=Math.atan2(r-i,n-t);h&&u<c?u+=Math.PI*2:!h&&u>c&&(c+=Math.PI*2);let d=u;const f=c-u,p=Math.abs(f),m=Math.sqrt(o*o+l*l),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,_=f/g;if(d+=_,h){a.push(i,t,e,s);for(let x=1,y=d;x<g;x++,y+=_)a.push(i,t,i+Math.sin(y)*m,t+Math.cos(y)*m);a.push(i,t,r,n)}else{a.push(e,s,i,t);for(let x=1,y=d;x<g;x++,y+=_)a.push(i+Math.sin(y)*m,t+Math.cos(y)*m,i,t);a.push(r,n,i,t)}return g*2}function bT(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 st(s[0],s[1]),h=new st(s[s.length-2],s[s.length-1]),o=e.type!==xe.POLY||e.closeStroke,l=Math.abs(a.x-h.x)<r&&Math.abs(a.y-h.y)<r;if(o){s=s.slice(),l&&(s.pop(),s.pop(),h.set(s[s.length-2],s[s.length-1]));const V=(a.x+h.x)*.5,L=(h.y+a.y)*.5;s.unshift(V,L),s.push(V,L)}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 _=s[0],x=s[1],y=s[2],v=s[3],b=0,w=0,E=-(x-v),T=_-y,A=0,I=0,M=Math.sqrt(E*E+T*T);E/=M,T/=M,E*=p,T*=p;const R=n.alignment,C=(1-R)*2,P=R*2;o||(n.cap===Xr.ROUND?d+=Ci(_-E*(C-P)*.5,x-T*(C-P)*.5,_-E*C,x-T*C,_+E*P,x+T*P,u,!0)+2:n.cap===Xr.SQUARE&&(d+=Bm(_,x,E,T,C,P,!0,u))),u.push(_-E*C,x-T*C,_+E*P,x+T*P);for(let V=1;V<c-1;++V){_=s[(V-1)*2],x=s[(V-1)*2+1],y=s[V*2],v=s[V*2+1],b=s[(V+1)*2],w=s[(V+1)*2+1],E=-(x-v),T=_-y,M=Math.sqrt(E*E+T*T),E/=M,T/=M,E*=p,T*=p,A=-(v-w),I=y-b,M=Math.sqrt(A*A+I*I),A/=M,I/=M,A*=p,I*=p;const L=y-_,$=x-v,O=y-b,N=w-v,Z=L*O+$*N,Q=$*O-N*L,H=Q<0;if(Math.abs(Q)<.001*Math.abs(Z)){u.push(y-E*C,v-T*C,y+E*P,v+T*P),Z>=0&&(n.join===ls.ROUND?d+=Ci(y,v,y-E*C,v-T*C,y-A*C,v-I*C,u,!1)+4:d+=2,u.push(y-A*P,v-I*P,y+A*C,v+I*C));continue}const lt=(-E+_)*(-T+v)-(-E+y)*(-T+x),Tt=(-A+b)*(-I+v)-(-A+y)*(-I+w),_t=(L*Tt-O*lt)/Q,kt=(N*lt-$*Tt)/Q,zt=(_t-y)*(_t-y)+(kt-v)*(kt-v),Qt=y+(_t-y)*C,Pt=v+(kt-v)*C,jt=y-(_t-y)*P,Ot=v-(kt-v)*P,ze=Math.min(L*L+$*$,O*O+N*N),is=H?C:P,li=ze+is*is*m,kn=zt<=li;let hi=n.join;if(hi===ls.MITER&&zt/m>g&&(hi=ls.BEVEL),kn)switch(hi){case ls.MITER:{u.push(Qt,Pt,jt,Ot);break}case ls.BEVEL:{H?u.push(Qt,Pt,y+E*P,v+T*P,Qt,Pt,y+A*P,v+I*P):u.push(y-E*C,v-T*C,jt,Ot,y-A*C,v-I*C,jt,Ot),d+=2;break}case ls.ROUND:{H?(u.push(Qt,Pt,y+E*P,v+T*P),d+=Ci(y,v,y+E*P,v+T*P,y+A*P,v+I*P,u,!0)+4,u.push(Qt,Pt,y+A*P,v+I*P)):(u.push(y-E*C,v-T*C,jt,Ot),d+=Ci(y,v,y-E*C,v-T*C,y-A*C,v-I*C,u,!1)+4,u.push(y-A*C,v-I*C,jt,Ot));break}}else{switch(u.push(y-E*C,v-T*C,y+E*P,v+T*P),hi){case ls.MITER:{H?u.push(jt,Ot,jt,Ot):u.push(Qt,Pt,Qt,Pt),d+=2;break}case ls.ROUND:{H?d+=Ci(y,v,y+E*P,v+T*P,y+A*P,v+I*P,u,!0)+2:d+=Ci(y,v,y-E*C,v-T*C,y-A*C,v-I*C,u,!1)+2;break}}u.push(y-A*C,v-I*C,y+A*P,v+I*P),d+=2}}_=s[(c-2)*2],x=s[(c-2)*2+1],y=s[(c-1)*2],v=s[(c-1)*2+1],E=-(x-v),T=_-y,M=Math.sqrt(E*E+T*T),E/=M,T/=M,E*=p,T*=p,u.push(y-E*C,v-T*C,y+E*P,v+T*P),o||(n.cap===Xr.ROUND?d+=Ci(y-E*(C-P)*.5,v-T*(C-P)*.5,y-E*C,v-T*C,y+E*P,v+T*P,u,!1)+2:n.cap===Xr.SQUARE&&(d+=Bm(y,v,E,T,C,P,!1,u)));const k=t.indices,U=mn.epsilon*mn.epsilon;for(let V=f;V<d+f-2;++V)_=u[V*2],x=u[V*2+1],y=u[(V+1)*2],v=u[(V+1)*2+1],b=u[(V+2)*2],w=u[(V+2)*2+1],!(Math.abs(_*(v-w)+y*(w-x)+b*(x-v))<U)&&k.push(V,V+1,V+2)}function wT(i,t){let e=0;const s=i.shape,r=i.points||s.points,n=s.type!==xe.POLY||s.closeStroke;if(r.length===0)return;const a=t.points,h=t.indices,o=r.length/2,l=a.length/2;let u=l;for(a.push(r[0],r[1]),e=1;e<o;e++)a.push(r[e*2],r[e*2+1]),h.push(u,u+1),u++;n&&h.push(u,l)}function Dm(i,t){i.lineStyle.native?wT(i,t):bT(i,t)}class cc{static curveLength(t,e,s,r,n,a){const h=t-2*s+n,o=e-2*r+a,l=2*s-2*t,u=2*r-2*e,c=4*(h*h+o*o),d=4*(h*l+o*u),f=l*l+u*u,p=2*Math.sqrt(c+d+f),m=Math.sqrt(c),g=2*c*m,_=2*Math.sqrt(f),x=d/m;return(g*p+m*d*(p-_)+(4*f*c-d*d)*Math.log((2*m+x+p)/(x+_)))/(4*g)}static curveTo(t,e,s,r,n){const a=n[n.length-2],h=n[n.length-1],o=mn._segmentsCount(cc.curveLength(a,h,t,e,s,r));let l=0,u=0;for(let c=1;c<=o;++c){const d=c/o;l=a+(t-a)*d,u=h+(e-h)*d,n.push(l+(t+(s-t)*d-l)*d,u+(e+(r-e)*d-u)*d)}}}const uc={[xe.POLY]:Fm,[xe.CIRC]:Na,[xe.ELIP]:Na,[xe.RECT]:yT,[xe.RREC]:xT},Om=[],Va=[];class Ua{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 Ua(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 gn=new st,Lm=class ry extends mp{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 Ia,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(),Va.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),Om.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 Ua(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 Ua(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,gn):gn.copyFrom(t),r.shape.contains(gn.x,gn.y))){let n=!1;if(r.holes){for(let a=0;a<r.holes.length;a++)if(r.holes[a].shape.contains(gn.x,gn.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 o=this.shapeIndex;o<e.length;o++){this.shapeIndex++;const l=e[o],u=l.fillStyle,c=l.lineStyle;uc[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=Fr.REPEAT,d===0?this.processFill(l):this.processLine(l);const _=this.points.length/2-g;_!==0&&(s&&!this._compareStyles(r,f)&&(s.end(m,g),s=null),s||(s=Om.pop()||new vT,s.begin(f,m,g),this.batches.push(s),r=f),this.addUvs(this.points,t,f.texture,g,_,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 h=a>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&h===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=h?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<ry.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++et._globalBatch;for(let c=0;c<this.drawCalls.length;c++)this.drawCalls[c].texArray.clear(),Va.push(this.drawCalls[c]);this.drawCalls.length=0;const e=this.colors,s=this.textureIds;let r=Va.pop();r||(r=new Dh,r.texArray=new Gh),r.texArray.count=0,r.start=0,r.size=0,r.type=xs.TRIANGLES;let n=0,a=null,h=0,o=!1,l=xs.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;o!==!!p.native&&(o=!!p.native,l=o?xs.LINES:xs.TRIANGLES,a=null,n=f,t++),a!==m&&(a=m,m._batchEnabled!==t&&(n===f&&(t++,n=0,r.size>0&&(r=Va.pop(),r||(r=new Dh,r.texArray=new Gh),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=Fr.REPEAT,r.texArray.elements[r.texArray.count++]=m,n++)),r.size+=d.size,u+=d.size,h=m._batchLocation,this.addColors(e,p.color,p.alpha,d.attribSize,d.attribStart),this.addTextureIds(s,h,d.attribSize,d.attribStart)}et._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),h=new Uint32Array(n);let o=0;for(let l=0;l<t.length/2;l++)a[o++]=t[l*2],a[o++]=t[l*2+1],a[o++]=e[l*2],a[o++]=e[l*2+1],h[o++]=s[l],a[o++]=r[l];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?Fm.triangulate(t,this):uc[t.type].triangulate(t,this)}processLine(t){Dm(t,this);for(let e=0;e<t.holes.length;e++)Dm(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const s=t[e];uc[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=Ct.shared.setValue(e).toLittleEndianNumber(),h=Ct.shared.setValue(a).toPremultiplied(s);t.length=Math.max(t.length,n+r);for(let o=0;o<r;o++)t[n+o]=h}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 h=0;const o=e.length,l=s.frame;for(;h<n;){let c=t[(r+h)*2],d=t[(r+h)*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}h++,e.push(c/l.width,d/l.height)}const u=s.baseTexture;(l.width<u.width||l.height<u.height)&&this.adjustUvs(e,s,o,n)}adjustUvs(t,e,s,r){const n=e.baseTexture,a=1e-6,h=s+r*2,o=e.frame,l=o.width/n.width,u=o.height/n.height;let c=o.x/o.width,d=o.y/o.height,f=Math.floor(t[s]+a),p=Math.floor(t[s+1]+a);for(let m=s+2;m<h;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<h;m+=2)t[m]=(t[m]+c)*l,t[m+1]=(t[m+1]+d)*u}};Lm.BATCHABLE_SIZE=100;let ET=Lm;class Ga{constructor(){this.color=16777215,this.alpha=1,this.texture=q.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new Ga;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=q.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class dc extends Ga{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=Xr.BUTT,this.join=ls.MITER,this.miterLimit=10}clone(){const t=new dc;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=Xr.BUTT,this.join=ls.MITER,this.miterLimit=10}}const fc={},pc=class Sl extends Bt{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 Ga,this._lineStyle=new dc,this._matrix=null,this._holeMode=!1,this.state=js.for2d(),this._geometry=t||new ET,this._geometry.refCount++,this._transformID=-1,this._tintColor=new Ct(16777215),this.blendMode=W.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new Sl(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:q.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:Xr.BUTT,join:ls.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 Nr,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Nr,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),cc.curveTo(t,e,s,r,n),this}bezierCurveTo(t,e,s,r,n,a){return this._initCurve(),hc.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,h=km.curveTo(t,e,s,r,n,a);if(h){const{cx:o,cy:l,radius:u,startAngle:c,endAngle:d,anticlockwise:f}=h;this.arc(o,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+=ha:a&&r<=n&&(r+=ha),n-r===0)return this;const h=t+Math.cos(r)*s,o=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]-h),d=Math.abs(u[u.length-1]-o);c<l&&d<l||u.push(h,o)}else this.moveTo(h,o),u=this.currentPath.points;return km.arc(h,o,t,e,s,r,n,a,u),this}beginFill(t=0,e){return this.beginTextureFill({texture:q.WHITE,color:t,alpha:e})}normalizeColor(t){const e=Ct.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:q.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 rt(t,e,s,r))}drawRoundedRect(t,e,s,r,n){return this.drawShape(new fa(t,e,s,r,n))}drawCircle(t,e,s){return this.drawShape(new ua(t,e,s))}drawEllipse(t,e,s,r){return this.drawShape(new da(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 Nr(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===xe.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,h=new Float32Array(this.vertexData.buffer,n.attribStart*4*2,n.attribSize*2),o=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:h,blendMode:e,indices:l,uvs:o,_batchRGB:Ct.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,Ct.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 h=0,o=a.length;h<o;h++)this._renderDrawCallDirect(t,s.drawCalls[h])}_renderDrawCallDirect(t,e){const{texArray:s,type:r,size:n,start:a}=e,h=s.count;for(let o=0;o<h;o++)t.texture.bind(s.elements[o],o);t.geometry.draw(r,n,a)}_resolveDirectShader(t){let e=this.shader;const s=this.pluginName;if(!e){if(!fc[s]){const{maxTextures:r}=t.plugins[s],n=new Int32Array(r);for(let o=0;o<r;o++)n[o]=o;const a={tint:new Float32Array([1,1,1,1]),translationMatrix:new Rt,default:Es.from({uSamplers:n},!0)},h=t.plugins[s]._shader.program;fc[s]=new Zs(h,a)}e=fc[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,Sl._TEMP_POINT),this._geometry.containsPoint(Sl._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=Ct.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,h=e.tx,o=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+h,u[c++]=a*p+r*f+o}}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)}};pc.curves=mn,pc._TEMP_POINT=new st;let hs=pc;class TT{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 mc=new st,Nm=new Nr,Vm=class iy extends Bt{constructor(t,e,s,r=xs.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=s||js.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=z.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===xs.TRIANGLES&&e.length<iy.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,h=r.c,o=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+h*p+l,c[d*2+1]=a*f+o*p+u}if(this._roundPixels){const d=z.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 TT(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,mc);const e=this.geometry.getBuffer("aVertexPosition").data,s=Nm.points,r=this.geometry.getIndex().data,n=r.length,a=this.drawMode===4?3:1;for(let h=0;h+2<n;h+=a){const o=r[h]*2,l=r[h+1]*2,u=r[h+2]*2;if(s[0]=e[o],s[1]=e[o+1],s[2]=e[l],s[3]=e[l+1],s[4]=e[u],s[5]=e[u+1],Nm.contains(mc.x,mc.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}};Vm.BATCHABLE_SIZE=100;let Xa=Vm;class gc extends Lr{constructor(t,e,s){super();const r=new Jt(t),n=new Jt(e,!0),a=new Jt(s,!0,!0);this.addAttribute("aVertexPosition",r,2,!1,tt.FLOAT).addAttribute("aTextureCoord",n,2,!1,tt.FLOAT).addIndex(a),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var AT=`varying vec2 vTextureCoord;
910
+ `;let fn=null;class gm{constructor(){fn||(fn=URL.createObjectURL(new Blob([vE],{type:"application/javascript"}))),this.worker=new Worker(fn)}}gm.revokeObjectURL=function(){fn&&(URL.revokeObjectURL(fn),fn=null)};let _m=0,sc;class bE{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const{worker:e}=new ec;e.addEventListener("message",s=>{e.terminate(),ec.revokeObjectURL(),t(s.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){sc===void 0&&(sc=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<sc&&(this._createdWorkers++,t=new gm().worker,t.addEventListener("message",e=>{this.complete(e.data),this.returnWorker(e.target),this.next()})),t}returnWorker(t){this.workerPool.push(t)}complete(t){t.error!==void 0?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const 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[_m]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:_m++,id:s})}}const ym=new bE;function ho(i,t,e){i.resource.internal=!0;const s=new q(i),r=()=>{delete t.promiseCache[e],Ai.has(e)&&Ai.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}const wE=[".jpeg",".jpg",".png",".webp",".avif"],EE=["image/jpeg","image/png","image/webp","image/avif"];async function TE(i){const t=await z.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 Fa={name:"loadTextures",extension:{type:Y.LoadParser,priority:Ne.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return un(i,EE)||Le(i,wE)},async load(i,t,e){var h;const s=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let r;s?this.config.preferWorkers&&await ym.isImageBitmapSupported()?r=await ym.loadImageBitmap(i):r=await TE(i):r=await new Promise((o,l)=>{const u=new Image;u.crossOrigin=this.config.crossOrigin,u.src=i,u.complete?o(u):(u.onload=()=>o(u),u.onerror=c=>l(c))});const n={...t.data};n.resolution??(n.resolution=_r(i)),s&&((h=n.resourceOptions)==null?void 0:h.ownsImageBitmap)===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const a=new et(r,n);return a.resource.src=i,ho(a,e,i)},unload(i){i.destroy(!0)}};K.add(Fa);const AE=".svg",SE="image/svg+xml",CE={extension:{type:Y.LoadParser,priority:Ne.High},name:"loadSVG",test(i){return un(i,SE)||Le(i,AE)},async testParse(i){return jh.test(i)},async parse(i,t,e){var n;const s=new jh(i,(n=t==null?void 0:t.data)==null?void 0:n.resourceOptions);await s.load();const r=new et(s,{resolution:_r(i),...t==null?void 0:t.data});return r.resource.src=t.src,ho(r,e,t.src)},async load(i,t){return(await z.ADAPTER.fetch(i)).text()},unload:Fa.unload};K.add(CE);const IE=[".mp4",".m4v",".webm",".ogv"],PE=["video/mp4","video/webm","video/ogg"],RE={name:"loadVideo",extension:{type:Y.LoadParser,priority:Ne.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test(i){return un(i,PE)||Le(i,IE)},async load(i,t,e){var a;let s;const r=await(await z.ADAPTER.fetch(i)).blob(),n=URL.createObjectURL(r);try{const h={autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline,...(a=t==null?void 0:t.data)==null?void 0:a.resourceOptions,autoLoad:!0},o=new rm(n,h);await o.load();const l=new et(o,{alphaMode:await Nb(),resolution:_r(i),...t==null?void 0:t.data});l.resource.src=i,s=ho(l,e,i),s.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(h){throw URL.revokeObjectURL(n),h}return s},unload(i){i.destroy(!0)}};K.add(RE);class ME{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{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 As(e||s||r||n,a=>typeof a=="string"?a:Array.isArray(a)?a.map(h=>(h==null?void 0:h.src)??(h==null?void 0:h.srcs)??h):a!=null&&a.src||a!=null&&a.srcs?a.src??a.srcs:a,!0)}addManifest(t){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const s=[];Array.isArray(e)?e.forEach(r=>{const n=r.src??r.srcs,a=r.alias??r.name;let h;if(typeof a=="string"){const o=this._createBundleAssetId(t,a);s.push(o),h=[a,o]}else{const o=a.map(l=>this._createBundleAssetId(t,l));s.push(...o),h=[...a,...o]}this.add({...r,alias:h,src:n})}):Object.keys(e).forEach(r=>{const n=[r,this._createBundleAssetId(t,r)];if(typeof e[r]=="string")this.add({alias:n,src:e[r]});else if(Array.isArray(e[r]))this.add({alias:n,src:e[r]});else{const a=e[r],h=a.src??a.srcs;this.add({...a,alias:n,src:Array.isArray(h)?h:[h]})}s.push(...n)}),this._bundles[t]=s}add(t,e,s,r,n){const a=[];typeof t=="string"||Array.isArray(t)&&typeof t[0]=="string"?(ot("7.2.0",`Assets.add now uses an object instead of individual parameters.
911
+ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),a.push({alias:t,src:e,data:s,format:r,loadParser:n})):Array.isArray(t)?a.push(...t):a.push(t);let h;h=o=>{this.hasKey(o)&&console.warn(`[Resolver] already has key: ${o} overwriting`)},As(a).forEach(o=>{const{src:l,srcs:u}=o;let{data:c,format:d,loadParser:f}=o;const p=As(l||u).map(_=>typeof _=="string"?sE(_):Array.isArray(_)?_:[_]),m=this.getAlias(o);Array.isArray(m)?m.forEach(h):h(m);const g=[];p.forEach(_=>{_.forEach(x=>{let y={};if(typeof x!="object"){y.src=x;for(let v=0;v<this._parsers.length;v++){const b=this._parsers[v];if(b.test(x)){y=b.parse(x);break}}}else c=x.data??c,d=x.format??d,f=x.loadParser??f,y={...y,...x};if(!m)throw new Error(`[Resolver] alias is undefined for this asset: ${y.src}`);y=this.buildResolvedAsset(y,{aliases:m,data:c,format:d,loadParser:f}),g.push(y)})}),m.forEach(_=>{this._assetMap[_]=g})})}resolveBundle(t){const e=Ma(t);t=As(t);const s={};return t.forEach(r=>{const n=this._bundles[r];if(n){const a=this.resolve(n),h={};for(const o in a){const l=a[o];h[this._extractAssetIdFromBundle(r,o)]=l}s[r]=h}}),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=Ma(t);t=As(t);const s={};return t.forEach(r=>{if(!this._resolverHash[r])if(this._assetMap[r]){let n=this._assetMap[r];const a=n[0],h=this._getPreferredOrder(n);h==null||h.priority.forEach(o=>{h.params[o].forEach(l=>{const u=n.filter(c=>c[o]?c[o]===l:!1);u.length&&(n=u)})}),this._resolverHash[r]=n[0]??a}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){const{aliases:s,data:r,loadParser:n,format:a}=e;return(this._basePath||this._rootPath)&&(t.src=bt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=s??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...r||{},...t.data},t.loadParser=n??t.loadParser,t.format=a??t.format??bt.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class FE{constructor(){this._detections=[],this._initialized=!1,this.resolver=new ME,this.loader=new iE,this.cache=Ai,this._backgroundLoader=new eE(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var n,a;if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let h=t.manifest;typeof h=="string"&&(h=await this.load(h)),this.resolver.addManifest(h)}const e=((n=t.texturePreference)==null?void 0:n.resolution)??1,s=typeof e=="number"?[e]:e,r=await this._detectFormats({preferredFormats:(a=t.texturePreference)==null?void 0:a.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:r,resolution:s}}),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=Ma(t),r=As(t).map(h=>{if(typeof h!="string"){const o=this.resolver.getAlias(h);return o.some(l=>!this.resolver.hasKey(l))&&this.add(h),Array.isArray(o)?o[0]:o}return this.resolver.hasKey(h)||this.add({alias:h,src:h}),h}),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 h=0,o=0;const l=()=>{e==null||e(++h/o)},u=a.map(c=>{const d=r[c];return o+=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 Ai.get(t);const e={};for(let s=0;s<t.length;s++)e[s]=Ai.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((h,o)=>{const l=n[h.src],u=[h.src];h.alias&&u.push(...h.alias),a[r[o]]=l,Ai.set(u,l)}),a}async unload(t){this._initialized||await this.init();const e=As(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=As(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=>{Ai.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 Fa.config.preferWorkers}set preferWorkers(t){ot("7.2.0","Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."),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 Gr=new FE;K.handleByList(Y.LoadParser,Gr.loader.parsers).handleByList(Y.ResolveParser,Gr.resolver.parsers).handleByList(Y.CacheParser,Gr.cache.parsers).handleByList(Y.DetectionParser,Gr.detections);const kE={extension:Y.CacheParser,test:i=>Array.isArray(i)&&i.every(t=>t instanceof q),getCacheableAssets:(i,t)=>{const e={};return i.forEach(s=>{t.forEach((r,n)=>{e[s+(n===0?"":n+1)]=r})}),e}};K.add(kE);async function xm(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{return!1}return!0}return!1}const BE={extension:{type:Y.DetectionParser,priority:1},test:async()=>xm("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};K.add(BE);const DE={extension:{type:Y.DetectionParser,priority:0},test:async()=>xm("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};K.add(DE);const vm=["png","jpg","jpeg"],OE={extension:{type:Y.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...vm],remove:async i=>i.filter(t=>!vm.includes(t))};K.add(OE);const LE="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function rc(i){return LE?!1:document.createElement("video").canPlayType(i)!==""}const NE={extension:{type:Y.DetectionParser,priority:0},test:async()=>rc("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};K.add(NE);const VE={extension:{type:Y.DetectionParser,priority:0},test:async()=>rc("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};K.add(VE);const UE={extension:{type:Y.DetectionParser,priority:0},test:async()=>rc("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};K.add(UE);const GE={extension:Y.ResolveParser,test:Fa.test,parse:i=>{var t;return{resolution:parseFloat(((t=z.RETINA_PREFIX.exec(i))==null?void 0:t[1])??"1"),format:bt.extname(i).slice(1),src:i}}};K.add(GE);var ve=(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=35987]="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[i.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",i[i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",i[i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",i[i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",i))(ve||{});const ka={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,35987:1,34798:1,37808:1,36492:1,36493:1,36494:1,36495:1};let Ks,pn;function bm(){pn={bptc:Ks.getExtension("EXT_texture_compression_bptc"),astc:Ks.getExtension("WEBGL_compressed_texture_astc"),etc:Ks.getExtension("WEBGL_compressed_texture_etc"),s3tc:Ks.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:Ks.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:Ks.getExtension("WEBGL_compressed_texture_pvrtc")||Ks.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:Ks.getExtension("WEBGL_compressed_texture_etc1"),atc:Ks.getExtension("WEBGL_compressed_texture_atc")}}const XE={extension:{type:Y.DetectionParser,priority:2},test:async()=>{const i=z.ADAPTER.createCanvas().getContext("webgl");return i?(Ks=i,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async i=>{pn||bm();const t=[];for(const e in pn)pn[e]&&t.push(e);return[...t,...i]},remove:async i=>(pn||bm(),i.filter(t=>!(t in pn)))};K.add(XE);class $E extends aa{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 Eh(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 Eh(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class Si extends $E{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=Si._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||Si._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:h,levelWidth:o,levelHeight:l,levelBuffer:u}=this._levelBuffers[n];r.compressedTexImage2D(r.TEXTURE_2D,h,this.format,o,l,0,u)}return!0}onBlobLoaded(){this._levelBuffers=Si._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>=35916&&t<=35919)return"s3tc_sRGB";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(t===36196)return"etc1";if(t===35986||t===35987||t===34798)return"atc";if(t>=36492&&t<=36495)return"bptc";if(t===37808)return"astc";throw new Error(`Invalid (compressed) texture format given: ${t}`)}static _createLevelBuffers(t,e,s,r,n,a,h){const o=new Array(s);let l=t.byteOffset,u=a,c=h,d=u+r-1&~(r-1),f=c+n-1&~(n-1),p=d*f*ka[e];for(let m=0;m<s;m++)o[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*ka[e];return o}}const ic=4,Ba=124,YE=32,wm=20,HE=542327876,Da={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},WE={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},Oa={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},zE=1,jE=2,qE=4,ZE=64,KE=512,QE=131072,JE=827611204,tT=861165636,eT=894720068,sT=808540228,rT=4,iT={[JE]:ve.COMPRESSED_RGBA_S3TC_DXT1_EXT,[tT]:ve.COMPRESSED_RGBA_S3TC_DXT3_EXT,[eT]:ve.COMPRESSED_RGBA_S3TC_DXT5_EXT},nT={70:ve.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:ve.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:ve.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:ve.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:ve.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:ve.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:ve.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:ve.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:ve.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:ve.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:ve.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:ve.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:ve.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function oT(i){const t=new Uint32Array(i);if(t[0]!==HE)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(i,0,Ba/Uint32Array.BYTES_PER_ELEMENT),s=e[Da.HEIGHT],r=e[Da.WIDTH],n=e[Da.MIPMAP_COUNT],a=new Uint32Array(i,Da.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,YE/Uint32Array.BYTES_PER_ELEMENT),h=a[zE];if(h&qE){const o=a[WE.FOURCC];if(o!==sT){const x=iT[o],y=ic+Ba,v=new Uint8Array(i,y);return[new Si(v,{format:x,width:r,height:s,levels:n})]}const l=ic+Ba,u=new Uint32Array(t.buffer,l,wm/Uint32Array.BYTES_PER_ELEMENT),c=u[Oa.DXGI_FORMAT],d=u[Oa.RESOURCE_DIMENSION],f=u[Oa.MISC_FLAG],p=u[Oa.ARRAY_SIZE],m=nT[c];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${c}`);if(f===rT)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,_=ic+Ba+wm;if(p===1)g.push(new Uint8Array(i,_));else{const x=ka[m];let y=0,v=r,b=s;for(let E=0;E<n;E++){const T=Math.max(1,v+3&-4),A=Math.max(1,b+3&-4),I=T*A*x;y+=I,v=v>>>1,b=b>>>1}let w=_;for(let E=0;E<p;E++)g.push(new Uint8Array(i,w,y)),w+=y}return g.map(x=>new Si(x,{format:m,width:r,height:s,levels:n}))}throw h&ZE?new Error("DDSParser does not support uncompressed texture data."):h&KE?new Error("DDSParser does not supported YUV uncompressed texture data."):h&QE?new Error("DDSParser does not support single-channel (lumninance) texture data!"):h&jE?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 Em=[171,75,84,88,32,49,49,187,13,10,26,10],aT=67305985,Ss={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},nc=64,Tm={[tt.UNSIGNED_BYTE]:1,[tt.UNSIGNED_SHORT]:2,[tt.INT]:4,[tt.UNSIGNED_INT]:4,[tt.FLOAT]:4,[tt.HALF_FLOAT]:8},lT={[G.RGBA]:4,[G.RGB]:3,[G.RG]:2,[G.RED]:1,[G.LUMINANCE]:1,[G.LUMINANCE_ALPHA]:2,[G.ALPHA]:1},hT={[tt.UNSIGNED_SHORT_4_4_4_4]:2,[tt.UNSIGNED_SHORT_5_5_5_1]:2,[tt.UNSIGNED_SHORT_5_6_5]:2};function cT(i,t,e=!1){const s=new DataView(t);if(!uT(i,s))return null;const r=s.getUint32(Ss.ENDIANNESS,!0)===aT,n=s.getUint32(Ss.GL_TYPE,r),a=s.getUint32(Ss.GL_FORMAT,r),h=s.getUint32(Ss.GL_INTERNAL_FORMAT,r),o=s.getUint32(Ss.PIXEL_WIDTH,r),l=s.getUint32(Ss.PIXEL_HEIGHT,r)||1,u=s.getUint32(Ss.PIXEL_DEPTH,r)||1,c=s.getUint32(Ss.NUMBER_OF_ARRAY_ELEMENTS,r)||1,d=s.getUint32(Ss.NUMBER_OF_FACES,r),f=s.getUint32(Ss.NUMBER_OF_MIPMAP_LEVELS,r),p=s.getUint32(Ss.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,_=o+3&-4,x=l+3&-4,y=new Array(c);let v=o*l;n===0&&(v=_*x);let b;if(n!==0?Tm[n]?b=Tm[n]*lT[a]:b=hT[n]:b=ka[h],b===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const w=e?fT(s,p,r):null;let E=v*b,T=o,A=l,I=_,M=x,R=nc+p;for(let C=0;C<f;C++){const P=s.getUint32(R,r);let k=R+4;for(let U=0;U<c;U++){let V=y[U];V||(V=y[U]=new Array(f)),V[C]={levelID:C,levelWidth:f>1||n!==0?T:I,levelHeight:f>1||n!==0?A:M,levelBuffer:new Uint8Array(t,k,E)},k+=E}R+=P+4,R=R%4!==0?R+4-R%4:R,T=T>>1||1,A=A>>1||1,I=T+m-1&~(m-1),M=A+g-1&~(g-1),E=I*M*b}return n!==0?{uncompressed:y.map(C=>{let P=C[0].levelBuffer,k=!1;return n===tt.FLOAT?P=new Float32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4):n===tt.UNSIGNED_INT?(k=!0,P=new Uint32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4)):n===tt.INT&&(k=!0,P=new Int32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4)),{resource:new aa(P,{width:C[0].levelWidth,height:C[0].levelHeight}),type:n,format:k?dT(a):a}}),kvData:w}:{compressed:y.map(C=>new Si(null,{format:h,width:o,height:l,levels:f,levelBuffers:C})),kvData:w}}function uT(i,t){for(let e=0;e<Em.length;e++)if(t.getUint8(e)!==Em[e])return console.error(`${i} is not a valid *.ktx file!`),!1;return!0}function dT(i){switch(i){case G.RGBA:return G.RGBA_INTEGER;case G.RGB:return G.RGB_INTEGER;case G.RG:return G.RG_INTEGER;case G.RED:return G.RED_INTEGER;default:return i}}function fT(i,t,e){const s=new Map;let r=0;for(;r<t;){const n=i.getUint32(nc+r,e),a=nc+r+4,h=3-(n+3)%4;if(n===0||n>t-r){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let o=0;for(;o<n&&i.getUint8(a+o)!==0;o++);if(o===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const l=new TextDecoder().decode(new Uint8Array(i.buffer,a,o)),u=new DataView(i.buffer,a+o+1,n-o-1);s.set(l,u),r+=4+n+h}return s}const pT={extension:{type:Y.LoadParser,priority:Ne.High},name:"loadDDS",test(i){return Le(i,".dds")},async load(i,t,e){const s=await(await z.ADAPTER.fetch(i)).arrayBuffer(),r=oT(s).map(n=>{const a=new et(n,{mipmap:vs.OFF,alphaMode:Re.NO_PREMULTIPLIED_ALPHA,resolution:_r(i),...t.data});return ho(a,e,i)});return r.length===1?r[0]:r},unload(i){Array.isArray(i)?i.forEach(t=>t.destroy(!0)):i.destroy(!0)}};K.add(pT);const mT={extension:{type:Y.LoadParser,priority:Ne.High},name:"loadKTX",test(i){return Le(i,".ktx")},async load(i,t,e){const s=await(await z.ADAPTER.fetch(i)).arrayBuffer(),{compressed:r,uncompressed:n,kvData:a}=cT(i,s),h=r??n,o={mipmap:vs.OFF,alphaMode:Re.NO_PREMULTIPLIED_ALPHA,resolution:_r(i),...t.data},l=h.map(u=>{h===n&&Object.assign(o,{type:u.type,format:u.format});const c=u.resource??u,d=new et(c,o);return d.ktxKeyValueData=a,ho(d,e,i)});return l.length===1?l[0]:l},unload(i){Array.isArray(i)?i.forEach(t=>t.destroy(!0)):i.destroy(!0)}};K.add(mT);const gT=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],_T={extension:Y.ResolveParser,test:i=>{const t=bt.extname(i).slice(1);return["basis","ktx","dds"].includes(t)},parse:i=>{var s,r;const t=i.split("."),e=t.pop();if(["ktx","dds"].includes(e)){const n=t.pop();if(gT.includes(n))return{resolution:parseFloat(((s=z.RETINA_PREFIX.exec(i))==null?void 0:s[1])??"1"),format:n,src:i}}return{resolution:parseFloat(((r=z.RETINA_PREFIX.exec(i))==null?void 0:r[1])??"1"),format:e,src:i}}};K.add(_T);const La=new rt,yT=4,Am=class Lo{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.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,h)=>{n.toBlob(o=>{if(!o){h(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>a(l.result),l.onerror=h,l.readAsDataURL(o)},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((h,o)=>{const l=new FileReader;l.onload=()=>h(l.result),l.onerror=o,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:h}=this._rawPixels(t,e);a&&Lo._flipY(s,r,n),h&&Lo._unpremultiplyAlpha(s);const o=new Jb(r,n,1),l=new ImageData(new Uint8ClampedArray(s.buffer),r,n);return o.context.putImageData(l,0,0),o.canvas}pixels(t,e){const{pixels:s,width:r,height:n,flipY:a,premultipliedAlpha:h}=this._rawPixels(t,e);return a&&Lo._flipY(s,r,n),h&&Lo._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,h,o=!1;t&&(t instanceof wi?h=t:(h=s.generateTexture(t,{region:e,resolution:s.resolution,multisample:s.multisample}),o=!0,e&&(La.width=e.width,La.height=e.height,e=La)));const l=s.gl;if(h){if(r=h.baseTexture.resolution,e=e??h.frame,n=!1,a=h.baseTexture.alphaMode>0&&h.baseTexture.format===G.RGBA,!o){s.renderTexture.bind(h);const f=h.framebuffer.glFramebuffers[s.CONTEXT_UID];f.blitFramebuffer&&s.framebuffer.bind(f.blitFramebuffer)}}else r=s.resolution,e||(e=La,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(yT*u*c);return l.readPixels(Math.round(e.x*r),Math.round(e.y*r),u,c,l.RGBA,l.UNSIGNED_BYTE,d),o&&(h==null||h.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 h=0;h<n;h++){const o=h*r,l=(s-h-1)*r;a.set(t.subarray(o,o+r)),t.copyWithin(o,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}}}};Am.extension={name:"extract",type:Y.RendererSystem};let xT=Am;K.add(xT);const Na={build(i){const t=i.points;let e,s,r,n,a,h;if(i.type===xe.CIRC){const p=i.shape;e=p.x,s=p.y,a=h=p.radius,r=n=0}else if(i.type===xe.ELIP){const p=i.shape;e=p.x,s=p.y,a=p.width,h=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=h=Math.max(0,Math.min(p.radius,Math.min(m,g))),r=m-a,n=g-h}if(!(a>=0&&h>=0&&r>=0&&n>=0)){t.length=0;return}const o=Math.ceil(2.3*Math.sqrt(a+h)),l=o*8+(r?4:0)+(n?4:0);if(t.length=l,l===0)return;if(o===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=o*4+(r?2:0)+2,d=c,f=l;{const p=r+a,m=n,g=e+p,_=e-p,x=s+m;if(t[u++]=g,t[u++]=x,t[--c]=x,t[--c]=_,n){const y=s-m;t[d++]=_,t[d++]=y,t[--f]=y,t[--f]=g}}for(let p=1;p<o;p++){const m=Math.PI/2*(p/o),g=r+Math.cos(m)*a,_=n+Math.sin(m)*h,x=e+g,y=e-g,v=s+_,b=s-_;t[u++]=x,t[u++]=v,t[--c]=v,t[--c]=y,t[d++]=y,t[d++]=b,t[--f]=b,t[--f]=x}{const p=r,m=n+h,g=e+p,_=e-p,x=s+m,y=s-m;t[u++]=g,t[u++]=x,t[--f]=y,t[--f]=g,r&&(t[u++]=_,t[u++]=x,t[--f]=y,t[--f]=_)}},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 h,o;if(i.type!==xe.RREC){const u=i.shape;h=u.x,o=u.y}else{const u=i.shape;h=u.x+u.width/2,o=u.y+u.height/2}const l=i.matrix;s.push(i.matrix?l.a*h+l.c*o+l.tx:h,i.matrix?l.b*h+l.d*o+l.ty:o),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 Sm(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 h=i[r],o=i[r+1];s+=(h-n)*(o+a),n=h,a=o}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,h=e-n-1,o=n,l=n+1;[i[a],i[o]]=[i[o],i[a]],[i[h],i[l]]=[i[l],i[h]]}}}const Cm={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){Sm(e,!1);const a=[];for(let l=0;l<s.length;l++){const u=s[l];Sm(u.points,!0),a.push(e.length/2),e=e.concat(u.points)}const h=Sy(e,a,2);if(!h)return;const o=r.length/2;for(let l=0;l<h.length;l+=3)n.push(h[l]+o),n.push(h[l+1]+o),n.push(h[l+2]+o);for(let l=0;l<e.length;l++)r.push(e[l])}}},vT={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)}},bT={build(i){Na.build(i)},triangulate(i,t){Na.triangulate(i,t)}};var ls=(i=>(i.MITER="miter",i.BEVEL="bevel",i.ROUND="round",i))(ls||{}),Xr=(i=>(i.BUTT="butt",i.ROUND="round",i.SQUARE="square",i))(Xr||{});const mn={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}};class Im{static curveTo(t,e,s,r,n,a){const h=a[a.length-2],o=a[a.length-1]-e,l=h-t,u=r-e,c=s-t,d=Math.abs(o*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=o*o+l*l,p=u*u+c*c,m=o*u+l*c,g=n*Math.sqrt(f)/d,_=n*Math.sqrt(p)/d,x=g*m/f,y=_*m/p,v=g*c+_*l,b=g*u+_*o,w=l*(_+x),E=o*(_+x),T=c*(g+y),A=u*(g+y),I=Math.atan2(E-b,w-v),M=Math.atan2(A-b,T-v);return{cx:v+t,cy:b+e,radius:n,startAngle:I,endAngle:M,anticlockwise:l*u>c*o}}static arc(t,e,s,r,n,a,h,o,l){const u=h-a,c=mn._segmentsCount(Math.abs(u)*n,Math.ceil(Math.abs(u)/ha)*40),d=u/(c*2),f=d*2,p=Math.cos(d),m=Math.sin(d),g=c-1,_=g%1/g;for(let x=0;x<=g;++x){const y=x+_*x,v=d+a+f*y,b=Math.cos(v),w=-Math.sin(v);l.push((p*b+m*w)*n+s,(p*-w+m*b)*n+r)}}}class wT{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 oc{static curveLength(t,e,s,r,n,a,h,o){let l=0,u=0,c=0,d=0,f=0,p=0,m=0,g=0,_=0,x=0,y=0,v=t,b=e;for(let w=1;w<=10;++w)u=w/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*h,_=m*e+3*p*u*r+3*f*c*a+d*o,x=v-g,y=b-_,v=g,b=_,l+=Math.sqrt(x*x+y*y);return l}static curveTo(t,e,s,r,n,a,h){const o=h[h.length-2],l=h[h.length-1];h.length-=2;const u=mn._segmentsCount(oc.curveLength(o,l,t,e,s,r,n,a));let c=0,d=0,f=0,p=0,m=0;h.push(o,l);for(let g=1,_=0;g<=u;++g)_=g/u,c=1-_,d=c*c,f=d*c,p=_*_,m=p*_,h.push(f*o+3*d*_*t+3*c*p*s+m*n,f*l+3*d*_*e+3*c*p*r+m*a)}}function Pm(i,t,e,s,r,n,a,h){const o=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=o+d,m=l+f,g=u+d,_=c+f;return h.push(p,m,g,_),2}function Ci(i,t,e,s,r,n,a,h){const o=e-i,l=s-t;let u=Math.atan2(o,l),c=Math.atan2(r-i,n-t);h&&u<c?u+=Math.PI*2:!h&&u>c&&(c+=Math.PI*2);let d=u;const f=c-u,p=Math.abs(f),m=Math.sqrt(o*o+l*l),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,_=f/g;if(d+=_,h){a.push(i,t,e,s);for(let x=1,y=d;x<g;x++,y+=_)a.push(i,t,i+Math.sin(y)*m,t+Math.cos(y)*m);a.push(i,t,r,n)}else{a.push(e,s,i,t);for(let x=1,y=d;x<g;x++,y+=_)a.push(i+Math.sin(y)*m,t+Math.cos(y)*m,i,t);a.push(r,n,i,t)}return g*2}function ET(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 st(s[0],s[1]),h=new st(s[s.length-2],s[s.length-1]),o=e.type!==xe.POLY||e.closeStroke,l=Math.abs(a.x-h.x)<r&&Math.abs(a.y-h.y)<r;if(o){s=s.slice(),l&&(s.pop(),s.pop(),h.set(s[s.length-2],s[s.length-1]));const V=(a.x+h.x)*.5,L=(h.y+a.y)*.5;s.unshift(V,L),s.push(V,L)}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 _=s[0],x=s[1],y=s[2],v=s[3],b=0,w=0,E=-(x-v),T=_-y,A=0,I=0,M=Math.sqrt(E*E+T*T);E/=M,T/=M,E*=p,T*=p;const R=n.alignment,C=(1-R)*2,P=R*2;o||(n.cap===Xr.ROUND?d+=Ci(_-E*(C-P)*.5,x-T*(C-P)*.5,_-E*C,x-T*C,_+E*P,x+T*P,u,!0)+2:n.cap===Xr.SQUARE&&(d+=Pm(_,x,E,T,C,P,!0,u))),u.push(_-E*C,x-T*C,_+E*P,x+T*P);for(let V=1;V<c-1;++V){_=s[(V-1)*2],x=s[(V-1)*2+1],y=s[V*2],v=s[V*2+1],b=s[(V+1)*2],w=s[(V+1)*2+1],E=-(x-v),T=_-y,M=Math.sqrt(E*E+T*T),E/=M,T/=M,E*=p,T*=p,A=-(v-w),I=y-b,M=Math.sqrt(A*A+I*I),A/=M,I/=M,A*=p,I*=p;const L=y-_,$=x-v,O=y-b,N=w-v,Z=L*O+$*N,Q=$*O-N*L,H=Q<0;if(Math.abs(Q)<.001*Math.abs(Z)){u.push(y-E*C,v-T*C,y+E*P,v+T*P),Z>=0&&(n.join===ls.ROUND?d+=Ci(y,v,y-E*C,v-T*C,y-A*C,v-I*C,u,!1)+4:d+=2,u.push(y-A*P,v-I*P,y+A*C,v+I*C));continue}const lt=(-E+_)*(-T+v)-(-E+y)*(-T+x),Tt=(-A+b)*(-I+v)-(-A+y)*(-I+w),_t=(L*Tt-O*lt)/Q,kt=(N*lt-$*Tt)/Q,zt=(_t-y)*(_t-y)+(kt-v)*(kt-v),Qt=y+(_t-y)*C,Pt=v+(kt-v)*C,jt=y-(_t-y)*P,Ot=v-(kt-v)*P,ze=Math.min(L*L+$*$,O*O+N*N),is=H?C:P,li=ze+is*is*m,kn=zt<=li;let hi=n.join;if(hi===ls.MITER&&zt/m>g&&(hi=ls.BEVEL),kn)switch(hi){case ls.MITER:{u.push(Qt,Pt,jt,Ot);break}case ls.BEVEL:{H?u.push(Qt,Pt,y+E*P,v+T*P,Qt,Pt,y+A*P,v+I*P):u.push(y-E*C,v-T*C,jt,Ot,y-A*C,v-I*C,jt,Ot),d+=2;break}case ls.ROUND:{H?(u.push(Qt,Pt,y+E*P,v+T*P),d+=Ci(y,v,y+E*P,v+T*P,y+A*P,v+I*P,u,!0)+4,u.push(Qt,Pt,y+A*P,v+I*P)):(u.push(y-E*C,v-T*C,jt,Ot),d+=Ci(y,v,y-E*C,v-T*C,y-A*C,v-I*C,u,!1)+4,u.push(y-A*C,v-I*C,jt,Ot));break}}else{switch(u.push(y-E*C,v-T*C,y+E*P,v+T*P),hi){case ls.MITER:{H?u.push(jt,Ot,jt,Ot):u.push(Qt,Pt,Qt,Pt),d+=2;break}case ls.ROUND:{H?d+=Ci(y,v,y+E*P,v+T*P,y+A*P,v+I*P,u,!0)+2:d+=Ci(y,v,y-E*C,v-T*C,y-A*C,v-I*C,u,!1)+2;break}}u.push(y-A*C,v-I*C,y+A*P,v+I*P),d+=2}}_=s[(c-2)*2],x=s[(c-2)*2+1],y=s[(c-1)*2],v=s[(c-1)*2+1],E=-(x-v),T=_-y,M=Math.sqrt(E*E+T*T),E/=M,T/=M,E*=p,T*=p,u.push(y-E*C,v-T*C,y+E*P,v+T*P),o||(n.cap===Xr.ROUND?d+=Ci(y-E*(C-P)*.5,v-T*(C-P)*.5,y-E*C,v-T*C,y+E*P,v+T*P,u,!1)+2:n.cap===Xr.SQUARE&&(d+=Pm(y,v,E,T,C,P,!1,u)));const k=t.indices,U=mn.epsilon*mn.epsilon;for(let V=f;V<d+f-2;++V)_=u[V*2],x=u[V*2+1],y=u[(V+1)*2],v=u[(V+1)*2+1],b=u[(V+2)*2],w=u[(V+2)*2+1],!(Math.abs(_*(v-w)+y*(w-x)+b*(x-v))<U)&&k.push(V,V+1,V+2)}function TT(i,t){let e=0;const s=i.shape,r=i.points||s.points,n=s.type!==xe.POLY||s.closeStroke;if(r.length===0)return;const a=t.points,h=t.indices,o=r.length/2,l=a.length/2;let u=l;for(a.push(r[0],r[1]),e=1;e<o;e++)a.push(r[e*2],r[e*2+1]),h.push(u,u+1),u++;n&&h.push(u,l)}function Rm(i,t){i.lineStyle.native?TT(i,t):ET(i,t)}class ac{static curveLength(t,e,s,r,n,a){const h=t-2*s+n,o=e-2*r+a,l=2*s-2*t,u=2*r-2*e,c=4*(h*h+o*o),d=4*(h*l+o*u),f=l*l+u*u,p=2*Math.sqrt(c+d+f),m=Math.sqrt(c),g=2*c*m,_=2*Math.sqrt(f),x=d/m;return(g*p+m*d*(p-_)+(4*f*c-d*d)*Math.log((2*m+x+p)/(x+_)))/(4*g)}static curveTo(t,e,s,r,n){const a=n[n.length-2],h=n[n.length-1],o=mn._segmentsCount(ac.curveLength(a,h,t,e,s,r));let l=0,u=0;for(let c=1;c<=o;++c){const d=c/o;l=a+(t-a)*d,u=h+(e-h)*d,n.push(l+(t+(s-t)*d-l)*d,u+(e+(r-e)*d-u)*d)}}}const lc={[xe.POLY]:Cm,[xe.CIRC]:Na,[xe.ELIP]:Na,[xe.RECT]:vT,[xe.RREC]:bT},Mm=[],Va=[];class Ua{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 Ua(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 gn=new st,Fm=class Q0 extends cp{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 Ia,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(),Va.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),Mm.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 Ua(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 Ua(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,gn):gn.copyFrom(t),r.shape.contains(gn.x,gn.y))){let n=!1;if(r.holes){for(let a=0;a<r.holes.length;a++)if(r.holes[a].shape.contains(gn.x,gn.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 o=this.shapeIndex;o<e.length;o++){this.shapeIndex++;const l=e[o],u=l.fillStyle,c=l.lineStyle;lc[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=Fr.REPEAT,d===0?this.processFill(l):this.processLine(l);const _=this.points.length/2-g;_!==0&&(s&&!this._compareStyles(r,f)&&(s.end(m,g),s=null),s||(s=Mm.pop()||new wT,s.begin(f,m,g),this.batches.push(s),r=f),this.addUvs(this.points,t,f.texture,g,_,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 h=a>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&h===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=h?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<Q0.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++et._globalBatch;for(let c=0;c<this.drawCalls.length;c++)this.drawCalls[c].texArray.clear(),Va.push(this.drawCalls[c]);this.drawCalls.length=0;const e=this.colors,s=this.textureIds;let r=Va.pop();r||(r=new Fh,r.texArray=new Nh),r.texArray.count=0,r.start=0,r.size=0,r.type=xs.TRIANGLES;let n=0,a=null,h=0,o=!1,l=xs.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;o!==!!p.native&&(o=!!p.native,l=o?xs.LINES:xs.TRIANGLES,a=null,n=f,t++),a!==m&&(a=m,m._batchEnabled!==t&&(n===f&&(t++,n=0,r.size>0&&(r=Va.pop(),r||(r=new Fh,r.texArray=new Nh),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=Fr.REPEAT,r.texArray.elements[r.texArray.count++]=m,n++)),r.size+=d.size,u+=d.size,h=m._batchLocation,this.addColors(e,p.color,p.alpha,d.attribSize,d.attribStart),this.addTextureIds(s,h,d.attribSize,d.attribStart)}et._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),h=new Uint32Array(n);let o=0;for(let l=0;l<t.length/2;l++)a[o++]=t[l*2],a[o++]=t[l*2+1],a[o++]=e[l*2],a[o++]=e[l*2+1],h[o++]=s[l],a[o++]=r[l];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?Cm.triangulate(t,this):lc[t.type].triangulate(t,this)}processLine(t){Rm(t,this);for(let e=0;e<t.holes.length;e++)Rm(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const s=t[e];lc[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=Ct.shared.setValue(e).toLittleEndianNumber(),h=Ct.shared.setValue(a).toPremultiplied(s);t.length=Math.max(t.length,n+r);for(let o=0;o<r;o++)t[n+o]=h}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 h=0;const o=e.length,l=s.frame;for(;h<n;){let c=t[(r+h)*2],d=t[(r+h)*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}h++,e.push(c/l.width,d/l.height)}const u=s.baseTexture;(l.width<u.width||l.height<u.height)&&this.adjustUvs(e,s,o,n)}adjustUvs(t,e,s,r){const n=e.baseTexture,a=1e-6,h=s+r*2,o=e.frame,l=o.width/n.width,u=o.height/n.height;let c=o.x/o.width,d=o.y/o.height,f=Math.floor(t[s]+a),p=Math.floor(t[s+1]+a);for(let m=s+2;m<h;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<h;m+=2)t[m]=(t[m]+c)*l,t[m+1]=(t[m+1]+d)*u}};Fm.BATCHABLE_SIZE=100;let AT=Fm;class Ga{constructor(){this.color=16777215,this.alpha=1,this.texture=q.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new Ga;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=q.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class hc extends Ga{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=Xr.BUTT,this.join=ls.MITER,this.miterLimit=10}clone(){const t=new hc;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=Xr.BUTT,this.join=ls.MITER,this.miterLimit=10}}const cc={},uc=class Sl extends Bt{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 Ga,this._lineStyle=new hc,this._matrix=null,this._holeMode=!1,this.state=js.for2d(),this._geometry=t||new AT,this._geometry.refCount++,this._transformID=-1,this._tintColor=new Ct(16777215),this.blendMode=W.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new Sl(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:q.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:Xr.BUTT,join:ls.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 Nr,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Nr,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),ac.curveTo(t,e,s,r,n),this}bezierCurveTo(t,e,s,r,n,a){return this._initCurve(),oc.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,h=Im.curveTo(t,e,s,r,n,a);if(h){const{cx:o,cy:l,radius:u,startAngle:c,endAngle:d,anticlockwise:f}=h;this.arc(o,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+=ha:a&&r<=n&&(r+=ha),n-r===0)return this;const h=t+Math.cos(r)*s,o=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]-h),d=Math.abs(u[u.length-1]-o);c<l&&d<l||u.push(h,o)}else this.moveTo(h,o),u=this.currentPath.points;return Im.arc(h,o,t,e,s,r,n,a,u),this}beginFill(t=0,e){return this.beginTextureFill({texture:q.WHITE,color:t,alpha:e})}normalizeColor(t){const e=Ct.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:q.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 rt(t,e,s,r))}drawRoundedRect(t,e,s,r,n){return this.drawShape(new fa(t,e,s,r,n))}drawCircle(t,e,s){return this.drawShape(new ua(t,e,s))}drawEllipse(t,e,s,r){return this.drawShape(new da(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 Nr(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===xe.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,h=new Float32Array(this.vertexData.buffer,n.attribStart*4*2,n.attribSize*2),o=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:h,blendMode:e,indices:l,uvs:o,_batchRGB:Ct.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,Ct.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 h=0,o=a.length;h<o;h++)this._renderDrawCallDirect(t,s.drawCalls[h])}_renderDrawCallDirect(t,e){const{texArray:s,type:r,size:n,start:a}=e,h=s.count;for(let o=0;o<h;o++)t.texture.bind(s.elements[o],o);t.geometry.draw(r,n,a)}_resolveDirectShader(t){let e=this.shader;const s=this.pluginName;if(!e){if(!cc[s]){const{maxTextures:r}=t.plugins[s],n=new Int32Array(r);for(let o=0;o<r;o++)n[o]=o;const a={tint:new Float32Array([1,1,1,1]),translationMatrix:new Rt,default:Es.from({uSamplers:n},!0)},h=t.plugins[s]._shader.program;cc[s]=new Zs(h,a)}e=cc[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,Sl._TEMP_POINT),this._geometry.containsPoint(Sl._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=Ct.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,h=e.tx,o=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+h,u[c++]=a*p+r*f+o}}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)}};uc.curves=mn,uc._TEMP_POINT=new st;let hs=uc;class ST{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 dc=new st,km=new Nr,Bm=class J0 extends Bt{constructor(t,e,s,r=xs.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=s||js.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=z.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===xs.TRIANGLES&&e.length<J0.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,h=r.c,o=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+h*p+l,c[d*2+1]=a*f+o*p+u}if(this._roundPixels){const d=z.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 ST(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,dc);const e=this.geometry.getBuffer("aVertexPosition").data,s=km.points,r=this.geometry.getIndex().data,n=r.length,a=this.drawMode===4?3:1;for(let h=0;h+2<n;h+=a){const o=r[h]*2,l=r[h+1]*2,u=r[h+2]*2;if(s[0]=e[o],s[1]=e[o+1],s[2]=e[l],s[3]=e[l+1],s[4]=e[u],s[5]=e[u+1],km.contains(dc.x,dc.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}};Bm.BATCHABLE_SIZE=100;let Xa=Bm;class fc extends Lr{constructor(t,e,s){super();const r=new Jt(t),n=new Jt(e,!0),a=new Jt(s,!0,!0);this.addAttribute("aVertexPosition",r,2,!1,tt.FLOAT).addAttribute("aTextureCoord",n,2,!1,tt.FLOAT).addIndex(a),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var CT=`varying vec2 vTextureCoord;
912
912
  uniform vec4 uColor;
913
913
 
914
914
  uniform sampler2D uSampler;
@@ -917,7 +917,7 @@ void main(void)
917
917
  {
918
918
  gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;
919
919
  }
920
- `,ST=`attribute vec2 aVertexPosition;
920
+ `,IT=`attribute vec2 aVertexPosition;
921
921
  attribute vec2 aTextureCoord;
922
922
 
923
923
  uniform mat3 projectionMatrix;
@@ -932,7 +932,7 @@ void main(void)
932
932
 
933
933
  vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
934
934
  }
935
- `;class $a extends Zs{constructor(t,e){const s={uSampler:t,alpha:1,uTextureMatrix:Rt.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||yr.from(ST,AT),s),this._colorDirty=!1,this.uvMatrix=new Op(t),this.batchable=e.program===void 0,this.pluginName=e.pluginName,this._tintColor=new Ct(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;Ct.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class CT extends gc{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,h=this.width/n,o=this.height/a;for(let u=0;u<t;u++){const c=u%this.segWidth,d=u/this.segWidth|0;e.push(c*h,d*o),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 IT extends Xa{constructor(t,e,s){const r=new CT(t.width,t.height,e,s),n=new $a(q.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 Ya=10;class PT extends IT{constructor(t,e,s,r,n){var a,h,o,l;super(q.WHITE,4,4),this._origWidth=t.orig.width,this._origHeight=t.orig.height,this._width=this._origWidth,this._height=this._origHeight,this._leftWidth=e??((a=t.defaultBorders)==null?void 0:a.left)??Ya,this._rightWidth=r??((h=t.defaultBorders)==null?void 0:h.right)??Ya,this._topHeight=s??((o=t.defaultBorders)==null?void 0:o.top)??Ya,this._bottomHeight=n??((l=t.defaultBorders)==null?void 0:l.bottom)??Ya,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 RT extends Xa{constructor(t=q.EMPTY,e,s,r,n){const a=new gc(e,s,r);a.getBuffer("aVertexPosition").static=!1;const h=new $a(t);super(a,h,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 MT extends Bt{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=W.NORMAL,this.autoResize=r,this.roundPixels=!0,this.baseTexture=null,this.setProperties(e),this._tintColor=new Ct(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 Um{constructor(t,e,s){this.geometry=new Lr,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||tt.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 Jt(qb(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(let a=0;a<this.dynamicProperties.length;++a){const h=this.dynamicProperties[a];h.offset=e,e+=h.size,this.dynamicStride+=h.size}const s=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(s),this.dynamicDataUint32=new Uint32Array(s),this.dynamicBuffer=new Jt(this.dynamicData,!1,!1);let r=0;this.staticStride=0;for(let a=0;a<this.staticProperties.length;++a){const h=this.staticProperties[a];h.offset=r,r+=h.size,this.staticStride+=h.size}const n=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(n),this.staticDataUint32=new Uint32Array(n),this.staticBuffer=new Jt(this.staticData,!0,!1);for(let a=0;a<this.dynamicProperties.length;++a){const h=this.dynamicProperties[a];t.addAttribute(h.attributeName,this.dynamicBuffer,0,h.type===tt.UNSIGNED_BYTE,h.type,this.dynamicStride*4,h.offset*4)}for(let a=0;a<this.staticProperties.length;++a){const h=this.staticProperties[a];t.addAttribute(h.attributeName,this.staticBuffer,0,h.type===tt.UNSIGNED_BYTE,h.type,this.staticStride*4,h.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===tt.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===tt.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 FT=`varying vec2 vTextureCoord;
935
+ `;class $a extends Zs{constructor(t,e){const s={uSampler:t,alpha:1,uTextureMatrix:Rt.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||yr.from(IT,CT),s),this._colorDirty=!1,this.uvMatrix=new Mp(t),this.batchable=e.program===void 0,this.pluginName=e.pluginName,this._tintColor=new Ct(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;Ct.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class PT extends fc{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,h=this.width/n,o=this.height/a;for(let u=0;u<t;u++){const c=u%this.segWidth,d=u/this.segWidth|0;e.push(c*h,d*o),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 RT extends Xa{constructor(t,e,s){const r=new PT(t.width,t.height,e,s),n=new $a(q.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 Ya=10;class MT extends RT{constructor(t,e,s,r,n){var a,h,o,l;super(q.WHITE,4,4),this._origWidth=t.orig.width,this._origHeight=t.orig.height,this._width=this._origWidth,this._height=this._origHeight,this._leftWidth=e??((a=t.defaultBorders)==null?void 0:a.left)??Ya,this._rightWidth=r??((h=t.defaultBorders)==null?void 0:h.right)??Ya,this._topHeight=s??((o=t.defaultBorders)==null?void 0:o.top)??Ya,this._bottomHeight=n??((l=t.defaultBorders)==null?void 0:l.bottom)??Ya,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 FT extends Xa{constructor(t=q.EMPTY,e,s,r,n){const a=new fc(e,s,r);a.getBuffer("aVertexPosition").static=!1;const h=new $a(t);super(a,h,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 kT extends Bt{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=W.NORMAL,this.autoResize=r,this.roundPixels=!0,this.baseTexture=null,this.setProperties(e),this._tintColor=new Ct(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 Dm{constructor(t,e,s){this.geometry=new Lr,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||tt.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 Jt(Kb(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(let a=0;a<this.dynamicProperties.length;++a){const h=this.dynamicProperties[a];h.offset=e,e+=h.size,this.dynamicStride+=h.size}const s=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(s),this.dynamicDataUint32=new Uint32Array(s),this.dynamicBuffer=new Jt(this.dynamicData,!1,!1);let r=0;this.staticStride=0;for(let a=0;a<this.staticProperties.length;++a){const h=this.staticProperties[a];h.offset=r,r+=h.size,this.staticStride+=h.size}const n=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(n),this.staticDataUint32=new Uint32Array(n),this.staticBuffer=new Jt(this.staticData,!0,!1);for(let a=0;a<this.dynamicProperties.length;++a){const h=this.dynamicProperties[a];t.addAttribute(h.attributeName,this.dynamicBuffer,0,h.type===tt.UNSIGNED_BYTE,h.type,this.dynamicStride*4,h.offset*4)}for(let a=0;a<this.staticProperties.length;++a){const h=this.staticProperties[a];t.addAttribute(h.attributeName,this.staticBuffer,0,h.type===tt.UNSIGNED_BYTE,h.type,this.staticStride*4,h.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===tt.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===tt.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 BT=`varying vec2 vTextureCoord;
936
936
  varying vec4 vColor;
937
937
 
938
938
  uniform sampler2D uSampler;
@@ -940,7 +940,7 @@ uniform sampler2D uSampler;
940
940
  void main(void){
941
941
  vec4 color = texture2D(uSampler, vTextureCoord) * vColor;
942
942
  gl_FragColor = color;
943
- }`,kT=`attribute vec2 aVertexPosition;
943
+ }`,DT=`attribute vec2 aVertexPosition;
944
944
  attribute vec2 aTextureCoord;
945
945
  attribute vec4 aColor;
946
946
 
@@ -965,8 +965,8 @@ void main(void){
965
965
  vTextureCoord = aTextureCoord;
966
966
  vColor = aColor * uColor;
967
967
  }
968
- `;class Gm extends xa{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new Rt,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:tt.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=Zs.from(kT,FT,{}),this.state=js.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 h=t._buffers;h||(h=t._buffers=this.generateBuffers(t));const o=e[0]._texture.baseTexture,l=o.alphaMode>0;this.state.blendMode=ip(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=Ct.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,l).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=o,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>=h.length&&h.push(this._generateOneMoreBuffer(t));const g=h[p];g.uploadDynamic(e,f,m);const _=t._bufferUpdateIDs[p]||0;d=d||g._updateID<_,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 Um(this.properties,n,r));return e}_generateOneMoreBuffer(t){const e=t._batchSize,s=t._properties;return new Um(this.properties,s,e)}uploadVertices(t,e,s,r,n,a){let h=0,o=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,_=f.orig;g?(o=g.x-d.anchor.x*_.width,h=o+g.width,u=g.y-d.anchor.y*_.height,l=u+g.height):(h=_.width*(1-d.anchor.x),o=_.width*-d.anchor.x,l=_.height*(1-d.anchor.y),u=_.height*-d.anchor.y),r[a]=o*p,r[a+1]=u*m,r[a+n]=h*p,r[a+n+1]=u*m,r[a+n*2]=h*p,r[a+n*2+1]=l*m,r[a+n*3]=o*p,r[a+n*3+1]=l*m,a+=n*4}}uploadPosition(t,e,s,r,n,a){for(let h=0;h<s;h++){const o=t[e+h].position;r[a]=o.x,r[a+1]=o.y,r[a+n]=o.x,r[a+n+1]=o.y,r[a+n*2]=o.x,r[a+n*2+1]=o.y,r[a+n*3]=o.x,r[a+n*3+1]=o.y,a+=n*4}}uploadRotation(t,e,s,r,n,a){for(let h=0;h<s;h++){const o=t[e+h].rotation;r[a]=o,r[a+n]=o,r[a+n*2]=o,r[a+n*3]=o,a+=n*4}}uploadUvs(t,e,s,r,n,a){for(let h=0;h<s;++h){const o=t[e+h]._texture._uvs;o?(r[a]=o.x0,r[a+1]=o.y0,r[a+n]=o.x1,r[a+n+1]=o.y1,r[a+n*2]=o.x2,r[a+n*2+1]=o.y2,r[a+n*3]=o.x3,r[a+n*3+1]=o.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 h=0;h<s;++h){const o=t[e+h],l=Ct.shared.setValue(o._tintRGB).toPremultiplied(o.alpha,o.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}}Gm.extension={name:"particle",type:Y.RendererPlugin},K.add(Gm);var Ha=(i=>(i[i.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",i[i.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",i))(Ha||{});const Wa={willReadFrequently:!0},Qs=class J{static get experimentalLetterSpacingSupported(){let t=J._experimentalLetterSpacingSupported;if(t!==void 0){const e=z.ADAPTER.getCanvasRenderingContext2D().prototype;t=J._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,s,r,n,a,h,o,l){this.text=t,this.style=e,this.width=s,this.height=r,this.lines=n,this.lineWidths=a,this.lineHeight=h,this.maxLineWidth=o,this.fontProperties=l}static measureText(t,e,s,r=J._canvas){s=s??e.wordWrap;const n=e.toFontString(),a=J.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);const h=r.getContext("2d",Wa);h.font=n;const o=(s?J.wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),l=new Array(o.length);let u=0;for(let p=0;p<o.length;p++){const m=J._measureText(o[p],e.letterSpacing,h);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+(o.length-1)*(d+e.leading);return e.dropShadow&&(f+=e.dropShadowDistance),new J(t,e,c,f,o,l,d+e.leading,u,a)}static _measureText(t,e,s){let r=!1;J.experimentalLetterSpacingSupported&&(J.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+=(J.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,s=J._canvas){const r=s.getContext("2d",Wa);let n=0,a="",h="";const o=Object.create(null),{letterSpacing:l,whiteSpace:u}=e,c=J.collapseSpaces(u),d=J.collapseNewlines(u);let f=!c;const p=e.wordWrapWidth+l,m=J.tokenize(t);for(let g=0;g<m.length;g++){let _=m[g];if(J.isNewline(_)){if(!d){h+=J.addLine(a),f=!c,a="",n=0;continue}_=" "}if(c){const y=J.isBreakingSpace(_),v=J.isBreakingSpace(a[a.length-1]);if(y&&v)continue}const x=J.getFromCache(_,l,o,r);if(x>p)if(a!==""&&(h+=J.addLine(a),a="",n=0),J.canBreakWords(_,e.breakWords)){const y=J.wordWrapSplit(_);for(let v=0;v<y.length;v++){let b=y[v],w=b,E=1;for(;y[v+E];){const A=y[v+E];if(!J.canBreakChars(w,A,_,v,e.breakWords))b+=A;else break;w=A,E++}v+=E-1;const T=J.getFromCache(b,l,o,r);T+n>p&&(h+=J.addLine(a),f=!1,a="",n=0),a+=b,n+=T}}else{a.length>0&&(h+=J.addLine(a),a="",n=0);const y=g===m.length-1;h+=J.addLine(_,!y),f=!1,a="",n=0}else x+n>p&&(f=!1,h+=J.addLine(a),a="",n=0),(a.length>0||!J.isBreakingSpace(_)||f)&&(a+=_,n+=x)}return h+=J.addLine(a,!1),h}static addLine(t,e=!0){return t=J.trimRight(t),t=e?`${t}
969
- `:t,t}static getFromCache(t,e,s,r){let n=s[t];return typeof n!="number"&&(n=J._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(!J.isBreakingSpace(s))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:J._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:J._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(J.isBreakingSpace(n,a)||J.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 J.graphemeSegmenter(t)}static measureFont(t){if(J._fonts[t])return J._fonts[t];const e={ascent:0,descent:0,fontSize:0},s=J._canvas,r=J._context;r.font=t;const n=J.METRICS_STRING+J.BASELINE_SYMBOL,a=Math.ceil(r.measureText(n).width);let h=Math.ceil(r.measureText(J.BASELINE_SYMBOL).width);const o=Math.ceil(J.HEIGHT_MULTIPLIER*h);if(h=h*J.BASELINE_MULTIPLIER|0,a===0||o===0)return J._fonts[t]=e,e;s.width=a,s.height=o,r.fillStyle="#f00",r.fillRect(0,0,a,o),r.font=t,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(n,0,h);const l=r.getImageData(0,0,a,o).data,u=l.length,c=a*4;let d=0,f=0,p=!1;for(d=0;d<h;++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=h-d,f=u-c,p=!1,d=o;d>h;--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-h,e.fontSize=e.ascent+e.descent,J._fonts[t]=e,e}static clearMetrics(t=""){t?delete J._fonts[t]:J._fonts={}}static get _canvas(){var t;if(!J.__canvas){let e;try{const s=new OffscreenCanvas(0,0);if((t=s.getContext("2d",Wa))!=null&&t.measureText)return J.__canvas=s,s;e=z.ADAPTER.createCanvas()}catch{e=z.ADAPTER.createCanvas()}e.width=e.height=10,J.__canvas=e}return J.__canvas}static get _context(){return J.__context||(J.__context=J._canvas.getContext("2d",Wa)),J.__context}};Qs.METRICS_STRING="|ÉqÅ",Qs.BASELINE_SYMBOL="M",Qs.BASELINE_MULTIPLIER=1.4,Qs.HEIGHT_MULTIPLIER=2,Qs.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]})(),Qs.experimentalLetterSpacing=!1,Qs._fonts={},Qs._newlines=[10,13],Qs._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let $r=Qs;const BT=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Xm=class No{constructor(t){this.styleID=0,this.reset(),yc(this,t,t)}clone(){const t={};return yc(t,this,No.defaultStyle),new No(t)}reset(){yc(this,No.defaultStyle,No.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=_c(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=_c(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){DT(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=_c(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)&&!BT.includes(r)&&(r=`"${r}"`),e[s]=r}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};Xm.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Ha.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 vr=Xm;function _c(i){const t=Ct.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 DT(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 yc(i,t,e){for(const s in e)Array.isArray(t[s])?i[s]=t[s].slice():i[s]=t[s]}const OT={texture:!0,children:!1,baseTexture:!0},$m=class bd extends qe{constructor(t,e,s){let r=!1;s||(s=z.ADAPTER.createCanvas(),r=!0),s.width=3,s.height=3;const n=q.from(s);n.orig=new rt,n.trim=new rt,super(n),this._ownCanvas=r,this.canvas=s,this.context=s.getContext("2d",{willReadFrequently:!0}),this._resolution=bd.defaultResolution??z.RESOLUTION,this._autoResolution=bd.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 $r.experimentalLetterSpacing}static set experimentalLetterSpacing(t){ot("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),$r.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=$r.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=r.width,a=r.height,h=r.lines,o=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,_=g?Math.ceil(Math.max(1,a)+e.padding*2):0,x=_*this._resolution;if(g){s.fillStyle="black",s.strokeStyle="black";const v=e.dropShadowColor,b=e.dropShadowBlur*this._resolution,w=e.dropShadowDistance*this._resolution;s.shadowColor=Ct.shared.setValue(v).setAlpha(e.dropShadowAlpha).toRgbaString(),s.shadowBlur=b,s.shadowOffsetX=Math.cos(e.dropShadowAngle)*w,s.shadowOffsetY=Math.sin(e.dropShadowAngle)*w+x}else s.fillStyle=this._generateFillStyle(e,h,r),s.strokeStyle=e.stroke,s.shadowColor="black",s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0;let y=(o-c.fontSize)/2;o-c.fontSize<0&&(y=0);for(let v=0;v<h.length;v++)d=e.strokeThickness/2,f=e.strokeThickness/2+v*o+c.ascent+y,e.align==="right"?d+=u-l[v]:e.align==="center"&&(d+=(u-l[v])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(h[v],d+e.padding,f+e.padding-_,!0),e.fill&&this.drawLetterSpacing(h[v],d+e.padding,f+e.padding-_)}this.updateTexture()}drawLetterSpacing(t,e,s,r=!1){const n=this._style.letterSpacing;let a=!1;if($r.experimentalLetterSpacingSupported&&($r.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 h=e;const o=$r.graphemeSegmenter(t);let l=this.context.measureText(t).width,u=0;for(let c=0;c<o.length;++c){const d=o[c];r?this.context.strokeText(d,h,s):this.context.fillText(d,h,s);let f="";for(let p=c+1;p<o.length;++p)f+=o[p];u=this.context.measureText(f).width,h+=l-u+n,l=u}}updateTexture(){const t=this.canvas;if(this._style.trim){const a=Jb(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,h=t.padding||0,o=this.canvas.width/this._resolution-a-h*2,l=this.canvas.height/this._resolution-a-h*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===Ha.LINEAR_VERTICAL){n=this.context.createLinearGradient(o/2,h,o/2,l+h);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 _=m+d,x=s.lineHeight*(f+1);let y=_;f+1<e.length&&x<_&&(y=(_+x)/2);const v=(y-g)/l;for(let b=0;b<u.length;b++){let w=0;typeof c[b]=="number"?w=c[b]:w=b/u.length;let E=Math.min(1,Math.max(0,g/l+w*v));E=Number(E.toFixed(5)),n.addColorStop(E,u[b])}}}else{n=this.context.createLinearGradient(h,l/2,o+h,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({},OT,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=Dr(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=Dr(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 vr?this._style=t:this._style=new vr(t),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(t){t=String(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)}};$m.defaultAutoResolution=!0;let za=$m;class LT{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function NT(i,t){var s;let e=!1;if((s=i==null?void 0:i._textures)!=null&&s.length){for(let r=0;r<i._textures.length;r++)if(i._textures[r]instanceof q){const n=i._textures[r].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function VT(i,t){if(i.baseTexture instanceof et){const e=i.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function UT(i,t){if(i._texture&&i._texture instanceof q){const e=i._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function GT(i,t){return t instanceof za?(t.updateText(!0),!0):!1}function XT(i,t){if(t instanceof vr){const e=t.toFontString();return $r.measureFont(e),!0}return!1}function $T(i,t){if(i instanceof za){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 YT(i,t){return i instanceof vr?(t.includes(i)||t.push(i),!0):!1}const Ym=class ny{constructor(t){this.limiter=new LT(ny.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($T),this.registerFindHook(YT),this.registerFindHook(NT),this.registerFindHook(VT),this.registerFindHook(UT),this.registerUploadHook(GT),this.registerUploadHook(XT)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,wt.system.addOnce(this.tick,this,Vr.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)wt.system.addOnce(this.tick,this,Vr.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 Bt)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&wt.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}};Ym.uploadsPerFrame=4;let xc=Ym;Object.defineProperties(z,{UPLOADS_PER_FRAME:{get(){return xc.uploadsPerFrame},set(i){ot("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),xc.uploadsPerFrame=i}}});function Hm(i,t){return t instanceof et?(t._glTextures[i.CONTEXT_UID]||i.texture.bind(t),!0):!1}function HT(i,t){if(!(t instanceof hs))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&&Hm(i,n.baseTexture)}return e.batchable||i.geometry.bind(e,t._resolveDirectShader(i)),!0}function WT(i,t){return i instanceof hs?(t.push(i),!0):!1}class Wm extends xc{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(WT),this.registerUploadHook(Hm),this.registerUploadHook(HT)}}Wm.extension={name:"prepare",type:Y.RendererSystem},K.add(Wm);var zT=`#version 300 es
968
+ `;class Om extends xa{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new Rt,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:tt.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=Zs.from(DT,BT,{}),this.state=js.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 h=t._buffers;h||(h=t._buffers=this.generateBuffers(t));const o=e[0]._texture.baseTexture,l=o.alphaMode>0;this.state.blendMode=Jf(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=Ct.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,l).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=o,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>=h.length&&h.push(this._generateOneMoreBuffer(t));const g=h[p];g.uploadDynamic(e,f,m);const _=t._bufferUpdateIDs[p]||0;d=d||g._updateID<_,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 Dm(this.properties,n,r));return e}_generateOneMoreBuffer(t){const e=t._batchSize,s=t._properties;return new Dm(this.properties,s,e)}uploadVertices(t,e,s,r,n,a){let h=0,o=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,_=f.orig;g?(o=g.x-d.anchor.x*_.width,h=o+g.width,u=g.y-d.anchor.y*_.height,l=u+g.height):(h=_.width*(1-d.anchor.x),o=_.width*-d.anchor.x,l=_.height*(1-d.anchor.y),u=_.height*-d.anchor.y),r[a]=o*p,r[a+1]=u*m,r[a+n]=h*p,r[a+n+1]=u*m,r[a+n*2]=h*p,r[a+n*2+1]=l*m,r[a+n*3]=o*p,r[a+n*3+1]=l*m,a+=n*4}}uploadPosition(t,e,s,r,n,a){for(let h=0;h<s;h++){const o=t[e+h].position;r[a]=o.x,r[a+1]=o.y,r[a+n]=o.x,r[a+n+1]=o.y,r[a+n*2]=o.x,r[a+n*2+1]=o.y,r[a+n*3]=o.x,r[a+n*3+1]=o.y,a+=n*4}}uploadRotation(t,e,s,r,n,a){for(let h=0;h<s;h++){const o=t[e+h].rotation;r[a]=o,r[a+n]=o,r[a+n*2]=o,r[a+n*3]=o,a+=n*4}}uploadUvs(t,e,s,r,n,a){for(let h=0;h<s;++h){const o=t[e+h]._texture._uvs;o?(r[a]=o.x0,r[a+1]=o.y0,r[a+n]=o.x1,r[a+n+1]=o.y1,r[a+n*2]=o.x2,r[a+n*2+1]=o.y2,r[a+n*3]=o.x3,r[a+n*3+1]=o.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 h=0;h<s;++h){const o=t[e+h],l=Ct.shared.setValue(o._tintRGB).toPremultiplied(o.alpha,o.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}}Om.extension={name:"particle",type:Y.RendererPlugin},K.add(Om);var Ha=(i=>(i[i.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",i[i.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",i))(Ha||{});const Wa={willReadFrequently:!0},Qs=class J{static get experimentalLetterSpacingSupported(){let t=J._experimentalLetterSpacingSupported;if(t!==void 0){const e=z.ADAPTER.getCanvasRenderingContext2D().prototype;t=J._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,s,r,n,a,h,o,l){this.text=t,this.style=e,this.width=s,this.height=r,this.lines=n,this.lineWidths=a,this.lineHeight=h,this.maxLineWidth=o,this.fontProperties=l}static measureText(t,e,s,r=J._canvas){s=s??e.wordWrap;const n=e.toFontString(),a=J.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);const h=r.getContext("2d",Wa);h.font=n;const o=(s?J.wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),l=new Array(o.length);let u=0;for(let p=0;p<o.length;p++){const m=J._measureText(o[p],e.letterSpacing,h);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+(o.length-1)*(d+e.leading);return e.dropShadow&&(f+=e.dropShadowDistance),new J(t,e,c,f,o,l,d+e.leading,u,a)}static _measureText(t,e,s){let r=!1;J.experimentalLetterSpacingSupported&&(J.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+=(J.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,s=J._canvas){const r=s.getContext("2d",Wa);let n=0,a="",h="";const o=Object.create(null),{letterSpacing:l,whiteSpace:u}=e,c=J.collapseSpaces(u),d=J.collapseNewlines(u);let f=!c;const p=e.wordWrapWidth+l,m=J.tokenize(t);for(let g=0;g<m.length;g++){let _=m[g];if(J.isNewline(_)){if(!d){h+=J.addLine(a),f=!c,a="",n=0;continue}_=" "}if(c){const y=J.isBreakingSpace(_),v=J.isBreakingSpace(a[a.length-1]);if(y&&v)continue}const x=J.getFromCache(_,l,o,r);if(x>p)if(a!==""&&(h+=J.addLine(a),a="",n=0),J.canBreakWords(_,e.breakWords)){const y=J.wordWrapSplit(_);for(let v=0;v<y.length;v++){let b=y[v],w=b,E=1;for(;y[v+E];){const A=y[v+E];if(!J.canBreakChars(w,A,_,v,e.breakWords))b+=A;else break;w=A,E++}v+=E-1;const T=J.getFromCache(b,l,o,r);T+n>p&&(h+=J.addLine(a),f=!1,a="",n=0),a+=b,n+=T}}else{a.length>0&&(h+=J.addLine(a),a="",n=0);const y=g===m.length-1;h+=J.addLine(_,!y),f=!1,a="",n=0}else x+n>p&&(f=!1,h+=J.addLine(a),a="",n=0),(a.length>0||!J.isBreakingSpace(_)||f)&&(a+=_,n+=x)}return h+=J.addLine(a,!1),h}static addLine(t,e=!0){return t=J.trimRight(t),t=e?`${t}
969
+ `:t,t}static getFromCache(t,e,s,r){let n=s[t];return typeof n!="number"&&(n=J._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(!J.isBreakingSpace(s))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:J._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:J._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(J.isBreakingSpace(n,a)||J.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 J.graphemeSegmenter(t)}static measureFont(t){if(J._fonts[t])return J._fonts[t];const e={ascent:0,descent:0,fontSize:0},s=J._canvas,r=J._context;r.font=t;const n=J.METRICS_STRING+J.BASELINE_SYMBOL,a=Math.ceil(r.measureText(n).width);let h=Math.ceil(r.measureText(J.BASELINE_SYMBOL).width);const o=Math.ceil(J.HEIGHT_MULTIPLIER*h);if(h=h*J.BASELINE_MULTIPLIER|0,a===0||o===0)return J._fonts[t]=e,e;s.width=a,s.height=o,r.fillStyle="#f00",r.fillRect(0,0,a,o),r.font=t,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(n,0,h);const l=r.getImageData(0,0,a,o).data,u=l.length,c=a*4;let d=0,f=0,p=!1;for(d=0;d<h;++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=h-d,f=u-c,p=!1,d=o;d>h;--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-h,e.fontSize=e.ascent+e.descent,J._fonts[t]=e,e}static clearMetrics(t=""){t?delete J._fonts[t]:J._fonts={}}static get _canvas(){var t;if(!J.__canvas){let e;try{const s=new OffscreenCanvas(0,0);if((t=s.getContext("2d",Wa))!=null&&t.measureText)return J.__canvas=s,s;e=z.ADAPTER.createCanvas()}catch{e=z.ADAPTER.createCanvas()}e.width=e.height=10,J.__canvas=e}return J.__canvas}static get _context(){return J.__context||(J.__context=J._canvas.getContext("2d",Wa)),J.__context}};Qs.METRICS_STRING="|ÉqÅ",Qs.BASELINE_SYMBOL="M",Qs.BASELINE_MULTIPLIER=1.4,Qs.HEIGHT_MULTIPLIER=2,Qs.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]})(),Qs.experimentalLetterSpacing=!1,Qs._fonts={},Qs._newlines=[10,13],Qs._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let $r=Qs;const OT=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Lm=class No{constructor(t){this.styleID=0,this.reset(),mc(this,t,t)}clone(){const t={};return mc(t,this,No.defaultStyle),new No(t)}reset(){mc(this,No.defaultStyle,No.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=pc(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=pc(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){LT(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=pc(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)&&!OT.includes(r)&&(r=`"${r}"`),e[s]=r}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};Lm.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Ha.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 vr=Lm;function pc(i){const t=Ct.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 LT(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 mc(i,t,e){for(const s in e)Array.isArray(t[s])?i[s]=t[s].slice():i[s]=t[s]}const NT={texture:!0,children:!1,baseTexture:!0},Nm=class yd extends qe{constructor(t,e,s){let r=!1;s||(s=z.ADAPTER.createCanvas(),r=!0),s.width=3,s.height=3;const n=q.from(s);n.orig=new rt,n.trim=new rt,super(n),this._ownCanvas=r,this.canvas=s,this.context=s.getContext("2d",{willReadFrequently:!0}),this._resolution=yd.defaultResolution??z.RESOLUTION,this._autoResolution=yd.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 $r.experimentalLetterSpacing}static set experimentalLetterSpacing(t){ot("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),$r.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=$r.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=r.width,a=r.height,h=r.lines,o=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,_=g?Math.ceil(Math.max(1,a)+e.padding*2):0,x=_*this._resolution;if(g){s.fillStyle="black",s.strokeStyle="black";const v=e.dropShadowColor,b=e.dropShadowBlur*this._resolution,w=e.dropShadowDistance*this._resolution;s.shadowColor=Ct.shared.setValue(v).setAlpha(e.dropShadowAlpha).toRgbaString(),s.shadowBlur=b,s.shadowOffsetX=Math.cos(e.dropShadowAngle)*w,s.shadowOffsetY=Math.sin(e.dropShadowAngle)*w+x}else s.fillStyle=this._generateFillStyle(e,h,r),s.strokeStyle=e.stroke,s.shadowColor="black",s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0;let y=(o-c.fontSize)/2;o-c.fontSize<0&&(y=0);for(let v=0;v<h.length;v++)d=e.strokeThickness/2,f=e.strokeThickness/2+v*o+c.ascent+y,e.align==="right"?d+=u-l[v]:e.align==="center"&&(d+=(u-l[v])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(h[v],d+e.padding,f+e.padding-_,!0),e.fill&&this.drawLetterSpacing(h[v],d+e.padding,f+e.padding-_)}this.updateTexture()}drawLetterSpacing(t,e,s,r=!1){const n=this._style.letterSpacing;let a=!1;if($r.experimentalLetterSpacingSupported&&($r.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 h=e;const o=$r.graphemeSegmenter(t);let l=this.context.measureText(t).width,u=0;for(let c=0;c<o.length;++c){const d=o[c];r?this.context.strokeText(d,h,s):this.context.fillText(d,h,s);let f="";for(let p=c+1;p<o.length;++p)f+=o[p];u=this.context.measureText(f).width,h+=l-u+n,l=u}}updateTexture(){const t=this.canvas;if(this._style.trim){const a=e1(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,h=t.padding||0,o=this.canvas.width/this._resolution-a-h*2,l=this.canvas.height/this._resolution-a-h*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===Ha.LINEAR_VERTICAL){n=this.context.createLinearGradient(o/2,h,o/2,l+h);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 _=m+d,x=s.lineHeight*(f+1);let y=_;f+1<e.length&&x<_&&(y=(_+x)/2);const v=(y-g)/l;for(let b=0;b<u.length;b++){let w=0;typeof c[b]=="number"?w=c[b]:w=b/u.length;let E=Math.min(1,Math.max(0,g/l+w*v));E=Number(E.toFixed(5)),n.addColorStop(E,u[b])}}}else{n=this.context.createLinearGradient(h,l/2,o+h,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({},NT,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=Dr(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=Dr(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 vr?this._style=t:this._style=new vr(t),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(t){t=String(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)}};Nm.defaultAutoResolution=!0;let za=Nm;class VT{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function UT(i,t){var s;let e=!1;if((s=i==null?void 0:i._textures)!=null&&s.length){for(let r=0;r<i._textures.length;r++)if(i._textures[r]instanceof q){const n=i._textures[r].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function GT(i,t){if(i.baseTexture instanceof et){const e=i.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function XT(i,t){if(i._texture&&i._texture instanceof q){const e=i._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function $T(i,t){return t instanceof za?(t.updateText(!0),!0):!1}function YT(i,t){if(t instanceof vr){const e=t.toFontString();return $r.measureFont(e),!0}return!1}function HT(i,t){if(i instanceof za){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 WT(i,t){return i instanceof vr?(t.includes(i)||t.push(i),!0):!1}const Vm=class ty{constructor(t){this.limiter=new VT(ty.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(HT),this.registerFindHook(WT),this.registerFindHook(UT),this.registerFindHook(GT),this.registerFindHook(XT),this.registerUploadHook($T),this.registerUploadHook(YT)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,wt.system.addOnce(this.tick,this,Vr.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)wt.system.addOnce(this.tick,this,Vr.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 Bt)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&wt.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}};Vm.uploadsPerFrame=4;let gc=Vm;Object.defineProperties(z,{UPLOADS_PER_FRAME:{get(){return gc.uploadsPerFrame},set(i){ot("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),gc.uploadsPerFrame=i}}});function Um(i,t){return t instanceof et?(t._glTextures[i.CONTEXT_UID]||i.texture.bind(t),!0):!1}function zT(i,t){if(!(t instanceof hs))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&&Um(i,n.baseTexture)}return e.batchable||i.geometry.bind(e,t._resolveDirectShader(i)),!0}function jT(i,t){return i instanceof hs?(t.push(i),!0):!1}class Gm extends gc{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(jT),this.registerUploadHook(Um),this.registerUploadHook(zT)}}Gm.extension={name:"prepare",type:Y.RendererSystem},K.add(Gm);var qT=`#version 300 es
970
970
  #define SHADER_NAME Tiling-Sprite-100
971
971
 
972
972
  precision lowp float;
@@ -992,7 +992,7 @@ void main(void)
992
992
 
993
993
  fragmentColor = texSample * uColor;
994
994
  }
995
- `,jT=`#version 300 es
995
+ `,ZT=`#version 300 es
996
996
  #define SHADER_NAME Tiling-Sprite-300
997
997
 
998
998
  precision lowp float;
@@ -1012,7 +1012,7 @@ void main(void)
1012
1012
 
1013
1013
  vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
1014
1014
  }
1015
- `,qT=`#version 100
1015
+ `,KT=`#version 100
1016
1016
  #ifdef GL_EXT_shader_texture_lod
1017
1017
  #extension GL_EXT_shader_texture_lod : enable
1018
1018
  #endif
@@ -1045,7 +1045,7 @@ void main(void)
1045
1045
 
1046
1046
  gl_FragColor = texSample * uColor;
1047
1047
  }
1048
- `,zm=`#version 100
1048
+ `,Xm=`#version 100
1049
1049
  #define SHADER_NAME Tiling-Sprite-100
1050
1050
 
1051
1051
  precision lowp float;
@@ -1065,7 +1065,7 @@ void main(void)
1065
1065
 
1066
1066
  vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
1067
1067
  }
1068
- `,ZT=`#version 100
1068
+ `,QT=`#version 100
1069
1069
  #define SHADER_NAME Tiling-Sprite-Simple-100
1070
1070
 
1071
1071
  precision lowp float;
@@ -1080,7 +1080,7 @@ void main(void)
1080
1080
  vec4 texSample = texture2D(uSampler, vTextureCoord);
1081
1081
  gl_FragColor = texSample * uColor;
1082
1082
  }
1083
- `;const ja=new Rt;class jm extends xa{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new Mp,this.state=js.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=Zs.from(zm,ZT,e),this.shader=t.context.webGLVersion>1?Zs.from(jT,zT,e):Zs.from(zm,qT,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 h=t._texture,o=h.baseTexture,l=o.alphaMode>0,u=t.tileTransform.localTransform,c=t.uvMatrix;let d=o.isPowerOfTwo&&h.frame.width===o.width&&h.frame.height===o.height;d&&(o._glTextures[e.CONTEXT_UID]?d=o.wrapMode!==Fr.CLAMP:o.wrapMode===Fr.CLAMP&&(o.wrapMode=Fr.REPEAT));const f=d?this.simpleShader:this.shader,p=h.width,m=h.height,g=t._width,_=t._height;ja.set(u.a*p/g,u.b*p/_,u.c*m/g,u.d*m/_,u.tx/g,u.ty/_),ja.invert(),d?ja.prepend(c.mapCoord):(f.uniforms.uMapCoord=c.mapCoord.toArray(!0),f.uniforms.uClampFrame=c.uClampFrame,f.uniforms.uClampOffset=c.uClampOffset),f.uniforms.uTransform=ja.toArray(!0),f.uniforms.uColor=Ct.shared.setValue(t.tint).premultiply(t.worldAlpha,l).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=h,e.shader.bind(f),e.geometry.bind(s),this.state.blendMode=ip(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}jm.extension={name:"tilingSprite",type:Y.RendererPlugin},K.add(jm);const qm=class Vo{constructor(t,e,s){this.linkedSheets=[],(t instanceof et||t instanceof q)&&(t={texture:t,data:e,resolutionFilename:s});const{texture:r,data:n,resolutionFilename:a=null,cachePrefix:h=""}=t;this.cachePrefix=h,this._texture=r instanceof q?r:null,this.baseTexture=r instanceof et?r:this._texture.baseTexture,this.textures={},this.animations={},this.data=n;const o=this.baseTexture.resource;this.resolution=this._updateResolution(a||(o?o.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=_r(t,null);return s===null&&(s=typeof e=="number"?e:parseFloat(e??"1")),s!==1&&this.baseTexture.setResolution(s),s}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Vo.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const s=Vo.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 h=null,o=null;const l=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,u=new rt(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?h=new rt(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):h=new rt(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&&(o=new rt(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 q(this.baseTexture,h,u,o,n.rotated?2:0,n.anchor,n.borders),q.addToCache(this.textures[r],this.cachePrefix+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*Vo.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Vo.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=[]}};qm.BATCH_SIZE=1e3;let Zm=qm;const KT=["jpg","png","jpeg","avif","webp","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"];function Km(i,t,e){const s={};if(i.forEach(r=>{s[r]=t}),Object.keys(t.textures).forEach(r=>{s[`${t.cachePrefix}${r}`]=t.textures[r]}),!e){const r=bt.dirname(i[0]);t.linkedSheets.forEach((n,a)=>{Object.assign(s,Km([`${r}/${t.data.meta.related_multi_packs[a]}`],n,!0))})}return s}const QT={extension:Y.Asset,cache:{test:i=>i instanceof Zm,getCacheableAssets:(i,t)=>Km(i,t,!1)},resolver:{test:i=>{const t=i.split("?")[0].split("."),e=t.pop(),s=t.pop();return e==="json"&&KT.includes(s)},parse:i=>{var e;const t=i.split(".");return{resolution:parseFloat(((e=z.RETINA_PREFIX.exec(i))==null?void 0:e[1])??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:Y.LoadParser,priority:Ne.Normal},async testParse(i,t){return bt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){var u,c;const{texture:s,imageFilename:r,cachePrefix:n}=(t==null?void 0:t.data)??{};let a=bt.dirname(t.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let h;if(s&&s.baseTexture)h=s;else{const d=rc(a+(r??i.meta.image),t.src);h=(await e.load([d]))[d]}const o=new Zm({texture:h.baseTexture,data:i,resolutionFilename:t.src,cachePrefix:n});await o.parse();const l=(u=i==null?void 0:i.meta)==null?void 0:u.related_multi_packs;if(Array.isArray(l)){const d=[];for(const p of l){if(typeof p!="string")continue;let m=a+p;(c=t.data)!=null&&c.ignoreMultiPack||(m=rc(m,t.src),d.push(e.load({src:m,data:{ignoreMultiPack:!0}})))}const f=await Promise.all(d);o.linkedSheets=f,f.forEach(p=>{p.linkedSheets=[o].concat(o.linkedSheets.filter(m=>m!==p))})}return o},unload(i){i.destroy(!0)}}};K.add(QT);class qa{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Za{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],h=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),o={};for(const l in h){const u=h[l].split("="),c=u[0],d=u[1].replace(/"/gm,""),f=parseFloat(d),p=isNaN(f)?d:f;o[c]=p}s[a].push(o)}const r=new qa;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 vc{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 qa,s=t.getElementsByTagName("info"),r=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),a=t.getElementsByTagName("char"),h=t.getElementsByTagName("kerning"),o=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<h.length;l++)e.kerning.push({first:parseInt(h[l].getAttribute("first"),10),second:parseInt(h[l].getAttribute("second"),10),amount:parseInt(h[l].getAttribute("amount"),10)});for(let l=0;l<o.length;l++)e.distanceField.push({fieldType:o[l].getAttribute("fieldType"),distanceRange:parseInt(o[l].getAttribute("distanceRange"),10)});return e}}class bc{static test(t){return typeof t=="string"&&t.includes("<font>")?vc.test(z.ADAPTER.parseXML(t)):!1}static parse(t){return vc.parse(z.ADAPTER.parseXML(t))}}const wc=[Za,vc,bc];function JT(i){for(let t=0;t<wc.length;t++)if(wc[t].test(i))return wc[t];return null}function tA(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 h;const o=e.dropShadow?e.dropShadowDistance:0,l=e.padding||0,u=i.width/s-o-l*2,c=i.height/s-o-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===Ha.LINEAR_VERTICAL){h=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 _=n.lineHeight*g;for(let x=0;x<d.length;x++){let y=0;typeof f[x]=="number"?y=f[x]:y=x/d.length;const v=_/c+y*m;let b=Math.max(p,v);b=Math.min(b,1),h.addColorStop(b,d[x]),p=b}}}else{h=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 _;typeof f[g]=="number"?_=f[g]:_=m/p,h.addColorStop(_,d[g]),m++}}return h}function eA(i,t,e,s,r,n,a){const h=e.text,o=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=tA(i,t,a,n,[h],e),t.strokeStyle=a.stroke,a.dropShadow){const c=a.dropShadowColor,d=a.dropShadowBlur*n,f=a.dropShadowDistance*n;t.shadowColor=Ct.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(h,l,u+e.lineHeight-o.descent),a.fill&&t.fillText(h,l,u+e.lineHeight-o.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function Ka(i){return i.codePointAt?i.codePointAt(0):i.charCodeAt(0)}function Qm(i){return Array.from?Array.from(i):i.split("")}function sA(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 h=n,o=a;h<=o;h++)t.push(String.fromCharCode(h))}else t.push(...Qm(r))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const Yr=class ur{constructor(t,e,s){var u;const[r]=t.info,[n]=t.common,[a]=t.page,[h]=t.distanceField,o=_r(a.file),l={};this._ownsTextures=s,this.font=r.face,this.size=r.size,this.lineHeight=n.lineHeight/o,this.chars={},this.pageTextures=l;for(let c=0;c<t.page.length;c++){const{id:d,file:f}=t.page[c];l[d]=e instanceof Array?e[c]:e[f],h!=null&&h.fieldType&&h.fieldType!=="none"&&(l[d].baseTexture.alphaMode=Re.NO_PREMULTIPLIED_ALPHA,l[d].baseTexture.mipmap=vs.OFF)}for(let c=0;c<t.char.length;c++){const{id:d,page:f}=t.char[c];let{x:p,y:m,width:g,height:_,xoffset:x,yoffset:y,xadvance:v}=t.char[c];p/=o,m/=o,g/=o,_/=o,x/=o,y/=o,v/=o;const b=new rt(p+l[f].frame.x/o,m+l[f].frame.y/o,g,_);this.chars[d]={xOffset:x,yOffset:y,xAdvance:v,kerning:{},texture:new q(l[f].baseTexture,b),page:f}}for(let c=0;c<t.kerning.length;c++){let{first:d,second:f,amount:p}=t.kerning[c];d/=o,f/=o,p/=o,this.chars[f]&&(this.chars[f].kerning[d]=p)}this.distanceFieldRange=h==null?void 0:h.distanceRange,this.distanceFieldType=((u=h==null?void 0:h.fieldType)==null?void 0:u.toLowerCase())??"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 qa)r=t;else{const a=JT(t);if(!a)throw new Error("Unrecognized data format for font.");r=a.parse(t)}e instanceof q&&(e=[e]);const n=new ur(r,e,s);return ur.available[n.font]=n,n}static uninstall(t){const e=ur.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete ur.available[t]}static from(t,e,s){if(!t)throw new Error("[BitmapFont] Property `name` is required.");const{chars:r,padding:n,resolution:a,textureWidth:h,textureHeight:o,...l}=Object.assign({},ur.defaultOptions,s),u=sA(r),c=e instanceof vr?e:new vr(e),d=h,f=new qa;f.info[0]={face:c.fontFamily,size:c.fontSize},f.common[0]={lineHeight:c.fontSize};let p=0,m=0,g,_,x,y=0;const v=[];for(let w=0;w<u.length;w++){g||(g=z.ADAPTER.createCanvas(),g.width=h,g.height=o,_=g.getContext("2d"),x=new et(g,{resolution:a,...l}),v.push(new q(x)),f.page.push({id:v.length-1,file:""}));const E=u[w],T=$r.measureText(E,c,!1,g),A=T.width,I=Math.ceil(T.height),M=Math.ceil((c.fontStyle==="italic"?2:1)*A);if(m>=o-I*a){if(m===0)throw new Error(`[BitmapFont] textureHeight ${o}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${E}')`);--w,g=null,_=null,x=null,m=0,p=0,y=0;continue}if(y=Math.max(I+T.fontProperties.descent,y),M*a+p>=d){if(p===0)throw new Error(`[BitmapFont] textureWidth ${h}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${E}')`);--w,m+=y*a,m=Math.ceil(m),p=0,y=0;continue}eA(g,_,T,p,m,a,c);const R=Ka(T.text);f.char.push({id:R,page:v.length-1,x:p/a,y:m/a,width:M,height:I,xoffset:0,yoffset:0,xadvance:A-(c.dropShadow?c.dropShadowDistance:0)-(c.stroke?c.strokeThickness:0)}),p+=(M+2*n)*a,p=Math.ceil(p)}if(!(s!=null&&s.skipKerning))for(let w=0,E=u.length;w<E;w++){const T=u[w];for(let A=0;A<E;A++){const I=u[A],M=_.measureText(T).width,R=_.measureText(I).width,C=_.measureText(T+I).width-(M+R);C&&f.kerning.push({first:Ka(T),second:Ka(I),amount:C})}}const b=new ur(f,v,!0);return ur.available[t]!==void 0&&ur.uninstall(t),ur.available[t]=b,b}};Yr.ALPHA=[["a","z"],["A","Z"]," "],Yr.NUMERIC=[["0","9"]],Yr.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Yr.ASCII=[[" ","~"]],Yr.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Yr.ALPHANUMERIC},Yr.available={};let Hr=Yr;var rA=`// Pixi texture info\r
1083
+ `;const ja=new Rt;class $m extends xa{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new Sp,this.state=js.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=Zs.from(Xm,QT,e),this.shader=t.context.webGLVersion>1?Zs.from(ZT,qT,e):Zs.from(Xm,KT,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 h=t._texture,o=h.baseTexture,l=o.alphaMode>0,u=t.tileTransform.localTransform,c=t.uvMatrix;let d=o.isPowerOfTwo&&h.frame.width===o.width&&h.frame.height===o.height;d&&(o._glTextures[e.CONTEXT_UID]?d=o.wrapMode!==Fr.CLAMP:o.wrapMode===Fr.CLAMP&&(o.wrapMode=Fr.REPEAT));const f=d?this.simpleShader:this.shader,p=h.width,m=h.height,g=t._width,_=t._height;ja.set(u.a*p/g,u.b*p/_,u.c*m/g,u.d*m/_,u.tx/g,u.ty/_),ja.invert(),d?ja.prepend(c.mapCoord):(f.uniforms.uMapCoord=c.mapCoord.toArray(!0),f.uniforms.uClampFrame=c.uClampFrame,f.uniforms.uClampOffset=c.uClampOffset),f.uniforms.uTransform=ja.toArray(!0),f.uniforms.uColor=Ct.shared.setValue(t.tint).premultiply(t.worldAlpha,l).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=h,e.shader.bind(f),e.geometry.bind(s),this.state.blendMode=Jf(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}$m.extension={name:"tilingSprite",type:Y.RendererPlugin},K.add($m);const Ym=class Vo{constructor(t,e,s){this.linkedSheets=[],(t instanceof et||t instanceof q)&&(t={texture:t,data:e,resolutionFilename:s});const{texture:r,data:n,resolutionFilename:a=null,cachePrefix:h=""}=t;this.cachePrefix=h,this._texture=r instanceof q?r:null,this.baseTexture=r instanceof et?r:this._texture.baseTexture,this.textures={},this.animations={},this.data=n;const o=this.baseTexture.resource;this.resolution=this._updateResolution(a||(o?o.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=_r(t,null);return s===null&&(s=typeof e=="number"?e:parseFloat(e??"1")),s!==1&&this.baseTexture.setResolution(s),s}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Vo.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const s=Vo.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 h=null,o=null;const l=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,u=new rt(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?h=new rt(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):h=new rt(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&&(o=new rt(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 q(this.baseTexture,h,u,o,n.rotated?2:0,n.anchor,n.borders),q.addToCache(this.textures[r],this.cachePrefix+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*Vo.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Vo.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=[]}};Ym.BATCH_SIZE=1e3;let Hm=Ym;const JT=["jpg","png","jpeg","avif","webp","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"];function Wm(i,t,e){const s={};if(i.forEach(r=>{s[r]=t}),Object.keys(t.textures).forEach(r=>{s[`${t.cachePrefix}${r}`]=t.textures[r]}),!e){const r=bt.dirname(i[0]);t.linkedSheets.forEach((n,a)=>{Object.assign(s,Wm([`${r}/${t.data.meta.related_multi_packs[a]}`],n,!0))})}return s}const tA={extension:Y.Asset,cache:{test:i=>i instanceof Hm,getCacheableAssets:(i,t)=>Wm(i,t,!1)},resolver:{test:i=>{const t=i.split("?")[0].split("."),e=t.pop(),s=t.pop();return e==="json"&&JT.includes(s)},parse:i=>{var e;const t=i.split(".");return{resolution:parseFloat(((e=z.RETINA_PREFIX.exec(i))==null?void 0:e[1])??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:Y.LoadParser,priority:Ne.Normal},async testParse(i,t){return bt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){var u,c;const{texture:s,imageFilename:r,cachePrefix:n}=(t==null?void 0:t.data)??{};let a=bt.dirname(t.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let h;if(s&&s.baseTexture)h=s;else{const d=tc(a+(r??i.meta.image),t.src);h=(await e.load([d]))[d]}const o=new Hm({texture:h.baseTexture,data:i,resolutionFilename:t.src,cachePrefix:n});await o.parse();const l=(u=i==null?void 0:i.meta)==null?void 0:u.related_multi_packs;if(Array.isArray(l)){const d=[];for(const p of l){if(typeof p!="string")continue;let m=a+p;(c=t.data)!=null&&c.ignoreMultiPack||(m=tc(m,t.src),d.push(e.load({src:m,data:{ignoreMultiPack:!0}})))}const f=await Promise.all(d);o.linkedSheets=f,f.forEach(p=>{p.linkedSheets=[o].concat(o.linkedSheets.filter(m=>m!==p))})}return o},unload(i){i.destroy(!0)}}};K.add(tA);class qa{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Za{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],h=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),o={};for(const l in h){const u=h[l].split("="),c=u[0],d=u[1].replace(/"/gm,""),f=parseFloat(d),p=isNaN(f)?d:f;o[c]=p}s[a].push(o)}const r=new qa;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 _c{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 qa,s=t.getElementsByTagName("info"),r=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),a=t.getElementsByTagName("char"),h=t.getElementsByTagName("kerning"),o=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<h.length;l++)e.kerning.push({first:parseInt(h[l].getAttribute("first"),10),second:parseInt(h[l].getAttribute("second"),10),amount:parseInt(h[l].getAttribute("amount"),10)});for(let l=0;l<o.length;l++)e.distanceField.push({fieldType:o[l].getAttribute("fieldType"),distanceRange:parseInt(o[l].getAttribute("distanceRange"),10)});return e}}class yc{static test(t){return typeof t=="string"&&t.includes("<font>")?_c.test(z.ADAPTER.parseXML(t)):!1}static parse(t){return _c.parse(z.ADAPTER.parseXML(t))}}const xc=[Za,_c,yc];function eA(i){for(let t=0;t<xc.length;t++)if(xc[t].test(i))return xc[t];return null}function sA(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 h;const o=e.dropShadow?e.dropShadowDistance:0,l=e.padding||0,u=i.width/s-o-l*2,c=i.height/s-o-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===Ha.LINEAR_VERTICAL){h=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 _=n.lineHeight*g;for(let x=0;x<d.length;x++){let y=0;typeof f[x]=="number"?y=f[x]:y=x/d.length;const v=_/c+y*m;let b=Math.max(p,v);b=Math.min(b,1),h.addColorStop(b,d[x]),p=b}}}else{h=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 _;typeof f[g]=="number"?_=f[g]:_=m/p,h.addColorStop(_,d[g]),m++}}return h}function rA(i,t,e,s,r,n,a){const h=e.text,o=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=sA(i,t,a,n,[h],e),t.strokeStyle=a.stroke,a.dropShadow){const c=a.dropShadowColor,d=a.dropShadowBlur*n,f=a.dropShadowDistance*n;t.shadowColor=Ct.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(h,l,u+e.lineHeight-o.descent),a.fill&&t.fillText(h,l,u+e.lineHeight-o.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function Ka(i){return i.codePointAt?i.codePointAt(0):i.charCodeAt(0)}function zm(i){return Array.from?Array.from(i):i.split("")}function iA(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 h=n,o=a;h<=o;h++)t.push(String.fromCharCode(h))}else t.push(...zm(r))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const Yr=class ur{constructor(t,e,s){var u;const[r]=t.info,[n]=t.common,[a]=t.page,[h]=t.distanceField,o=_r(a.file),l={};this._ownsTextures=s,this.font=r.face,this.size=r.size,this.lineHeight=n.lineHeight/o,this.chars={},this.pageTextures=l;for(let c=0;c<t.page.length;c++){const{id:d,file:f}=t.page[c];l[d]=e instanceof Array?e[c]:e[f],h!=null&&h.fieldType&&h.fieldType!=="none"&&(l[d].baseTexture.alphaMode=Re.NO_PREMULTIPLIED_ALPHA,l[d].baseTexture.mipmap=vs.OFF)}for(let c=0;c<t.char.length;c++){const{id:d,page:f}=t.char[c];let{x:p,y:m,width:g,height:_,xoffset:x,yoffset:y,xadvance:v}=t.char[c];p/=o,m/=o,g/=o,_/=o,x/=o,y/=o,v/=o;const b=new rt(p+l[f].frame.x/o,m+l[f].frame.y/o,g,_);this.chars[d]={xOffset:x,yOffset:y,xAdvance:v,kerning:{},texture:new q(l[f].baseTexture,b),page:f}}for(let c=0;c<t.kerning.length;c++){let{first:d,second:f,amount:p}=t.kerning[c];d/=o,f/=o,p/=o,this.chars[f]&&(this.chars[f].kerning[d]=p)}this.distanceFieldRange=h==null?void 0:h.distanceRange,this.distanceFieldType=((u=h==null?void 0:h.fieldType)==null?void 0:u.toLowerCase())??"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 qa)r=t;else{const a=eA(t);if(!a)throw new Error("Unrecognized data format for font.");r=a.parse(t)}e instanceof q&&(e=[e]);const n=new ur(r,e,s);return ur.available[n.font]=n,n}static uninstall(t){const e=ur.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete ur.available[t]}static from(t,e,s){if(!t)throw new Error("[BitmapFont] Property `name` is required.");const{chars:r,padding:n,resolution:a,textureWidth:h,textureHeight:o,...l}=Object.assign({},ur.defaultOptions,s),u=iA(r),c=e instanceof vr?e:new vr(e),d=h,f=new qa;f.info[0]={face:c.fontFamily,size:c.fontSize},f.common[0]={lineHeight:c.fontSize};let p=0,m=0,g,_,x,y=0;const v=[];for(let w=0;w<u.length;w++){g||(g=z.ADAPTER.createCanvas(),g.width=h,g.height=o,_=g.getContext("2d"),x=new et(g,{resolution:a,...l}),v.push(new q(x)),f.page.push({id:v.length-1,file:""}));const E=u[w],T=$r.measureText(E,c,!1,g),A=T.width,I=Math.ceil(T.height),M=Math.ceil((c.fontStyle==="italic"?2:1)*A);if(m>=o-I*a){if(m===0)throw new Error(`[BitmapFont] textureHeight ${o}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${E}')`);--w,g=null,_=null,x=null,m=0,p=0,y=0;continue}if(y=Math.max(I+T.fontProperties.descent,y),M*a+p>=d){if(p===0)throw new Error(`[BitmapFont] textureWidth ${h}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${E}')`);--w,m+=y*a,m=Math.ceil(m),p=0,y=0;continue}rA(g,_,T,p,m,a,c);const R=Ka(T.text);f.char.push({id:R,page:v.length-1,x:p/a,y:m/a,width:M,height:I,xoffset:0,yoffset:0,xadvance:A-(c.dropShadow?c.dropShadowDistance:0)-(c.stroke?c.strokeThickness:0)}),p+=(M+2*n)*a,p=Math.ceil(p)}if(!(s!=null&&s.skipKerning))for(let w=0,E=u.length;w<E;w++){const T=u[w];for(let A=0;A<E;A++){const I=u[A],M=_.measureText(T).width,R=_.measureText(I).width,C=_.measureText(T+I).width-(M+R);C&&f.kerning.push({first:Ka(T),second:Ka(I),amount:C})}}const b=new ur(f,v,!0);return ur.available[t]!==void 0&&ur.uninstall(t),ur.available[t]=b,b}};Yr.ALPHA=[["a","z"],["A","Z"]," "],Yr.NUMERIC=[["0","9"]],Yr.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Yr.ASCII=[[" ","~"]],Yr.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Yr.ALPHANUMERIC},Yr.available={};let Hr=Yr;var nA=`// Pixi texture info\r
1084
1084
  varying vec2 vTextureCoord;\r
1085
1085
  uniform sampler2D uSampler;\r
1086
1086
  \r
@@ -1118,7 +1118,7 @@ void main(void) {\r
1118
1118
  // NPM Textures, NPM outputs\r
1119
1119
  gl_FragColor = vec4(uColor.rgb, coverage);\r
1120
1120
  }\r
1121
- `,iA=`// Mesh material default fragment\r
1121
+ `,oA=`// Mesh material default fragment\r
1122
1122
  attribute vec2 aVertexPosition;\r
1123
1123
  attribute vec2 aTextureCoord;\r
1124
1124
  \r
@@ -1134,17 +1134,17 @@ void main(void)\r
1134
1134
  \r
1135
1135
  vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r
1136
1136
  }\r
1137
- `;const Jm=[],tg=[],eg=[],sg=class oy extends Bt{constructor(t,e={}){super();const{align:s,tint:r,maxWidth:n,letterSpacing:a,fontName:h,fontSize:o}=Object.assign({},oy.styleDefaults,e);if(!Hr.available[h])throw new Error(`Missing BitmapFont "${h}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=s,this._tintColor=new Ct(r),this._font=void 0,this._fontName=h,this._fontSize=o,this.text=t,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=a,this._anchor=new qs(()=>{this.dirty=!0},this,0,0),this._roundPixels=z.ROUND_PIXELS,this.dirty=!0,this._resolution=z.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var M;const t=Hr.available[this._fontName],e=this.fontSize,s=e/t.size,r=new st,n=[],a=[],h=[],o=this._text.replace(/(?:\r\n|\r)/g,`
1138
- `)||" ",l=Qm(o),u=this._maxWidth*t.size/e,c=t.distanceFieldType==="none"?Jm:tg;let d=null,f=0,p=0,m=0,g=-1,_=0,x=0,y=0,v=0;for(let R=0;R<l.length;R++){const C=l[R],P=Ka(C);if(/(?:\s)/.test(C)&&(g=R,_=f,v++),C==="\r"||C===`
1139
- `){a.push(f),h.push(-1),p=Math.max(p,f),++m,++x,r.x=0,r.y+=t.lineHeight,d=null,v=0;continue}const k=t.chars[P];if(!k)continue;d&&k.kerning[d]&&(r.x+=k.kerning[d]);const U=eg.pop()||{texture:q.EMPTY,line:0,charCode:0,prevSpaces:0,position:new st};U.texture=k.texture,U.line=m,U.charCode=P,U.position.x=Math.round(r.x+k.xOffset+this._letterSpacing/2),U.position.y=Math.round(r.y+k.yOffset),U.prevSpaces=v,n.push(U),f=U.position.x+Math.max(k.xAdvance-k.xOffset,k.texture.orig.width),r.x+=k.xAdvance+this._letterSpacing,y=Math.max(y,k.yOffset+k.texture.height),d=P,g!==-1&&u>0&&r.x>u&&(++x,nn(n,1+g-x,1+R-g),R=g,g=-1,a.push(_),h.push(n.length>0?n[n.length-1].prevSpaces:0),p=Math.max(p,_),m++,r.x=0,r.y+=t.lineHeight,d=null,v=0)}const b=l[l.length-1];b!=="\r"&&b!==`
1140
- `&&(/(?:\s)/.test(b)&&(f=_),a.push(f),p=Math.max(p,f),h.push(-1));const w=[];for(let R=0;R<=m;R++){let C=0;this._align==="right"?C=p-a[R]:this._align==="center"?C=(p-a[R])/2:this._align==="justify"&&(C=h[R]<0?0:(p-a[R])/h[R]),w.push(C)}const E=n.length,T={},A=[],I=this._activePagesMeshData;c.push(...I);for(let R=0;R<E;R++){const C=n[R].texture,P=C.baseTexture.uid;if(!T[P]){let k=c.pop();if(!k){const V=new gc;let L,$;t.distanceFieldType==="none"?(L=new $a(q.EMPTY),$=W.NORMAL):(L=new $a(q.EMPTY,{program:yr.from(iA,rA),uniforms:{uFWidth:0}}),$=W.NORMAL_NPM);const O=new Xa(V,L);O.blendMode=$,k={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:O,vertices:null,uvs:null,indices:null}}k.index=0,k.indexCount=0,k.vertexCount=0,k.uvsCount=0,k.total=0;const{_textureCache:U}=this;U[P]=U[P]||new q(C.baseTexture),k.mesh.texture=U[P],k.mesh.tint=this._tintColor.value,A.push(k),T[P]=k}T[P].total++}for(let R=0;R<I.length;R++)A.includes(I[R])||this.removeChild(I[R].mesh);for(let R=0;R<A.length;R++)A[R].mesh.parent!==this&&this.addChild(A[R].mesh);this._activePagesMeshData=A;for(const R in T){const C=T[R],P=C.total;if(!(((M=C.indices)==null?void 0:M.length)>6*P)||C.vertices.length<Xa.BATCHABLE_SIZE*2)C.vertices=new Float32Array(4*2*P),C.uvs=new Float32Array(4*2*P),C.indices=new Uint16Array(6*P);else{const k=C.total,U=C.vertices;for(let V=k*4*2;V<U.length;V++)U[V]=0}C.mesh.size=6*P}for(let R=0;R<E;R++){const C=n[R];let P=C.position.x+w[C.line]*(this._align==="justify"?C.prevSpaces:1);this._roundPixels&&(P=Math.round(P));const k=P*s,U=C.position.y*s,V=C.texture,L=T[V.baseTexture.uid],$=V.frame,O=V._uvs,N=L.index++;L.indices[N*6+0]=0+N*4,L.indices[N*6+1]=1+N*4,L.indices[N*6+2]=2+N*4,L.indices[N*6+3]=0+N*4,L.indices[N*6+4]=2+N*4,L.indices[N*6+5]=3+N*4,L.vertices[N*8+0]=k,L.vertices[N*8+1]=U,L.vertices[N*8+2]=k+$.width*s,L.vertices[N*8+3]=U,L.vertices[N*8+4]=k+$.width*s,L.vertices[N*8+5]=U+$.height*s,L.vertices[N*8+6]=k,L.vertices[N*8+7]=U+$.height*s,L.uvs[N*8+0]=O.x0,L.uvs[N*8+1]=O.y0,L.uvs[N*8+2]=O.x1,L.uvs[N*8+3]=O.y1,L.uvs[N*8+4]=O.x2,L.uvs[N*8+5]=O.y2,L.uvs[N*8+6]=O.x3,L.uvs[N*8+7]=O.y3}this._textWidth=p*s,this._textHeight=(r.y+t.lineHeight)*s;for(const R in T){const C=T[R];if(this.anchor.x!==0||this.anchor.y!==0){let V=0;const L=this._textWidth*this.anchor.x,$=this._textHeight*this.anchor.y;for(let O=0;O<C.total;O++)C.vertices[V++]-=L,C.vertices[V++]-=$,C.vertices[V++]-=L,C.vertices[V++]-=$,C.vertices[V++]-=L,C.vertices[V++]-=$,C.vertices[V++]-=L,C.vertices[V++]-=$}this._maxLineHeight=y*s;const P=C.mesh.geometry.getBuffer("aVertexPosition"),k=C.mesh.geometry.getBuffer("aTextureCoord"),U=C.mesh.geometry.getIndex();P.data=C.vertices,k.data=C.uvs,U.data=C.indices,P.update(),k.update(),U.update()}for(let R=0;R<n.length;R++)eg.push(n[R]);this._font=t,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}=Hr.available[this._fontName];if(s!=="none"){const{a:n,b:a,c:h,d:o}=this.worldTransform,l=Math.sqrt(n*n+a*a),u=Math.sqrt(h*h+o*o),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=Hr.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(!Hr.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??Hr.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??""),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=Hr.available[this._fontName].distanceFieldType==="none"?Jm:tg;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=q.EMPTY});for(const r in e)e[r].destroy(),delete e[r];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};sg.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let nA=sg;const oA=[".xml",".fnt"],aA={extension:{type:Y.LoadParser,priority:Ne.Normal},name:"loadBitmapFont",test(i){return oA.includes(bt.extname(i).toLowerCase())},async testParse(i){return Za.test(i)||bc.test(i)},async parse(i,t,e){const s=Za.test(i)?Za.parse(i):bc.parse(i),{src:r}=t,{page:n}=s,a=[];for(let l=0;l<n.length;++l){const u=n[l].file;let c=bt.join(bt.dirname(r),u);c=rc(c,r),a.push(c)}const h=await e.load(a),o=a.map(l=>h[l]);return Hr.install(s,o,!0)},async load(i,t){return(await z.ADAPTER.fetch(i)).text()},unload(i){i.destroy()}};K.add(aA);const Ec=class Nn extends vr{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new Nn(Object.keys(Nn.defaultOptions).reduce((e,s)=>({...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 Nn.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:s}=Nn;if(s[t]){const r=s[t];return this._fonts.push(r),r.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return z.ADAPTER.fetch(t).then(r=>r.blob()).then(async r=>new Promise((n,a)=>{const h=URL.createObjectURL(r),o=new FileReader;o.onload=()=>n([h,o.result]),o.onerror=a,o.readAsDataURL(r)})).then(async([r,n])=>{const a=Object.assign({family:bt.basename(t,bt.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 h=new FontFace(a.family,`url(${a.src})`,{weight:a.weight,style:a.style,display:a.display});a.fontFace=h,await h.load(),document.fonts.add(h),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}
1137
+ `;const jm=[],qm=[],Zm=[],Km=class ey extends Bt{constructor(t,e={}){super();const{align:s,tint:r,maxWidth:n,letterSpacing:a,fontName:h,fontSize:o}=Object.assign({},ey.styleDefaults,e);if(!Hr.available[h])throw new Error(`Missing BitmapFont "${h}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=s,this._tintColor=new Ct(r),this._font=void 0,this._fontName=h,this._fontSize=o,this.text=t,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=a,this._anchor=new qs(()=>{this.dirty=!0},this,0,0),this._roundPixels=z.ROUND_PIXELS,this.dirty=!0,this._resolution=z.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var M;const t=Hr.available[this._fontName],e=this.fontSize,s=e/t.size,r=new st,n=[],a=[],h=[],o=this._text.replace(/(?:\r\n|\r)/g,`
1138
+ `)||" ",l=zm(o),u=this._maxWidth*t.size/e,c=t.distanceFieldType==="none"?jm:qm;let d=null,f=0,p=0,m=0,g=-1,_=0,x=0,y=0,v=0;for(let R=0;R<l.length;R++){const C=l[R],P=Ka(C);if(/(?:\s)/.test(C)&&(g=R,_=f,v++),C==="\r"||C===`
1139
+ `){a.push(f),h.push(-1),p=Math.max(p,f),++m,++x,r.x=0,r.y+=t.lineHeight,d=null,v=0;continue}const k=t.chars[P];if(!k)continue;d&&k.kerning[d]&&(r.x+=k.kerning[d]);const U=Zm.pop()||{texture:q.EMPTY,line:0,charCode:0,prevSpaces:0,position:new st};U.texture=k.texture,U.line=m,U.charCode=P,U.position.x=Math.round(r.x+k.xOffset+this._letterSpacing/2),U.position.y=Math.round(r.y+k.yOffset),U.prevSpaces=v,n.push(U),f=U.position.x+Math.max(k.xAdvance-k.xOffset,k.texture.orig.width),r.x+=k.xAdvance+this._letterSpacing,y=Math.max(y,k.yOffset+k.texture.height),d=P,g!==-1&&u>0&&r.x>u&&(++x,nn(n,1+g-x,1+R-g),R=g,g=-1,a.push(_),h.push(n.length>0?n[n.length-1].prevSpaces:0),p=Math.max(p,_),m++,r.x=0,r.y+=t.lineHeight,d=null,v=0)}const b=l[l.length-1];b!=="\r"&&b!==`
1140
+ `&&(/(?:\s)/.test(b)&&(f=_),a.push(f),p=Math.max(p,f),h.push(-1));const w=[];for(let R=0;R<=m;R++){let C=0;this._align==="right"?C=p-a[R]:this._align==="center"?C=(p-a[R])/2:this._align==="justify"&&(C=h[R]<0?0:(p-a[R])/h[R]),w.push(C)}const E=n.length,T={},A=[],I=this._activePagesMeshData;c.push(...I);for(let R=0;R<E;R++){const C=n[R].texture,P=C.baseTexture.uid;if(!T[P]){let k=c.pop();if(!k){const V=new fc;let L,$;t.distanceFieldType==="none"?(L=new $a(q.EMPTY),$=W.NORMAL):(L=new $a(q.EMPTY,{program:yr.from(oA,nA),uniforms:{uFWidth:0}}),$=W.NORMAL_NPM);const O=new Xa(V,L);O.blendMode=$,k={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:O,vertices:null,uvs:null,indices:null}}k.index=0,k.indexCount=0,k.vertexCount=0,k.uvsCount=0,k.total=0;const{_textureCache:U}=this;U[P]=U[P]||new q(C.baseTexture),k.mesh.texture=U[P],k.mesh.tint=this._tintColor.value,A.push(k),T[P]=k}T[P].total++}for(let R=0;R<I.length;R++)A.includes(I[R])||this.removeChild(I[R].mesh);for(let R=0;R<A.length;R++)A[R].mesh.parent!==this&&this.addChild(A[R].mesh);this._activePagesMeshData=A;for(const R in T){const C=T[R],P=C.total;if(!(((M=C.indices)==null?void 0:M.length)>6*P)||C.vertices.length<Xa.BATCHABLE_SIZE*2)C.vertices=new Float32Array(4*2*P),C.uvs=new Float32Array(4*2*P),C.indices=new Uint16Array(6*P);else{const k=C.total,U=C.vertices;for(let V=k*4*2;V<U.length;V++)U[V]=0}C.mesh.size=6*P}for(let R=0;R<E;R++){const C=n[R];let P=C.position.x+w[C.line]*(this._align==="justify"?C.prevSpaces:1);this._roundPixels&&(P=Math.round(P));const k=P*s,U=C.position.y*s,V=C.texture,L=T[V.baseTexture.uid],$=V.frame,O=V._uvs,N=L.index++;L.indices[N*6+0]=0+N*4,L.indices[N*6+1]=1+N*4,L.indices[N*6+2]=2+N*4,L.indices[N*6+3]=0+N*4,L.indices[N*6+4]=2+N*4,L.indices[N*6+5]=3+N*4,L.vertices[N*8+0]=k,L.vertices[N*8+1]=U,L.vertices[N*8+2]=k+$.width*s,L.vertices[N*8+3]=U,L.vertices[N*8+4]=k+$.width*s,L.vertices[N*8+5]=U+$.height*s,L.vertices[N*8+6]=k,L.vertices[N*8+7]=U+$.height*s,L.uvs[N*8+0]=O.x0,L.uvs[N*8+1]=O.y0,L.uvs[N*8+2]=O.x1,L.uvs[N*8+3]=O.y1,L.uvs[N*8+4]=O.x2,L.uvs[N*8+5]=O.y2,L.uvs[N*8+6]=O.x3,L.uvs[N*8+7]=O.y3}this._textWidth=p*s,this._textHeight=(r.y+t.lineHeight)*s;for(const R in T){const C=T[R];if(this.anchor.x!==0||this.anchor.y!==0){let V=0;const L=this._textWidth*this.anchor.x,$=this._textHeight*this.anchor.y;for(let O=0;O<C.total;O++)C.vertices[V++]-=L,C.vertices[V++]-=$,C.vertices[V++]-=L,C.vertices[V++]-=$,C.vertices[V++]-=L,C.vertices[V++]-=$,C.vertices[V++]-=L,C.vertices[V++]-=$}this._maxLineHeight=y*s;const P=C.mesh.geometry.getBuffer("aVertexPosition"),k=C.mesh.geometry.getBuffer("aTextureCoord"),U=C.mesh.geometry.getIndex();P.data=C.vertices,k.data=C.uvs,U.data=C.indices,P.update(),k.update(),U.update()}for(let R=0;R<n.length;R++)Zm.push(n[R]);this._font=t,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}=Hr.available[this._fontName];if(s!=="none"){const{a:n,b:a,c:h,d:o}=this.worldTransform,l=Math.sqrt(n*n+a*a),u=Math.sqrt(h*h+o*o),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=Hr.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(!Hr.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??Hr.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??""),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=Hr.available[this._fontName].distanceFieldType==="none"?jm:qm;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=q.EMPTY});for(const r in e)e[r].destroy(),delete e[r];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};Km.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let aA=Km;const lA=[".xml",".fnt"],hA={extension:{type:Y.LoadParser,priority:Ne.Normal},name:"loadBitmapFont",test(i){return lA.includes(bt.extname(i).toLowerCase())},async testParse(i){return Za.test(i)||yc.test(i)},async parse(i,t,e){const s=Za.test(i)?Za.parse(i):yc.parse(i),{src:r}=t,{page:n}=s,a=[];for(let l=0;l<n.length;++l){const u=n[l].file;let c=bt.join(bt.dirname(r),u);c=tc(c,r),a.push(c)}const h=await e.load(a),o=a.map(l=>h[l]);return Hr.install(s,o,!0)},async load(i,t){return(await z.ADAPTER.fetch(i)).text()},unload(i){i.destroy()}};K.add(hA);const vc=class Nn extends vr{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new Nn(Object.keys(Nn.defaultOptions).reduce((e,s)=>({...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 Nn.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:s}=Nn;if(s[t]){const r=s[t];return this._fonts.push(r),r.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return z.ADAPTER.fetch(t).then(r=>r.blob()).then(async r=>new Promise((n,a)=>{const h=URL.createObjectURL(r),o=new FileReader;o.onload=()=>n([h,o.result]),o.onerror=a,o.readAsDataURL(r)})).then(async([r,n])=>{const a=Object.assign({family:bt.basename(t,bt.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 h=new FontFace(a.family,`url(${a.src})`,{weight:a.weight,style:a.style,display:a.display});a.fontFace=h,await h.load(),document.fonts.add(h),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}
1141
1141
  @font-face {
1142
1142
  font-family: "${e.family}";
1143
1143
  src: url('${e.dataSrc}');
1144
1144
  font-weight: ${e.weight};
1145
1145
  font-style: ${e.style};
1146
1146
  font-display: ${e.display};
1147
- }`,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=eo(t)),typeof t=="number"?zb(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,Nn.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}=z.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}};Ec.availableFonts={},Ec.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 Tc=Ec;const Qa=class Vn extends qe{constructor(t="",e={}){super(q.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const s=new Image,r=q.from(s,{scaleMode:z.SCALE_MODE,resourceOptions:{autoLoad:!1}});r.orig=new rt,r.trim=new rt,this.texture=r;const n="http://www.w3.org/2000/svg",a="http://www.w3.org/1999/xhtml",h=document.createElementNS(n,"svg"),o=document.createElementNS(n,"foreignObject"),l=document.createElementNS(a,"div"),u=document.createElementNS(a,"style");o.setAttribute("width","10000"),o.setAttribute("height","10000"),o.style.overflow="hidden",h.appendChild(o),this.maxWidth=Vn.defaultMaxWidth,this.maxHeight=Vn.defaultMaxHeight,this._domElement=l,this._styleElement=u,this._svgRoot=h,this._foreignObject=o,this._foreignObject.appendChild(u),this._foreignObject.appendChild(l),this._image=s,this._loadImage=new Image,this._autoResolution=Vn.defaultAutoResolution,this._resolution=Vn.defaultResolution??z.RESOLUTION,this.text=t,this.style=e}measureText(t){var u,c;const{text:e,style:s,resolution:r}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:e,style:s.toCSS(r)}),this._styleElement.textContent=s.toGlobalCSS(),document.body.appendChild(this._svgRoot);const n=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:a,height:h}=n;(a>this.maxWidth||h>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");const o=Math.min(this.maxWidth,Math.ceil(a)),l=Math.min(this.maxHeight,Math.ceil(h));return this._svgRoot.setAttribute("width",o.toString()),this._svgRoot.setAttribute("height",l.toString()),e!==this._text&&(this._domElement.innerHTML=this._text),s!==this._style&&(Object.assign(this._domElement,{style:(u=this._style)==null?void 0:u.toCSS(r)}),this._styleElement.textContent=(c=this._style)==null?void 0:c.toGlobalCSS()),{width:o+s.padding*2,height:l+s.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 h=this._updateID;await new Promise(o=>{r.onload=async()=>{if(h<this._updateID){o();return}await e.onBeforeDraw(),s.src=r.src,r.onload=null,r.src="",this.updateTexture(),o()};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 s,r,n,a,h;typeof t=="boolean"&&(t={children:t}),t=Object.assign({},Vn.defaultDestroyOptions,t),super.destroy(t);const e=null;this.ownsStyle&&((s=this._style)==null||s.cleanFonts()),this._style=e,(r=this._svgRoot)==null||r.remove(),this._svgRoot=e,(n=this._domElement)==null||n.remove(),this._domElement=e,(a=this._foreignObject)==null||a.remove(),this._foreignObject=e,(h=this._styleElement)==null||h.remove(),this._styleElement=e,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=e,this._image.src="",this._image=e}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(t){this.updateText(!0);const e=Dr(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=Dr(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 Tc?(this.ownsStyle=!1,this._style=t):t instanceof vr?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=Tc.from(t)):(this.ownsStyle=!0,this._style=new Tc(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(/&nbsp;/gi,"&#160;")}};Qa.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Qa.defaultMaxWidth=2024,Qa.defaultMaxHeight=2024,Qa.defaultAutoResolution=!0;class lA{constructor(t,e){this._fontName=t,this._defaultFontSize=e}createText(t,e){return new nA(t.toString(),{fontName:this._fontName,fontSize:this._defaultFontSize||e})}}function br(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function rg(i,t){i.prototype=Object.create(t.prototype),i.prototype.constructor=i,i.__proto__=t}/*!
1147
+ }`,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=eo(t)),typeof t=="number"?qb(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,Nn.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}=z.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}};vc.availableFonts={},vc.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 bc=vc;const Qa=class Vn extends qe{constructor(t="",e={}){super(q.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const s=new Image,r=q.from(s,{scaleMode:z.SCALE_MODE,resourceOptions:{autoLoad:!1}});r.orig=new rt,r.trim=new rt,this.texture=r;const n="http://www.w3.org/2000/svg",a="http://www.w3.org/1999/xhtml",h=document.createElementNS(n,"svg"),o=document.createElementNS(n,"foreignObject"),l=document.createElementNS(a,"div"),u=document.createElementNS(a,"style");o.setAttribute("width","10000"),o.setAttribute("height","10000"),o.style.overflow="hidden",h.appendChild(o),this.maxWidth=Vn.defaultMaxWidth,this.maxHeight=Vn.defaultMaxHeight,this._domElement=l,this._styleElement=u,this._svgRoot=h,this._foreignObject=o,this._foreignObject.appendChild(u),this._foreignObject.appendChild(l),this._image=s,this._loadImage=new Image,this._autoResolution=Vn.defaultAutoResolution,this._resolution=Vn.defaultResolution??z.RESOLUTION,this.text=t,this.style=e}measureText(t){var u,c;const{text:e,style:s,resolution:r}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:e,style:s.toCSS(r)}),this._styleElement.textContent=s.toGlobalCSS(),document.body.appendChild(this._svgRoot);const n=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:a,height:h}=n;(a>this.maxWidth||h>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");const o=Math.min(this.maxWidth,Math.ceil(a)),l=Math.min(this.maxHeight,Math.ceil(h));return this._svgRoot.setAttribute("width",o.toString()),this._svgRoot.setAttribute("height",l.toString()),e!==this._text&&(this._domElement.innerHTML=this._text),s!==this._style&&(Object.assign(this._domElement,{style:(u=this._style)==null?void 0:u.toCSS(r)}),this._styleElement.textContent=(c=this._style)==null?void 0:c.toGlobalCSS()),{width:o+s.padding*2,height:l+s.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 h=this._updateID;await new Promise(o=>{r.onload=async()=>{if(h<this._updateID){o();return}await e.onBeforeDraw(),s.src=r.src,r.onload=null,r.src="",this.updateTexture(),o()};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 s,r,n,a,h;typeof t=="boolean"&&(t={children:t}),t=Object.assign({},Vn.defaultDestroyOptions,t),super.destroy(t);const e=null;this.ownsStyle&&((s=this._style)==null||s.cleanFonts()),this._style=e,(r=this._svgRoot)==null||r.remove(),this._svgRoot=e,(n=this._domElement)==null||n.remove(),this._domElement=e,(a=this._foreignObject)==null||a.remove(),this._foreignObject=e,(h=this._styleElement)==null||h.remove(),this._styleElement=e,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=e,this._image.src="",this._image=e}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(t){this.updateText(!0);const e=Dr(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=Dr(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 bc?(this.ownsStyle=!1,this._style=t):t instanceof vr?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=bc.from(t)):(this.ownsStyle=!0,this._style=new bc(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(/&nbsp;/gi,"&#160;")}};Qa.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Qa.defaultMaxWidth=2024,Qa.defaultMaxHeight=2024,Qa.defaultAutoResolution=!0;class cA{constructor(t,e){this._fontName=t,this._defaultFontSize=e}createText(t,e){return new aA(t.toString(),{fontName:this._fontName,fontSize:this._defaultFontSize||e})}}function br(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Qm(i,t){i.prototype=Object.create(t.prototype),i.prototype.constructor=i,i.__proto__=t}/*!
1148
1148
  * GSAP 3.12.5
1149
1149
  * https://gsap.com
1150
1150
  *
@@ -1152,7 +1152,7 @@ void main(void)\r
1152
1152
  * Subject to the terms at https://gsap.com/standard-license or for
1153
1153
  * Club GSAP members, the agreement issued with that membership.
1154
1154
  * @author: Jack Doyle, jack@greensock.com
1155
- */var Ze={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},_n={duration:.5,overwrite:!1,delay:0},Ac,Ae,Dt,cs=1e8,Mt=1/cs,Sc=Math.PI*2,hA=Sc/4,cA=0,ig=Math.sqrt,uA=Math.cos,dA=Math.sin,me=function(t){return typeof t=="string"},Zt=function(t){return typeof t=="function"},wr=function(t){return typeof t=="number"},Cc=function(t){return typeof t>"u"},Js=function(t){return typeof t=="object"},Ve=function(t){return t!==!1},Ic=function(){return typeof window<"u"},Ja=function(t){return Zt(t)||me(t)},ng=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},Se=Array.isArray,Pc=/(?:-?\.?\d|\.)+/gi,og=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,yn=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Rc=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,ag=/[+-]=-?[.\d]+/,lg=/[^,'"\[\]\s]+/gi,fA=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Ut,tr,Mc,Fc,Ke={},tl={},hg,cg=function(t){return(tl=Pi(t,Ke))&&Xe},kc=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},co=function(t,e){return!e&&console.warn(t)},ug=function(t,e){return t&&(Ke[t]=e)&&tl&&(tl[t]=e)||Ke},uo=function(){return 0},pA={suppressEvents:!0,isStart:!0,kill:!1},el={suppressEvents:!0,kill:!1},mA={suppressEvents:!0},Bc={},Wr=[],Dc={},dg,Qe={},Oc={},fg=30,sl=[],Lc="",Nc=function(t){var e=t[0],s,r;if(Js(e)||Zt(e)||(t=[t]),!(s=(e._gsap||{}).harness)){for(r=sl.length;r--&&!sl[r].targetTest(e););s=sl[r]}for(r=t.length;r--;)t[r]&&(t[r]._gsap||(t[r]._gsap=new Xg(t[r],s)))||t.splice(r,1);return t},Ii=function(t){return t._gsap||Nc(fs(t))[0]._gsap},pg=function(t,e,s){return(s=t[e])&&Zt(s)?t[e]():Cc(s)&&t.getAttribute&&t.getAttribute(e)||s},Ue=function(t,e){return(t=t.split(",")).forEach(e)||t},te=function(t){return Math.round(t*1e5)/1e5||0},ge=function(t){return Math.round(t*1e7)/1e7||0},xn=function(t,e){var s=e.charAt(0),r=parseFloat(e.substr(2));return t=parseFloat(t),s==="+"?t+r:s==="-"?t-r:s==="*"?t*r:t/r},gA=function(t,e){for(var s=e.length,r=0;t.indexOf(e[r])<0&&++r<s;);return r<s},rl=function(){var t=Wr.length,e=Wr.slice(0),s,r;for(Dc={},Wr.length=0,s=0;s<t;s++)r=e[s],r&&r._lazy&&(r.render(r._lazy[0],r._lazy[1],!0)._lazy=0)},mg=function(t,e,s,r){Wr.length&&!Ae&&rl(),t.render(e,s,r||Ae&&e<0&&(t._initted||t._startAt)),Wr.length&&!Ae&&rl()},gg=function(t){var e=parseFloat(t);return(e||e===0)&&(t+"").match(lg).length<2?e:me(t)?t.trim():t},_g=function(t){return t},us=function(t,e){for(var s in e)s in t||(t[s]=e[s]);return t},_A=function(t){return function(e,s){for(var r in s)r in e||r==="duration"&&t||r==="ease"||(e[r]=s[r])}},Pi=function(t,e){for(var s in e)t[s]=e[s];return t},yg=function i(t,e){for(var s in e)s!=="__proto__"&&s!=="constructor"&&s!=="prototype"&&(t[s]=Js(e[s])?i(t[s]||(t[s]={}),e[s]):e[s]);return t},il=function(t,e){var s={},r;for(r in t)r in e||(s[r]=t[r]);return s},fo=function(t){var e=t.parent||Ut,s=t.keyframes?_A(Se(t.keyframes)):us;if(Ve(t.inherit))for(;e;)s(t,e.vars.defaults),e=e.parent||e._dp;return t},yA=function(t,e){for(var s=t.length,r=s===e.length;r&&s--&&t[s]===e[s];);return s<0},xg=function(t,e,s,r,n){s===void 0&&(s="_first"),r===void 0&&(r="_last");var a=t[r],h;if(n)for(h=e[n];a&&a[n]>h;)a=a._prev;return a?(e._next=a._next,a._next=e):(e._next=t[s],t[s]=e),e._next?e._next._prev=e:t[r]=e,e._prev=a,e.parent=e._dp=t,e},nl=function(t,e,s,r){s===void 0&&(s="_first"),r===void 0&&(r="_last");var n=e._prev,a=e._next;n?n._next=a:t[s]===e&&(t[s]=a),a?a._prev=n:t[r]===e&&(t[r]=n),e._next=e._prev=e.parent=null},zr=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},Ri=function(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var s=t;s;)s._dirty=1,s=s.parent;return t},xA=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},Vc=function(t,e,s,r){return t._startAt&&(Ae?t._startAt.revert(el):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,r))},vA=function i(t){return!t||t._ts&&i(t.parent)},vg=function(t){return t._repeat?vn(t._tTime,t=t.duration()+t._rDelay)*t:0},vn=function(t,e){var s=Math.floor(t/=e);return t&&s===t?s-1:s},ol=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},al=function(t){return t._end=ge(t._start+(t._tDur/Math.abs(t._ts||t._rts||Mt)||0))},ll=function(t,e){var s=t._dp;return s&&s.smoothChildTiming&&t._ts&&(t._start=ge(s._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),al(t),s._dirty||Ri(s,t)),t},bg=function(t,e){var s;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(s=ol(t.rawTime(),e),(!e._dur||mo(0,e.totalDuration(),s)-e._tTime>Mt)&&e.render(s,!0)),Ri(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(s=t;s._dp;)s.rawTime()>=0&&s.totalTime(s._tTime),s=s._dp;t._zTime=-Mt}},er=function(t,e,s,r){return e.parent&&zr(e),e._start=ge((wr(s)?s:s||t!==Ut?ds(t,s,e):t._time)+e._delay),e._end=ge(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),xg(t,e,"_first","_last",t._sort?"_start":0),Uc(e)||(t._recent=e),r||bg(t,e),t._ts<0&&ll(t,t._tTime),t},wg=function(t,e){return(Ke.ScrollTrigger||kc("scrollTrigger",e))&&Ke.ScrollTrigger.create(e,t)},Eg=function(t,e,s,r,n){if(qc(t,e,n),!t._initted)return 1;if(!s&&t._pt&&!Ae&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&dg!==ts.frame)return Wr.push(t),t._lazy=[n,r],1},bA=function i(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||i(e))},Uc=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},wA=function(t,e,s,r){var n=t.ratio,a=e<0||!e&&(!t._start&&bA(t)&&!(!t._initted&&Uc(t))||(t._ts<0||t._dp._ts<0)&&!Uc(t))?0:1,h=t._rDelay,o=0,l,u,c;if(h&&t._repeat&&(o=mo(0,t._tDur,e),u=vn(o,h),t._yoyo&&u&1&&(a=1-a),u!==vn(t._tTime,h)&&(n=1-a,t.vars.repeatRefresh&&t._initted&&t.invalidate())),a!==n||Ae||r||t._zTime===Mt||!e&&t._zTime){if(!t._initted&&Eg(t,e,r,s,o))return;for(c=t._zTime,t._zTime=e||(s?Mt:0),s||(s=e&&!c),t.ratio=a,t._from&&(a=1-a),t._time=0,t._tTime=o,l=t._pt;l;)l.r(a,l.d),l=l._next;e<0&&Vc(t,e,s,!0),t._onUpdate&&!s&&Je(t,"onUpdate"),o&&t._repeat&&!s&&t.parent&&Je(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===a&&(a&&zr(t,1),!s&&!Ae&&(Je(t,a?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},EA=function(t,e,s){var r;if(s>e)for(r=t._first;r&&r._start<=s;){if(r.data==="isPause"&&r._start>e)return r;r=r._next}else for(r=t._last;r&&r._start>=s;){if(r.data==="isPause"&&r._start<e)return r;r=r._prev}},bn=function(t,e,s,r){var n=t._repeat,a=ge(e)||0,h=t._tTime/t._tDur;return h&&!r&&(t._time*=a/t._dur),t._dur=a,t._tDur=n?n<0?1e10:ge(a*(n+1)+t._rDelay*n):a,h>0&&!r&&ll(t,t._tTime=t._tDur*h),t.parent&&al(t),s||Ri(t.parent,t),t},Tg=function(t){return t instanceof Me?Ri(t):bn(t,t._dur)},TA={_start:0,endTime:uo,totalDuration:uo},ds=function i(t,e,s){var r=t.labels,n=t._recent||TA,a=t.duration()>=cs?n.endTime(!1):t._dur,h,o,l;return me(e)&&(isNaN(e)||e in r)?(o=e.charAt(0),l=e.substr(-1)==="%",h=e.indexOf("="),o==="<"||o===">"?(h>=0&&(e=e.replace(/=/,"")),(o==="<"?n._start:n.endTime(n._repeat>=0))+(parseFloat(e.substr(1))||0)*(l?(h<0?n:s).totalDuration()/100:1)):h<0?(e in r||(r[e]=a),r[e]):(o=parseFloat(e.charAt(h-1)+e.substr(h+1)),l&&s&&(o=o/100*(Se(s)?s[0]:s).totalDuration()),h>1?i(t,e.substr(0,h-1),s)+o:a+o)):e==null?a:+e},po=function(t,e,s){var r=wr(e[1]),n=(r?2:1)+(t<2?0:1),a=e[n],h,o;if(r&&(a.duration=e[1]),a.parent=s,t){for(h=a,o=s;o&&!("immediateRender"in h);)h=o.vars.defaults||{},o=Ve(o.vars.inherit)&&o.parent;a.immediateRender=Ve(h.immediateRender),t<2?a.runBackwards=1:a.startAt=e[n-1]}return new ie(e[0],a,e[n+1])},jr=function(t,e){return t||t===0?e(t):e},mo=function(t,e,s){return s<t?t:s>e?e:s},Ce=function(t,e){return!me(t)||!(e=fA.exec(t))?"":e[1]},AA=function(t,e,s){return jr(s,function(r){return mo(t,e,r)})},Gc=[].slice,Ag=function(t,e){return t&&Js(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&Js(t[0]))&&!t.nodeType&&t!==tr},SA=function(t,e,s){return s===void 0&&(s=[]),t.forEach(function(r){var n;return me(r)&&!e||Ag(r,1)?(n=s).push.apply(n,fs(r)):s.push(r)})||s},fs=function(t,e,s){return Dt&&!e&&Dt.selector?Dt.selector(t):me(t)&&!s&&(Mc||!En())?Gc.call((e||Fc).querySelectorAll(t),0):Se(t)?SA(t,s):Ag(t)?Gc.call(t,0):t?[t]:[]},Xc=function(t){return t=fs(t)[0]||co("Invalid scope")||{},function(e){var s=t.current||t.nativeElement||t;return fs(e,s.querySelectorAll?s:s===t?co("Invalid scope")||Fc.createElement("div"):t)}},Sg=function(t){return t.sort(function(){return .5-Math.random()})},Cg=function(t){if(Zt(t))return t;var e=Js(t)?t:{each:t},s=Mi(e.ease),r=e.from||0,n=parseFloat(e.base)||0,a={},h=r>0&&r<1,o=isNaN(r)||h,l=e.axis,u=r,c=r;return me(r)?u=c={center:.5,edges:.5,end:1}[r]||0:!h&&o&&(u=r[0],c=r[1]),function(d,f,p){var m=(p||e).length,g=a[m],_,x,y,v,b,w,E,T,A;if(!g){if(A=e.grid==="auto"?0:(e.grid||[1,cs])[1],!A){for(E=-cs;E<(E=p[A++].getBoundingClientRect().left)&&A<m;);A<m&&A--}for(g=a[m]=[],_=o?Math.min(A,m)*u-.5:r%A,x=A===cs?0:o?m*c/A-.5:r/A|0,E=0,T=cs,w=0;w<m;w++)y=w%A-_,v=x-(w/A|0),g[w]=b=l?Math.abs(l==="y"?v:y):ig(y*y+v*v),b>E&&(E=b),b<T&&(T=b);r==="random"&&Sg(g),g.max=E-T,g.min=T,g.v=m=(parseFloat(e.amount)||parseFloat(e.each)*(A>m?m-1:l?l==="y"?m/A:A:Math.max(A,m/A))||0)*(r==="edges"?-1:1),g.b=m<0?n-m:n,g.u=Ce(e.amount||e.each)||0,s=s&&m<0?Vg(s):s}return m=(g[d]-g.min)/g.max||0,ge(g.b+(s?s(m):m)*g.v)+g.u}},$c=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(s){var r=ge(Math.round(parseFloat(s)/t)*t*e);return(r-r%1)/e+(wr(s)?0:Ce(s))}},Ig=function(t,e){var s=Se(t),r,n;return!s&&Js(t)&&(r=s=t.radius||cs,t.values?(t=fs(t.values),(n=!wr(t[0]))&&(r*=r)):t=$c(t.increment)),jr(e,s?Zt(t)?function(a){return n=t(a),Math.abs(n-a)<=r?n:a}:function(a){for(var h=parseFloat(n?a.x:a),o=parseFloat(n?a.y:0),l=cs,u=0,c=t.length,d,f;c--;)n?(d=t[c].x-h,f=t[c].y-o,d=d*d+f*f):d=Math.abs(t[c]-h),d<l&&(l=d,u=c);return u=!r||l<=r?t[u]:a,n||u===a||wr(a)?u:u+Ce(a)}:$c(t))},Pg=function(t,e,s,r){return jr(Se(t)?!e:s===!0?!!(s=0):!r,function(){return Se(t)?t[~~(Math.random()*t.length)]:(s=s||1e-5)&&(r=s<1?Math.pow(10,(s+"").length-2):1)&&Math.floor(Math.round((t-s/2+Math.random()*(e-t+s*.99))/s)*s*r)/r})},CA=function(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];return function(r){return e.reduce(function(n,a){return a(n)},r)}},IA=function(t,e){return function(s){return t(parseFloat(s))+(e||Ce(s))}},PA=function(t,e,s){return Mg(t,e,0,1,s)},Rg=function(t,e,s){return jr(s,function(r){return t[~~e(r)]})},RA=function i(t,e,s){var r=e-t;return Se(t)?Rg(t,i(0,t.length),e):jr(s,function(n){return(r+(n-t)%r)%r+t})},MA=function i(t,e,s){var r=e-t,n=r*2;return Se(t)?Rg(t,i(0,t.length-1),e):jr(s,function(a){return a=(n+(a-t)%n)%n||0,t+(a>r?n-a:a)})},go=function(t){for(var e=0,s="",r,n,a,h;~(r=t.indexOf("random(",e));)a=t.indexOf(")",r),h=t.charAt(r+7)==="[",n=t.substr(r+7,a-r-7).match(h?lg:Pc),s+=t.substr(e,r-e)+Pg(h?n:+n[0],h?0:+n[1],+n[2]||1e-5),e=a+1;return s+t.substr(e,t.length-e)},Mg=function(t,e,s,r,n){var a=e-t,h=r-s;return jr(n,function(o){return s+((o-t)/a*h||0)})},FA=function i(t,e,s,r){var n=isNaN(t+e)?0:function(f){return(1-f)*t+f*e};if(!n){var a=me(t),h={},o,l,u,c,d;if(s===!0&&(r=1)&&(s=null),a)t={p:t},e={p:e};else if(Se(t)&&!Se(e)){for(u=[],c=t.length,d=c-2,l=1;l<c;l++)u.push(i(t[l-1],t[l]));c--,n=function(p){p*=c;var m=Math.min(d,~~p);return u[m](p-m)},s=e}else r||(t=Pi(Se(t)?[]:{},t));if(!u){for(o in e)zc.call(h,t,o,"get",e[o]);n=function(p){return Qc(p,h)||(a?t.p:t)}}}return jr(s,n)},Fg=function(t,e,s){var r=t.labels,n=cs,a,h,o;for(a in r)h=r[a]-e,h<0==!!s&&h&&n>(h=Math.abs(h))&&(o=a,n=h);return o},Je=function(t,e,s){var r=t.vars,n=r[e],a=Dt,h=t._ctx,o,l,u;if(n)return o=r[e+"Params"],l=r.callbackScope||t,s&&Wr.length&&rl(),h&&(Dt=h),u=o?n.apply(l,o):n.call(l),Dt=a,u},_o=function(t){return zr(t),t.scrollTrigger&&t.scrollTrigger.kill(!!Ae),t.progress()<1&&Je(t,"onInterrupt"),t},wn,kg=[],Bg=function(t){if(t)if(t=!t.name&&t.default||t,Ic()||t.headless){var e=t.name,s=Zt(t),r=e&&!s&&t.init?function(){this._props=[]}:t,n={init:uo,render:Qc,add:zc,kill:jA,modifier:zA,rawVars:0},a={targetTest:0,get:0,getSetter:Kc,aliases:{},register:0};if(En(),t!==r){if(Qe[e])return;us(r,us(il(t,n),a)),Pi(r.prototype,Pi(n,il(t,a))),Qe[r.prop=e]=r,t.targetTest&&(sl.push(r),Bc[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}ug(e,r),t.register&&t.register(Xe,r,Ge)}else kg.push(t)},It=255,yo={aqua:[0,It,It],lime:[0,It,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,It],navy:[0,0,128],white:[It,It,It],olive:[128,128,0],yellow:[It,It,0],orange:[It,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[It,0,0],pink:[It,192,203],cyan:[0,It,It],transparent:[It,It,It,0]},Yc=function(t,e,s){return t+=t<0?1:t>1?-1:0,(t*6<1?e+(s-e)*t*6:t<.5?s:t*3<2?e+(s-e)*(2/3-t)*6:e)*It+.5|0},Dg=function(t,e,s){var r=t?wr(t)?[t>>16,t>>8&It,t&It]:0:yo.black,n,a,h,o,l,u,c,d,f,p;if(!r){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),yo[t])r=yo[t];else if(t.charAt(0)==="#"){if(t.length<6&&(n=t.charAt(1),a=t.charAt(2),h=t.charAt(3),t="#"+n+n+a+a+h+h+(t.length===5?t.charAt(4)+t.charAt(4):"")),t.length===9)return r=parseInt(t.substr(1,6),16),[r>>16,r>>8&It,r&It,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),r=[t>>16,t>>8&It,t&It]}else if(t.substr(0,3)==="hsl"){if(r=p=t.match(Pc),!e)o=+r[0]%360/360,l=+r[1]/100,u=+r[2]/100,a=u<=.5?u*(l+1):u+l-u*l,n=u*2-a,r.length>3&&(r[3]*=1),r[0]=Yc(o+1/3,n,a),r[1]=Yc(o,n,a),r[2]=Yc(o-1/3,n,a);else if(~t.indexOf("="))return r=t.match(og),s&&r.length<4&&(r[3]=1),r}else r=t.match(Pc)||yo.transparent;r=r.map(Number)}return e&&!p&&(n=r[0]/It,a=r[1]/It,h=r[2]/It,c=Math.max(n,a,h),d=Math.min(n,a,h),u=(c+d)/2,c===d?o=l=0:(f=c-d,l=u>.5?f/(2-c-d):f/(c+d),o=c===n?(a-h)/f+(a<h?6:0):c===a?(h-n)/f+2:(n-a)/f+4,o*=60),r[0]=~~(o+.5),r[1]=~~(l*100+.5),r[2]=~~(u*100+.5)),s&&r.length<4&&(r[3]=1),r},Og=function(t){var e=[],s=[],r=-1;return t.split(qr).forEach(function(n){var a=n.match(yn)||[];e.push.apply(e,a),s.push(r+=a.length+1)}),e.c=s,e},Lg=function(t,e,s){var r="",n=(t+r).match(qr),a=e?"hsla(":"rgba(",h=0,o,l,u,c;if(!n)return t;if(n=n.map(function(d){return(d=Dg(d,e,1))&&a+(e?d[0]+","+d[1]+"%,"+d[2]+"%,"+d[3]:d.join(","))+")"}),s&&(u=Og(t),o=s.c,o.join(r)!==u.c.join(r)))for(l=t.replace(qr,"1").split(yn),c=l.length-1;h<c;h++)r+=l[h]+(~o.indexOf(h)?n.shift()||a+"0,0,0,0)":(u.length?u:n.length?n:s).shift());if(!l)for(l=t.split(qr),c=l.length-1;h<c;h++)r+=l[h]+n[h];return r+l[c]},qr=function(){var i="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in yo)i+="|"+t+"\\b";return new RegExp(i+")","gi")}(),kA=/hsl[a]?\(/,Ng=function(t){var e=t.join(" "),s;if(qr.lastIndex=0,qr.test(e))return s=kA.test(e),t[1]=Lg(t[1],s),t[0]=Lg(t[0],s,Og(t[1])),!0},xo,ts=function(){var i=Date.now,t=500,e=33,s=i(),r=s,n=1e3/240,a=n,h=[],o,l,u,c,d,f,p=function m(g){var _=i()-r,x=g===!0,y,v,b,w;if((_>t||_<0)&&(s+=_-e),r+=_,b=r-s,y=b-a,(y>0||x)&&(w=++c.frame,d=b-c.time*1e3,c.time=b=b/1e3,a+=y+(y>=n?4:n-y),v=1),x||(o=l(m)),v)for(f=0;f<h.length;f++)h[f](b,d,w,g)};return c={time:0,frame:0,tick:function(){p(!0)},deltaRatio:function(g){return d/(1e3/(g||60))},wake:function(){hg&&(!Mc&&Ic()&&(tr=Mc=window,Fc=tr.document||{},Ke.gsap=Xe,(tr.gsapVersions||(tr.gsapVersions=[])).push(Xe.version),cg(tl||tr.GreenSockGlobals||!tr.gsap&&tr||{}),kg.forEach(Bg)),u=typeof requestAnimationFrame<"u"&&requestAnimationFrame,o&&c.sleep(),l=u||function(g){return setTimeout(g,a-c.time*1e3+1|0)},xo=1,p(2))},sleep:function(){(u?cancelAnimationFrame:clearTimeout)(o),xo=0,l=uo},lagSmoothing:function(g,_){t=g||1/0,e=Math.min(_||33,t)},fps:function(g){n=1e3/(g||240),a=c.time*1e3+n},add:function(g,_,x){var y=_?function(v,b,w,E){g(v,b,w,E),c.remove(y)}:g;return c.remove(g),h[x?"unshift":"push"](y),En(),y},remove:function(g,_){~(_=h.indexOf(g))&&h.splice(_,1)&&f>=_&&f--},_listeners:h},c}(),En=function(){return!xo&&ts.wake()},ut={},BA=/^[\d.\-M][\d.\-,\s]/,DA=/["']/g,OA=function(t){for(var e={},s=t.substr(1,t.length-3).split(":"),r=s[0],n=1,a=s.length,h,o,l;n<a;n++)o=s[n],h=n!==a-1?o.lastIndexOf(","):o.length,l=o.substr(0,h),e[r]=isNaN(l)?l.replace(DA,"").trim():+l,r=o.substr(h+1).trim();return e},LA=function(t){var e=t.indexOf("(")+1,s=t.indexOf(")"),r=t.indexOf("(",e);return t.substring(e,~r&&r<s?t.indexOf(")",s+1):s)},NA=function(t){var e=(t+"").split("("),s=ut[e[0]];return s&&e.length>1&&s.config?s.config.apply(null,~t.indexOf("{")?[OA(e[1])]:LA(t).split(",").map(gg)):ut._CE&&BA.test(t)?ut._CE("",t):s},Vg=function(t){return function(e){return 1-t(1-e)}},Ug=function i(t,e){for(var s=t._first,r;s;)s instanceof Me?i(s,e):s.vars.yoyoEase&&(!s._yoyo||!s._repeat)&&s._yoyo!==e&&(s.timeline?i(s.timeline,e):(r=s._ease,s._ease=s._yEase,s._yEase=r,s._yoyo=e)),s=s._next},Mi=function(t,e){return t&&(Zt(t)?t:ut[t]||NA(t))||e},Fi=function(t,e,s,r){s===void 0&&(s=function(o){return 1-e(1-o)}),r===void 0&&(r=function(o){return o<.5?e(o*2)/2:1-e((1-o)*2)/2});var n={easeIn:e,easeOut:s,easeInOut:r},a;return Ue(t,function(h){ut[h]=Ke[h]=n,ut[a=h.toLowerCase()]=s;for(var o in n)ut[a+(o==="easeIn"?".in":o==="easeOut"?".out":".inOut")]=ut[h+"."+o]=n[o]}),n},Gg=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},Hc=function i(t,e,s){var r=e>=1?e:1,n=(s||(t?.3:.45))/(e<1?e:1),a=n/Sc*(Math.asin(1/r)||0),h=function(u){return u===1?1:r*Math.pow(2,-10*u)*dA((u-a)*n)+1},o=t==="out"?h:t==="in"?function(l){return 1-h(1-l)}:Gg(h);return n=Sc/n,o.config=function(l,u){return i(t,l,u)},o},Wc=function i(t,e){e===void 0&&(e=1.70158);var s=function(a){return a?--a*a*((e+1)*a+e)+1:0},r=t==="out"?s:t==="in"?function(n){return 1-s(1-n)}:Gg(s);return r.config=function(n){return i(t,n)},r};Ue("Linear,Quad,Cubic,Quart,Quint,Strong",function(i,t){var e=t<5?t+1:t;Fi(i+",Power"+(e-1),t?function(s){return Math.pow(s,e)}:function(s){return s},function(s){return 1-Math.pow(1-s,e)},function(s){return s<.5?Math.pow(s*2,e)/2:1-Math.pow((1-s)*2,e)/2})}),ut.Linear.easeNone=ut.none=ut.Linear.easeIn,Fi("Elastic",Hc("in"),Hc("out"),Hc()),function(i,t){var e=1/t,s=2*e,r=2.5*e,n=function(h){return h<e?i*h*h:h<s?i*Math.pow(h-1.5/t,2)+.75:h<r?i*(h-=2.25/t)*h+.9375:i*Math.pow(h-2.625/t,2)+.984375};Fi("Bounce",function(a){return 1-n(1-a)},n)}(7.5625,2.75),Fi("Expo",function(i){return i?Math.pow(2,10*(i-1)):0}),Fi("Circ",function(i){return-(ig(1-i*i)-1)}),Fi("Sine",function(i){return i===1?1:-uA(i*hA)+1}),Fi("Back",Wc("in"),Wc("out"),Wc()),ut.SteppedEase=ut.steps=Ke.SteppedEase={config:function(t,e){t===void 0&&(t=1);var s=1/t,r=t+(e?0:1),n=e?1:0,a=1-Mt;return function(h){return((r*mo(0,a,h)|0)+n)*s}}},_n.ease=ut["quad.out"],Ue("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(i){return Lc+=i+","+i+"Params,"});var Xg=function(t,e){this.id=cA++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:pg,this.set=e?e.getSetter:Kc},vo=function(){function i(e){this.vars=e,this._delay=+e.delay||0,(this._repeat=e.repeat===1/0?-2:e.repeat||0)&&(this._rDelay=e.repeatDelay||0,this._yoyo=!!e.yoyo||!!e.yoyoEase),this._ts=1,bn(this,+e.duration,1,1),this.data=e.data,Dt&&(this._ctx=Dt,Dt.data.push(this)),xo||ts.wake()}var t=i.prototype;return t.delay=function(s){return s||s===0?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+s-this._delay),this._delay=s,this):this._delay},t.duration=function(s){return arguments.length?this.totalDuration(this._repeat>0?s+(s+this._rDelay)*this._repeat:s):this.totalDuration()&&this._dur},t.totalDuration=function(s){return arguments.length?(this._dirty=0,bn(this,this._repeat<0?s:(s-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(s,r){if(En(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(ll(this,s),!n._dp||n.parent||bg(n,this);n&&n.parent;)n.parent._time!==n._start+(n._ts>=0?n._tTime/n._ts:(n.totalDuration()-n._tTime)/-n._ts)&&n.totalTime(n._tTime,!0),n=n.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&s<this._tDur||this._ts<0&&s>0||!this._tDur&&!s)&&er(this._dp,this,this._start-this._delay)}return(this._tTime!==s||!this._dur&&!r||this._initted&&Math.abs(this._zTime)===Mt||!s&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=s),mg(this,s,r)),this},t.time=function(s,r){return arguments.length?this.totalTime(Math.min(this.totalDuration(),s+vg(this))%(this._dur+this._rDelay)||(s?this._dur:0),r):this._time},t.totalProgress=function(s,r){return arguments.length?this.totalTime(this.totalDuration()*s,r):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>0?1:0},t.progress=function(s,r){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-s:s)+vg(this),r):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},t.iteration=function(s,r){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(s-1)*n,r):this._repeat?vn(this._tTime,n)+1:1},t.timeScale=function(s,r){if(!arguments.length)return this._rts===-Mt?0:this._rts;if(this._rts===s)return this;var n=this.parent&&this._ts?ol(this.parent._time,this):this._tTime;return this._rts=+s||0,this._ts=this._ps||s===-Mt?0:this._rts,this.totalTime(mo(-Math.abs(this._delay),this._tDur,n),r!==!1),al(this),xA(this)},t.paused=function(s){return arguments.length?(this._ps!==s&&(this._ps=s,s?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(En(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==Mt&&(this._tTime-=Mt)))),this):this._ps},t.startTime=function(s){if(arguments.length){this._start=s;var r=this.parent||this._dp;return r&&(r._sort||!this.parent)&&er(r,this,s-this._delay),this}return this._start},t.endTime=function(s){return this._start+(Ve(s)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},t.rawTime=function(s){var r=this.parent||this._dp;return r?s&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?ol(r.rawTime(s),this):this._tTime:this._tTime},t.revert=function(s){s===void 0&&(s=mA);var r=Ae;return Ae=s,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(s),this.totalTime(-.01,s.suppressEvents)),this.data!=="nested"&&s.kill!==!1&&this.kill(),Ae=r,this},t.globalTime=function(s){for(var r=this,n=arguments.length?s:r.rawTime();r;)n=r._start+n/(Math.abs(r._ts)||1),r=r._dp;return!this.parent&&this._sat?this._sat.globalTime(s):n},t.repeat=function(s){return arguments.length?(this._repeat=s===1/0?-2:s,Tg(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(s){if(arguments.length){var r=this._time;return this._rDelay=s,Tg(this),r?this.time(r):this}return this._rDelay},t.yoyo=function(s){return arguments.length?(this._yoyo=s,this):this._yoyo},t.seek=function(s,r){return this.totalTime(ds(this,s),Ve(r))},t.restart=function(s,r){return this.play().totalTime(s?-this._delay:0,Ve(r))},t.play=function(s,r){return s!=null&&this.seek(s,r),this.reversed(!1).paused(!1)},t.reverse=function(s,r){return s!=null&&this.seek(s||this.totalDuration(),r),this.reversed(!0).paused(!1)},t.pause=function(s,r){return s!=null&&this.seek(s,r),this.paused(!0)},t.resume=function(){return this.paused(!1)},t.reversed=function(s){return arguments.length?(!!s!==this.reversed()&&this.timeScale(-this._rts||(s?-Mt:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-Mt,this},t.isActive=function(){var s=this.parent||this._dp,r=this._start,n;return!!(!s||this._ts&&this._initted&&s.isActive()&&(n=s.rawTime(!0))>=r&&n<this.endTime(!0)-Mt)},t.eventCallback=function(s,r,n){var a=this.vars;return arguments.length>1?(r?(a[s]=r,n&&(a[s+"Params"]=n),s==="onUpdate"&&(this._onUpdate=r)):delete a[s],this):a[s]},t.then=function(s){var r=this;return new Promise(function(n){var a=Zt(s)?s:_g,h=function(){var l=r.then;r.then=null,Zt(a)&&(a=a(r))&&(a.then||a===r)&&(r.then=l),n(a),r.then=l};r._initted&&r.totalProgress()===1&&r._ts>=0||!r._tTime&&r._ts<0?h():r._prom=h})},t.kill=function(){_o(this)},i}();us(vo.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-Mt,_prom:0,_ps:!1,_rts:1});var Me=function(i){rg(t,i);function t(s,r){var n;return s===void 0&&(s={}),n=i.call(this,s)||this,n.labels={},n.smoothChildTiming=!!s.smoothChildTiming,n.autoRemoveChildren=!!s.autoRemoveChildren,n._sort=Ve(s.sortChildren),Ut&&er(s.parent||Ut,br(n),r),s.reversed&&n.reverse(),s.paused&&n.paused(!0),s.scrollTrigger&&wg(br(n),s.scrollTrigger),n}var e=t.prototype;return e.to=function(r,n,a){return po(0,arguments,this),this},e.from=function(r,n,a){return po(1,arguments,this),this},e.fromTo=function(r,n,a,h){return po(2,arguments,this),this},e.set=function(r,n,a){return n.duration=0,n.parent=this,fo(n).repeatDelay||(n.repeat=0),n.immediateRender=!!n.immediateRender,new ie(r,n,ds(this,a),1),this},e.call=function(r,n,a){return er(this,ie.delayedCall(0,r,n),a)},e.staggerTo=function(r,n,a,h,o,l,u){return a.duration=n,a.stagger=a.stagger||h,a.onComplete=l,a.onCompleteParams=u,a.parent=this,new ie(r,a,ds(this,o)),this},e.staggerFrom=function(r,n,a,h,o,l,u){return a.runBackwards=1,fo(a).immediateRender=Ve(a.immediateRender),this.staggerTo(r,n,a,h,o,l,u)},e.staggerFromTo=function(r,n,a,h,o,l,u,c){return h.startAt=a,fo(h).immediateRender=Ve(h.immediateRender),this.staggerTo(r,n,h,o,l,u,c)},e.render=function(r,n,a){var h=this._time,o=this._dirty?this.totalDuration():this._tDur,l=this._dur,u=r<=0?0:ge(r),c=this._zTime<0!=r<0&&(this._initted||!l),d,f,p,m,g,_,x,y,v,b,w,E;if(this!==Ut&&u>o&&r>=0&&(u=o),u!==this._tTime||a||c){if(h!==this._time&&l&&(u+=this._time-h,r+=this._time-h),d=u,v=this._start,y=this._ts,_=!y,c&&(l||(h=this._zTime),(r||!n)&&(this._zTime=r)),this._repeat){if(w=this._yoyo,g=l+this._rDelay,this._repeat<-1&&r<0)return this.totalTime(g*100+r,n,a);if(d=ge(u%g),u===o?(m=this._repeat,d=l):(m=~~(u/g),m&&m===u/g&&(d=l,m--),d>l&&(d=l)),b=vn(this._tTime,g),!h&&this._tTime&&b!==m&&this._tTime-b*g-this._dur<=0&&(b=m),w&&m&1&&(d=l-d,E=1),m!==b&&!this._lock){var T=w&&b&1,A=T===(w&&m&1);if(m<b&&(T=!T),h=T?0:u%l?l:u,this._lock=1,this.render(h||(E?0:ge(m*g)),n,!l)._lock=0,this._tTime=u,!n&&this.parent&&Je(this,"onRepeat"),this.vars.repeatRefresh&&!E&&(this.invalidate()._lock=1),h&&h!==this._time||_!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(l=this._dur,o=this._tDur,A&&(this._lock=2,h=T?l:-1e-4,this.render(h,!0),this.vars.repeatRefresh&&!E&&this.invalidate()),this._lock=0,!this._ts&&!_)return this;Ug(this,E)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(x=EA(this,ge(h),ge(d)),x&&(u-=d-(d=x._start))),this._tTime=u,this._time=d,this._act=!y,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=r,h=0),!h&&d&&!n&&!m&&(Je(this,"onStart"),this._tTime!==u))return this;if(d>=h&&r>=0)for(f=this._first;f;){if(p=f._next,(f._act||d>=f._start)&&f._ts&&x!==f){if(f.parent!==this)return this.render(r,n,a);if(f.render(f._ts>0?(d-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(d-f._start)*f._ts,n,a),d!==this._time||!this._ts&&!_){x=0,p&&(u+=this._zTime=-Mt);break}}f=p}else{f=this._last;for(var I=r<0?r:d;f;){if(p=f._prev,(f._act||I<=f._end)&&f._ts&&x!==f){if(f.parent!==this)return this.render(r,n,a);if(f.render(f._ts>0?(I-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(I-f._start)*f._ts,n,a||Ae&&(f._initted||f._startAt)),d!==this._time||!this._ts&&!_){x=0,p&&(u+=this._zTime=I?-Mt:Mt);break}}f=p}}if(x&&!n&&(this.pause(),x.render(d>=h?0:-Mt)._zTime=d>=h?1:-1,this._ts))return this._start=v,al(this),this.render(r,n,a);this._onUpdate&&!n&&Je(this,"onUpdate",!0),(u===o&&this._tTime>=this.totalDuration()||!u&&h)&&(v===this._start||Math.abs(y)!==Math.abs(this._ts))&&(this._lock||((r||!l)&&(u===o&&this._ts>0||!u&&this._ts<0)&&zr(this,1),!n&&!(r<0&&!h)&&(u||h||!o)&&(Je(this,u===o&&r>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(u<o&&this.timeScale()>0)&&this._prom())))}return this},e.add=function(r,n){var a=this;if(wr(n)||(n=ds(this,n,r)),!(r instanceof vo)){if(Se(r))return r.forEach(function(h){return a.add(h,n)}),this;if(me(r))return this.addLabel(r,n);if(Zt(r))r=ie.delayedCall(0,r);else return this}return this!==r?er(this,r,n):this},e.getChildren=function(r,n,a,h){r===void 0&&(r=!0),n===void 0&&(n=!0),a===void 0&&(a=!0),h===void 0&&(h=-cs);for(var o=[],l=this._first;l;)l._start>=h&&(l instanceof ie?n&&o.push(l):(a&&o.push(l),r&&o.push.apply(o,l.getChildren(!0,n,a)))),l=l._next;return o},e.getById=function(r){for(var n=this.getChildren(1,1,1),a=n.length;a--;)if(n[a].vars.id===r)return n[a]},e.remove=function(r){return me(r)?this.removeLabel(r):Zt(r)?this.killTweensOf(r):(nl(this,r),r===this._recent&&(this._recent=this._last),Ri(this))},e.totalTime=function(r,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=ge(ts.time-(this._ts>0?r/this._ts:(this.totalDuration()-r)/-this._ts))),i.prototype.totalTime.call(this,r,n),this._forcing=0,this):this._tTime},e.addLabel=function(r,n){return this.labels[r]=ds(this,n),this},e.removeLabel=function(r){return delete this.labels[r],this},e.addPause=function(r,n,a){var h=ie.delayedCall(0,n||uo,a);return h.data="isPause",this._hasPause=1,er(this,h,ds(this,r))},e.removePause=function(r){var n=this._first;for(r=ds(this,r);n;)n._start===r&&n.data==="isPause"&&zr(n),n=n._next},e.killTweensOf=function(r,n,a){for(var h=this.getTweensOf(r,a),o=h.length;o--;)Zr!==h[o]&&h[o].kill(r,n);return this},e.getTweensOf=function(r,n){for(var a=[],h=fs(r),o=this._first,l=wr(n),u;o;)o instanceof ie?gA(o._targets,h)&&(l?(!Zr||o._initted&&o._ts)&&o.globalTime(0)<=n&&o.globalTime(o.totalDuration())>n:!n||o.isActive())&&a.push(o):(u=o.getTweensOf(h,n)).length&&a.push.apply(a,u),o=o._next;return a},e.tweenTo=function(r,n){n=n||{};var a=this,h=ds(a,r),o=n,l=o.startAt,u=o.onStart,c=o.onStartParams,d=o.immediateRender,f,p=ie.to(a,us({ease:n.ease||"none",lazy:!1,immediateRender:!1,time:h,overwrite:"auto",duration:n.duration||Math.abs((h-(l&&"time"in l?l.time:a._time))/a.timeScale())||Mt,onStart:function(){if(a.pause(),!f){var g=n.duration||Math.abs((h-(l&&"time"in l?l.time:a._time))/a.timeScale());p._dur!==g&&bn(p,g,0,1).render(p._time,!0,!0),f=1}u&&u.apply(p,c||[])}},n));return d?p.render(0):p},e.tweenFromTo=function(r,n,a){return this.tweenTo(n,us({startAt:{time:ds(this,r)}},a))},e.recent=function(){return this._recent},e.nextLabel=function(r){return r===void 0&&(r=this._time),Fg(this,ds(this,r))},e.previousLabel=function(r){return r===void 0&&(r=this._time),Fg(this,ds(this,r),1)},e.currentLabel=function(r){return arguments.length?this.seek(r,!0):this.previousLabel(this._time+Mt)},e.shiftChildren=function(r,n,a){a===void 0&&(a=0);for(var h=this._first,o=this.labels,l;h;)h._start>=a&&(h._start+=r,h._end+=r),h=h._next;if(n)for(l in o)o[l]>=a&&(o[l]+=r);return Ri(this)},e.invalidate=function(r){var n=this._first;for(this._lock=0;n;)n.invalidate(r),n=n._next;return i.prototype.invalidate.call(this,r)},e.clear=function(r){r===void 0&&(r=!0);for(var n=this._first,a;n;)a=n._next,this.remove(n),n=a;return this._dp&&(this._time=this._tTime=this._pTime=0),r&&(this.labels={}),Ri(this)},e.totalDuration=function(r){var n=0,a=this,h=a._last,o=cs,l,u,c;if(arguments.length)return a.timeScale((a._repeat<0?a.duration():a.totalDuration())/(a.reversed()?-r:r));if(a._dirty){for(c=a.parent;h;)l=h._prev,h._dirty&&h.totalDuration(),u=h._start,u>o&&a._sort&&h._ts&&!a._lock?(a._lock=1,er(a,h,u-h._delay,1)._lock=0):o=u,u<0&&h._ts&&(n-=u,(!c&&!a._dp||c&&c.smoothChildTiming)&&(a._start+=u/a._ts,a._time-=u,a._tTime-=u),a.shiftChildren(-u,!1,-1/0),o=0),h._end>n&&h._ts&&(n=h._end),h=l;bn(a,a===Ut&&a._time>n?a._time:n,1,1),a._dirty=0}return a._tDur},t.updateRoot=function(r){if(Ut._ts&&(mg(Ut,ol(r,Ut)),dg=ts.frame),ts.frame>=fg){fg+=Ze.autoSleep||120;var n=Ut._first;if((!n||!n._ts)&&Ze.autoSleep&&ts._listeners.length<2){for(;n&&!n._ts;)n=n._next;n||ts.sleep()}}},t}(vo);us(Me.prototype,{_lock:0,_hasPause:0,_forcing:0});var VA=function(t,e,s,r,n,a,h){var o=new Ge(this._pt,t,e,0,1,jg,null,n),l=0,u=0,c,d,f,p,m,g,_,x;for(o.b=s,o.e=r,s+="",r+="",(_=~r.indexOf("random("))&&(r=go(r)),a&&(x=[s,r],a(x,t,e),s=x[0],r=x[1]),d=s.match(Rc)||[];c=Rc.exec(r);)p=c[0],m=r.substring(l,c.index),f?f=(f+1)%5:m.substr(-5)==="rgba("&&(f=1),p!==d[u++]&&(g=parseFloat(d[u-1])||0,o._pt={_next:o._pt,p:m||u===1?m:",",s:g,c:p.charAt(1)==="="?xn(g,p)-g:parseFloat(p)-g,m:f&&f<4?Math.round:0},l=Rc.lastIndex);return o.c=l<r.length?r.substring(l,r.length):"",o.fp=h,(ag.test(r)||_)&&(o.e=0),this._pt=o,o},zc=function(t,e,s,r,n,a,h,o,l,u){Zt(r)&&(r=r(n||0,t,a));var c=t[e],d=s!=="get"?s:Zt(c)?l?t[e.indexOf("set")||!Zt(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():c,f=Zt(c)?l?YA:Wg:Zc,p;if(me(r)&&(~r.indexOf("random(")&&(r=go(r)),r.charAt(1)==="="&&(p=xn(d,r)+(Ce(d)||0),(p||p===0)&&(r=p))),!u||d!==r||jc)return!isNaN(d*r)&&r!==""?(p=new Ge(this._pt,t,e,+d||0,r-(d||0),typeof c=="boolean"?WA:zg,0,f),l&&(p.fp=l),h&&p.modifier(h,this,t),this._pt=p):(!c&&!(e in t)&&kc(e,r),VA.call(this,t,e,d,r,f,o||Ze.stringFilter,l))},UA=function(t,e,s,r,n){if(Zt(t)&&(t=bo(t,n,e,s,r)),!Js(t)||t.style&&t.nodeType||Se(t)||ng(t))return me(t)?bo(t,n,e,s,r):t;var a={},h;for(h in t)a[h]=bo(t[h],n,e,s,r);return a},$g=function(t,e,s,r,n,a){var h,o,l,u;if(Qe[t]&&(h=new Qe[t]).init(n,h.rawVars?e[t]:UA(e[t],r,n,a,s),s,r,a)!==!1&&(s._pt=o=new Ge(s._pt,n,t,0,1,h.render,h,0,h.priority),s!==wn))for(l=s._ptLookup[s._targets.indexOf(n)],u=h._props.length;u--;)l[h._props[u]]=o;return h},Zr,jc,qc=function i(t,e,s){var r=t.vars,n=r.ease,a=r.startAt,h=r.immediateRender,o=r.lazy,l=r.onUpdate,u=r.runBackwards,c=r.yoyoEase,d=r.keyframes,f=r.autoRevert,p=t._dur,m=t._startAt,g=t._targets,_=t.parent,x=_&&_.data==="nested"?_.vars.targets:g,y=t._overwrite==="auto"&&!Ac,v=t.timeline,b,w,E,T,A,I,M,R,C,P,k,U,V;if(v&&(!d||!n)&&(n="none"),t._ease=Mi(n,_n.ease),t._yEase=c?Vg(Mi(c===!0?n:c,_n.ease)):0,c&&t._yoyo&&!t._repeat&&(c=t._yEase,t._yEase=t._ease,t._ease=c),t._from=!v&&!!r.runBackwards,!v||d&&!r.stagger){if(R=g[0]?Ii(g[0]).harness:0,U=R&&r[R.prop],b=il(r,Bc),m&&(m._zTime<0&&m.progress(1),e<0&&u&&h&&!f?m.render(-1,!0):m.revert(u&&p?el:pA),m._lazy=0),a){if(zr(t._startAt=ie.set(g,us({data:"isStart",overwrite:!1,parent:_,immediateRender:!0,lazy:!m&&Ve(o),startAt:null,delay:0,onUpdate:l&&function(){return Je(t,"onUpdate")},stagger:0},a))),t._startAt._dp=0,t._startAt._sat=t,e<0&&(Ae||!h&&!f)&&t._startAt.revert(el),h&&p&&e<=0&&s<=0){e&&(t._zTime=e);return}}else if(u&&p&&!m){if(e&&(h=!1),E=us({overwrite:!1,data:"isFromStart",lazy:h&&!m&&Ve(o),immediateRender:h,stagger:0,parent:_},b),U&&(E[R.prop]=U),zr(t._startAt=ie.set(g,E)),t._startAt._dp=0,t._startAt._sat=t,e<0&&(Ae?t._startAt.revert(el):t._startAt.render(-1,!0)),t._zTime=e,!h)i(t._startAt,Mt,Mt);else if(!e)return}for(t._pt=t._ptCache=0,o=p&&Ve(o)||o&&!p,w=0;w<g.length;w++){if(A=g[w],M=A._gsap||Nc(g)[w]._gsap,t._ptLookup[w]=P={},Dc[M.id]&&Wr.length&&rl(),k=x===g?w:x.indexOf(A),R&&(C=new R).init(A,U||b,t,k,x)!==!1&&(t._pt=T=new Ge(t._pt,A,C.name,0,1,C.render,C,0,C.priority),C._props.forEach(function(L){P[L]=T}),C.priority&&(I=1)),!R||U)for(E in b)Qe[E]&&(C=$g(E,b,t,k,A,x))?C.priority&&(I=1):P[E]=T=zc.call(t,A,E,"get",b[E],k,x,0,r.stringFilter);t._op&&t._op[w]&&t.kill(A,t._op[w]),y&&t._pt&&(Zr=t,Ut.killTweensOf(A,P,t.globalTime(e)),V=!t.parent,Zr=0),t._pt&&o&&(Dc[M.id]=1)}I&&qg(t),t._onInit&&t._onInit(t)}t._onUpdate=l,t._initted=(!t._op||t._pt)&&!V,d&&e<=0&&v.render(cs,!0,!0)},GA=function(t,e,s,r,n,a,h,o){var l=(t._pt&&t._ptCache||(t._ptCache={}))[e],u,c,d,f;if(!l)for(l=t._ptCache[e]=[],d=t._ptLookup,f=t._targets.length;f--;){if(u=d[f][e],u&&u.d&&u.d._pt)for(u=u.d._pt;u&&u.p!==e&&u.fp!==e;)u=u._next;if(!u)return jc=1,t.vars[e]="+=0",qc(t,h),jc=0,o?co(e+" not eligible for reset"):1;l.push(u)}for(f=l.length;f--;)c=l[f],u=c._pt||c,u.s=(r||r===0)&&!n?r:u.s+(r||0)+a*u.c,u.c=s-u.s,c.e&&(c.e=te(s)+Ce(c.e)),c.b&&(c.b=u.s+Ce(c.b))},XA=function(t,e){var s=t[0]?Ii(t[0]).harness:0,r=s&&s.aliases,n,a,h,o;if(!r)return e;n=Pi({},e);for(a in r)if(a in n)for(o=r[a].split(","),h=o.length;h--;)n[o[h]]=n[a];return n},$A=function(t,e,s,r){var n=e.ease||r||"power1.inOut",a,h;if(Se(e))h=s[t]||(s[t]=[]),e.forEach(function(o,l){return h.push({t:l/(e.length-1)*100,v:o,e:n})});else for(a in e)h=s[a]||(s[a]=[]),a==="ease"||h.push({t:parseFloat(t),v:e[a],e:n})},bo=function(t,e,s,r,n){return Zt(t)?t.call(e,s,r,n):me(t)&&~t.indexOf("random(")?go(t):t},Yg=Lc+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",Hg={};Ue(Yg+",id,stagger,delay,duration,paused,scrollTrigger",function(i){return Hg[i]=1});var ie=function(i){rg(t,i);function t(s,r,n,a){var h;typeof r=="number"&&(n.duration=r,r=n,n=null),h=i.call(this,a?r:fo(r))||this;var o=h.vars,l=o.duration,u=o.delay,c=o.immediateRender,d=o.stagger,f=o.overwrite,p=o.keyframes,m=o.defaults,g=o.scrollTrigger,_=o.yoyoEase,x=r.parent||Ut,y=(Se(s)||ng(s)?wr(s[0]):"length"in r)?[s]:fs(s),v,b,w,E,T,A,I,M;if(h._targets=y.length?Nc(y):co("GSAP target "+s+" not found. https://gsap.com",!Ze.nullTargetWarn)||[],h._ptLookup=[],h._overwrite=f,p||d||Ja(l)||Ja(u)){if(r=h.vars,v=h.timeline=new Me({data:"nested",defaults:m||{},targets:x&&x.data==="nested"?x.vars.targets:y}),v.kill(),v.parent=v._dp=br(h),v._start=0,d||Ja(l)||Ja(u)){if(E=y.length,I=d&&Cg(d),Js(d))for(T in d)~Yg.indexOf(T)&&(M||(M={}),M[T]=d[T]);for(b=0;b<E;b++)w=il(r,Hg),w.stagger=0,_&&(w.yoyoEase=_),M&&Pi(w,M),A=y[b],w.duration=+bo(l,br(h),b,A,y),w.delay=(+bo(u,br(h),b,A,y)||0)-h._delay,!d&&E===1&&w.delay&&(h._delay=u=w.delay,h._start+=u,w.delay=0),v.to(A,w,I?I(b,A,y):0),v._ease=ut.none;v.duration()?l=u=0:h.timeline=0}else if(p){fo(us(v.vars.defaults,{ease:"none"})),v._ease=Mi(p.ease||r.ease||"none");var R=0,C,P,k;if(Se(p))p.forEach(function(U){return v.to(y,U,">")}),v.duration();else{w={};for(T in p)T==="ease"||T==="easeEach"||$A(T,p[T],w,p.easeEach);for(T in w)for(C=w[T].sort(function(U,V){return U.t-V.t}),R=0,b=0;b<C.length;b++)P=C[b],k={ease:P.e,duration:(P.t-(b?C[b-1].t:0))/100*l},k[T]=P.v,v.to(y,k,R),R+=k.duration;v.duration()<l&&v.to({},{duration:l-v.duration()})}}l||h.duration(l=v.duration())}else h.timeline=0;return f===!0&&!Ac&&(Zr=br(h),Ut.killTweensOf(y),Zr=0),er(x,br(h),n),r.reversed&&h.reverse(),r.paused&&h.paused(!0),(c||!l&&!p&&h._start===ge(x._time)&&Ve(c)&&vA(br(h))&&x.data!=="nested")&&(h._tTime=-Mt,h.render(Math.max(0,-u)||0)),g&&wg(br(h),g),h}var e=t.prototype;return e.render=function(r,n,a){var h=this._time,o=this._tDur,l=this._dur,u=r<0,c=r>o-Mt&&!u?o:r<Mt?0:r,d,f,p,m,g,_,x,y,v;if(!l)wA(this,r,n,a);else if(c!==this._tTime||!r||a||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==u){if(d=c,y=this.timeline,this._repeat){if(m=l+this._rDelay,this._repeat<-1&&u)return this.totalTime(m*100+r,n,a);if(d=ge(c%m),c===o?(p=this._repeat,d=l):(p=~~(c/m),p&&p===ge(c/m)&&(d=l,p--),d>l&&(d=l)),_=this._yoyo&&p&1,_&&(v=this._yEase,d=l-d),g=vn(this._tTime,m),d===h&&!a&&this._initted&&p===g)return this._tTime=c,this;p!==g&&(y&&this._yEase&&Ug(y,_),this.vars.repeatRefresh&&!_&&!this._lock&&this._time!==m&&this._initted&&(this._lock=a=1,this.render(ge(m*p),!0).invalidate()._lock=0))}if(!this._initted){if(Eg(this,u?r:d,a,n,c))return this._tTime=0,this;if(h!==this._time&&!(a&&this.vars.repeatRefresh&&p!==g))return this;if(l!==this._dur)return this.render(r,n,a)}if(this._tTime=c,this._time=d,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=x=(v||this._ease)(d/l),this._from&&(this.ratio=x=1-x),d&&!h&&!n&&!p&&(Je(this,"onStart"),this._tTime!==c))return this;for(f=this._pt;f;)f.r(x,f.d),f=f._next;y&&y.render(r<0?r:y._dur*y._ease(d/this._dur),n,a)||this._startAt&&(this._zTime=r),this._onUpdate&&!n&&(u&&Vc(this,r,n,a),Je(this,"onUpdate")),this._repeat&&p!==g&&this.vars.onRepeat&&!n&&this.parent&&Je(this,"onRepeat"),(c===this._tDur||!c)&&this._tTime===c&&(u&&!this._onUpdate&&Vc(this,r,!0,!0),(r||!l)&&(c===this._tDur&&this._ts>0||!c&&this._ts<0)&&zr(this,1),!n&&!(u&&!h)&&(c||h||_)&&(Je(this,c===o?"onComplete":"onReverseComplete",!0),this._prom&&!(c<o&&this.timeScale()>0)&&this._prom()))}return this},e.targets=function(){return this._targets},e.invalidate=function(r){return(!r||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(r),i.prototype.invalidate.call(this,r)},e.resetTo=function(r,n,a,h,o){xo||ts.wake(),this._ts||this.play();var l=Math.min(this._dur,(this._dp._time-this._start)*this._ts),u;return this._initted||qc(this,l),u=this._ease(l/this._dur),GA(this,r,n,a,h,u,l,o)?this.resetTo(r,n,a,h,1):(ll(this,0),this.parent||xg(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},e.kill=function(r,n){if(n===void 0&&(n="all"),!r&&(!n||n==="all"))return this._lazy=this._pt=0,this.parent?_o(this):this;if(this.timeline){var a=this.timeline.totalDuration();return this.timeline.killTweensOf(r,n,Zr&&Zr.vars.overwrite!==!0)._first||_o(this),this.parent&&a!==this.timeline.totalDuration()&&bn(this,this._dur*this.timeline._tDur/a,0,1),this}var h=this._targets,o=r?fs(r):h,l=this._ptLookup,u=this._pt,c,d,f,p,m,g,_;if((!n||n==="all")&&yA(h,o))return n==="all"&&(this._pt=0),_o(this);for(c=this._op=this._op||[],n!=="all"&&(me(n)&&(m={},Ue(n,function(x){return m[x]=1}),n=m),n=XA(h,n)),_=h.length;_--;)if(~o.indexOf(h[_])){d=l[_],n==="all"?(c[_]=n,p=d,f={}):(f=c[_]=c[_]||{},p=n);for(m in p)g=d&&d[m],g&&((!("kill"in g.d)||g.d.kill(m)===!0)&&nl(this,g,"_pt"),delete d[m]),f!=="all"&&(f[m]=1)}return this._initted&&!this._pt&&u&&_o(this),this},t.to=function(r,n){return new t(r,n,arguments[2])},t.from=function(r,n){return po(1,arguments)},t.delayedCall=function(r,n,a,h){return new t(n,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:r,onComplete:n,onReverseComplete:n,onCompleteParams:a,onReverseCompleteParams:a,callbackScope:h})},t.fromTo=function(r,n,a){return po(2,arguments)},t.set=function(r,n){return n.duration=0,n.repeatDelay||(n.repeat=0),new t(r,n)},t.killTweensOf=function(r,n,a){return Ut.killTweensOf(r,n,a)},t}(vo);us(ie.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),Ue("staggerTo,staggerFrom,staggerFromTo",function(i){ie[i]=function(){var t=new Me,e=Gc.call(arguments,0);return e.splice(i==="staggerFromTo"?5:4,0,0),t[i].apply(t,e)}});var Zc=function(t,e,s){return t[e]=s},Wg=function(t,e,s){return t[e](s)},YA=function(t,e,s,r){return t[e](r.fp,s)},HA=function(t,e,s){return t.setAttribute(e,s)},Kc=function(t,e){return Zt(t[e])?Wg:Cc(t[e])&&t.setAttribute?HA:Zc},zg=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},WA=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},jg=function(t,e){var s=e._pt,r="";if(!t&&e.b)r=e.b;else if(t===1&&e.e)r=e.e;else{for(;s;)r=s.p+(s.m?s.m(s.s+s.c*t):Math.round((s.s+s.c*t)*1e4)/1e4)+r,s=s._next;r+=e.c}e.set(e.t,e.p,r,e)},Qc=function(t,e){for(var s=e._pt;s;)s.r(t,s.d),s=s._next},zA=function(t,e,s,r){for(var n=this._pt,a;n;)a=n._next,n.p===r&&n.modifier(t,e,s),n=a},jA=function(t){for(var e=this._pt,s,r;e;)r=e._next,e.p===t&&!e.op||e.op===t?nl(this,e,"_pt"):e.dep||(s=1),e=r;return!s},qA=function(t,e,s,r){r.mSet(t,e,r.m.call(r.tween,s,r.mt),r)},qg=function(t){for(var e=t._pt,s,r,n,a;e;){for(s=e._next,r=n;r&&r.pr>e.pr;)r=r._next;(e._prev=r?r._prev:a)?e._prev._next=e:n=e,(e._next=r)?r._prev=e:a=e,e=s}t._pt=n},Ge=function(){function i(e,s,r,n,a,h,o,l,u){this.t=s,this.s=n,this.c=a,this.p=r,this.r=h||zg,this.d=o||this,this.set=l||Zc,this.pr=u||0,this._next=e,e&&(e._prev=this)}var t=i.prototype;return t.modifier=function(s,r,n){this.mSet=this.mSet||this.set,this.set=qA,this.m=s,this.mt=n,this.tween=r},i}();Ue(Lc+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(i){return Bc[i]=1}),Ke.TweenMax=Ke.TweenLite=ie,Ke.TimelineLite=Ke.TimelineMax=Me,Ut=new Me({sortChildren:!1,defaults:_n,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Ze.stringFilter=Ng;var ki=[],hl={},ZA=[],Zg=0,KA=0,Jc=function(t){return(hl[t]||ZA).map(function(e){return e()})},tu=function(){var t=Date.now(),e=[];t-Zg>2&&(Jc("matchMediaInit"),ki.forEach(function(s){var r=s.queries,n=s.conditions,a,h,o,l;for(h in r)a=tr.matchMedia(r[h]).matches,a&&(o=1),a!==n[h]&&(n[h]=a,l=1);l&&(s.revert(),o&&e.push(s))}),Jc("matchMediaRevert"),e.forEach(function(s){return s.onMatch(s,function(r){return s.add(null,r)})}),Zg=t,Jc("matchMedia"))},Kg=function(){function i(e,s){this.selector=s&&Xc(s),this.data=[],this._r=[],this.isReverted=!1,this.id=KA++,e&&this.add(e)}var t=i.prototype;return t.add=function(s,r,n){Zt(s)&&(n=r,r=s,s=Zt);var a=this,h=function(){var l=Dt,u=a.selector,c;return l&&l!==a&&l.data.push(a),n&&(a.selector=Xc(n)),Dt=a,c=r.apply(a,arguments),Zt(c)&&a._r.push(c),Dt=l,a.selector=u,a.isReverted=!1,c};return a.last=h,s===Zt?h(a,function(o){return a.add(null,o)}):s?a[s]=h:h},t.ignore=function(s){var r=Dt;Dt=null,s(this),Dt=r},t.getTweens=function(){var s=[];return this.data.forEach(function(r){return r instanceof i?s.push.apply(s,r.getTweens()):r instanceof ie&&!(r.parent&&r.parent.data==="nested")&&s.push(r)}),s},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(s,r){var n=this;if(s?function(){for(var h=n.getTweens(),o=n.data.length,l;o--;)l=n.data[o],l.data==="isFlip"&&(l.revert(),l.getChildren(!0,!0,!1).forEach(function(u){return h.splice(h.indexOf(u),1)}));for(h.map(function(u){return{g:u._dur||u._delay||u._sat&&!u._sat.vars.immediateRender?u.globalTime(0):-1/0,t:u}}).sort(function(u,c){return c.g-u.g||-1/0}).forEach(function(u){return u.t.revert(s)}),o=n.data.length;o--;)l=n.data[o],l instanceof Me?l.data!=="nested"&&(l.scrollTrigger&&l.scrollTrigger.revert(),l.kill()):!(l instanceof ie)&&l.revert&&l.revert(s);n._r.forEach(function(u){return u(s,n)}),n.isReverted=!0}():this.data.forEach(function(h){return h.kill&&h.kill()}),this.clear(),r)for(var a=ki.length;a--;)ki[a].id===this.id&&ki.splice(a,1)},t.revert=function(s){this.kill(s||{})},i}(),QA=function(){function i(e){this.contexts=[],this.scope=e,Dt&&Dt.data.push(this)}var t=i.prototype;return t.add=function(s,r,n){Js(s)||(s={matches:s});var a=new Kg(0,n||this.scope),h=a.conditions={},o,l,u;Dt&&!a.selector&&(a.selector=Dt.selector),this.contexts.push(a),r=a.add("onMatch",r),a.queries=s;for(l in s)l==="all"?u=1:(o=tr.matchMedia(s[l]),o&&(ki.indexOf(a)<0&&ki.push(a),(h[l]=o.matches)&&(u=1),o.addListener?o.addListener(tu):o.addEventListener("change",tu)));return u&&r(a,function(c){return a.add(null,c)}),this},t.revert=function(s){this.kill(s||{})},t.kill=function(s){this.contexts.forEach(function(r){return r.kill(s,!0)})},i}(),cl={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];e.forEach(function(r){return Bg(r)})},timeline:function(t){return new Me(t)},getTweensOf:function(t,e){return Ut.getTweensOf(t,e)},getProperty:function(t,e,s,r){me(t)&&(t=fs(t)[0]);var n=Ii(t||{}).get,a=s?_g:gg;return s==="native"&&(s=""),t&&(e?a((Qe[e]&&Qe[e].get||n)(t,e,s,r)):function(h,o,l){return a((Qe[h]&&Qe[h].get||n)(t,h,o,l))})},quickSetter:function(t,e,s){if(t=fs(t),t.length>1){var r=t.map(function(u){return Xe.quickSetter(u,e,s)}),n=r.length;return function(u){for(var c=n;c--;)r[c](u)}}t=t[0]||{};var a=Qe[e],h=Ii(t),o=h.harness&&(h.harness.aliases||{})[e]||e,l=a?function(u){var c=new a;wn._pt=0,c.init(t,s?u+s:u,wn,0,[t]),c.render(1,c),wn._pt&&Qc(1,wn)}:h.set(t,o);return a?l:function(u){return l(t,o,s?u+s:u,h,1)}},quickTo:function(t,e,s){var r,n=Xe.to(t,Pi((r={},r[e]="+=0.1",r.paused=!0,r),s||{})),a=function(o,l,u){return n.resetTo(e,o,l,u)};return a.tween=n,a},isTweening:function(t){return Ut.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=Mi(t.ease,_n.ease)),yg(_n,t||{})},config:function(t){return yg(Ze,t||{})},registerEffect:function(t){var e=t.name,s=t.effect,r=t.plugins,n=t.defaults,a=t.extendTimeline;(r||"").split(",").forEach(function(h){return h&&!Qe[h]&&!Ke[h]&&co(e+" effect requires "+h+" plugin.")}),Oc[e]=function(h,o,l){return s(fs(h),us(o||{},n),l)},a&&(Me.prototype[e]=function(h,o,l){return this.add(Oc[e](h,Js(o)?o:(l=o)&&{},this),l)})},registerEase:function(t,e){ut[t]=Mi(e)},parseEase:function(t,e){return arguments.length?Mi(t,e):ut},getById:function(t){return Ut.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var s=new Me(t),r,n;for(s.smoothChildTiming=Ve(t.smoothChildTiming),Ut.remove(s),s._dp=0,s._time=s._tTime=Ut._time,r=Ut._first;r;)n=r._next,(e||!(!r._dur&&r instanceof ie&&r.vars.onComplete===r._targets[0]))&&er(s,r,r._start-r._delay),r=n;return er(Ut,s,0),s},context:function(t,e){return t?new Kg(t,e):Dt},matchMedia:function(t){return new QA(t)},matchMediaRefresh:function(){return ki.forEach(function(t){var e=t.conditions,s,r;for(r in e)e[r]&&(e[r]=!1,s=1);s&&t.revert()})||tu()},addEventListener:function(t,e){var s=hl[t]||(hl[t]=[]);~s.indexOf(e)||s.push(e)},removeEventListener:function(t,e){var s=hl[t],r=s&&s.indexOf(e);r>=0&&s.splice(r,1)},utils:{wrap:RA,wrapYoyo:MA,distribute:Cg,random:Pg,snap:Ig,normalize:PA,getUnit:Ce,clamp:AA,splitColor:Dg,toArray:fs,selector:Xc,mapRange:Mg,pipe:CA,unitize:IA,interpolate:FA,shuffle:Sg},install:cg,effects:Oc,ticker:ts,updateRoot:Me.updateRoot,plugins:Qe,globalTimeline:Ut,core:{PropTween:Ge,globals:ug,Tween:ie,Timeline:Me,Animation:vo,getCache:Ii,_removeLinkedListItem:nl,reverting:function(){return Ae},context:function(t){return t&&Dt&&(Dt.data.push(t),t._ctx=Dt),Dt},suppressOverwrites:function(t){return Ac=t}}};Ue("to,from,fromTo,delayedCall,set,killTweensOf",function(i){return cl[i]=ie[i]}),ts.add(Me.updateRoot),wn=cl.to({},{duration:0});var JA=function(t,e){for(var s=t._pt;s&&s.p!==e&&s.op!==e&&s.fp!==e;)s=s._next;return s},tS=function(t,e){var s=t._targets,r,n,a;for(r in e)for(n=s.length;n--;)a=t._ptLookup[n][r],a&&(a=a.d)&&(a._pt&&(a=JA(a,r)),a&&a.modifier&&a.modifier(e[r],t,s[n],r))},eu=function(t,e){return{name:t,rawVars:1,init:function(r,n,a){a._onInit=function(h){var o,l;if(me(n)&&(o={},Ue(n,function(u){return o[u]=1}),n=o),e){o={};for(l in n)o[l]=e(n[l]);n=o}tS(h,n)}}}},Xe=cl.registerPlugin({name:"attr",init:function(t,e,s,r,n){var a,h,o;this.tween=s;for(a in e)o=t.getAttribute(a)||"",h=this.add(t,"setAttribute",(o||0)+"",e[a],r,n,0,0,a),h.op=a,h.b=o,this._props.push(a)},render:function(t,e){for(var s=e._pt;s;)Ae?s.set(s.t,s.p,s.b,s):s.r(t,s.d),s=s._next}},{name:"endArray",init:function(t,e){for(var s=e.length;s--;)this.add(t,s,t[s]||0,e[s],0,0,0,0,0,1)}},eu("roundProps",$c),eu("modifiers"),eu("snap",Ig))||cl;ie.version=Me.version=Xe.version="3.12.5",hg=1,Ic()&&En(),ut.Power0,ut.Power1,ut.Power2,ut.Power3,ut.Power4,ut.Linear,ut.Quad,ut.Cubic,ut.Quart,ut.Quint,ut.Strong,ut.Elastic,ut.Back,ut.SteppedEase,ut.Bounce,ut.Sine,ut.Expo,ut.Circ;/*!
1155
+ */var Ze={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},_n={duration:.5,overwrite:!1,delay:0},wc,Ae,Dt,cs=1e8,Mt=1/cs,Ec=Math.PI*2,uA=Ec/4,dA=0,Jm=Math.sqrt,fA=Math.cos,pA=Math.sin,me=function(t){return typeof t=="string"},Zt=function(t){return typeof t=="function"},wr=function(t){return typeof t=="number"},Tc=function(t){return typeof t>"u"},Js=function(t){return typeof t=="object"},Ve=function(t){return t!==!1},Ac=function(){return typeof window<"u"},Ja=function(t){return Zt(t)||me(t)},tg=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},Se=Array.isArray,Sc=/(?:-?\.?\d|\.)+/gi,eg=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,yn=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Cc=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,sg=/[+-]=-?[.\d]+/,rg=/[^,'"\[\]\s]+/gi,mA=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Ut,tr,Ic,Pc,Ke={},tl={},ig,ng=function(t){return(tl=Pi(t,Ke))&&Xe},Rc=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},co=function(t,e){return!e&&console.warn(t)},og=function(t,e){return t&&(Ke[t]=e)&&tl&&(tl[t]=e)||Ke},uo=function(){return 0},gA={suppressEvents:!0,isStart:!0,kill:!1},el={suppressEvents:!0,kill:!1},_A={suppressEvents:!0},Mc={},Wr=[],Fc={},ag,Qe={},kc={},lg=30,sl=[],Bc="",Dc=function(t){var e=t[0],s,r;if(Js(e)||Zt(e)||(t=[t]),!(s=(e._gsap||{}).harness)){for(r=sl.length;r--&&!sl[r].targetTest(e););s=sl[r]}for(r=t.length;r--;)t[r]&&(t[r]._gsap||(t[r]._gsap=new Lg(t[r],s)))||t.splice(r,1);return t},Ii=function(t){return t._gsap||Dc(fs(t))[0]._gsap},hg=function(t,e,s){return(s=t[e])&&Zt(s)?t[e]():Tc(s)&&t.getAttribute&&t.getAttribute(e)||s},Ue=function(t,e){return(t=t.split(",")).forEach(e)||t},te=function(t){return Math.round(t*1e5)/1e5||0},ge=function(t){return Math.round(t*1e7)/1e7||0},xn=function(t,e){var s=e.charAt(0),r=parseFloat(e.substr(2));return t=parseFloat(t),s==="+"?t+r:s==="-"?t-r:s==="*"?t*r:t/r},yA=function(t,e){for(var s=e.length,r=0;t.indexOf(e[r])<0&&++r<s;);return r<s},rl=function(){var t=Wr.length,e=Wr.slice(0),s,r;for(Fc={},Wr.length=0,s=0;s<t;s++)r=e[s],r&&r._lazy&&(r.render(r._lazy[0],r._lazy[1],!0)._lazy=0)},cg=function(t,e,s,r){Wr.length&&!Ae&&rl(),t.render(e,s,r||Ae&&e<0&&(t._initted||t._startAt)),Wr.length&&!Ae&&rl()},ug=function(t){var e=parseFloat(t);return(e||e===0)&&(t+"").match(rg).length<2?e:me(t)?t.trim():t},dg=function(t){return t},us=function(t,e){for(var s in e)s in t||(t[s]=e[s]);return t},xA=function(t){return function(e,s){for(var r in s)r in e||r==="duration"&&t||r==="ease"||(e[r]=s[r])}},Pi=function(t,e){for(var s in e)t[s]=e[s];return t},fg=function i(t,e){for(var s in e)s!=="__proto__"&&s!=="constructor"&&s!=="prototype"&&(t[s]=Js(e[s])?i(t[s]||(t[s]={}),e[s]):e[s]);return t},il=function(t,e){var s={},r;for(r in t)r in e||(s[r]=t[r]);return s},fo=function(t){var e=t.parent||Ut,s=t.keyframes?xA(Se(t.keyframes)):us;if(Ve(t.inherit))for(;e;)s(t,e.vars.defaults),e=e.parent||e._dp;return t},vA=function(t,e){for(var s=t.length,r=s===e.length;r&&s--&&t[s]===e[s];);return s<0},pg=function(t,e,s,r,n){s===void 0&&(s="_first"),r===void 0&&(r="_last");var a=t[r],h;if(n)for(h=e[n];a&&a[n]>h;)a=a._prev;return a?(e._next=a._next,a._next=e):(e._next=t[s],t[s]=e),e._next?e._next._prev=e:t[r]=e,e._prev=a,e.parent=e._dp=t,e},nl=function(t,e,s,r){s===void 0&&(s="_first"),r===void 0&&(r="_last");var n=e._prev,a=e._next;n?n._next=a:t[s]===e&&(t[s]=a),a?a._prev=n:t[r]===e&&(t[r]=n),e._next=e._prev=e.parent=null},zr=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},Ri=function(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var s=t;s;)s._dirty=1,s=s.parent;return t},bA=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},Oc=function(t,e,s,r){return t._startAt&&(Ae?t._startAt.revert(el):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,r))},wA=function i(t){return!t||t._ts&&i(t.parent)},mg=function(t){return t._repeat?vn(t._tTime,t=t.duration()+t._rDelay)*t:0},vn=function(t,e){var s=Math.floor(t/=e);return t&&s===t?s-1:s},ol=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},al=function(t){return t._end=ge(t._start+(t._tDur/Math.abs(t._ts||t._rts||Mt)||0))},ll=function(t,e){var s=t._dp;return s&&s.smoothChildTiming&&t._ts&&(t._start=ge(s._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),al(t),s._dirty||Ri(s,t)),t},gg=function(t,e){var s;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(s=ol(t.rawTime(),e),(!e._dur||mo(0,e.totalDuration(),s)-e._tTime>Mt)&&e.render(s,!0)),Ri(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(s=t;s._dp;)s.rawTime()>=0&&s.totalTime(s._tTime),s=s._dp;t._zTime=-Mt}},er=function(t,e,s,r){return e.parent&&zr(e),e._start=ge((wr(s)?s:s||t!==Ut?ds(t,s,e):t._time)+e._delay),e._end=ge(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),pg(t,e,"_first","_last",t._sort?"_start":0),Lc(e)||(t._recent=e),r||gg(t,e),t._ts<0&&ll(t,t._tTime),t},_g=function(t,e){return(Ke.ScrollTrigger||Rc("scrollTrigger",e))&&Ke.ScrollTrigger.create(e,t)},yg=function(t,e,s,r,n){if(Wc(t,e,n),!t._initted)return 1;if(!s&&t._pt&&!Ae&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&ag!==ts.frame)return Wr.push(t),t._lazy=[n,r],1},EA=function i(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||i(e))},Lc=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},TA=function(t,e,s,r){var n=t.ratio,a=e<0||!e&&(!t._start&&EA(t)&&!(!t._initted&&Lc(t))||(t._ts<0||t._dp._ts<0)&&!Lc(t))?0:1,h=t._rDelay,o=0,l,u,c;if(h&&t._repeat&&(o=mo(0,t._tDur,e),u=vn(o,h),t._yoyo&&u&1&&(a=1-a),u!==vn(t._tTime,h)&&(n=1-a,t.vars.repeatRefresh&&t._initted&&t.invalidate())),a!==n||Ae||r||t._zTime===Mt||!e&&t._zTime){if(!t._initted&&yg(t,e,r,s,o))return;for(c=t._zTime,t._zTime=e||(s?Mt:0),s||(s=e&&!c),t.ratio=a,t._from&&(a=1-a),t._time=0,t._tTime=o,l=t._pt;l;)l.r(a,l.d),l=l._next;e<0&&Oc(t,e,s,!0),t._onUpdate&&!s&&Je(t,"onUpdate"),o&&t._repeat&&!s&&t.parent&&Je(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===a&&(a&&zr(t,1),!s&&!Ae&&(Je(t,a?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},AA=function(t,e,s){var r;if(s>e)for(r=t._first;r&&r._start<=s;){if(r.data==="isPause"&&r._start>e)return r;r=r._next}else for(r=t._last;r&&r._start>=s;){if(r.data==="isPause"&&r._start<e)return r;r=r._prev}},bn=function(t,e,s,r){var n=t._repeat,a=ge(e)||0,h=t._tTime/t._tDur;return h&&!r&&(t._time*=a/t._dur),t._dur=a,t._tDur=n?n<0?1e10:ge(a*(n+1)+t._rDelay*n):a,h>0&&!r&&ll(t,t._tTime=t._tDur*h),t.parent&&al(t),s||Ri(t.parent,t),t},xg=function(t){return t instanceof Me?Ri(t):bn(t,t._dur)},SA={_start:0,endTime:uo,totalDuration:uo},ds=function i(t,e,s){var r=t.labels,n=t._recent||SA,a=t.duration()>=cs?n.endTime(!1):t._dur,h,o,l;return me(e)&&(isNaN(e)||e in r)?(o=e.charAt(0),l=e.substr(-1)==="%",h=e.indexOf("="),o==="<"||o===">"?(h>=0&&(e=e.replace(/=/,"")),(o==="<"?n._start:n.endTime(n._repeat>=0))+(parseFloat(e.substr(1))||0)*(l?(h<0?n:s).totalDuration()/100:1)):h<0?(e in r||(r[e]=a),r[e]):(o=parseFloat(e.charAt(h-1)+e.substr(h+1)),l&&s&&(o=o/100*(Se(s)?s[0]:s).totalDuration()),h>1?i(t,e.substr(0,h-1),s)+o:a+o)):e==null?a:+e},po=function(t,e,s){var r=wr(e[1]),n=(r?2:1)+(t<2?0:1),a=e[n],h,o;if(r&&(a.duration=e[1]),a.parent=s,t){for(h=a,o=s;o&&!("immediateRender"in h);)h=o.vars.defaults||{},o=Ve(o.vars.inherit)&&o.parent;a.immediateRender=Ve(h.immediateRender),t<2?a.runBackwards=1:a.startAt=e[n-1]}return new ie(e[0],a,e[n+1])},jr=function(t,e){return t||t===0?e(t):e},mo=function(t,e,s){return s<t?t:s>e?e:s},Ce=function(t,e){return!me(t)||!(e=mA.exec(t))?"":e[1]},CA=function(t,e,s){return jr(s,function(r){return mo(t,e,r)})},Nc=[].slice,vg=function(t,e){return t&&Js(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&Js(t[0]))&&!t.nodeType&&t!==tr},IA=function(t,e,s){return s===void 0&&(s=[]),t.forEach(function(r){var n;return me(r)&&!e||vg(r,1)?(n=s).push.apply(n,fs(r)):s.push(r)})||s},fs=function(t,e,s){return Dt&&!e&&Dt.selector?Dt.selector(t):me(t)&&!s&&(Ic||!En())?Nc.call((e||Pc).querySelectorAll(t),0):Se(t)?IA(t,s):vg(t)?Nc.call(t,0):t?[t]:[]},Vc=function(t){return t=fs(t)[0]||co("Invalid scope")||{},function(e){var s=t.current||t.nativeElement||t;return fs(e,s.querySelectorAll?s:s===t?co("Invalid scope")||Pc.createElement("div"):t)}},bg=function(t){return t.sort(function(){return .5-Math.random()})},wg=function(t){if(Zt(t))return t;var e=Js(t)?t:{each:t},s=Mi(e.ease),r=e.from||0,n=parseFloat(e.base)||0,a={},h=r>0&&r<1,o=isNaN(r)||h,l=e.axis,u=r,c=r;return me(r)?u=c={center:.5,edges:.5,end:1}[r]||0:!h&&o&&(u=r[0],c=r[1]),function(d,f,p){var m=(p||e).length,g=a[m],_,x,y,v,b,w,E,T,A;if(!g){if(A=e.grid==="auto"?0:(e.grid||[1,cs])[1],!A){for(E=-cs;E<(E=p[A++].getBoundingClientRect().left)&&A<m;);A<m&&A--}for(g=a[m]=[],_=o?Math.min(A,m)*u-.5:r%A,x=A===cs?0:o?m*c/A-.5:r/A|0,E=0,T=cs,w=0;w<m;w++)y=w%A-_,v=x-(w/A|0),g[w]=b=l?Math.abs(l==="y"?v:y):Jm(y*y+v*v),b>E&&(E=b),b<T&&(T=b);r==="random"&&bg(g),g.max=E-T,g.min=T,g.v=m=(parseFloat(e.amount)||parseFloat(e.each)*(A>m?m-1:l?l==="y"?m/A:A:Math.max(A,m/A))||0)*(r==="edges"?-1:1),g.b=m<0?n-m:n,g.u=Ce(e.amount||e.each)||0,s=s&&m<0?Bg(s):s}return m=(g[d]-g.min)/g.max||0,ge(g.b+(s?s(m):m)*g.v)+g.u}},Uc=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(s){var r=ge(Math.round(parseFloat(s)/t)*t*e);return(r-r%1)/e+(wr(s)?0:Ce(s))}},Eg=function(t,e){var s=Se(t),r,n;return!s&&Js(t)&&(r=s=t.radius||cs,t.values?(t=fs(t.values),(n=!wr(t[0]))&&(r*=r)):t=Uc(t.increment)),jr(e,s?Zt(t)?function(a){return n=t(a),Math.abs(n-a)<=r?n:a}:function(a){for(var h=parseFloat(n?a.x:a),o=parseFloat(n?a.y:0),l=cs,u=0,c=t.length,d,f;c--;)n?(d=t[c].x-h,f=t[c].y-o,d=d*d+f*f):d=Math.abs(t[c]-h),d<l&&(l=d,u=c);return u=!r||l<=r?t[u]:a,n||u===a||wr(a)?u:u+Ce(a)}:Uc(t))},Tg=function(t,e,s,r){return jr(Se(t)?!e:s===!0?!!(s=0):!r,function(){return Se(t)?t[~~(Math.random()*t.length)]:(s=s||1e-5)&&(r=s<1?Math.pow(10,(s+"").length-2):1)&&Math.floor(Math.round((t-s/2+Math.random()*(e-t+s*.99))/s)*s*r)/r})},PA=function(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];return function(r){return e.reduce(function(n,a){return a(n)},r)}},RA=function(t,e){return function(s){return t(parseFloat(s))+(e||Ce(s))}},MA=function(t,e,s){return Sg(t,e,0,1,s)},Ag=function(t,e,s){return jr(s,function(r){return t[~~e(r)]})},FA=function i(t,e,s){var r=e-t;return Se(t)?Ag(t,i(0,t.length),e):jr(s,function(n){return(r+(n-t)%r)%r+t})},kA=function i(t,e,s){var r=e-t,n=r*2;return Se(t)?Ag(t,i(0,t.length-1),e):jr(s,function(a){return a=(n+(a-t)%n)%n||0,t+(a>r?n-a:a)})},go=function(t){for(var e=0,s="",r,n,a,h;~(r=t.indexOf("random(",e));)a=t.indexOf(")",r),h=t.charAt(r+7)==="[",n=t.substr(r+7,a-r-7).match(h?rg:Sc),s+=t.substr(e,r-e)+Tg(h?n:+n[0],h?0:+n[1],+n[2]||1e-5),e=a+1;return s+t.substr(e,t.length-e)},Sg=function(t,e,s,r,n){var a=e-t,h=r-s;return jr(n,function(o){return s+((o-t)/a*h||0)})},BA=function i(t,e,s,r){var n=isNaN(t+e)?0:function(f){return(1-f)*t+f*e};if(!n){var a=me(t),h={},o,l,u,c,d;if(s===!0&&(r=1)&&(s=null),a)t={p:t},e={p:e};else if(Se(t)&&!Se(e)){for(u=[],c=t.length,d=c-2,l=1;l<c;l++)u.push(i(t[l-1],t[l]));c--,n=function(p){p*=c;var m=Math.min(d,~~p);return u[m](p-m)},s=e}else r||(t=Pi(Se(t)?[]:{},t));if(!u){for(o in e)Yc.call(h,t,o,"get",e[o]);n=function(p){return qc(p,h)||(a?t.p:t)}}}return jr(s,n)},Cg=function(t,e,s){var r=t.labels,n=cs,a,h,o;for(a in r)h=r[a]-e,h<0==!!s&&h&&n>(h=Math.abs(h))&&(o=a,n=h);return o},Je=function(t,e,s){var r=t.vars,n=r[e],a=Dt,h=t._ctx,o,l,u;if(n)return o=r[e+"Params"],l=r.callbackScope||t,s&&Wr.length&&rl(),h&&(Dt=h),u=o?n.apply(l,o):n.call(l),Dt=a,u},_o=function(t){return zr(t),t.scrollTrigger&&t.scrollTrigger.kill(!!Ae),t.progress()<1&&Je(t,"onInterrupt"),t},wn,Ig=[],Pg=function(t){if(t)if(t=!t.name&&t.default||t,Ac()||t.headless){var e=t.name,s=Zt(t),r=e&&!s&&t.init?function(){this._props=[]}:t,n={init:uo,render:qc,add:Yc,kill:ZA,modifier:qA,rawVars:0},a={targetTest:0,get:0,getSetter:jc,aliases:{},register:0};if(En(),t!==r){if(Qe[e])return;us(r,us(il(t,n),a)),Pi(r.prototype,Pi(n,il(t,a))),Qe[r.prop=e]=r,t.targetTest&&(sl.push(r),Mc[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}og(e,r),t.register&&t.register(Xe,r,Ge)}else Ig.push(t)},It=255,yo={aqua:[0,It,It],lime:[0,It,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,It],navy:[0,0,128],white:[It,It,It],olive:[128,128,0],yellow:[It,It,0],orange:[It,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[It,0,0],pink:[It,192,203],cyan:[0,It,It],transparent:[It,It,It,0]},Gc=function(t,e,s){return t+=t<0?1:t>1?-1:0,(t*6<1?e+(s-e)*t*6:t<.5?s:t*3<2?e+(s-e)*(2/3-t)*6:e)*It+.5|0},Rg=function(t,e,s){var r=t?wr(t)?[t>>16,t>>8&It,t&It]:0:yo.black,n,a,h,o,l,u,c,d,f,p;if(!r){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),yo[t])r=yo[t];else if(t.charAt(0)==="#"){if(t.length<6&&(n=t.charAt(1),a=t.charAt(2),h=t.charAt(3),t="#"+n+n+a+a+h+h+(t.length===5?t.charAt(4)+t.charAt(4):"")),t.length===9)return r=parseInt(t.substr(1,6),16),[r>>16,r>>8&It,r&It,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),r=[t>>16,t>>8&It,t&It]}else if(t.substr(0,3)==="hsl"){if(r=p=t.match(Sc),!e)o=+r[0]%360/360,l=+r[1]/100,u=+r[2]/100,a=u<=.5?u*(l+1):u+l-u*l,n=u*2-a,r.length>3&&(r[3]*=1),r[0]=Gc(o+1/3,n,a),r[1]=Gc(o,n,a),r[2]=Gc(o-1/3,n,a);else if(~t.indexOf("="))return r=t.match(eg),s&&r.length<4&&(r[3]=1),r}else r=t.match(Sc)||yo.transparent;r=r.map(Number)}return e&&!p&&(n=r[0]/It,a=r[1]/It,h=r[2]/It,c=Math.max(n,a,h),d=Math.min(n,a,h),u=(c+d)/2,c===d?o=l=0:(f=c-d,l=u>.5?f/(2-c-d):f/(c+d),o=c===n?(a-h)/f+(a<h?6:0):c===a?(h-n)/f+2:(n-a)/f+4,o*=60),r[0]=~~(o+.5),r[1]=~~(l*100+.5),r[2]=~~(u*100+.5)),s&&r.length<4&&(r[3]=1),r},Mg=function(t){var e=[],s=[],r=-1;return t.split(qr).forEach(function(n){var a=n.match(yn)||[];e.push.apply(e,a),s.push(r+=a.length+1)}),e.c=s,e},Fg=function(t,e,s){var r="",n=(t+r).match(qr),a=e?"hsla(":"rgba(",h=0,o,l,u,c;if(!n)return t;if(n=n.map(function(d){return(d=Rg(d,e,1))&&a+(e?d[0]+","+d[1]+"%,"+d[2]+"%,"+d[3]:d.join(","))+")"}),s&&(u=Mg(t),o=s.c,o.join(r)!==u.c.join(r)))for(l=t.replace(qr,"1").split(yn),c=l.length-1;h<c;h++)r+=l[h]+(~o.indexOf(h)?n.shift()||a+"0,0,0,0)":(u.length?u:n.length?n:s).shift());if(!l)for(l=t.split(qr),c=l.length-1;h<c;h++)r+=l[h]+n[h];return r+l[c]},qr=function(){var i="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in yo)i+="|"+t+"\\b";return new RegExp(i+")","gi")}(),DA=/hsl[a]?\(/,kg=function(t){var e=t.join(" "),s;if(qr.lastIndex=0,qr.test(e))return s=DA.test(e),t[1]=Fg(t[1],s),t[0]=Fg(t[0],s,Mg(t[1])),!0},xo,ts=function(){var i=Date.now,t=500,e=33,s=i(),r=s,n=1e3/240,a=n,h=[],o,l,u,c,d,f,p=function m(g){var _=i()-r,x=g===!0,y,v,b,w;if((_>t||_<0)&&(s+=_-e),r+=_,b=r-s,y=b-a,(y>0||x)&&(w=++c.frame,d=b-c.time*1e3,c.time=b=b/1e3,a+=y+(y>=n?4:n-y),v=1),x||(o=l(m)),v)for(f=0;f<h.length;f++)h[f](b,d,w,g)};return c={time:0,frame:0,tick:function(){p(!0)},deltaRatio:function(g){return d/(1e3/(g||60))},wake:function(){ig&&(!Ic&&Ac()&&(tr=Ic=window,Pc=tr.document||{},Ke.gsap=Xe,(tr.gsapVersions||(tr.gsapVersions=[])).push(Xe.version),ng(tl||tr.GreenSockGlobals||!tr.gsap&&tr||{}),Ig.forEach(Pg)),u=typeof requestAnimationFrame<"u"&&requestAnimationFrame,o&&c.sleep(),l=u||function(g){return setTimeout(g,a-c.time*1e3+1|0)},xo=1,p(2))},sleep:function(){(u?cancelAnimationFrame:clearTimeout)(o),xo=0,l=uo},lagSmoothing:function(g,_){t=g||1/0,e=Math.min(_||33,t)},fps:function(g){n=1e3/(g||240),a=c.time*1e3+n},add:function(g,_,x){var y=_?function(v,b,w,E){g(v,b,w,E),c.remove(y)}:g;return c.remove(g),h[x?"unshift":"push"](y),En(),y},remove:function(g,_){~(_=h.indexOf(g))&&h.splice(_,1)&&f>=_&&f--},_listeners:h},c}(),En=function(){return!xo&&ts.wake()},ut={},OA=/^[\d.\-M][\d.\-,\s]/,LA=/["']/g,NA=function(t){for(var e={},s=t.substr(1,t.length-3).split(":"),r=s[0],n=1,a=s.length,h,o,l;n<a;n++)o=s[n],h=n!==a-1?o.lastIndexOf(","):o.length,l=o.substr(0,h),e[r]=isNaN(l)?l.replace(LA,"").trim():+l,r=o.substr(h+1).trim();return e},VA=function(t){var e=t.indexOf("(")+1,s=t.indexOf(")"),r=t.indexOf("(",e);return t.substring(e,~r&&r<s?t.indexOf(")",s+1):s)},UA=function(t){var e=(t+"").split("("),s=ut[e[0]];return s&&e.length>1&&s.config?s.config.apply(null,~t.indexOf("{")?[NA(e[1])]:VA(t).split(",").map(ug)):ut._CE&&OA.test(t)?ut._CE("",t):s},Bg=function(t){return function(e){return 1-t(1-e)}},Dg=function i(t,e){for(var s=t._first,r;s;)s instanceof Me?i(s,e):s.vars.yoyoEase&&(!s._yoyo||!s._repeat)&&s._yoyo!==e&&(s.timeline?i(s.timeline,e):(r=s._ease,s._ease=s._yEase,s._yEase=r,s._yoyo=e)),s=s._next},Mi=function(t,e){return t&&(Zt(t)?t:ut[t]||UA(t))||e},Fi=function(t,e,s,r){s===void 0&&(s=function(o){return 1-e(1-o)}),r===void 0&&(r=function(o){return o<.5?e(o*2)/2:1-e((1-o)*2)/2});var n={easeIn:e,easeOut:s,easeInOut:r},a;return Ue(t,function(h){ut[h]=Ke[h]=n,ut[a=h.toLowerCase()]=s;for(var o in n)ut[a+(o==="easeIn"?".in":o==="easeOut"?".out":".inOut")]=ut[h+"."+o]=n[o]}),n},Og=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},Xc=function i(t,e,s){var r=e>=1?e:1,n=(s||(t?.3:.45))/(e<1?e:1),a=n/Ec*(Math.asin(1/r)||0),h=function(u){return u===1?1:r*Math.pow(2,-10*u)*pA((u-a)*n)+1},o=t==="out"?h:t==="in"?function(l){return 1-h(1-l)}:Og(h);return n=Ec/n,o.config=function(l,u){return i(t,l,u)},o},$c=function i(t,e){e===void 0&&(e=1.70158);var s=function(a){return a?--a*a*((e+1)*a+e)+1:0},r=t==="out"?s:t==="in"?function(n){return 1-s(1-n)}:Og(s);return r.config=function(n){return i(t,n)},r};Ue("Linear,Quad,Cubic,Quart,Quint,Strong",function(i,t){var e=t<5?t+1:t;Fi(i+",Power"+(e-1),t?function(s){return Math.pow(s,e)}:function(s){return s},function(s){return 1-Math.pow(1-s,e)},function(s){return s<.5?Math.pow(s*2,e)/2:1-Math.pow((1-s)*2,e)/2})}),ut.Linear.easeNone=ut.none=ut.Linear.easeIn,Fi("Elastic",Xc("in"),Xc("out"),Xc()),function(i,t){var e=1/t,s=2*e,r=2.5*e,n=function(h){return h<e?i*h*h:h<s?i*Math.pow(h-1.5/t,2)+.75:h<r?i*(h-=2.25/t)*h+.9375:i*Math.pow(h-2.625/t,2)+.984375};Fi("Bounce",function(a){return 1-n(1-a)},n)}(7.5625,2.75),Fi("Expo",function(i){return i?Math.pow(2,10*(i-1)):0}),Fi("Circ",function(i){return-(Jm(1-i*i)-1)}),Fi("Sine",function(i){return i===1?1:-fA(i*uA)+1}),Fi("Back",$c("in"),$c("out"),$c()),ut.SteppedEase=ut.steps=Ke.SteppedEase={config:function(t,e){t===void 0&&(t=1);var s=1/t,r=t+(e?0:1),n=e?1:0,a=1-Mt;return function(h){return((r*mo(0,a,h)|0)+n)*s}}},_n.ease=ut["quad.out"],Ue("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(i){return Bc+=i+","+i+"Params,"});var Lg=function(t,e){this.id=dA++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:hg,this.set=e?e.getSetter:jc},vo=function(){function i(e){this.vars=e,this._delay=+e.delay||0,(this._repeat=e.repeat===1/0?-2:e.repeat||0)&&(this._rDelay=e.repeatDelay||0,this._yoyo=!!e.yoyo||!!e.yoyoEase),this._ts=1,bn(this,+e.duration,1,1),this.data=e.data,Dt&&(this._ctx=Dt,Dt.data.push(this)),xo||ts.wake()}var t=i.prototype;return t.delay=function(s){return s||s===0?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+s-this._delay),this._delay=s,this):this._delay},t.duration=function(s){return arguments.length?this.totalDuration(this._repeat>0?s+(s+this._rDelay)*this._repeat:s):this.totalDuration()&&this._dur},t.totalDuration=function(s){return arguments.length?(this._dirty=0,bn(this,this._repeat<0?s:(s-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(s,r){if(En(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(ll(this,s),!n._dp||n.parent||gg(n,this);n&&n.parent;)n.parent._time!==n._start+(n._ts>=0?n._tTime/n._ts:(n.totalDuration()-n._tTime)/-n._ts)&&n.totalTime(n._tTime,!0),n=n.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&s<this._tDur||this._ts<0&&s>0||!this._tDur&&!s)&&er(this._dp,this,this._start-this._delay)}return(this._tTime!==s||!this._dur&&!r||this._initted&&Math.abs(this._zTime)===Mt||!s&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=s),cg(this,s,r)),this},t.time=function(s,r){return arguments.length?this.totalTime(Math.min(this.totalDuration(),s+mg(this))%(this._dur+this._rDelay)||(s?this._dur:0),r):this._time},t.totalProgress=function(s,r){return arguments.length?this.totalTime(this.totalDuration()*s,r):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>0?1:0},t.progress=function(s,r){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-s:s)+mg(this),r):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},t.iteration=function(s,r){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(s-1)*n,r):this._repeat?vn(this._tTime,n)+1:1},t.timeScale=function(s,r){if(!arguments.length)return this._rts===-Mt?0:this._rts;if(this._rts===s)return this;var n=this.parent&&this._ts?ol(this.parent._time,this):this._tTime;return this._rts=+s||0,this._ts=this._ps||s===-Mt?0:this._rts,this.totalTime(mo(-Math.abs(this._delay),this._tDur,n),r!==!1),al(this),bA(this)},t.paused=function(s){return arguments.length?(this._ps!==s&&(this._ps=s,s?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(En(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==Mt&&(this._tTime-=Mt)))),this):this._ps},t.startTime=function(s){if(arguments.length){this._start=s;var r=this.parent||this._dp;return r&&(r._sort||!this.parent)&&er(r,this,s-this._delay),this}return this._start},t.endTime=function(s){return this._start+(Ve(s)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},t.rawTime=function(s){var r=this.parent||this._dp;return r?s&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?ol(r.rawTime(s),this):this._tTime:this._tTime},t.revert=function(s){s===void 0&&(s=_A);var r=Ae;return Ae=s,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(s),this.totalTime(-.01,s.suppressEvents)),this.data!=="nested"&&s.kill!==!1&&this.kill(),Ae=r,this},t.globalTime=function(s){for(var r=this,n=arguments.length?s:r.rawTime();r;)n=r._start+n/(Math.abs(r._ts)||1),r=r._dp;return!this.parent&&this._sat?this._sat.globalTime(s):n},t.repeat=function(s){return arguments.length?(this._repeat=s===1/0?-2:s,xg(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(s){if(arguments.length){var r=this._time;return this._rDelay=s,xg(this),r?this.time(r):this}return this._rDelay},t.yoyo=function(s){return arguments.length?(this._yoyo=s,this):this._yoyo},t.seek=function(s,r){return this.totalTime(ds(this,s),Ve(r))},t.restart=function(s,r){return this.play().totalTime(s?-this._delay:0,Ve(r))},t.play=function(s,r){return s!=null&&this.seek(s,r),this.reversed(!1).paused(!1)},t.reverse=function(s,r){return s!=null&&this.seek(s||this.totalDuration(),r),this.reversed(!0).paused(!1)},t.pause=function(s,r){return s!=null&&this.seek(s,r),this.paused(!0)},t.resume=function(){return this.paused(!1)},t.reversed=function(s){return arguments.length?(!!s!==this.reversed()&&this.timeScale(-this._rts||(s?-Mt:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-Mt,this},t.isActive=function(){var s=this.parent||this._dp,r=this._start,n;return!!(!s||this._ts&&this._initted&&s.isActive()&&(n=s.rawTime(!0))>=r&&n<this.endTime(!0)-Mt)},t.eventCallback=function(s,r,n){var a=this.vars;return arguments.length>1?(r?(a[s]=r,n&&(a[s+"Params"]=n),s==="onUpdate"&&(this._onUpdate=r)):delete a[s],this):a[s]},t.then=function(s){var r=this;return new Promise(function(n){var a=Zt(s)?s:dg,h=function(){var l=r.then;r.then=null,Zt(a)&&(a=a(r))&&(a.then||a===r)&&(r.then=l),n(a),r.then=l};r._initted&&r.totalProgress()===1&&r._ts>=0||!r._tTime&&r._ts<0?h():r._prom=h})},t.kill=function(){_o(this)},i}();us(vo.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-Mt,_prom:0,_ps:!1,_rts:1});var Me=function(i){Qm(t,i);function t(s,r){var n;return s===void 0&&(s={}),n=i.call(this,s)||this,n.labels={},n.smoothChildTiming=!!s.smoothChildTiming,n.autoRemoveChildren=!!s.autoRemoveChildren,n._sort=Ve(s.sortChildren),Ut&&er(s.parent||Ut,br(n),r),s.reversed&&n.reverse(),s.paused&&n.paused(!0),s.scrollTrigger&&_g(br(n),s.scrollTrigger),n}var e=t.prototype;return e.to=function(r,n,a){return po(0,arguments,this),this},e.from=function(r,n,a){return po(1,arguments,this),this},e.fromTo=function(r,n,a,h){return po(2,arguments,this),this},e.set=function(r,n,a){return n.duration=0,n.parent=this,fo(n).repeatDelay||(n.repeat=0),n.immediateRender=!!n.immediateRender,new ie(r,n,ds(this,a),1),this},e.call=function(r,n,a){return er(this,ie.delayedCall(0,r,n),a)},e.staggerTo=function(r,n,a,h,o,l,u){return a.duration=n,a.stagger=a.stagger||h,a.onComplete=l,a.onCompleteParams=u,a.parent=this,new ie(r,a,ds(this,o)),this},e.staggerFrom=function(r,n,a,h,o,l,u){return a.runBackwards=1,fo(a).immediateRender=Ve(a.immediateRender),this.staggerTo(r,n,a,h,o,l,u)},e.staggerFromTo=function(r,n,a,h,o,l,u,c){return h.startAt=a,fo(h).immediateRender=Ve(h.immediateRender),this.staggerTo(r,n,h,o,l,u,c)},e.render=function(r,n,a){var h=this._time,o=this._dirty?this.totalDuration():this._tDur,l=this._dur,u=r<=0?0:ge(r),c=this._zTime<0!=r<0&&(this._initted||!l),d,f,p,m,g,_,x,y,v,b,w,E;if(this!==Ut&&u>o&&r>=0&&(u=o),u!==this._tTime||a||c){if(h!==this._time&&l&&(u+=this._time-h,r+=this._time-h),d=u,v=this._start,y=this._ts,_=!y,c&&(l||(h=this._zTime),(r||!n)&&(this._zTime=r)),this._repeat){if(w=this._yoyo,g=l+this._rDelay,this._repeat<-1&&r<0)return this.totalTime(g*100+r,n,a);if(d=ge(u%g),u===o?(m=this._repeat,d=l):(m=~~(u/g),m&&m===u/g&&(d=l,m--),d>l&&(d=l)),b=vn(this._tTime,g),!h&&this._tTime&&b!==m&&this._tTime-b*g-this._dur<=0&&(b=m),w&&m&1&&(d=l-d,E=1),m!==b&&!this._lock){var T=w&&b&1,A=T===(w&&m&1);if(m<b&&(T=!T),h=T?0:u%l?l:u,this._lock=1,this.render(h||(E?0:ge(m*g)),n,!l)._lock=0,this._tTime=u,!n&&this.parent&&Je(this,"onRepeat"),this.vars.repeatRefresh&&!E&&(this.invalidate()._lock=1),h&&h!==this._time||_!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(l=this._dur,o=this._tDur,A&&(this._lock=2,h=T?l:-1e-4,this.render(h,!0),this.vars.repeatRefresh&&!E&&this.invalidate()),this._lock=0,!this._ts&&!_)return this;Dg(this,E)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(x=AA(this,ge(h),ge(d)),x&&(u-=d-(d=x._start))),this._tTime=u,this._time=d,this._act=!y,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=r,h=0),!h&&d&&!n&&!m&&(Je(this,"onStart"),this._tTime!==u))return this;if(d>=h&&r>=0)for(f=this._first;f;){if(p=f._next,(f._act||d>=f._start)&&f._ts&&x!==f){if(f.parent!==this)return this.render(r,n,a);if(f.render(f._ts>0?(d-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(d-f._start)*f._ts,n,a),d!==this._time||!this._ts&&!_){x=0,p&&(u+=this._zTime=-Mt);break}}f=p}else{f=this._last;for(var I=r<0?r:d;f;){if(p=f._prev,(f._act||I<=f._end)&&f._ts&&x!==f){if(f.parent!==this)return this.render(r,n,a);if(f.render(f._ts>0?(I-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(I-f._start)*f._ts,n,a||Ae&&(f._initted||f._startAt)),d!==this._time||!this._ts&&!_){x=0,p&&(u+=this._zTime=I?-Mt:Mt);break}}f=p}}if(x&&!n&&(this.pause(),x.render(d>=h?0:-Mt)._zTime=d>=h?1:-1,this._ts))return this._start=v,al(this),this.render(r,n,a);this._onUpdate&&!n&&Je(this,"onUpdate",!0),(u===o&&this._tTime>=this.totalDuration()||!u&&h)&&(v===this._start||Math.abs(y)!==Math.abs(this._ts))&&(this._lock||((r||!l)&&(u===o&&this._ts>0||!u&&this._ts<0)&&zr(this,1),!n&&!(r<0&&!h)&&(u||h||!o)&&(Je(this,u===o&&r>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(u<o&&this.timeScale()>0)&&this._prom())))}return this},e.add=function(r,n){var a=this;if(wr(n)||(n=ds(this,n,r)),!(r instanceof vo)){if(Se(r))return r.forEach(function(h){return a.add(h,n)}),this;if(me(r))return this.addLabel(r,n);if(Zt(r))r=ie.delayedCall(0,r);else return this}return this!==r?er(this,r,n):this},e.getChildren=function(r,n,a,h){r===void 0&&(r=!0),n===void 0&&(n=!0),a===void 0&&(a=!0),h===void 0&&(h=-cs);for(var o=[],l=this._first;l;)l._start>=h&&(l instanceof ie?n&&o.push(l):(a&&o.push(l),r&&o.push.apply(o,l.getChildren(!0,n,a)))),l=l._next;return o},e.getById=function(r){for(var n=this.getChildren(1,1,1),a=n.length;a--;)if(n[a].vars.id===r)return n[a]},e.remove=function(r){return me(r)?this.removeLabel(r):Zt(r)?this.killTweensOf(r):(nl(this,r),r===this._recent&&(this._recent=this._last),Ri(this))},e.totalTime=function(r,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=ge(ts.time-(this._ts>0?r/this._ts:(this.totalDuration()-r)/-this._ts))),i.prototype.totalTime.call(this,r,n),this._forcing=0,this):this._tTime},e.addLabel=function(r,n){return this.labels[r]=ds(this,n),this},e.removeLabel=function(r){return delete this.labels[r],this},e.addPause=function(r,n,a){var h=ie.delayedCall(0,n||uo,a);return h.data="isPause",this._hasPause=1,er(this,h,ds(this,r))},e.removePause=function(r){var n=this._first;for(r=ds(this,r);n;)n._start===r&&n.data==="isPause"&&zr(n),n=n._next},e.killTweensOf=function(r,n,a){for(var h=this.getTweensOf(r,a),o=h.length;o--;)Zr!==h[o]&&h[o].kill(r,n);return this},e.getTweensOf=function(r,n){for(var a=[],h=fs(r),o=this._first,l=wr(n),u;o;)o instanceof ie?yA(o._targets,h)&&(l?(!Zr||o._initted&&o._ts)&&o.globalTime(0)<=n&&o.globalTime(o.totalDuration())>n:!n||o.isActive())&&a.push(o):(u=o.getTweensOf(h,n)).length&&a.push.apply(a,u),o=o._next;return a},e.tweenTo=function(r,n){n=n||{};var a=this,h=ds(a,r),o=n,l=o.startAt,u=o.onStart,c=o.onStartParams,d=o.immediateRender,f,p=ie.to(a,us({ease:n.ease||"none",lazy:!1,immediateRender:!1,time:h,overwrite:"auto",duration:n.duration||Math.abs((h-(l&&"time"in l?l.time:a._time))/a.timeScale())||Mt,onStart:function(){if(a.pause(),!f){var g=n.duration||Math.abs((h-(l&&"time"in l?l.time:a._time))/a.timeScale());p._dur!==g&&bn(p,g,0,1).render(p._time,!0,!0),f=1}u&&u.apply(p,c||[])}},n));return d?p.render(0):p},e.tweenFromTo=function(r,n,a){return this.tweenTo(n,us({startAt:{time:ds(this,r)}},a))},e.recent=function(){return this._recent},e.nextLabel=function(r){return r===void 0&&(r=this._time),Cg(this,ds(this,r))},e.previousLabel=function(r){return r===void 0&&(r=this._time),Cg(this,ds(this,r),1)},e.currentLabel=function(r){return arguments.length?this.seek(r,!0):this.previousLabel(this._time+Mt)},e.shiftChildren=function(r,n,a){a===void 0&&(a=0);for(var h=this._first,o=this.labels,l;h;)h._start>=a&&(h._start+=r,h._end+=r),h=h._next;if(n)for(l in o)o[l]>=a&&(o[l]+=r);return Ri(this)},e.invalidate=function(r){var n=this._first;for(this._lock=0;n;)n.invalidate(r),n=n._next;return i.prototype.invalidate.call(this,r)},e.clear=function(r){r===void 0&&(r=!0);for(var n=this._first,a;n;)a=n._next,this.remove(n),n=a;return this._dp&&(this._time=this._tTime=this._pTime=0),r&&(this.labels={}),Ri(this)},e.totalDuration=function(r){var n=0,a=this,h=a._last,o=cs,l,u,c;if(arguments.length)return a.timeScale((a._repeat<0?a.duration():a.totalDuration())/(a.reversed()?-r:r));if(a._dirty){for(c=a.parent;h;)l=h._prev,h._dirty&&h.totalDuration(),u=h._start,u>o&&a._sort&&h._ts&&!a._lock?(a._lock=1,er(a,h,u-h._delay,1)._lock=0):o=u,u<0&&h._ts&&(n-=u,(!c&&!a._dp||c&&c.smoothChildTiming)&&(a._start+=u/a._ts,a._time-=u,a._tTime-=u),a.shiftChildren(-u,!1,-1/0),o=0),h._end>n&&h._ts&&(n=h._end),h=l;bn(a,a===Ut&&a._time>n?a._time:n,1,1),a._dirty=0}return a._tDur},t.updateRoot=function(r){if(Ut._ts&&(cg(Ut,ol(r,Ut)),ag=ts.frame),ts.frame>=lg){lg+=Ze.autoSleep||120;var n=Ut._first;if((!n||!n._ts)&&Ze.autoSleep&&ts._listeners.length<2){for(;n&&!n._ts;)n=n._next;n||ts.sleep()}}},t}(vo);us(Me.prototype,{_lock:0,_hasPause:0,_forcing:0});var GA=function(t,e,s,r,n,a,h){var o=new Ge(this._pt,t,e,0,1,$g,null,n),l=0,u=0,c,d,f,p,m,g,_,x;for(o.b=s,o.e=r,s+="",r+="",(_=~r.indexOf("random("))&&(r=go(r)),a&&(x=[s,r],a(x,t,e),s=x[0],r=x[1]),d=s.match(Cc)||[];c=Cc.exec(r);)p=c[0],m=r.substring(l,c.index),f?f=(f+1)%5:m.substr(-5)==="rgba("&&(f=1),p!==d[u++]&&(g=parseFloat(d[u-1])||0,o._pt={_next:o._pt,p:m||u===1?m:",",s:g,c:p.charAt(1)==="="?xn(g,p)-g:parseFloat(p)-g,m:f&&f<4?Math.round:0},l=Cc.lastIndex);return o.c=l<r.length?r.substring(l,r.length):"",o.fp=h,(sg.test(r)||_)&&(o.e=0),this._pt=o,o},Yc=function(t,e,s,r,n,a,h,o,l,u){Zt(r)&&(r=r(n||0,t,a));var c=t[e],d=s!=="get"?s:Zt(c)?l?t[e.indexOf("set")||!Zt(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():c,f=Zt(c)?l?WA:Gg:zc,p;if(me(r)&&(~r.indexOf("random(")&&(r=go(r)),r.charAt(1)==="="&&(p=xn(d,r)+(Ce(d)||0),(p||p===0)&&(r=p))),!u||d!==r||Hc)return!isNaN(d*r)&&r!==""?(p=new Ge(this._pt,t,e,+d||0,r-(d||0),typeof c=="boolean"?jA:Xg,0,f),l&&(p.fp=l),h&&p.modifier(h,this,t),this._pt=p):(!c&&!(e in t)&&Rc(e,r),GA.call(this,t,e,d,r,f,o||Ze.stringFilter,l))},XA=function(t,e,s,r,n){if(Zt(t)&&(t=bo(t,n,e,s,r)),!Js(t)||t.style&&t.nodeType||Se(t)||tg(t))return me(t)?bo(t,n,e,s,r):t;var a={},h;for(h in t)a[h]=bo(t[h],n,e,s,r);return a},Ng=function(t,e,s,r,n,a){var h,o,l,u;if(Qe[t]&&(h=new Qe[t]).init(n,h.rawVars?e[t]:XA(e[t],r,n,a,s),s,r,a)!==!1&&(s._pt=o=new Ge(s._pt,n,t,0,1,h.render,h,0,h.priority),s!==wn))for(l=s._ptLookup[s._targets.indexOf(n)],u=h._props.length;u--;)l[h._props[u]]=o;return h},Zr,Hc,Wc=function i(t,e,s){var r=t.vars,n=r.ease,a=r.startAt,h=r.immediateRender,o=r.lazy,l=r.onUpdate,u=r.runBackwards,c=r.yoyoEase,d=r.keyframes,f=r.autoRevert,p=t._dur,m=t._startAt,g=t._targets,_=t.parent,x=_&&_.data==="nested"?_.vars.targets:g,y=t._overwrite==="auto"&&!wc,v=t.timeline,b,w,E,T,A,I,M,R,C,P,k,U,V;if(v&&(!d||!n)&&(n="none"),t._ease=Mi(n,_n.ease),t._yEase=c?Bg(Mi(c===!0?n:c,_n.ease)):0,c&&t._yoyo&&!t._repeat&&(c=t._yEase,t._yEase=t._ease,t._ease=c),t._from=!v&&!!r.runBackwards,!v||d&&!r.stagger){if(R=g[0]?Ii(g[0]).harness:0,U=R&&r[R.prop],b=il(r,Mc),m&&(m._zTime<0&&m.progress(1),e<0&&u&&h&&!f?m.render(-1,!0):m.revert(u&&p?el:gA),m._lazy=0),a){if(zr(t._startAt=ie.set(g,us({data:"isStart",overwrite:!1,parent:_,immediateRender:!0,lazy:!m&&Ve(o),startAt:null,delay:0,onUpdate:l&&function(){return Je(t,"onUpdate")},stagger:0},a))),t._startAt._dp=0,t._startAt._sat=t,e<0&&(Ae||!h&&!f)&&t._startAt.revert(el),h&&p&&e<=0&&s<=0){e&&(t._zTime=e);return}}else if(u&&p&&!m){if(e&&(h=!1),E=us({overwrite:!1,data:"isFromStart",lazy:h&&!m&&Ve(o),immediateRender:h,stagger:0,parent:_},b),U&&(E[R.prop]=U),zr(t._startAt=ie.set(g,E)),t._startAt._dp=0,t._startAt._sat=t,e<0&&(Ae?t._startAt.revert(el):t._startAt.render(-1,!0)),t._zTime=e,!h)i(t._startAt,Mt,Mt);else if(!e)return}for(t._pt=t._ptCache=0,o=p&&Ve(o)||o&&!p,w=0;w<g.length;w++){if(A=g[w],M=A._gsap||Dc(g)[w]._gsap,t._ptLookup[w]=P={},Fc[M.id]&&Wr.length&&rl(),k=x===g?w:x.indexOf(A),R&&(C=new R).init(A,U||b,t,k,x)!==!1&&(t._pt=T=new Ge(t._pt,A,C.name,0,1,C.render,C,0,C.priority),C._props.forEach(function(L){P[L]=T}),C.priority&&(I=1)),!R||U)for(E in b)Qe[E]&&(C=Ng(E,b,t,k,A,x))?C.priority&&(I=1):P[E]=T=Yc.call(t,A,E,"get",b[E],k,x,0,r.stringFilter);t._op&&t._op[w]&&t.kill(A,t._op[w]),y&&t._pt&&(Zr=t,Ut.killTweensOf(A,P,t.globalTime(e)),V=!t.parent,Zr=0),t._pt&&o&&(Fc[M.id]=1)}I&&Yg(t),t._onInit&&t._onInit(t)}t._onUpdate=l,t._initted=(!t._op||t._pt)&&!V,d&&e<=0&&v.render(cs,!0,!0)},$A=function(t,e,s,r,n,a,h,o){var l=(t._pt&&t._ptCache||(t._ptCache={}))[e],u,c,d,f;if(!l)for(l=t._ptCache[e]=[],d=t._ptLookup,f=t._targets.length;f--;){if(u=d[f][e],u&&u.d&&u.d._pt)for(u=u.d._pt;u&&u.p!==e&&u.fp!==e;)u=u._next;if(!u)return Hc=1,t.vars[e]="+=0",Wc(t,h),Hc=0,o?co(e+" not eligible for reset"):1;l.push(u)}for(f=l.length;f--;)c=l[f],u=c._pt||c,u.s=(r||r===0)&&!n?r:u.s+(r||0)+a*u.c,u.c=s-u.s,c.e&&(c.e=te(s)+Ce(c.e)),c.b&&(c.b=u.s+Ce(c.b))},YA=function(t,e){var s=t[0]?Ii(t[0]).harness:0,r=s&&s.aliases,n,a,h,o;if(!r)return e;n=Pi({},e);for(a in r)if(a in n)for(o=r[a].split(","),h=o.length;h--;)n[o[h]]=n[a];return n},HA=function(t,e,s,r){var n=e.ease||r||"power1.inOut",a,h;if(Se(e))h=s[t]||(s[t]=[]),e.forEach(function(o,l){return h.push({t:l/(e.length-1)*100,v:o,e:n})});else for(a in e)h=s[a]||(s[a]=[]),a==="ease"||h.push({t:parseFloat(t),v:e[a],e:n})},bo=function(t,e,s,r,n){return Zt(t)?t.call(e,s,r,n):me(t)&&~t.indexOf("random(")?go(t):t},Vg=Bc+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",Ug={};Ue(Vg+",id,stagger,delay,duration,paused,scrollTrigger",function(i){return Ug[i]=1});var ie=function(i){Qm(t,i);function t(s,r,n,a){var h;typeof r=="number"&&(n.duration=r,r=n,n=null),h=i.call(this,a?r:fo(r))||this;var o=h.vars,l=o.duration,u=o.delay,c=o.immediateRender,d=o.stagger,f=o.overwrite,p=o.keyframes,m=o.defaults,g=o.scrollTrigger,_=o.yoyoEase,x=r.parent||Ut,y=(Se(s)||tg(s)?wr(s[0]):"length"in r)?[s]:fs(s),v,b,w,E,T,A,I,M;if(h._targets=y.length?Dc(y):co("GSAP target "+s+" not found. https://gsap.com",!Ze.nullTargetWarn)||[],h._ptLookup=[],h._overwrite=f,p||d||Ja(l)||Ja(u)){if(r=h.vars,v=h.timeline=new Me({data:"nested",defaults:m||{},targets:x&&x.data==="nested"?x.vars.targets:y}),v.kill(),v.parent=v._dp=br(h),v._start=0,d||Ja(l)||Ja(u)){if(E=y.length,I=d&&wg(d),Js(d))for(T in d)~Vg.indexOf(T)&&(M||(M={}),M[T]=d[T]);for(b=0;b<E;b++)w=il(r,Ug),w.stagger=0,_&&(w.yoyoEase=_),M&&Pi(w,M),A=y[b],w.duration=+bo(l,br(h),b,A,y),w.delay=(+bo(u,br(h),b,A,y)||0)-h._delay,!d&&E===1&&w.delay&&(h._delay=u=w.delay,h._start+=u,w.delay=0),v.to(A,w,I?I(b,A,y):0),v._ease=ut.none;v.duration()?l=u=0:h.timeline=0}else if(p){fo(us(v.vars.defaults,{ease:"none"})),v._ease=Mi(p.ease||r.ease||"none");var R=0,C,P,k;if(Se(p))p.forEach(function(U){return v.to(y,U,">")}),v.duration();else{w={};for(T in p)T==="ease"||T==="easeEach"||HA(T,p[T],w,p.easeEach);for(T in w)for(C=w[T].sort(function(U,V){return U.t-V.t}),R=0,b=0;b<C.length;b++)P=C[b],k={ease:P.e,duration:(P.t-(b?C[b-1].t:0))/100*l},k[T]=P.v,v.to(y,k,R),R+=k.duration;v.duration()<l&&v.to({},{duration:l-v.duration()})}}l||h.duration(l=v.duration())}else h.timeline=0;return f===!0&&!wc&&(Zr=br(h),Ut.killTweensOf(y),Zr=0),er(x,br(h),n),r.reversed&&h.reverse(),r.paused&&h.paused(!0),(c||!l&&!p&&h._start===ge(x._time)&&Ve(c)&&wA(br(h))&&x.data!=="nested")&&(h._tTime=-Mt,h.render(Math.max(0,-u)||0)),g&&_g(br(h),g),h}var e=t.prototype;return e.render=function(r,n,a){var h=this._time,o=this._tDur,l=this._dur,u=r<0,c=r>o-Mt&&!u?o:r<Mt?0:r,d,f,p,m,g,_,x,y,v;if(!l)TA(this,r,n,a);else if(c!==this._tTime||!r||a||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==u){if(d=c,y=this.timeline,this._repeat){if(m=l+this._rDelay,this._repeat<-1&&u)return this.totalTime(m*100+r,n,a);if(d=ge(c%m),c===o?(p=this._repeat,d=l):(p=~~(c/m),p&&p===ge(c/m)&&(d=l,p--),d>l&&(d=l)),_=this._yoyo&&p&1,_&&(v=this._yEase,d=l-d),g=vn(this._tTime,m),d===h&&!a&&this._initted&&p===g)return this._tTime=c,this;p!==g&&(y&&this._yEase&&Dg(y,_),this.vars.repeatRefresh&&!_&&!this._lock&&this._time!==m&&this._initted&&(this._lock=a=1,this.render(ge(m*p),!0).invalidate()._lock=0))}if(!this._initted){if(yg(this,u?r:d,a,n,c))return this._tTime=0,this;if(h!==this._time&&!(a&&this.vars.repeatRefresh&&p!==g))return this;if(l!==this._dur)return this.render(r,n,a)}if(this._tTime=c,this._time=d,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=x=(v||this._ease)(d/l),this._from&&(this.ratio=x=1-x),d&&!h&&!n&&!p&&(Je(this,"onStart"),this._tTime!==c))return this;for(f=this._pt;f;)f.r(x,f.d),f=f._next;y&&y.render(r<0?r:y._dur*y._ease(d/this._dur),n,a)||this._startAt&&(this._zTime=r),this._onUpdate&&!n&&(u&&Oc(this,r,n,a),Je(this,"onUpdate")),this._repeat&&p!==g&&this.vars.onRepeat&&!n&&this.parent&&Je(this,"onRepeat"),(c===this._tDur||!c)&&this._tTime===c&&(u&&!this._onUpdate&&Oc(this,r,!0,!0),(r||!l)&&(c===this._tDur&&this._ts>0||!c&&this._ts<0)&&zr(this,1),!n&&!(u&&!h)&&(c||h||_)&&(Je(this,c===o?"onComplete":"onReverseComplete",!0),this._prom&&!(c<o&&this.timeScale()>0)&&this._prom()))}return this},e.targets=function(){return this._targets},e.invalidate=function(r){return(!r||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(r),i.prototype.invalidate.call(this,r)},e.resetTo=function(r,n,a,h,o){xo||ts.wake(),this._ts||this.play();var l=Math.min(this._dur,(this._dp._time-this._start)*this._ts),u;return this._initted||Wc(this,l),u=this._ease(l/this._dur),$A(this,r,n,a,h,u,l,o)?this.resetTo(r,n,a,h,1):(ll(this,0),this.parent||pg(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},e.kill=function(r,n){if(n===void 0&&(n="all"),!r&&(!n||n==="all"))return this._lazy=this._pt=0,this.parent?_o(this):this;if(this.timeline){var a=this.timeline.totalDuration();return this.timeline.killTweensOf(r,n,Zr&&Zr.vars.overwrite!==!0)._first||_o(this),this.parent&&a!==this.timeline.totalDuration()&&bn(this,this._dur*this.timeline._tDur/a,0,1),this}var h=this._targets,o=r?fs(r):h,l=this._ptLookup,u=this._pt,c,d,f,p,m,g,_;if((!n||n==="all")&&vA(h,o))return n==="all"&&(this._pt=0),_o(this);for(c=this._op=this._op||[],n!=="all"&&(me(n)&&(m={},Ue(n,function(x){return m[x]=1}),n=m),n=YA(h,n)),_=h.length;_--;)if(~o.indexOf(h[_])){d=l[_],n==="all"?(c[_]=n,p=d,f={}):(f=c[_]=c[_]||{},p=n);for(m in p)g=d&&d[m],g&&((!("kill"in g.d)||g.d.kill(m)===!0)&&nl(this,g,"_pt"),delete d[m]),f!=="all"&&(f[m]=1)}return this._initted&&!this._pt&&u&&_o(this),this},t.to=function(r,n){return new t(r,n,arguments[2])},t.from=function(r,n){return po(1,arguments)},t.delayedCall=function(r,n,a,h){return new t(n,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:r,onComplete:n,onReverseComplete:n,onCompleteParams:a,onReverseCompleteParams:a,callbackScope:h})},t.fromTo=function(r,n,a){return po(2,arguments)},t.set=function(r,n){return n.duration=0,n.repeatDelay||(n.repeat=0),new t(r,n)},t.killTweensOf=function(r,n,a){return Ut.killTweensOf(r,n,a)},t}(vo);us(ie.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),Ue("staggerTo,staggerFrom,staggerFromTo",function(i){ie[i]=function(){var t=new Me,e=Nc.call(arguments,0);return e.splice(i==="staggerFromTo"?5:4,0,0),t[i].apply(t,e)}});var zc=function(t,e,s){return t[e]=s},Gg=function(t,e,s){return t[e](s)},WA=function(t,e,s,r){return t[e](r.fp,s)},zA=function(t,e,s){return t.setAttribute(e,s)},jc=function(t,e){return Zt(t[e])?Gg:Tc(t[e])&&t.setAttribute?zA:zc},Xg=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},jA=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},$g=function(t,e){var s=e._pt,r="";if(!t&&e.b)r=e.b;else if(t===1&&e.e)r=e.e;else{for(;s;)r=s.p+(s.m?s.m(s.s+s.c*t):Math.round((s.s+s.c*t)*1e4)/1e4)+r,s=s._next;r+=e.c}e.set(e.t,e.p,r,e)},qc=function(t,e){for(var s=e._pt;s;)s.r(t,s.d),s=s._next},qA=function(t,e,s,r){for(var n=this._pt,a;n;)a=n._next,n.p===r&&n.modifier(t,e,s),n=a},ZA=function(t){for(var e=this._pt,s,r;e;)r=e._next,e.p===t&&!e.op||e.op===t?nl(this,e,"_pt"):e.dep||(s=1),e=r;return!s},KA=function(t,e,s,r){r.mSet(t,e,r.m.call(r.tween,s,r.mt),r)},Yg=function(t){for(var e=t._pt,s,r,n,a;e;){for(s=e._next,r=n;r&&r.pr>e.pr;)r=r._next;(e._prev=r?r._prev:a)?e._prev._next=e:n=e,(e._next=r)?r._prev=e:a=e,e=s}t._pt=n},Ge=function(){function i(e,s,r,n,a,h,o,l,u){this.t=s,this.s=n,this.c=a,this.p=r,this.r=h||Xg,this.d=o||this,this.set=l||zc,this.pr=u||0,this._next=e,e&&(e._prev=this)}var t=i.prototype;return t.modifier=function(s,r,n){this.mSet=this.mSet||this.set,this.set=KA,this.m=s,this.mt=n,this.tween=r},i}();Ue(Bc+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(i){return Mc[i]=1}),Ke.TweenMax=Ke.TweenLite=ie,Ke.TimelineLite=Ke.TimelineMax=Me,Ut=new Me({sortChildren:!1,defaults:_n,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Ze.stringFilter=kg;var ki=[],hl={},QA=[],Hg=0,JA=0,Zc=function(t){return(hl[t]||QA).map(function(e){return e()})},Kc=function(){var t=Date.now(),e=[];t-Hg>2&&(Zc("matchMediaInit"),ki.forEach(function(s){var r=s.queries,n=s.conditions,a,h,o,l;for(h in r)a=tr.matchMedia(r[h]).matches,a&&(o=1),a!==n[h]&&(n[h]=a,l=1);l&&(s.revert(),o&&e.push(s))}),Zc("matchMediaRevert"),e.forEach(function(s){return s.onMatch(s,function(r){return s.add(null,r)})}),Hg=t,Zc("matchMedia"))},Wg=function(){function i(e,s){this.selector=s&&Vc(s),this.data=[],this._r=[],this.isReverted=!1,this.id=JA++,e&&this.add(e)}var t=i.prototype;return t.add=function(s,r,n){Zt(s)&&(n=r,r=s,s=Zt);var a=this,h=function(){var l=Dt,u=a.selector,c;return l&&l!==a&&l.data.push(a),n&&(a.selector=Vc(n)),Dt=a,c=r.apply(a,arguments),Zt(c)&&a._r.push(c),Dt=l,a.selector=u,a.isReverted=!1,c};return a.last=h,s===Zt?h(a,function(o){return a.add(null,o)}):s?a[s]=h:h},t.ignore=function(s){var r=Dt;Dt=null,s(this),Dt=r},t.getTweens=function(){var s=[];return this.data.forEach(function(r){return r instanceof i?s.push.apply(s,r.getTweens()):r instanceof ie&&!(r.parent&&r.parent.data==="nested")&&s.push(r)}),s},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(s,r){var n=this;if(s?function(){for(var h=n.getTweens(),o=n.data.length,l;o--;)l=n.data[o],l.data==="isFlip"&&(l.revert(),l.getChildren(!0,!0,!1).forEach(function(u){return h.splice(h.indexOf(u),1)}));for(h.map(function(u){return{g:u._dur||u._delay||u._sat&&!u._sat.vars.immediateRender?u.globalTime(0):-1/0,t:u}}).sort(function(u,c){return c.g-u.g||-1/0}).forEach(function(u){return u.t.revert(s)}),o=n.data.length;o--;)l=n.data[o],l instanceof Me?l.data!=="nested"&&(l.scrollTrigger&&l.scrollTrigger.revert(),l.kill()):!(l instanceof ie)&&l.revert&&l.revert(s);n._r.forEach(function(u){return u(s,n)}),n.isReverted=!0}():this.data.forEach(function(h){return h.kill&&h.kill()}),this.clear(),r)for(var a=ki.length;a--;)ki[a].id===this.id&&ki.splice(a,1)},t.revert=function(s){this.kill(s||{})},i}(),tS=function(){function i(e){this.contexts=[],this.scope=e,Dt&&Dt.data.push(this)}var t=i.prototype;return t.add=function(s,r,n){Js(s)||(s={matches:s});var a=new Wg(0,n||this.scope),h=a.conditions={},o,l,u;Dt&&!a.selector&&(a.selector=Dt.selector),this.contexts.push(a),r=a.add("onMatch",r),a.queries=s;for(l in s)l==="all"?u=1:(o=tr.matchMedia(s[l]),o&&(ki.indexOf(a)<0&&ki.push(a),(h[l]=o.matches)&&(u=1),o.addListener?o.addListener(Kc):o.addEventListener("change",Kc)));return u&&r(a,function(c){return a.add(null,c)}),this},t.revert=function(s){this.kill(s||{})},t.kill=function(s){this.contexts.forEach(function(r){return r.kill(s,!0)})},i}(),cl={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];e.forEach(function(r){return Pg(r)})},timeline:function(t){return new Me(t)},getTweensOf:function(t,e){return Ut.getTweensOf(t,e)},getProperty:function(t,e,s,r){me(t)&&(t=fs(t)[0]);var n=Ii(t||{}).get,a=s?dg:ug;return s==="native"&&(s=""),t&&(e?a((Qe[e]&&Qe[e].get||n)(t,e,s,r)):function(h,o,l){return a((Qe[h]&&Qe[h].get||n)(t,h,o,l))})},quickSetter:function(t,e,s){if(t=fs(t),t.length>1){var r=t.map(function(u){return Xe.quickSetter(u,e,s)}),n=r.length;return function(u){for(var c=n;c--;)r[c](u)}}t=t[0]||{};var a=Qe[e],h=Ii(t),o=h.harness&&(h.harness.aliases||{})[e]||e,l=a?function(u){var c=new a;wn._pt=0,c.init(t,s?u+s:u,wn,0,[t]),c.render(1,c),wn._pt&&qc(1,wn)}:h.set(t,o);return a?l:function(u){return l(t,o,s?u+s:u,h,1)}},quickTo:function(t,e,s){var r,n=Xe.to(t,Pi((r={},r[e]="+=0.1",r.paused=!0,r),s||{})),a=function(o,l,u){return n.resetTo(e,o,l,u)};return a.tween=n,a},isTweening:function(t){return Ut.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=Mi(t.ease,_n.ease)),fg(_n,t||{})},config:function(t){return fg(Ze,t||{})},registerEffect:function(t){var e=t.name,s=t.effect,r=t.plugins,n=t.defaults,a=t.extendTimeline;(r||"").split(",").forEach(function(h){return h&&!Qe[h]&&!Ke[h]&&co(e+" effect requires "+h+" plugin.")}),kc[e]=function(h,o,l){return s(fs(h),us(o||{},n),l)},a&&(Me.prototype[e]=function(h,o,l){return this.add(kc[e](h,Js(o)?o:(l=o)&&{},this),l)})},registerEase:function(t,e){ut[t]=Mi(e)},parseEase:function(t,e){return arguments.length?Mi(t,e):ut},getById:function(t){return Ut.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var s=new Me(t),r,n;for(s.smoothChildTiming=Ve(t.smoothChildTiming),Ut.remove(s),s._dp=0,s._time=s._tTime=Ut._time,r=Ut._first;r;)n=r._next,(e||!(!r._dur&&r instanceof ie&&r.vars.onComplete===r._targets[0]))&&er(s,r,r._start-r._delay),r=n;return er(Ut,s,0),s},context:function(t,e){return t?new Wg(t,e):Dt},matchMedia:function(t){return new tS(t)},matchMediaRefresh:function(){return ki.forEach(function(t){var e=t.conditions,s,r;for(r in e)e[r]&&(e[r]=!1,s=1);s&&t.revert()})||Kc()},addEventListener:function(t,e){var s=hl[t]||(hl[t]=[]);~s.indexOf(e)||s.push(e)},removeEventListener:function(t,e){var s=hl[t],r=s&&s.indexOf(e);r>=0&&s.splice(r,1)},utils:{wrap:FA,wrapYoyo:kA,distribute:wg,random:Tg,snap:Eg,normalize:MA,getUnit:Ce,clamp:CA,splitColor:Rg,toArray:fs,selector:Vc,mapRange:Sg,pipe:PA,unitize:RA,interpolate:BA,shuffle:bg},install:ng,effects:kc,ticker:ts,updateRoot:Me.updateRoot,plugins:Qe,globalTimeline:Ut,core:{PropTween:Ge,globals:og,Tween:ie,Timeline:Me,Animation:vo,getCache:Ii,_removeLinkedListItem:nl,reverting:function(){return Ae},context:function(t){return t&&Dt&&(Dt.data.push(t),t._ctx=Dt),Dt},suppressOverwrites:function(t){return wc=t}}};Ue("to,from,fromTo,delayedCall,set,killTweensOf",function(i){return cl[i]=ie[i]}),ts.add(Me.updateRoot),wn=cl.to({},{duration:0});var eS=function(t,e){for(var s=t._pt;s&&s.p!==e&&s.op!==e&&s.fp!==e;)s=s._next;return s},sS=function(t,e){var s=t._targets,r,n,a;for(r in e)for(n=s.length;n--;)a=t._ptLookup[n][r],a&&(a=a.d)&&(a._pt&&(a=eS(a,r)),a&&a.modifier&&a.modifier(e[r],t,s[n],r))},Qc=function(t,e){return{name:t,rawVars:1,init:function(r,n,a){a._onInit=function(h){var o,l;if(me(n)&&(o={},Ue(n,function(u){return o[u]=1}),n=o),e){o={};for(l in n)o[l]=e(n[l]);n=o}sS(h,n)}}}},Xe=cl.registerPlugin({name:"attr",init:function(t,e,s,r,n){var a,h,o;this.tween=s;for(a in e)o=t.getAttribute(a)||"",h=this.add(t,"setAttribute",(o||0)+"",e[a],r,n,0,0,a),h.op=a,h.b=o,this._props.push(a)},render:function(t,e){for(var s=e._pt;s;)Ae?s.set(s.t,s.p,s.b,s):s.r(t,s.d),s=s._next}},{name:"endArray",init:function(t,e){for(var s=e.length;s--;)this.add(t,s,t[s]||0,e[s],0,0,0,0,0,1)}},Qc("roundProps",Uc),Qc("modifiers"),Qc("snap",Eg))||cl;ie.version=Me.version=Xe.version="3.12.5",ig=1,Ac()&&En(),ut.Power0,ut.Power1,ut.Power2,ut.Power3,ut.Power4,ut.Linear,ut.Quad,ut.Cubic,ut.Quart,ut.Quint,ut.Strong,ut.Elastic,ut.Back,ut.SteppedEase,ut.Bounce,ut.Sine,ut.Expo,ut.Circ;/*!
1156
1156
  * CSSPlugin 3.12.5
1157
1157
  * https://gsap.com
1158
1158
  *
@@ -1160,15 +1160,15 @@ void main(void)\r
1160
1160
  * Subject to the terms at https://gsap.com/standard-license or for
1161
1161
  * Club GSAP members, the agreement issued with that membership.
1162
1162
  * @author: Jack Doyle, jack@greensock.com
1163
- */var Qg,Kr,Tn,su,Bi,Jg,ru,eS=function(){return typeof window<"u"},Er={},Di=180/Math.PI,An=Math.PI/180,Sn=Math.atan2,t_=1e8,iu=/([A-Z])/g,sS=/(left|right|width|margin|padding|x)/i,rS=/[\s,\(]\S/,sr={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},nu=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},iS=function(t,e){return e.set(e.t,e.p,t===1?e.e:Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},nS=function(t,e){return e.set(e.t,e.p,t?Math.round((e.s+e.c*t)*1e4)/1e4+e.u:e.b,e)},oS=function(t,e){var s=e.s+e.c*t;e.set(e.t,e.p,~~(s+(s<0?-.5:.5))+e.u,e)},e_=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},s_=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},aS=function(t,e,s){return t.style[e]=s},lS=function(t,e,s){return t.style.setProperty(e,s)},hS=function(t,e,s){return t._gsap[e]=s},cS=function(t,e,s){return t._gsap.scaleX=t._gsap.scaleY=s},uS=function(t,e,s,r,n){var a=t._gsap;a.scaleX=a.scaleY=s,a.renderTransform(n,a)},dS=function(t,e,s,r,n){var a=t._gsap;a[e]=s,a.renderTransform(n,a)},Gt="transform",$e=Gt+"Origin",fS=function i(t,e){var s=this,r=this.target,n=r.style,a=r._gsap;if(t in Er&&n){if(this.tfm=this.tfm||{},t!=="transform")t=sr[t]||t,~t.indexOf(",")?t.split(",").forEach(function(h){return s.tfm[h]=Tr(r,h)}):this.tfm[t]=a.x?a[t]:Tr(r,t),t===$e&&(this.tfm.zOrigin=a.zOrigin);else return sr.transform.split(",").forEach(function(h){return i.call(s,h,e)});if(this.props.indexOf(Gt)>=0)return;a.svg&&(this.svgo=r.getAttribute("data-svg-origin"),this.props.push($e,e,"")),t=Gt}(n||e)&&this.props.push(t,e,n[t])},r_=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},pS=function(){var t=this.props,e=this.target,s=e.style,r=e._gsap,n,a;for(n=0;n<t.length;n+=3)t[n+1]?e[t[n]]=t[n+2]:t[n+2]?s[t[n]]=t[n+2]:s.removeProperty(t[n].substr(0,2)==="--"?t[n]:t[n].replace(iu,"-$1").toLowerCase());if(this.tfm){for(a in this.tfm)r[a]=this.tfm[a];r.svg&&(r.renderTransform(),e.setAttribute("data-svg-origin",this.svgo||"")),n=ru(),(!n||!n.isStart)&&!s[Gt]&&(r_(s),r.zOrigin&&s[$e]&&(s[$e]+=" "+r.zOrigin+"px",r.zOrigin=0,r.renderTransform()),r.uncache=1)}},i_=function(t,e){var s={target:t,props:[],revert:pS,save:fS};return t._gsap||Xe.core.getCache(t),e&&e.split(",").forEach(function(r){return s.save(r)}),s},n_,ou=function(t,e){var s=Kr.createElementNS?Kr.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Kr.createElement(t);return s&&s.style?s:Kr.createElement(t)},rr=function i(t,e,s){var r=getComputedStyle(t);return r[e]||r.getPropertyValue(e.replace(iu,"-$1").toLowerCase())||r.getPropertyValue(e)||!s&&i(t,Cn(e)||e,1)||""},o_="O,Moz,ms,Ms,Webkit".split(","),Cn=function(t,e,s){var r=e||Bi,n=r.style,a=5;if(t in n&&!s)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);a--&&!(o_[a]+t in n););return a<0?null:(a===3?"ms":a>=0?o_[a]:"")+t},au=function(){eS()&&window.document&&(Qg=window,Kr=Qg.document,Tn=Kr.documentElement,Bi=ou("div")||{style:{}},ou("div"),Gt=Cn(Gt),$e=Gt+"Origin",Bi.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",n_=!!Cn("perspective"),ru=Xe.core.reverting,su=1)},lu=function i(t){var e=ou("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),s=this.parentNode,r=this.nextSibling,n=this.style.cssText,a;if(Tn.appendChild(e),e.appendChild(this),this.style.display="block",t)try{a=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=i}catch{}else this._gsapBBox&&(a=this._gsapBBox());return s&&(r?s.insertBefore(this,r):s.appendChild(this)),Tn.removeChild(e),this.style.cssText=n,a},a_=function(t,e){for(var s=e.length;s--;)if(t.hasAttribute(e[s]))return t.getAttribute(e[s])},l_=function(t){var e;try{e=t.getBBox()}catch{e=lu.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===lu||(e=lu.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+a_(t,["x","cx","x1"])||0,y:+a_(t,["y","cy","y1"])||0,width:0,height:0}:e},h_=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&l_(t))},Oi=function(t,e){if(e){var s=t.style,r;e in Er&&e!==$e&&(e=Gt),s.removeProperty?(r=e.substr(0,2),(r==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),s.removeProperty(r==="--"?e:e.replace(iu,"-$1").toLowerCase())):s.removeAttribute(e)}},Qr=function(t,e,s,r,n,a){var h=new Ge(t._pt,e,s,0,1,a?s_:e_);return t._pt=h,h.b=r,h.e=n,t._props.push(s),h},c_={deg:1,rad:1,turn:1},mS={grid:1,flex:1},Jr=function i(t,e,s,r){var n=parseFloat(s)||0,a=(s+"").trim().substr((n+"").length)||"px",h=Bi.style,o=sS.test(e),l=t.tagName.toLowerCase()==="svg",u=(l?"client":"offset")+(o?"Width":"Height"),c=100,d=r==="px",f=r==="%",p,m,g,_;if(r===a||!n||c_[r]||c_[a])return n;if(a!=="px"&&!d&&(n=i(t,e,s,"px")),_=t.getCTM&&h_(t),(f||a==="%")&&(Er[e]||~e.indexOf("adius")))return p=_?t.getBBox()[o?"width":"height"]:t[u],te(f?n/p*c:n/100*p);if(h[o?"width":"height"]=c+(d?a:r),m=~e.indexOf("adius")||r==="em"&&t.appendChild&&!l?t:t.parentNode,_&&(m=(t.ownerSVGElement||{}).parentNode),(!m||m===Kr||!m.appendChild)&&(m=Kr.body),g=m._gsap,g&&f&&g.width&&o&&g.time===ts.time&&!g.uncache)return te(n/g.width*c);if(f&&(e==="height"||e==="width")){var x=t.style[e];t.style[e]=c+r,p=t[u],x?t.style[e]=x:Oi(t,e)}else(f||a==="%")&&!mS[rr(m,"display")]&&(h.position=rr(t,"position")),m===t&&(h.position="static"),m.appendChild(Bi),p=Bi[u],m.removeChild(Bi),h.position="absolute";return o&&f&&(g=Ii(m),g.time=ts.time,g.width=m[u]),te(d?p*n/c:p&&n?c/p*n:0)},Tr=function(t,e,s,r){var n;return su||au(),e in sr&&e!=="transform"&&(e=sr[e],~e.indexOf(",")&&(e=e.split(",")[0])),Er[e]&&e!=="transform"?(n=Eo(t,r),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:dl(rr(t,$e))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||r||~(n+"").indexOf("calc("))&&(n=ul[e]&&ul[e](t,e,s)||rr(t,e)||pg(t,e)||(e==="opacity"?1:0))),s&&!~(n+"").trim().indexOf(" ")?Jr(t,e,n,s)+s:n},gS=function(t,e,s,r){if(!s||s==="none"){var n=Cn(e,t,1),a=n&&rr(t,n,1);a&&a!==s?(e=n,s=a):e==="borderColor"&&(s=rr(t,"borderTopColor"))}var h=new Ge(this._pt,t.style,e,0,1,jg),o=0,l=0,u,c,d,f,p,m,g,_,x,y,v,b;if(h.b=s,h.e=r,s+="",r+="",r==="auto"&&(m=t.style[e],t.style[e]=r,r=rr(t,e)||r,m?t.style[e]=m:Oi(t,e)),u=[s,r],Ng(u),s=u[0],r=u[1],d=s.match(yn)||[],b=r.match(yn)||[],b.length){for(;c=yn.exec(r);)g=c[0],x=r.substring(o,c.index),p?p=(p+1)%5:(x.substr(-5)==="rgba("||x.substr(-5)==="hsla(")&&(p=1),g!==(m=d[l++]||"")&&(f=parseFloat(m)||0,v=m.substr((f+"").length),g.charAt(1)==="="&&(g=xn(f,g)+v),_=parseFloat(g),y=g.substr((_+"").length),o=yn.lastIndex-y.length,y||(y=y||Ze.units[e]||v,o===r.length&&(r+=y,h.e+=y)),v!==y&&(f=Jr(t,e,m,y)||0),h._pt={_next:h._pt,p:x||l===1?x:",",s:f,c:_-f,m:p&&p<4||e==="zIndex"?Math.round:0});h.c=o<r.length?r.substring(o,r.length):""}else h.r=e==="display"&&r==="none"?s_:e_;return ag.test(r)&&(h.e=0),this._pt=h,h},u_={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},_S=function(t){var e=t.split(" "),s=e[0],r=e[1]||"50%";return(s==="top"||s==="bottom"||r==="left"||r==="right")&&(t=s,s=r,r=t),e[0]=u_[s]||s,e[1]=u_[r]||r,e.join(" ")},yS=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var s=e.t,r=s.style,n=e.u,a=s._gsap,h,o,l;if(n==="all"||n===!0)r.cssText="",o=1;else for(n=n.split(","),l=n.length;--l>-1;)h=n[l],Er[h]&&(o=1,h=h==="transformOrigin"?$e:Gt),Oi(s,h);o&&(Oi(s,Gt),a&&(a.svg&&s.removeAttribute("transform"),Eo(s,1),a.uncache=1,r_(r)))}},ul={clearProps:function(t,e,s,r,n){if(n.data!=="isFromStart"){var a=t._pt=new Ge(t._pt,e,s,0,0,yS);return a.u=r,a.pr=-10,a.tween=n,t._props.push(s),1}}},wo=[1,0,0,1,0,0],d_={},f_=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},p_=function(t){var e=rr(t,Gt);return f_(e)?wo:e.substr(7).match(og).map(te)},hu=function(t,e){var s=t._gsap||Ii(t),r=t.style,n=p_(t),a,h,o,l;return s.svg&&t.getAttribute("transform")?(o=t.transform.baseVal.consolidate().matrix,n=[o.a,o.b,o.c,o.d,o.e,o.f],n.join(",")==="1,0,0,1,0,0"?wo:n):(n===wo&&!t.offsetParent&&t!==Tn&&!s.svg&&(o=r.display,r.display="block",a=t.parentNode,(!a||!t.offsetParent)&&(l=1,h=t.nextElementSibling,Tn.appendChild(t)),n=p_(t),o?r.display=o:Oi(t,"display"),l&&(h?a.insertBefore(t,h):a?a.appendChild(t):Tn.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},cu=function(t,e,s,r,n,a){var h=t._gsap,o=n||hu(t,!0),l=h.xOrigin||0,u=h.yOrigin||0,c=h.xOffset||0,d=h.yOffset||0,f=o[0],p=o[1],m=o[2],g=o[3],_=o[4],x=o[5],y=e.split(" "),v=parseFloat(y[0])||0,b=parseFloat(y[1])||0,w,E,T,A;s?o!==wo&&(E=f*g-p*m)&&(T=v*(g/E)+b*(-m/E)+(m*x-g*_)/E,A=v*(-p/E)+b*(f/E)-(f*x-p*_)/E,v=T,b=A):(w=l_(t),v=w.x+(~y[0].indexOf("%")?v/100*w.width:v),b=w.y+(~(y[1]||y[0]).indexOf("%")?b/100*w.height:b)),r||r!==!1&&h.smooth?(_=v-l,x=b-u,h.xOffset=c+(_*f+x*m)-_,h.yOffset=d+(_*p+x*g)-x):h.xOffset=h.yOffset=0,h.xOrigin=v,h.yOrigin=b,h.smooth=!!r,h.origin=e,h.originIsAbsolute=!!s,t.style[$e]="0px 0px",a&&(Qr(a,h,"xOrigin",l,v),Qr(a,h,"yOrigin",u,b),Qr(a,h,"xOffset",c,h.xOffset),Qr(a,h,"yOffset",d,h.yOffset)),t.setAttribute("data-svg-origin",v+" "+b)},Eo=function(t,e){var s=t._gsap||new Xg(t);if("x"in s&&!e&&!s.uncache)return s;var r=t.style,n=s.scaleX<0,a="px",h="deg",o=getComputedStyle(t),l=rr(t,$e)||"0",u,c,d,f,p,m,g,_,x,y,v,b,w,E,T,A,I,M,R,C,P,k,U,V,L,$,O,N,Z,Q,H,lt;return u=c=d=m=g=_=x=y=v=0,f=p=1,s.svg=!!(t.getCTM&&h_(t)),o.translate&&((o.translate!=="none"||o.scale!=="none"||o.rotate!=="none")&&(r[Gt]=(o.translate!=="none"?"translate3d("+(o.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(o.rotate!=="none"?"rotate("+o.rotate+") ":"")+(o.scale!=="none"?"scale("+o.scale.split(" ").join(",")+") ":"")+(o[Gt]!=="none"?o[Gt]:"")),r.scale=r.rotate=r.translate="none"),E=hu(t,s.svg),s.svg&&(s.uncache?(L=t.getBBox(),l=s.xOrigin-L.x+"px "+(s.yOrigin-L.y)+"px",V=""):V=!e&&t.getAttribute("data-svg-origin"),cu(t,V||l,!!V||s.originIsAbsolute,s.smooth!==!1,E)),b=s.xOrigin||0,w=s.yOrigin||0,E!==wo&&(M=E[0],R=E[1],C=E[2],P=E[3],u=k=E[4],c=U=E[5],E.length===6?(f=Math.sqrt(M*M+R*R),p=Math.sqrt(P*P+C*C),m=M||R?Sn(R,M)*Di:0,x=C||P?Sn(C,P)*Di+m:0,x&&(p*=Math.abs(Math.cos(x*An))),s.svg&&(u-=b-(b*M+w*C),c-=w-(b*R+w*P))):(lt=E[6],Q=E[7],O=E[8],N=E[9],Z=E[10],H=E[11],u=E[12],c=E[13],d=E[14],T=Sn(lt,Z),g=T*Di,T&&(A=Math.cos(-T),I=Math.sin(-T),V=k*A+O*I,L=U*A+N*I,$=lt*A+Z*I,O=k*-I+O*A,N=U*-I+N*A,Z=lt*-I+Z*A,H=Q*-I+H*A,k=V,U=L,lt=$),T=Sn(-C,Z),_=T*Di,T&&(A=Math.cos(-T),I=Math.sin(-T),V=M*A-O*I,L=R*A-N*I,$=C*A-Z*I,H=P*I+H*A,M=V,R=L,C=$),T=Sn(R,M),m=T*Di,T&&(A=Math.cos(T),I=Math.sin(T),V=M*A+R*I,L=k*A+U*I,R=R*A-M*I,U=U*A-k*I,M=V,k=L),g&&Math.abs(g)+Math.abs(m)>359.9&&(g=m=0,_=180-_),f=te(Math.sqrt(M*M+R*R+C*C)),p=te(Math.sqrt(U*U+lt*lt)),T=Sn(k,U),x=Math.abs(T)>2e-4?T*Di:0,v=H?1/(H<0?-H:H):0),s.svg&&(V=t.getAttribute("transform"),s.forceCSS=t.setAttribute("transform","")||!f_(rr(t,Gt)),V&&t.setAttribute("transform",V))),Math.abs(x)>90&&Math.abs(x)<270&&(n?(f*=-1,x+=m<=0?180:-180,m+=m<=0?180:-180):(p*=-1,x+=x<=0?180:-180)),e=e||s.uncache,s.x=u-((s.xPercent=u&&(!e&&s.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-u)?-50:0)))?t.offsetWidth*s.xPercent/100:0)+a,s.y=c-((s.yPercent=c&&(!e&&s.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-c)?-50:0)))?t.offsetHeight*s.yPercent/100:0)+a,s.z=d+a,s.scaleX=te(f),s.scaleY=te(p),s.rotation=te(m)+h,s.rotationX=te(g)+h,s.rotationY=te(_)+h,s.skewX=x+h,s.skewY=y+h,s.transformPerspective=v+a,(s.zOrigin=parseFloat(l.split(" ")[2])||!e&&s.zOrigin||0)&&(r[$e]=dl(l)),s.xOffset=s.yOffset=0,s.force3D=Ze.force3D,s.renderTransform=s.svg?vS:n_?m_:xS,s.uncache=0,s},dl=function(t){return(t=t.split(" "))[0]+" "+t[1]},uu=function(t,e,s){var r=Ce(e);return te(parseFloat(e)+parseFloat(Jr(t,"x",s+"px",r)))+r},xS=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,m_(t,e)},Li="0deg",To="0px",Ni=") ",m_=function(t,e){var s=e||this,r=s.xPercent,n=s.yPercent,a=s.x,h=s.y,o=s.z,l=s.rotation,u=s.rotationY,c=s.rotationX,d=s.skewX,f=s.skewY,p=s.scaleX,m=s.scaleY,g=s.transformPerspective,_=s.force3D,x=s.target,y=s.zOrigin,v="",b=_==="auto"&&t&&t!==1||_===!0;if(y&&(c!==Li||u!==Li)){var w=parseFloat(u)*An,E=Math.sin(w),T=Math.cos(w),A;w=parseFloat(c)*An,A=Math.cos(w),a=uu(x,a,E*A*-y),h=uu(x,h,-Math.sin(w)*-y),o=uu(x,o,T*A*-y+y)}g!==To&&(v+="perspective("+g+Ni),(r||n)&&(v+="translate("+r+"%, "+n+"%) "),(b||a!==To||h!==To||o!==To)&&(v+=o!==To||b?"translate3d("+a+", "+h+", "+o+") ":"translate("+a+", "+h+Ni),l!==Li&&(v+="rotate("+l+Ni),u!==Li&&(v+="rotateY("+u+Ni),c!==Li&&(v+="rotateX("+c+Ni),(d!==Li||f!==Li)&&(v+="skew("+d+", "+f+Ni),(p!==1||m!==1)&&(v+="scale("+p+", "+m+Ni),x.style[Gt]=v||"translate(0, 0)"},vS=function(t,e){var s=e||this,r=s.xPercent,n=s.yPercent,a=s.x,h=s.y,o=s.rotation,l=s.skewX,u=s.skewY,c=s.scaleX,d=s.scaleY,f=s.target,p=s.xOrigin,m=s.yOrigin,g=s.xOffset,_=s.yOffset,x=s.forceCSS,y=parseFloat(a),v=parseFloat(h),b,w,E,T,A;o=parseFloat(o),l=parseFloat(l),u=parseFloat(u),u&&(u=parseFloat(u),l+=u,o+=u),o||l?(o*=An,l*=An,b=Math.cos(o)*c,w=Math.sin(o)*c,E=Math.sin(o-l)*-d,T=Math.cos(o-l)*d,l&&(u*=An,A=Math.tan(l-u),A=Math.sqrt(1+A*A),E*=A,T*=A,u&&(A=Math.tan(u),A=Math.sqrt(1+A*A),b*=A,w*=A)),b=te(b),w=te(w),E=te(E),T=te(T)):(b=c,T=d,w=E=0),(y&&!~(a+"").indexOf("px")||v&&!~(h+"").indexOf("px"))&&(y=Jr(f,"x",a,"px"),v=Jr(f,"y",h,"px")),(p||m||g||_)&&(y=te(y+p-(p*b+m*E)+g),v=te(v+m-(p*w+m*T)+_)),(r||n)&&(A=f.getBBox(),y=te(y+r/100*A.width),v=te(v+n/100*A.height)),A="matrix("+b+","+w+","+E+","+T+","+y+","+v+")",f.setAttribute("transform",A),x&&(f.style[Gt]=A)},bS=function(t,e,s,r,n){var a=360,h=me(n),o=parseFloat(n)*(h&&~n.indexOf("rad")?Di:1),l=o-r,u=r+l+"deg",c,d;return h&&(c=n.split("_")[1],c==="short"&&(l%=a,l!==l%(a/2)&&(l+=l<0?a:-a)),c==="cw"&&l<0?l=(l+a*t_)%a-~~(l/a)*a:c==="ccw"&&l>0&&(l=(l-a*t_)%a-~~(l/a)*a)),t._pt=d=new Ge(t._pt,e,s,r,l,iS),d.e=u,d.u="deg",t._props.push(s),d},g_=function(t,e){for(var s in e)t[s]=e[s];return t},wS=function(t,e,s){var r=g_({},s._gsap),n="perspective,force3D,transformOrigin,svgOrigin",a=s.style,h,o,l,u,c,d,f,p;r.svg?(l=s.getAttribute("transform"),s.setAttribute("transform",""),a[Gt]=e,h=Eo(s,1),Oi(s,Gt),s.setAttribute("transform",l)):(l=getComputedStyle(s)[Gt],a[Gt]=e,h=Eo(s,1),a[Gt]=l);for(o in Er)l=r[o],u=h[o],l!==u&&n.indexOf(o)<0&&(f=Ce(l),p=Ce(u),c=f!==p?Jr(s,o,l,p):parseFloat(l),d=parseFloat(u),t._pt=new Ge(t._pt,h,o,c,d-c,nu),t._pt.u=p||0,t._props.push(o));g_(h,r)};Ue("padding,margin,Width,Radius",function(i,t){var e="Top",s="Right",r="Bottom",n="Left",a=(t<3?[e,s,r,n]:[e+n,e+s,r+s,r+n]).map(function(h){return t<2?i+h:"border"+h+i});ul[t>1?"border"+i:i]=function(h,o,l,u,c){var d,f;if(arguments.length<4)return d=a.map(function(p){return Tr(h,p,l)}),f=d.join(" "),f.split(d[0]).length===5?d[0]:f;d=(u+"").split(" "),f={},a.forEach(function(p,m){return f[p]=d[m]=d[m]||d[(m-1)/2|0]}),h.init(o,f,c)}});var __={name:"css",register:au,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,s,r,n){var a=this._props,h=t.style,o=s.vars.startAt,l,u,c,d,f,p,m,g,_,x,y,v,b,w,E,T;su||au(),this.styles=this.styles||i_(t),T=this.styles.props,this.tween=s;for(m in e)if(m!=="autoRound"&&(u=e[m],!(Qe[m]&&$g(m,e,s,r,t,n)))){if(f=typeof u,p=ul[m],f==="function"&&(u=u.call(s,r,t,n),f=typeof u),f==="string"&&~u.indexOf("random(")&&(u=go(u)),p)p(this,t,m,u,s)&&(E=1);else if(m.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(m)+"").trim(),u+="",qr.lastIndex=0,qr.test(l)||(g=Ce(l),_=Ce(u)),_?g!==_&&(l=Jr(t,m,l,_)+_):g&&(u+=g),this.add(h,"setProperty",l,u,r,n,0,0,m),a.push(m),T.push(m,0,h[m]);else if(f!=="undefined"){if(o&&m in o?(l=typeof o[m]=="function"?o[m].call(s,r,t,n):o[m],me(l)&&~l.indexOf("random(")&&(l=go(l)),Ce(l+"")||l==="auto"||(l+=Ze.units[m]||Ce(Tr(t,m))||""),(l+"").charAt(1)==="="&&(l=Tr(t,m))):l=Tr(t,m),d=parseFloat(l),x=f==="string"&&u.charAt(1)==="="&&u.substr(0,2),x&&(u=u.substr(2)),c=parseFloat(u),m in sr&&(m==="autoAlpha"&&(d===1&&Tr(t,"visibility")==="hidden"&&c&&(d=0),T.push("visibility",0,h.visibility),Qr(this,h,"visibility",d?"inherit":"hidden",c?"inherit":"hidden",!c)),m!=="scale"&&m!=="transform"&&(m=sr[m],~m.indexOf(",")&&(m=m.split(",")[0]))),y=m in Er,y){if(this.styles.save(m),v||(b=t._gsap,b.renderTransform&&!e.parseTransform||Eo(t,e.parseTransform),w=e.smoothOrigin!==!1&&b.smooth,v=this._pt=new Ge(this._pt,h,Gt,0,1,b.renderTransform,b,0,-1),v.dep=1),m==="scale")this._pt=new Ge(this._pt,b,"scaleY",b.scaleY,(x?xn(b.scaleY,x+c):c)-b.scaleY||0,nu),this._pt.u=0,a.push("scaleY",m),m+="X";else if(m==="transformOrigin"){T.push($e,0,h[$e]),u=_S(u),b.svg?cu(t,u,0,w,0,this):(_=parseFloat(u.split(" ")[2])||0,_!==b.zOrigin&&Qr(this,b,"zOrigin",b.zOrigin,_),Qr(this,h,m,dl(l),dl(u)));continue}else if(m==="svgOrigin"){cu(t,u,1,w,0,this);continue}else if(m in d_){bS(this,b,m,d,x?xn(d,x+u):u);continue}else if(m==="smoothOrigin"){Qr(this,b,"smooth",b.smooth,u);continue}else if(m==="force3D"){b[m]=u;continue}else if(m==="transform"){wS(this,u,t);continue}}else m in h||(m=Cn(m)||m);if(y||(c||c===0)&&(d||d===0)&&!rS.test(u)&&m in h)g=(l+"").substr((d+"").length),c||(c=0),_=Ce(u)||(m in Ze.units?Ze.units[m]:g),g!==_&&(d=Jr(t,m,l,_)),this._pt=new Ge(this._pt,y?b:h,m,d,(x?xn(d,x+c):c)-d,!y&&(_==="px"||m==="zIndex")&&e.autoRound!==!1?oS:nu),this._pt.u=_||0,g!==_&&_!=="%"&&(this._pt.b=l,this._pt.r=nS);else if(m in h)gS.call(this,t,m,l,x?x+u:u);else if(m in t)this.add(t,m,l||t[m],x?x+u:u,r,n);else if(m!=="parseTransform"){kc(m,u);continue}y||(m in h?T.push(m,0,h[m]):T.push(m,1,l||t[m])),a.push(m)}}E&&qg(this)},render:function(t,e){if(e.tween._time||!ru())for(var s=e._pt;s;)s.r(t,s.d),s=s._next;else e.styles.revert()},get:Tr,aliases:sr,getSetter:function(t,e,s){var r=sr[e];return r&&r.indexOf(",")<0&&(e=r),e in Er&&e!==$e&&(t._gsap.x||Tr(t,"x"))?s&&Jg===s?e==="scale"?cS:hS:(Jg=s||{})&&(e==="scale"?uS:dS):t.style&&!Cc(t.style[e])?aS:~e.indexOf("-")?lS:Kc(t,e)},core:{_removeProperty:Oi,_getMatrix:hu}};Xe.utils.checkPrefix=Cn,Xe.core.getStyleSaver=i_,function(i,t,e,s){var r=Ue(i+","+t+","+e,function(n){Er[n]=1});Ue(t,function(n){Ze.units[n]="deg",d_[n]=1}),sr[r[13]]=i+","+t,Ue(s,function(n){var a=n.split(":");sr[a[1]]=r[a[0]]})}("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY"),Ue("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(i){Ze.units[i]="px"}),Xe.registerPlugin(__);var xt=Xe.registerPlugin(__)||Xe;xt.core.Tween;class du extends hs{constructor(t){super(),this.radius=0,this.enableTint=!0,this.bgColor="#fff",this.borderWidth=0,this.borderColor="black",this.bgAlpha=1;const{x:e=0,y:s=0,width:r=0,height:n=0,bgColor:a="#fff",alpha:h=1,radius:o=0,borderWidth:l=0,borderColor:u="black",enableTint:c=!0}=t;this.x=e,this.y=s,this.bgAlpha=h,this.radius=o,this.enableTint=c,this.bgColor=a,this.borderWidth=l,this.borderColor=u,this.renderBg(r,n)}updateColor(t){xt.to(this,{tint:t,duration:.25})}renderBg(t,e){this.clear(),this.enableTint?(this.beginFill("#fff",this.bgAlpha),this.tint=this.bgColor):(this.beginFill(this.bgColor,this.bgAlpha),this.borderWidth&&this.lineStyle(this.borderWidth,this.borderColor,1)),this.borderWidth&&this.lineStyle(this.borderWidth,this.borderColor,1),this.radius!==0?typeof this.radius=="number"?this.drawRoundedRect(0,0,t,e,this.radius):(this.moveTo(0+this.radius[0],0),this.lineTo(0+t-this.radius[1],0),this.radius[1]>0?this.arcTo(0+t,0,0+t,0+this.radius[1],this.radius[1]):this.lineTo(0+t,0),this.lineTo(0+t,0+e-this.radius[2]),this.radius[2]>0?this.arcTo(0+t,0+e,0+t-this.radius[2],0+e,this.radius[2]):this.lineTo(0+t,0+e),this.lineTo(0+this.radius[3],0+e),this.radius[3]>0?this.arcTo(0,0+e,0,0+e-this.radius[3],this.radius[3]):this.lineTo(0,0+e),this.lineTo(0,0+this.radius[0]),this.radius[0]>0?this.arcTo(0,0,0+this.radius[0],0,this.radius[0]):this.lineTo(0,0),this.closePath()):this.drawRect(0,0,t,e),this.endFill()}}class Ao extends Bt{constructor(t,e,s,r){if(super(),r){const n=new hs;n.beginFill(16777215),n.drawRect(0,0,t,e),n.endFill(),this.addChild(n),this.mask=n}s?(this._bgColorFill=new du({width:t,height:e,bgColor:s}),this.addChild(this._bgColorFill)):(this._fill=new qe,this._fill.width=t,this._fill.height=e,this.addChild(this._fill))}setSize(t,e){this._fill&&(this._fill.width=t,this._fill.height=e),this._bgColorFill&&this._bgColorFill.renderBg(t,e)}}/*!
1163
+ */var zg,Kr,Tn,Jc,Bi,jg,tu,rS=function(){return typeof window<"u"},Er={},Di=180/Math.PI,An=Math.PI/180,Sn=Math.atan2,qg=1e8,eu=/([A-Z])/g,iS=/(left|right|width|margin|padding|x)/i,nS=/[\s,\(]\S/,sr={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},su=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},oS=function(t,e){return e.set(e.t,e.p,t===1?e.e:Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},aS=function(t,e){return e.set(e.t,e.p,t?Math.round((e.s+e.c*t)*1e4)/1e4+e.u:e.b,e)},lS=function(t,e){var s=e.s+e.c*t;e.set(e.t,e.p,~~(s+(s<0?-.5:.5))+e.u,e)},Zg=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},Kg=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},hS=function(t,e,s){return t.style[e]=s},cS=function(t,e,s){return t.style.setProperty(e,s)},uS=function(t,e,s){return t._gsap[e]=s},dS=function(t,e,s){return t._gsap.scaleX=t._gsap.scaleY=s},fS=function(t,e,s,r,n){var a=t._gsap;a.scaleX=a.scaleY=s,a.renderTransform(n,a)},pS=function(t,e,s,r,n){var a=t._gsap;a[e]=s,a.renderTransform(n,a)},Gt="transform",$e=Gt+"Origin",mS=function i(t,e){var s=this,r=this.target,n=r.style,a=r._gsap;if(t in Er&&n){if(this.tfm=this.tfm||{},t!=="transform")t=sr[t]||t,~t.indexOf(",")?t.split(",").forEach(function(h){return s.tfm[h]=Tr(r,h)}):this.tfm[t]=a.x?a[t]:Tr(r,t),t===$e&&(this.tfm.zOrigin=a.zOrigin);else return sr.transform.split(",").forEach(function(h){return i.call(s,h,e)});if(this.props.indexOf(Gt)>=0)return;a.svg&&(this.svgo=r.getAttribute("data-svg-origin"),this.props.push($e,e,"")),t=Gt}(n||e)&&this.props.push(t,e,n[t])},Qg=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},gS=function(){var t=this.props,e=this.target,s=e.style,r=e._gsap,n,a;for(n=0;n<t.length;n+=3)t[n+1]?e[t[n]]=t[n+2]:t[n+2]?s[t[n]]=t[n+2]:s.removeProperty(t[n].substr(0,2)==="--"?t[n]:t[n].replace(eu,"-$1").toLowerCase());if(this.tfm){for(a in this.tfm)r[a]=this.tfm[a];r.svg&&(r.renderTransform(),e.setAttribute("data-svg-origin",this.svgo||"")),n=tu(),(!n||!n.isStart)&&!s[Gt]&&(Qg(s),r.zOrigin&&s[$e]&&(s[$e]+=" "+r.zOrigin+"px",r.zOrigin=0,r.renderTransform()),r.uncache=1)}},Jg=function(t,e){var s={target:t,props:[],revert:gS,save:mS};return t._gsap||Xe.core.getCache(t),e&&e.split(",").forEach(function(r){return s.save(r)}),s},t_,ru=function(t,e){var s=Kr.createElementNS?Kr.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Kr.createElement(t);return s&&s.style?s:Kr.createElement(t)},rr=function i(t,e,s){var r=getComputedStyle(t);return r[e]||r.getPropertyValue(e.replace(eu,"-$1").toLowerCase())||r.getPropertyValue(e)||!s&&i(t,Cn(e)||e,1)||""},e_="O,Moz,ms,Ms,Webkit".split(","),Cn=function(t,e,s){var r=e||Bi,n=r.style,a=5;if(t in n&&!s)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);a--&&!(e_[a]+t in n););return a<0?null:(a===3?"ms":a>=0?e_[a]:"")+t},iu=function(){rS()&&window.document&&(zg=window,Kr=zg.document,Tn=Kr.documentElement,Bi=ru("div")||{style:{}},ru("div"),Gt=Cn(Gt),$e=Gt+"Origin",Bi.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",t_=!!Cn("perspective"),tu=Xe.core.reverting,Jc=1)},nu=function i(t){var e=ru("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),s=this.parentNode,r=this.nextSibling,n=this.style.cssText,a;if(Tn.appendChild(e),e.appendChild(this),this.style.display="block",t)try{a=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=i}catch{}else this._gsapBBox&&(a=this._gsapBBox());return s&&(r?s.insertBefore(this,r):s.appendChild(this)),Tn.removeChild(e),this.style.cssText=n,a},s_=function(t,e){for(var s=e.length;s--;)if(t.hasAttribute(e[s]))return t.getAttribute(e[s])},r_=function(t){var e;try{e=t.getBBox()}catch{e=nu.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===nu||(e=nu.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+s_(t,["x","cx","x1"])||0,y:+s_(t,["y","cy","y1"])||0,width:0,height:0}:e},i_=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&r_(t))},Oi=function(t,e){if(e){var s=t.style,r;e in Er&&e!==$e&&(e=Gt),s.removeProperty?(r=e.substr(0,2),(r==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),s.removeProperty(r==="--"?e:e.replace(eu,"-$1").toLowerCase())):s.removeAttribute(e)}},Qr=function(t,e,s,r,n,a){var h=new Ge(t._pt,e,s,0,1,a?Kg:Zg);return t._pt=h,h.b=r,h.e=n,t._props.push(s),h},n_={deg:1,rad:1,turn:1},_S={grid:1,flex:1},Jr=function i(t,e,s,r){var n=parseFloat(s)||0,a=(s+"").trim().substr((n+"").length)||"px",h=Bi.style,o=iS.test(e),l=t.tagName.toLowerCase()==="svg",u=(l?"client":"offset")+(o?"Width":"Height"),c=100,d=r==="px",f=r==="%",p,m,g,_;if(r===a||!n||n_[r]||n_[a])return n;if(a!=="px"&&!d&&(n=i(t,e,s,"px")),_=t.getCTM&&i_(t),(f||a==="%")&&(Er[e]||~e.indexOf("adius")))return p=_?t.getBBox()[o?"width":"height"]:t[u],te(f?n/p*c:n/100*p);if(h[o?"width":"height"]=c+(d?a:r),m=~e.indexOf("adius")||r==="em"&&t.appendChild&&!l?t:t.parentNode,_&&(m=(t.ownerSVGElement||{}).parentNode),(!m||m===Kr||!m.appendChild)&&(m=Kr.body),g=m._gsap,g&&f&&g.width&&o&&g.time===ts.time&&!g.uncache)return te(n/g.width*c);if(f&&(e==="height"||e==="width")){var x=t.style[e];t.style[e]=c+r,p=t[u],x?t.style[e]=x:Oi(t,e)}else(f||a==="%")&&!_S[rr(m,"display")]&&(h.position=rr(t,"position")),m===t&&(h.position="static"),m.appendChild(Bi),p=Bi[u],m.removeChild(Bi),h.position="absolute";return o&&f&&(g=Ii(m),g.time=ts.time,g.width=m[u]),te(d?p*n/c:p&&n?c/p*n:0)},Tr=function(t,e,s,r){var n;return Jc||iu(),e in sr&&e!=="transform"&&(e=sr[e],~e.indexOf(",")&&(e=e.split(",")[0])),Er[e]&&e!=="transform"?(n=Eo(t,r),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:dl(rr(t,$e))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||r||~(n+"").indexOf("calc("))&&(n=ul[e]&&ul[e](t,e,s)||rr(t,e)||hg(t,e)||(e==="opacity"?1:0))),s&&!~(n+"").trim().indexOf(" ")?Jr(t,e,n,s)+s:n},yS=function(t,e,s,r){if(!s||s==="none"){var n=Cn(e,t,1),a=n&&rr(t,n,1);a&&a!==s?(e=n,s=a):e==="borderColor"&&(s=rr(t,"borderTopColor"))}var h=new Ge(this._pt,t.style,e,0,1,$g),o=0,l=0,u,c,d,f,p,m,g,_,x,y,v,b;if(h.b=s,h.e=r,s+="",r+="",r==="auto"&&(m=t.style[e],t.style[e]=r,r=rr(t,e)||r,m?t.style[e]=m:Oi(t,e)),u=[s,r],kg(u),s=u[0],r=u[1],d=s.match(yn)||[],b=r.match(yn)||[],b.length){for(;c=yn.exec(r);)g=c[0],x=r.substring(o,c.index),p?p=(p+1)%5:(x.substr(-5)==="rgba("||x.substr(-5)==="hsla(")&&(p=1),g!==(m=d[l++]||"")&&(f=parseFloat(m)||0,v=m.substr((f+"").length),g.charAt(1)==="="&&(g=xn(f,g)+v),_=parseFloat(g),y=g.substr((_+"").length),o=yn.lastIndex-y.length,y||(y=y||Ze.units[e]||v,o===r.length&&(r+=y,h.e+=y)),v!==y&&(f=Jr(t,e,m,y)||0),h._pt={_next:h._pt,p:x||l===1?x:",",s:f,c:_-f,m:p&&p<4||e==="zIndex"?Math.round:0});h.c=o<r.length?r.substring(o,r.length):""}else h.r=e==="display"&&r==="none"?Kg:Zg;return sg.test(r)&&(h.e=0),this._pt=h,h},o_={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},xS=function(t){var e=t.split(" "),s=e[0],r=e[1]||"50%";return(s==="top"||s==="bottom"||r==="left"||r==="right")&&(t=s,s=r,r=t),e[0]=o_[s]||s,e[1]=o_[r]||r,e.join(" ")},vS=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var s=e.t,r=s.style,n=e.u,a=s._gsap,h,o,l;if(n==="all"||n===!0)r.cssText="",o=1;else for(n=n.split(","),l=n.length;--l>-1;)h=n[l],Er[h]&&(o=1,h=h==="transformOrigin"?$e:Gt),Oi(s,h);o&&(Oi(s,Gt),a&&(a.svg&&s.removeAttribute("transform"),Eo(s,1),a.uncache=1,Qg(r)))}},ul={clearProps:function(t,e,s,r,n){if(n.data!=="isFromStart"){var a=t._pt=new Ge(t._pt,e,s,0,0,vS);return a.u=r,a.pr=-10,a.tween=n,t._props.push(s),1}}},wo=[1,0,0,1,0,0],a_={},l_=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},h_=function(t){var e=rr(t,Gt);return l_(e)?wo:e.substr(7).match(eg).map(te)},ou=function(t,e){var s=t._gsap||Ii(t),r=t.style,n=h_(t),a,h,o,l;return s.svg&&t.getAttribute("transform")?(o=t.transform.baseVal.consolidate().matrix,n=[o.a,o.b,o.c,o.d,o.e,o.f],n.join(",")==="1,0,0,1,0,0"?wo:n):(n===wo&&!t.offsetParent&&t!==Tn&&!s.svg&&(o=r.display,r.display="block",a=t.parentNode,(!a||!t.offsetParent)&&(l=1,h=t.nextElementSibling,Tn.appendChild(t)),n=h_(t),o?r.display=o:Oi(t,"display"),l&&(h?a.insertBefore(t,h):a?a.appendChild(t):Tn.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},au=function(t,e,s,r,n,a){var h=t._gsap,o=n||ou(t,!0),l=h.xOrigin||0,u=h.yOrigin||0,c=h.xOffset||0,d=h.yOffset||0,f=o[0],p=o[1],m=o[2],g=o[3],_=o[4],x=o[5],y=e.split(" "),v=parseFloat(y[0])||0,b=parseFloat(y[1])||0,w,E,T,A;s?o!==wo&&(E=f*g-p*m)&&(T=v*(g/E)+b*(-m/E)+(m*x-g*_)/E,A=v*(-p/E)+b*(f/E)-(f*x-p*_)/E,v=T,b=A):(w=r_(t),v=w.x+(~y[0].indexOf("%")?v/100*w.width:v),b=w.y+(~(y[1]||y[0]).indexOf("%")?b/100*w.height:b)),r||r!==!1&&h.smooth?(_=v-l,x=b-u,h.xOffset=c+(_*f+x*m)-_,h.yOffset=d+(_*p+x*g)-x):h.xOffset=h.yOffset=0,h.xOrigin=v,h.yOrigin=b,h.smooth=!!r,h.origin=e,h.originIsAbsolute=!!s,t.style[$e]="0px 0px",a&&(Qr(a,h,"xOrigin",l,v),Qr(a,h,"yOrigin",u,b),Qr(a,h,"xOffset",c,h.xOffset),Qr(a,h,"yOffset",d,h.yOffset)),t.setAttribute("data-svg-origin",v+" "+b)},Eo=function(t,e){var s=t._gsap||new Lg(t);if("x"in s&&!e&&!s.uncache)return s;var r=t.style,n=s.scaleX<0,a="px",h="deg",o=getComputedStyle(t),l=rr(t,$e)||"0",u,c,d,f,p,m,g,_,x,y,v,b,w,E,T,A,I,M,R,C,P,k,U,V,L,$,O,N,Z,Q,H,lt;return u=c=d=m=g=_=x=y=v=0,f=p=1,s.svg=!!(t.getCTM&&i_(t)),o.translate&&((o.translate!=="none"||o.scale!=="none"||o.rotate!=="none")&&(r[Gt]=(o.translate!=="none"?"translate3d("+(o.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(o.rotate!=="none"?"rotate("+o.rotate+") ":"")+(o.scale!=="none"?"scale("+o.scale.split(" ").join(",")+") ":"")+(o[Gt]!=="none"?o[Gt]:"")),r.scale=r.rotate=r.translate="none"),E=ou(t,s.svg),s.svg&&(s.uncache?(L=t.getBBox(),l=s.xOrigin-L.x+"px "+(s.yOrigin-L.y)+"px",V=""):V=!e&&t.getAttribute("data-svg-origin"),au(t,V||l,!!V||s.originIsAbsolute,s.smooth!==!1,E)),b=s.xOrigin||0,w=s.yOrigin||0,E!==wo&&(M=E[0],R=E[1],C=E[2],P=E[3],u=k=E[4],c=U=E[5],E.length===6?(f=Math.sqrt(M*M+R*R),p=Math.sqrt(P*P+C*C),m=M||R?Sn(R,M)*Di:0,x=C||P?Sn(C,P)*Di+m:0,x&&(p*=Math.abs(Math.cos(x*An))),s.svg&&(u-=b-(b*M+w*C),c-=w-(b*R+w*P))):(lt=E[6],Q=E[7],O=E[8],N=E[9],Z=E[10],H=E[11],u=E[12],c=E[13],d=E[14],T=Sn(lt,Z),g=T*Di,T&&(A=Math.cos(-T),I=Math.sin(-T),V=k*A+O*I,L=U*A+N*I,$=lt*A+Z*I,O=k*-I+O*A,N=U*-I+N*A,Z=lt*-I+Z*A,H=Q*-I+H*A,k=V,U=L,lt=$),T=Sn(-C,Z),_=T*Di,T&&(A=Math.cos(-T),I=Math.sin(-T),V=M*A-O*I,L=R*A-N*I,$=C*A-Z*I,H=P*I+H*A,M=V,R=L,C=$),T=Sn(R,M),m=T*Di,T&&(A=Math.cos(T),I=Math.sin(T),V=M*A+R*I,L=k*A+U*I,R=R*A-M*I,U=U*A-k*I,M=V,k=L),g&&Math.abs(g)+Math.abs(m)>359.9&&(g=m=0,_=180-_),f=te(Math.sqrt(M*M+R*R+C*C)),p=te(Math.sqrt(U*U+lt*lt)),T=Sn(k,U),x=Math.abs(T)>2e-4?T*Di:0,v=H?1/(H<0?-H:H):0),s.svg&&(V=t.getAttribute("transform"),s.forceCSS=t.setAttribute("transform","")||!l_(rr(t,Gt)),V&&t.setAttribute("transform",V))),Math.abs(x)>90&&Math.abs(x)<270&&(n?(f*=-1,x+=m<=0?180:-180,m+=m<=0?180:-180):(p*=-1,x+=x<=0?180:-180)),e=e||s.uncache,s.x=u-((s.xPercent=u&&(!e&&s.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-u)?-50:0)))?t.offsetWidth*s.xPercent/100:0)+a,s.y=c-((s.yPercent=c&&(!e&&s.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-c)?-50:0)))?t.offsetHeight*s.yPercent/100:0)+a,s.z=d+a,s.scaleX=te(f),s.scaleY=te(p),s.rotation=te(m)+h,s.rotationX=te(g)+h,s.rotationY=te(_)+h,s.skewX=x+h,s.skewY=y+h,s.transformPerspective=v+a,(s.zOrigin=parseFloat(l.split(" ")[2])||!e&&s.zOrigin||0)&&(r[$e]=dl(l)),s.xOffset=s.yOffset=0,s.force3D=Ze.force3D,s.renderTransform=s.svg?wS:t_?c_:bS,s.uncache=0,s},dl=function(t){return(t=t.split(" "))[0]+" "+t[1]},lu=function(t,e,s){var r=Ce(e);return te(parseFloat(e)+parseFloat(Jr(t,"x",s+"px",r)))+r},bS=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,c_(t,e)},Li="0deg",To="0px",Ni=") ",c_=function(t,e){var s=e||this,r=s.xPercent,n=s.yPercent,a=s.x,h=s.y,o=s.z,l=s.rotation,u=s.rotationY,c=s.rotationX,d=s.skewX,f=s.skewY,p=s.scaleX,m=s.scaleY,g=s.transformPerspective,_=s.force3D,x=s.target,y=s.zOrigin,v="",b=_==="auto"&&t&&t!==1||_===!0;if(y&&(c!==Li||u!==Li)){var w=parseFloat(u)*An,E=Math.sin(w),T=Math.cos(w),A;w=parseFloat(c)*An,A=Math.cos(w),a=lu(x,a,E*A*-y),h=lu(x,h,-Math.sin(w)*-y),o=lu(x,o,T*A*-y+y)}g!==To&&(v+="perspective("+g+Ni),(r||n)&&(v+="translate("+r+"%, "+n+"%) "),(b||a!==To||h!==To||o!==To)&&(v+=o!==To||b?"translate3d("+a+", "+h+", "+o+") ":"translate("+a+", "+h+Ni),l!==Li&&(v+="rotate("+l+Ni),u!==Li&&(v+="rotateY("+u+Ni),c!==Li&&(v+="rotateX("+c+Ni),(d!==Li||f!==Li)&&(v+="skew("+d+", "+f+Ni),(p!==1||m!==1)&&(v+="scale("+p+", "+m+Ni),x.style[Gt]=v||"translate(0, 0)"},wS=function(t,e){var s=e||this,r=s.xPercent,n=s.yPercent,a=s.x,h=s.y,o=s.rotation,l=s.skewX,u=s.skewY,c=s.scaleX,d=s.scaleY,f=s.target,p=s.xOrigin,m=s.yOrigin,g=s.xOffset,_=s.yOffset,x=s.forceCSS,y=parseFloat(a),v=parseFloat(h),b,w,E,T,A;o=parseFloat(o),l=parseFloat(l),u=parseFloat(u),u&&(u=parseFloat(u),l+=u,o+=u),o||l?(o*=An,l*=An,b=Math.cos(o)*c,w=Math.sin(o)*c,E=Math.sin(o-l)*-d,T=Math.cos(o-l)*d,l&&(u*=An,A=Math.tan(l-u),A=Math.sqrt(1+A*A),E*=A,T*=A,u&&(A=Math.tan(u),A=Math.sqrt(1+A*A),b*=A,w*=A)),b=te(b),w=te(w),E=te(E),T=te(T)):(b=c,T=d,w=E=0),(y&&!~(a+"").indexOf("px")||v&&!~(h+"").indexOf("px"))&&(y=Jr(f,"x",a,"px"),v=Jr(f,"y",h,"px")),(p||m||g||_)&&(y=te(y+p-(p*b+m*E)+g),v=te(v+m-(p*w+m*T)+_)),(r||n)&&(A=f.getBBox(),y=te(y+r/100*A.width),v=te(v+n/100*A.height)),A="matrix("+b+","+w+","+E+","+T+","+y+","+v+")",f.setAttribute("transform",A),x&&(f.style[Gt]=A)},ES=function(t,e,s,r,n){var a=360,h=me(n),o=parseFloat(n)*(h&&~n.indexOf("rad")?Di:1),l=o-r,u=r+l+"deg",c,d;return h&&(c=n.split("_")[1],c==="short"&&(l%=a,l!==l%(a/2)&&(l+=l<0?a:-a)),c==="cw"&&l<0?l=(l+a*qg)%a-~~(l/a)*a:c==="ccw"&&l>0&&(l=(l-a*qg)%a-~~(l/a)*a)),t._pt=d=new Ge(t._pt,e,s,r,l,oS),d.e=u,d.u="deg",t._props.push(s),d},u_=function(t,e){for(var s in e)t[s]=e[s];return t},TS=function(t,e,s){var r=u_({},s._gsap),n="perspective,force3D,transformOrigin,svgOrigin",a=s.style,h,o,l,u,c,d,f,p;r.svg?(l=s.getAttribute("transform"),s.setAttribute("transform",""),a[Gt]=e,h=Eo(s,1),Oi(s,Gt),s.setAttribute("transform",l)):(l=getComputedStyle(s)[Gt],a[Gt]=e,h=Eo(s,1),a[Gt]=l);for(o in Er)l=r[o],u=h[o],l!==u&&n.indexOf(o)<0&&(f=Ce(l),p=Ce(u),c=f!==p?Jr(s,o,l,p):parseFloat(l),d=parseFloat(u),t._pt=new Ge(t._pt,h,o,c,d-c,su),t._pt.u=p||0,t._props.push(o));u_(h,r)};Ue("padding,margin,Width,Radius",function(i,t){var e="Top",s="Right",r="Bottom",n="Left",a=(t<3?[e,s,r,n]:[e+n,e+s,r+s,r+n]).map(function(h){return t<2?i+h:"border"+h+i});ul[t>1?"border"+i:i]=function(h,o,l,u,c){var d,f;if(arguments.length<4)return d=a.map(function(p){return Tr(h,p,l)}),f=d.join(" "),f.split(d[0]).length===5?d[0]:f;d=(u+"").split(" "),f={},a.forEach(function(p,m){return f[p]=d[m]=d[m]||d[(m-1)/2|0]}),h.init(o,f,c)}});var d_={name:"css",register:iu,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,s,r,n){var a=this._props,h=t.style,o=s.vars.startAt,l,u,c,d,f,p,m,g,_,x,y,v,b,w,E,T;Jc||iu(),this.styles=this.styles||Jg(t),T=this.styles.props,this.tween=s;for(m in e)if(m!=="autoRound"&&(u=e[m],!(Qe[m]&&Ng(m,e,s,r,t,n)))){if(f=typeof u,p=ul[m],f==="function"&&(u=u.call(s,r,t,n),f=typeof u),f==="string"&&~u.indexOf("random(")&&(u=go(u)),p)p(this,t,m,u,s)&&(E=1);else if(m.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(m)+"").trim(),u+="",qr.lastIndex=0,qr.test(l)||(g=Ce(l),_=Ce(u)),_?g!==_&&(l=Jr(t,m,l,_)+_):g&&(u+=g),this.add(h,"setProperty",l,u,r,n,0,0,m),a.push(m),T.push(m,0,h[m]);else if(f!=="undefined"){if(o&&m in o?(l=typeof o[m]=="function"?o[m].call(s,r,t,n):o[m],me(l)&&~l.indexOf("random(")&&(l=go(l)),Ce(l+"")||l==="auto"||(l+=Ze.units[m]||Ce(Tr(t,m))||""),(l+"").charAt(1)==="="&&(l=Tr(t,m))):l=Tr(t,m),d=parseFloat(l),x=f==="string"&&u.charAt(1)==="="&&u.substr(0,2),x&&(u=u.substr(2)),c=parseFloat(u),m in sr&&(m==="autoAlpha"&&(d===1&&Tr(t,"visibility")==="hidden"&&c&&(d=0),T.push("visibility",0,h.visibility),Qr(this,h,"visibility",d?"inherit":"hidden",c?"inherit":"hidden",!c)),m!=="scale"&&m!=="transform"&&(m=sr[m],~m.indexOf(",")&&(m=m.split(",")[0]))),y=m in Er,y){if(this.styles.save(m),v||(b=t._gsap,b.renderTransform&&!e.parseTransform||Eo(t,e.parseTransform),w=e.smoothOrigin!==!1&&b.smooth,v=this._pt=new Ge(this._pt,h,Gt,0,1,b.renderTransform,b,0,-1),v.dep=1),m==="scale")this._pt=new Ge(this._pt,b,"scaleY",b.scaleY,(x?xn(b.scaleY,x+c):c)-b.scaleY||0,su),this._pt.u=0,a.push("scaleY",m),m+="X";else if(m==="transformOrigin"){T.push($e,0,h[$e]),u=xS(u),b.svg?au(t,u,0,w,0,this):(_=parseFloat(u.split(" ")[2])||0,_!==b.zOrigin&&Qr(this,b,"zOrigin",b.zOrigin,_),Qr(this,h,m,dl(l),dl(u)));continue}else if(m==="svgOrigin"){au(t,u,1,w,0,this);continue}else if(m in a_){ES(this,b,m,d,x?xn(d,x+u):u);continue}else if(m==="smoothOrigin"){Qr(this,b,"smooth",b.smooth,u);continue}else if(m==="force3D"){b[m]=u;continue}else if(m==="transform"){TS(this,u,t);continue}}else m in h||(m=Cn(m)||m);if(y||(c||c===0)&&(d||d===0)&&!nS.test(u)&&m in h)g=(l+"").substr((d+"").length),c||(c=0),_=Ce(u)||(m in Ze.units?Ze.units[m]:g),g!==_&&(d=Jr(t,m,l,_)),this._pt=new Ge(this._pt,y?b:h,m,d,(x?xn(d,x+c):c)-d,!y&&(_==="px"||m==="zIndex")&&e.autoRound!==!1?lS:su),this._pt.u=_||0,g!==_&&_!=="%"&&(this._pt.b=l,this._pt.r=aS);else if(m in h)yS.call(this,t,m,l,x?x+u:u);else if(m in t)this.add(t,m,l||t[m],x?x+u:u,r,n);else if(m!=="parseTransform"){Rc(m,u);continue}y||(m in h?T.push(m,0,h[m]):T.push(m,1,l||t[m])),a.push(m)}}E&&Yg(this)},render:function(t,e){if(e.tween._time||!tu())for(var s=e._pt;s;)s.r(t,s.d),s=s._next;else e.styles.revert()},get:Tr,aliases:sr,getSetter:function(t,e,s){var r=sr[e];return r&&r.indexOf(",")<0&&(e=r),e in Er&&e!==$e&&(t._gsap.x||Tr(t,"x"))?s&&jg===s?e==="scale"?dS:uS:(jg=s||{})&&(e==="scale"?fS:pS):t.style&&!Tc(t.style[e])?hS:~e.indexOf("-")?cS:jc(t,e)},core:{_removeProperty:Oi,_getMatrix:ou}};Xe.utils.checkPrefix=Cn,Xe.core.getStyleSaver=Jg,function(i,t,e,s){var r=Ue(i+","+t+","+e,function(n){Er[n]=1});Ue(t,function(n){Ze.units[n]="deg",a_[n]=1}),sr[r[13]]=i+","+t,Ue(s,function(n){var a=n.split(":");sr[a[1]]=r[a[0]]})}("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY"),Ue("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(i){Ze.units[i]="px"}),Xe.registerPlugin(d_);var xt=Xe.registerPlugin(d_)||Xe;xt.core.Tween;class hu extends hs{constructor(t){super(),this.radius=0,this.enableTint=!0,this.bgColor="#fff",this.borderWidth=0,this.borderColor="black",this.bgAlpha=1;const{x:e=0,y:s=0,width:r=0,height:n=0,bgColor:a="#fff",alpha:h=1,radius:o=0,borderWidth:l=0,borderColor:u="black",enableTint:c=!0}=t;this.x=e,this.y=s,this.bgAlpha=h,this.radius=o,this.enableTint=c,this.bgColor=a,this.borderWidth=l,this.borderColor=u,this.renderBg(r,n)}updateColor(t){xt.to(this,{tint:t,duration:.25})}renderBg(t,e){this.clear(),this.enableTint?(this.beginFill("#fff",this.bgAlpha),this.tint=this.bgColor):(this.beginFill(this.bgColor,this.bgAlpha),this.borderWidth&&this.lineStyle(this.borderWidth,this.borderColor,1)),this.borderWidth&&this.lineStyle(this.borderWidth,this.borderColor,1),this.radius!==0?typeof this.radius=="number"?this.drawRoundedRect(0,0,t,e,this.radius):(this.moveTo(0+this.radius[0],0),this.lineTo(0+t-this.radius[1],0),this.radius[1]>0?this.arcTo(0+t,0,0+t,0+this.radius[1],this.radius[1]):this.lineTo(0+t,0),this.lineTo(0+t,0+e-this.radius[2]),this.radius[2]>0?this.arcTo(0+t,0+e,0+t-this.radius[2],0+e,this.radius[2]):this.lineTo(0+t,0+e),this.lineTo(0+this.radius[3],0+e),this.radius[3]>0?this.arcTo(0,0+e,0,0+e-this.radius[3],this.radius[3]):this.lineTo(0,0+e),this.lineTo(0,0+this.radius[0]),this.radius[0]>0?this.arcTo(0,0,0+this.radius[0],0,this.radius[0]):this.lineTo(0,0),this.closePath()):this.drawRect(0,0,t,e),this.endFill()}}class Ao extends Bt{constructor(t,e,s,r){if(super(),r){const n=new hs;n.beginFill(16777215),n.drawRect(0,0,t,e),n.endFill(),this.addChild(n),this.mask=n}s?(this._bgColorFill=new hu({width:t,height:e,bgColor:s}),this.addChild(this._bgColorFill)):(this._fill=new qe,this._fill.width=t,this._fill.height=e,this.addChild(this._fill))}setSize(t,e){this._fill&&(this._fill.width=t,this._fill.height=e),this._bgColorFill&&this._bgColorFill.renderBg(t,e)}}/*!
1164
1164
  * @pixi/particle-emitter - v5.0.8
1165
1165
  * Compiled Mon, 28 Nov 2022 04:01:38 UTC
1166
1166
  *
1167
1167
  * @pixi/particle-emitter is licensed under the MIT License.
1168
1168
  * http://www.opensource.org/licenses/mit-license
1169
- */class ir{constructor(t,e,s){this.value=t,this.time=e,this.next=null,this.isStepped=!1,s?this.ease=typeof s=="function"?s:v_(s):this.ease=null}static createList(t){if("list"in t){const s=t.list;let r;const{value:n,time:a}=s[0],h=r=new ir(typeof n=="string"?pl(n):n,a,t.ease);if(s.length>2||s.length===2&&s[1].value!==n)for(let o=1;o<s.length;++o){const{value:l,time:u}=s[o];r.next=new ir(typeof l=="string"?pl(l):l,u),r=r.next}return h.isStepped=!!t.isStepped,h}const e=new ir(typeof t.start=="string"?pl(t.start):t.start,0);return t.end!==t.start&&(e.next=new ir(typeof t.end=="string"?pl(t.end):t.end,1)),e}}let So=q.from;const nr=Math.PI/180;function Ar(i,t){if(!i)return;const e=Math.sin(i),s=Math.cos(i),r=t.x*s-t.y*e,n=t.x*e+t.y*s;t.x=r,t.y=n}function fl(i,t,e){return i<<16|t<<8|e}function y_(i){return Math.sqrt(i.x*i.x+i.y*i.y)}function ES(i){const t=1/y_(i);i.x*=t,i.y*=t}function x_(i,t){i.x*=t,i.y*=t}function pl(i,t){t||(t={}),i.charAt(0)==="#"?i=i.substr(1):i.indexOf("0x")===0&&(i=i.substr(2));let e;return i.length===8&&(e=i.substr(0,2),i=i.substr(2)),t.r=parseInt(i.substr(0,2),16),t.g=parseInt(i.substr(2,2),16),t.b=parseInt(i.substr(4,2),16),e&&(t.a=parseInt(e,16)),t}function v_(i){const t=i.length,e=1/t;return function(s){const r=t*s|0,n=(s-r*e)*t,a=i[r]||i[t-1];return a.s+n*(2*(1-n)*(a.cp-a.s)+n*(a.e-a.s))}}function TS(i){return i?(i=i.toUpperCase().replace(/ /g,"_"),W[i]||W.NORMAL):W.NORMAL}class fu extends qe{constructor(t){super(),this.prevChild=this.nextChild=null,this.emitter=t,this.config={},this.anchor.x=this.anchor.y=.5,this.maxLife=0,this.age=0,this.agePercent=0,this.oneOverLife=0,this.next=null,this.prev=null,this.init=this.init,this.kill=this.kill}init(t){this.maxLife=t,this.age=this.agePercent=0,this.rotation=0,this.position.x=this.position.y=0,this.scale.x=this.scale.y=1,this.tint=16777215,this.alpha=1,this.oneOverLife=1/this.maxLife,this.visible=!0}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=this.next=this.prev=null,super.destroy()}}var Ft;(function(i){i[i.Spawn=0]="Spawn",i[i.Normal=2]="Normal",i[i.Late=5]="Late"})(Ft||(Ft={}));const pu=wt.shared,Vi=Symbol("Position particle per emitter position");class Et{constructor(t,e){this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],this.minLifetime=0,this.maxLifetime=0,this.customEase=null,this._frequency=1,this.spawnChance=1,this.maxParticles=1e3,this.emitterLifetime=-1,this.spawnPos=new st,this.particlesPerWave=1,this.rotation=0,this.ownerPos=new st,this._prevEmitterPos=new st,this._prevPosIsValid=!1,this._posChanged=!1,this._parent=null,this.addAtBack=!1,this.particleCount=0,this._emit=!1,this._spawnTimer=0,this._emitterLife=-1,this._activeParticlesFirst=null,this._activeParticlesLast=null,this._poolFirst=null,this._origConfig=null,this._autoUpdate=!1,this._destroyWhenComplete=!1,this._completeCallback=null,this.parent=t,e&&this.init(e),this.recycle=this.recycle,this.update=this.update,this.rotate=this.rotate,this.updateSpawnPos=this.updateSpawnPos,this.updateOwnerPos=this.updateOwnerPos}static registerBehavior(t){Et.knownBehaviors[t.type]=t}get frequency(){return this._frequency}set frequency(t){typeof t=="number"&&t>0?this._frequency=t:this._frequency=1}get parent(){return this._parent}set parent(t){this.cleanup(),this._parent=t}init(t){if(!t)return;this.cleanup(),this._origConfig=t,this.minLifetime=t.lifetime.min,this.maxLifetime=t.lifetime.max,t.ease?this.customEase=typeof t.ease=="function"?t.ease:v_(t.ease):this.customEase=null,this.particlesPerWave=1,t.particlesPerWave&&t.particlesPerWave>1&&(this.particlesPerWave=t.particlesPerWave),this.frequency=t.frequency,this.spawnChance=typeof t.spawnChance=="number"&&t.spawnChance>0?t.spawnChance:1,this.emitterLifetime=t.emitterLifetime||-1,this.maxParticles=t.maxParticles>0?t.maxParticles:1e3,this.addAtBack=!!t.addAtBack,this.rotation=0,this.ownerPos.set(0),t.pos?this.spawnPos.copyFrom(t.pos):this.spawnPos.set(0),this._prevEmitterPos.copyFrom(this.spawnPos),this._prevPosIsValid=!1,this._spawnTimer=0,this.emit=t.emit===void 0?!0:!!t.emit,this.autoUpdate=!!t.autoUpdate;const e=t.behaviors.map(s=>{const r=Et.knownBehaviors[s.type];return r?new r(s.config):(console.error(`Unknown behavior: ${s.type}`),null)}).filter(s=>!!s);e.push(Vi),e.sort((s,r)=>s===Vi?r.order===Ft.Spawn?1:-1:r===Vi?s.order===Ft.Spawn?-1:1:s.order-r.order),this.initBehaviors=e.slice(),this.updateBehaviors=e.filter(s=>s!==Vi&&s.updateParticle),this.recycleBehaviors=e.filter(s=>s!==Vi&&s.recycleParticle)}getBehavior(t){return Et.knownBehaviors[t]&&this.initBehaviors.find(e=>e instanceof Et.knownBehaviors[t])||null}fillPool(t){for(;t>0;--t){const e=new fu(this);e.next=this._poolFirst,this._poolFirst=e}}recycle(t,e=!1){for(let s=0;s<this.recycleBehaviors.length;++s)this.recycleBehaviors[s].recycleParticle(t,!e);t.next&&(t.next.prev=t.prev),t.prev&&(t.prev.next=t.next),t===this._activeParticlesLast&&(this._activeParticlesLast=t.prev),t===this._activeParticlesFirst&&(this._activeParticlesFirst=t.next),t.prev=null,t.next=this._poolFirst,this._poolFirst=t,t.parent&&t.parent.removeChild(t),--this.particleCount}rotate(t){if(this.rotation===t)return;const e=t-this.rotation;this.rotation=t,Ar(e,this.spawnPos),this._posChanged=!0}updateSpawnPos(t,e){this._posChanged=!0,this.spawnPos.x=t,this.spawnPos.y=e}updateOwnerPos(t,e){this._posChanged=!0,this.ownerPos.x=t,this.ownerPos.y=e}resetPositionTracking(){this._prevPosIsValid=!1}get emit(){return this._emit}set emit(t){this._emit=!!t,this._emitterLife=this.emitterLifetime}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){this._autoUpdate&&!t?pu.remove(this.update,this):!this._autoUpdate&&t&&pu.add(this.update,this),this._autoUpdate=!!t}playOnceAndDestroy(t){this.autoUpdate=!0,this.emit=!0,this._destroyWhenComplete=!0,this._completeCallback=t}playOnce(t){this.emit=!0,this._completeCallback=t}update(t){if(this._autoUpdate&&(t=pu.elapsedMS*.001),!this._parent)return;for(let a=this._activeParticlesFirst,h;a;a=h)if(h=a.next,a.age+=t,a.age>a.maxLife||a.age<0)this.recycle(a);else{let o=a.age*a.oneOverLife;this.customEase&&(this.customEase.length===4?o=this.customEase(o,0,1,1):o=this.customEase(o)),a.agePercent=o;for(let l=0;l<this.updateBehaviors.length;++l)if(this.updateBehaviors[l].updateParticle(a,t)){this.recycle(a);break}}let e,s;this._prevPosIsValid&&(e=this._prevEmitterPos.x,s=this._prevEmitterPos.y);const r=this.ownerPos.x+this.spawnPos.x,n=this.ownerPos.y+this.spawnPos.y;if(this._emit)for(this._spawnTimer-=t<0?0:t;this._spawnTimer<=0;){if(this._emitterLife>=0&&(this._emitterLife-=this._frequency,this._emitterLife<=0)){this._spawnTimer=0,this._emitterLife=0,this.emit=!1;break}if(this.particleCount>=this.maxParticles){this._spawnTimer+=this._frequency;continue}let a,h;if(this._prevPosIsValid&&this._posChanged){const u=1+this._spawnTimer/t;a=(r-e)*u+e,h=(n-s)*u+s}else a=r,h=n;let o=null,l=null;for(let u=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),c=0;c<u;++c){if(this.spawnChance<1&&Math.random()>=this.spawnChance)continue;let d;if(this.minLifetime===this.maxLifetime?d=this.minLifetime:d=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,-this._spawnTimer>=d)continue;let f;this._poolFirst?(f=this._poolFirst,this._poolFirst=this._poolFirst.next,f.next=null):f=new fu(this),f.init(d),this.addAtBack?this._parent.addChildAt(f,0):this._parent.addChild(f),o?(l.next=f,f.prev=l,l=f):l=o=f,++this.particleCount}if(o){this._activeParticlesLast?(this._activeParticlesLast.next=o,o.prev=this._activeParticlesLast,this._activeParticlesLast=l):(this._activeParticlesFirst=o,this._activeParticlesLast=l);for(let u=0;u<this.initBehaviors.length;++u){const c=this.initBehaviors[u];if(c===Vi)for(let d=o,f;d;d=f){f=d.next,this.rotation!==0&&(Ar(this.rotation,d.position),d.rotation+=this.rotation),d.position.x+=a,d.position.y+=h,d.age+=-this._spawnTimer;let p=d.age*d.oneOverLife;this.customEase&&(this.customEase.length===4?p=this.customEase(p,0,1,1):p=this.customEase(p)),d.agePercent=p}else c.initParticles(o)}for(let u=o,c;u;u=c){c=u.next;for(let d=0;d<this.updateBehaviors.length;++d)if(this.updateBehaviors[d].updateParticle(u,-this._spawnTimer)){this.recycle(u);break}}}this._spawnTimer+=this._frequency}if(this._posChanged&&(this._prevEmitterPos.x=r,this._prevEmitterPos.y=n,this._prevPosIsValid=!0,this._posChanged=!1),!this._emit&&!this._activeParticlesFirst){if(this._completeCallback){const a=this._completeCallback;this._completeCallback=null,a()}this._destroyWhenComplete&&this.destroy()}}emitNow(){const t=this.ownerPos.x+this.spawnPos.x,e=this.ownerPos.y+this.spawnPos.y;let s=null,r=null;for(let n=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),a=0;a<n;++a){if(this.spawnChance<1&&Math.random()>=this.spawnChance)continue;let h;this._poolFirst?(h=this._poolFirst,this._poolFirst=this._poolFirst.next,h.next=null):h=new fu(this);let o;this.minLifetime===this.maxLifetime?o=this.minLifetime:o=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,h.init(o),this.addAtBack?this._parent.addChildAt(h,0):this._parent.addChild(h),s?(r.next=h,h.prev=r,r=h):r=s=h,++this.particleCount}if(s){this._activeParticlesLast?(this._activeParticlesLast.next=s,s.prev=this._activeParticlesLast,this._activeParticlesLast=r):(this._activeParticlesFirst=s,this._activeParticlesLast=r);for(let n=0;n<this.initBehaviors.length;++n){const a=this.initBehaviors[n];if(a===Vi)for(let h=s,o;h;h=o)o=h.next,this.rotation!==0&&(Ar(this.rotation,h.position),h.rotation+=this.rotation),h.position.x+=t,h.position.y+=e;else a.initParticles(s)}}}cleanup(){let t,e;for(t=this._activeParticlesFirst;t;t=e)e=t.next,this.recycle(t,!0);this._activeParticlesFirst=this._activeParticlesLast=null,this.particleCount=0}get destroyed(){return!(this._parent&&this.initBehaviors.length)}destroy(){this.autoUpdate=!1,this.cleanup();let t;for(let e=this._poolFirst;e;e=t)t=e.next,e.destroy();this._poolFirst=this._parent=this.spawnPos=this.ownerPos=this.customEase=this._completeCallback=null,this.initBehaviors.length=this.updateBehaviors.length=this.recycleBehaviors.length=0}}Et.knownBehaviors={};class mu{constructor(t){this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h}getRandPos(t){t.x=Math.random()*this.w+this.x,t.y=Math.random()*this.h+this.y}}mu.type="rect",mu.editorConfig=null;class ml{constructor(t){this.x=t.x||0,this.y=t.y||0,this.radius=t.radius,this.innerRadius=t.innerRadius||0,this.rotation=!!t.affectRotation}getRandPos(t){this.innerRadius!==this.radius?t.x=Math.random()*(this.radius-this.innerRadius)+this.innerRadius:t.x=this.radius,t.y=0;const e=Math.random()*Math.PI*2;this.rotation&&(t.rotation+=e),Ar(e,t.position),t.position.x+=this.x,t.position.y+=this.y}}ml.type="torus",ml.editorConfig=null;class gu{constructor(t){this.segments=[],this.countingLengths=[],this.totalLength=0,this.init(t)}init(t){if(!t||!t.length)this.segments.push({p1:{x:0,y:0},p2:{x:0,y:0},l:0});else if(Array.isArray(t[0]))for(let e=0;e<t.length;++e){const s=t[e];let r=s[0];for(let n=1;n<s.length;++n){const a=s[n];this.segments.push({p1:r,p2:a,l:0}),r=a}}else{let e=t[0];for(let s=1;s<t.length;++s){const r=t[s];this.segments.push({p1:e,p2:r,l:0}),e=r}}for(let e=0;e<this.segments.length;++e){const{p1:s,p2:r}=this.segments[e],n=Math.sqrt((r.x-s.x)*(r.x-s.x)+(r.y-s.y)*(r.y-s.y));this.segments[e].l=n,this.totalLength+=n,this.countingLengths.push(this.totalLength)}}getRandPos(t){const e=Math.random()*this.totalLength;let s,r;if(this.segments.length===1)s=this.segments[0],r=e;else for(let h=0;h<this.countingLengths.length;++h)if(e<this.countingLengths[h]){s=this.segments[h],r=h===0?e:e-this.countingLengths[h-1];break}r/=s.l||1;const{p1:n,p2:a}=s;t.x=n.x+r*(a.x-n.x),t.y=n.y+r*(a.y-n.y)}}gu.type="polygonalChain",gu.editorConfig=null;class _u{constructor(t){var e;this.order=Ft.Late,this.minStart=t.minStart,this.maxStart=t.maxStart,this.accel=t.accel,this.rotate=!!t.rotate,this.maxSpeed=(e=t.maxSpeed)!==null&&e!==void 0?e:0}initParticles(t){let e=t;for(;e;){const s=Math.random()*(this.maxStart-this.minStart)+this.minStart;e.config.velocity?e.config.velocity.set(s,0):e.config.velocity=new st(s,0),Ar(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=t.config.velocity,r=s.x,n=s.y;if(s.x+=this.accel.x*e,s.y+=this.accel.y*e,this.maxSpeed){const a=y_(s);a>this.maxSpeed&&x_(s,this.maxSpeed/a)}t.x+=(r+s.x)/2*e,t.y+=(n+s.y)/2*e,this.rotate&&(t.rotation=Math.atan2(s.y,s.x))}}_u.type="moveAcceleration",_u.editorConfig=null;function AS(i){return this.ease&&(i=this.ease(i)),(this.first.next.value-this.first.value)*i+this.first.value}function SS(i){this.ease&&(i=this.ease(i));const t=this.first.value,e=this.first.next.value,s=(e.r-t.r)*i+t.r,r=(e.g-t.g)*i+t.g,n=(e.b-t.b)*i+t.b;return fl(s,r,n)}function CS(i){this.ease&&(i=this.ease(i));let t=this.first,e=t.next;for(;i>e.time;)t=e,e=e.next;return i=(i-t.time)/(e.time-t.time),(e.value-t.value)*i+t.value}function IS(i){this.ease&&(i=this.ease(i));let t=this.first,e=t.next;for(;i>e.time;)t=e,e=e.next;i=(i-t.time)/(e.time-t.time);const s=t.value,r=e.value,n=(r.r-s.r)*i+s.r,a=(r.g-s.g)*i+s.g,h=(r.b-s.b)*i+s.b;return fl(n,a,h)}function PS(i){this.ease&&(i=this.ease(i));let t=this.first;for(;t.next&&i>t.next.time;)t=t.next;return t.value}function RS(i){this.ease&&(i=this.ease(i));let t=this.first;for(;t.next&&i>t.next.time;)t=t.next;const e=t.value;return fl(e.r,e.g,e.b)}class Co{constructor(t=!1){this.first=null,this.isColor=!!t,this.interpolate=null,this.ease=null}reset(t){this.first=t,t.next&&t.next.time>=1?this.interpolate=this.isColor?SS:AS:t.isStepped?this.interpolate=this.isColor?RS:PS:this.interpolate=this.isColor?IS:CS,this.ease=this.first.ease}}class yu{constructor(t){this.order=Ft.Normal,this.list=new Co(!1),this.list.reset(ir.createList(t.alpha))}initParticles(t){let e=t;for(;e;)e.alpha=this.list.first.value,e=e.next}updateParticle(t){t.alpha=this.list.interpolate(t.agePercent)}}yu.type="alpha",yu.editorConfig=null;class xu{constructor(t){this.order=Ft.Normal,this.value=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.value,e=e.next}}xu.type="alphaStatic",xu.editorConfig=null;function b_(i){const t=[];for(let e=0;e<i.length;++e){let s=i[e];if(typeof s=="string")t.push(So(s));else if(s instanceof q)t.push(s);else{let r=s.count||1;for(typeof s.texture=="string"?s=So(s.texture):s=s.texture;r>0;--r)t.push(s)}}return t}class vu{constructor(t){this.order=Ft.Normal,this.anims=[];for(let e=0;e<t.anims.length;++e){const s=t.anims[e],r=b_(s.textures),n=s.framerate<0?-1:s.framerate>0?s.framerate:60,a={textures:r,duration:n>0?r.length/n:0,framerate:n,loop:n>0?!!s.loop:!1};this.anims.push(a)}}initParticles(t){let e=t;for(;e;){const s=Math.floor(Math.random()*this.anims.length),r=e.config.anim=this.anims[s];e.texture=r.textures[0],e.config.animElapsed=0,r.framerate===-1?(e.config.animDuration=e.maxLife,e.config.animFramerate=r.textures.length/e.maxLife):(e.config.animDuration=r.duration,e.config.animFramerate=r.framerate),e=e.next}}updateParticle(t,e){const s=t.config,r=s.anim;s.animElapsed+=e,s.animElapsed>=s.animDuration&&(s.anim.loop?s.animElapsed=s.animElapsed%s.animDuration:s.animElapsed=s.animDuration-1e-6);const n=s.animElapsed*s.animFramerate+1e-7|0;t.texture=r.textures[n]||r.textures[r.textures.length-1]||q.EMPTY}}vu.type="animatedRandom",vu.editorConfig=null;class bu{constructor(t){this.order=Ft.Normal;const e=t.anim,s=b_(e.textures),r=e.framerate<0?-1:e.framerate>0?e.framerate:60;this.anim={textures:s,duration:r>0?s.length/r:0,framerate:r,loop:r>0?!!e.loop:!1}}initParticles(t){let e=t;const s=this.anim;for(;e;)e.texture=s.textures[0],e.config.animElapsed=0,s.framerate===-1?(e.config.animDuration=e.maxLife,e.config.animFramerate=s.textures.length/e.maxLife):(e.config.animDuration=s.duration,e.config.animFramerate=s.framerate),e=e.next}updateParticle(t,e){const s=this.anim,r=t.config;r.animElapsed+=e,r.animElapsed>=r.animDuration&&(s.loop?r.animElapsed=r.animElapsed%r.animDuration:r.animElapsed=r.animDuration-1e-6);const n=r.animElapsed*r.animFramerate+1e-7|0;t.texture=s.textures[n]||s.textures[s.textures.length-1]||q.EMPTY}}bu.type="animatedSingle",bu.editorConfig=null;class wu{constructor(t){this.order=Ft.Normal,this.value=t.blendMode}initParticles(t){let e=t;for(;e;)e.blendMode=TS(this.value),e=e.next}}wu.type="blendMode",wu.editorConfig=null;class Eu{constructor(t){this.order=Ft.Spawn,this.spacing=t.spacing*nr,this.start=t.start*nr,this.distance=t.distance}initParticles(t){let e=0,s=t;for(;s;){let r;this.spacing?r=this.start+this.spacing*e:r=Math.random()*Math.PI*2,s.rotation=r,this.distance&&(s.position.x=this.distance,Ar(r,s.position)),s=s.next,++e}}}Eu.type="spawnBurst",Eu.editorConfig=null;class Tu{constructor(t){this.order=Ft.Normal,this.list=new Co(!0),this.list.reset(ir.createList(t.color))}initParticles(t){let e=t;const s=this.list.first.value,r=fl(s.r,s.g,s.b);for(;e;)e.tint=r,e=e.next}updateParticle(t){t.tint=this.list.interpolate(t.agePercent)}}Tu.type="color",Tu.editorConfig=null;class Au{constructor(t){this.order=Ft.Normal;let e=t.color;e.charAt(0)==="#"?e=e.substr(1):e.indexOf("0x")===0&&(e=e.substr(2)),this.value=parseInt(e,16)}initParticles(t){let e=t;for(;e;)e.tint=this.value,e=e.next}}Au.type="colorStatic",Au.editorConfig=null;class Su{constructor(t){this.order=Ft.Normal,this.index=0,this.textures=t.textures.map(e=>typeof e=="string"?So(e):e)}initParticles(t){let e=t;for(;e;)e.texture=this.textures[this.index],++this.index>=this.textures.length&&(this.index=0),e=e.next}}Su.type="textureOrdered",Su.editorConfig=null;const In=new st,w_=["E","LN2","LN10","LOG2E","LOG10E","PI","SQRT1_2","SQRT2","abs","acos","acosh","asin","asinh","atan","atanh","atan2","cbrt","ceil","cos","cosh","exp","expm1","floor","fround","hypot","log","log1p","log10","log2","max","min","pow","random","round","sign","sin","sinh","sqrt","tan","tanh"],MS=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(w_).join("|"),"g");function FS(i){const t=i.match(MS);for(let e=t.length-1;e>=0;--e)w_.indexOf(t[e])>=0&&(t[e]=`Math.${t[e]}`);return i=t.join(""),new Function("x",`return ${i};`)}class Cu{constructor(t){var e;if(this.order=Ft.Late,t.path)if(typeof t.path=="function")this.path=t.path;else try{this.path=FS(t.path)}catch{this.path=null}else this.path=s=>s;this.list=new Co(!1),this.list.reset(ir.createList(t.speed)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){e.config.initRotation=e.rotation,e.config.initPosition?e.config.initPosition.copyFrom(e.position):e.config.initPosition=new st(e.x,e.y),e.config.movement=0;const s=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=s,e=e.next}}updateParticle(t,e){const s=this.list.interpolate(t.agePercent)*t.config.speedMult;t.config.movement+=s*e,In.x=t.config.movement,In.y=this.path(In.x),Ar(t.config.initRotation,In),t.position.x=t.config.initPosition.x+In.x,t.position.y=t.config.initPosition.y+In.y}}Cu.type="movePath",Cu.editorConfig=null;class Iu{constructor(){this.order=Ft.Spawn}initParticles(t){}}Iu.type="spawnPoint",Iu.editorConfig=null;class Pu{constructor(t){this.order=Ft.Normal,this.textures=t.textures.map(e=>typeof e=="string"?So(e):e)}initParticles(t){let e=t;for(;e;){const s=Math.floor(Math.random()*this.textures.length);e.texture=this.textures[s],e=e.next}}}Pu.type="textureRandom",Pu.editorConfig=null;class Ru{constructor(t){this.order=Ft.Normal,this.minStart=t.minStart*nr,this.maxStart=t.maxStart*nr,this.minSpeed=t.minSpeed*nr,this.maxSpeed=t.maxSpeed*nr,this.accel=t.accel*nr}initParticles(t){let e=t;for(;e;)this.minStart===this.maxStart?e.rotation+=this.maxStart:e.rotation+=Math.random()*(this.maxStart-this.minStart)+this.minStart,e.config.rotSpeed=Math.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed,e=e.next}updateParticle(t,e){if(this.accel){const s=t.config.rotSpeed;t.config.rotSpeed+=this.accel*e,t.rotation+=(t.config.rotSpeed+s)/2*e}else t.rotation+=t.config.rotSpeed*e}}Ru.type="rotation",Ru.editorConfig=null;class Mu{constructor(t){this.order=Ft.Normal,this.min=t.min*nr,this.max=t.max*nr}initParticles(t){let e=t;for(;e;)this.min===this.max?e.rotation+=this.max:e.rotation+=Math.random()*(this.max-this.min)+this.min,e=e.next}}Mu.type="rotationStatic",Mu.editorConfig=null;class Fu{constructor(t){this.order=Ft.Late+1,this.rotation=(t.rotation||0)*nr}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}}Fu.type="noRotation",Fu.editorConfig=null;class ku{constructor(t){var e;this.order=Ft.Normal,this.list=new Co(!1),this.list.reset(ir.createList(t.scale)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const s=Math.random()*(1-this.minMult)+this.minMult;e.config.scaleMult=s,e.scale.x=e.scale.y=this.list.first.value*s,e=e.next}}updateParticle(t){t.scale.x=t.scale.y=this.list.interpolate(t.agePercent)*t.config.scaleMult}}ku.type="scale",ku.editorConfig=null;class Bu{constructor(t){this.order=Ft.Normal,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const s=Math.random()*(this.max-this.min)+this.min;e.scale.x=e.scale.y=s,e=e.next}}}Bu.type="scaleStatic",Bu.editorConfig=null;class Cs{constructor(t){this.order=Ft.Spawn;const e=Cs.shapes[t.type];if(!e)throw new Error(`No shape found with type '${t.type}'`);this.shape=new e(t.data)}static registerShape(t,e){Cs.shapes[e||t.type]=t}initParticles(t){let e=t;for(;e;)this.shape.getRandPos(e),e=e.next}}Cs.type="spawnShape",Cs.editorConfig=null,Cs.shapes={},Cs.registerShape(gu),Cs.registerShape(mu),Cs.registerShape(ml),Cs.registerShape(ml,"circle");class Du{constructor(t){this.order=Ft.Normal,this.texture=typeof t.texture=="string"?So(t.texture):t.texture}initParticles(t){let e=t;for(;e;)e.texture=this.texture,e=e.next}}Du.type="textureSingle",Du.editorConfig=null;class Ou{constructor(t){var e;this.order=Ft.Late,this.list=new Co(!1),this.list.reset(ir.createList(t.speed)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const s=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=s,e.config.velocity?e.config.velocity.set(this.list.first.value*s,0):e.config.velocity=new st(this.list.first.value*s,0),Ar(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=this.list.interpolate(t.agePercent)*t.config.speedMult,r=t.config.velocity;ES(r),x_(r,s),t.x+=r.x*e,t.y+=r.y*e}}Ou.type="moveSpeed",Ou.editorConfig=null;class Lu{constructor(t){this.order=Ft.Late,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const s=Math.random()*(this.max-this.min)+this.min;e.config.velocity?e.config.velocity.set(s,0):e.config.velocity=new st(s,0),Ar(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=t.config.velocity;t.x+=s.x*e,t.y+=s.y*e}}Lu.type="moveSpeedStatic",Lu.editorConfig=null,Et.registerBehavior(_u),Et.registerBehavior(yu),Et.registerBehavior(xu),Et.registerBehavior(vu),Et.registerBehavior(bu),Et.registerBehavior(wu),Et.registerBehavior(Eu),Et.registerBehavior(Tu),Et.registerBehavior(Au),Et.registerBehavior(Su),Et.registerBehavior(Cu),Et.registerBehavior(Iu),Et.registerBehavior(Pu),Et.registerBehavior(Ru),Et.registerBehavior(Mu),Et.registerBehavior(Fu),Et.registerBehavior(ku),Et.registerBehavior(Bu),Et.registerBehavior(Cs),Et.registerBehavior(Du),Et.registerBehavior(Ou),Et.registerBehavior(Lu);class Nu extends za{constructor(t){const{text:e,fontSize:s=36,fontColor:r=16777215,stroke:n,strokeColor:a,strokeThickness:h,fontFamily:o="Arial",fontWeight:l="normal",wordWrap:u=!1,wordWrapWidth:c=100,lineHeight:d=1.25,align:f="left",indent:p=0,shadow:m}=t,g=new vr({fontSize:s,wordWrap:u,wordWrapWidth:c,fontWeight:l,lineHeight:d*s,breakWords:u,fill:r,align:f,fontFamily:o,stroke:n?a:"transparent",strokeThickness:n?h:0,lineJoin:"round"});m&&(g.dropShadow=!0,g.dropShadowColor=m[0],g.dropShadowAngle=m[1]*(Math.PI/180),g.dropShadowBlur=m[2],g.dropShadowDistance=m[3]),super(e,g),this.position.x=p*s}}class kS extends Bt{constructor(t){super();const{start:e,control:s,end:r,json:n,duration:a,ease:h="power1.out",showControl:o=!1,loop:l=!1}=t;this._particleContainer=new MT,this.addChild(this._particleContainer);const u=new Et(this._particleContainer,n),c=this._createBezierPoints([e,...s,r],100,o),d={pathThrough:0};xt.to(d,{duration:a,pathThrough:c.length-1,repeat:l?-1:0,ease:h,onStart:()=>{u.emit=!0},onUpdate:()=>{const p=Math.floor(d.pathThrough),m=c[p];u.updateOwnerPos(m.x,m.y)},onComplete:()=>{xt.to(this,{alpha:0,duration:.5,onComplete:()=>{u.emit=!1,f.destroy(),this.removeFromParent()}})}});const f=new wt;f.add(()=>{u.update(1/75)}),f.start()}_createBezierPoints(t,e,s){const r=[];s&&t.forEach((n,a)=>{const h=new Nu({text:a+1,fontSize:16});h.position.set(n.x,n.y),this.addChild(h)});for(let n=0;n<e;n++){const a=this._multiPointBezier(t,n/e);r.push(a)}return r}_multiPointBezier(t,e){const s=t.length;let r=0,n=0;const a=[];for(let h=0;h<s;h++)a[h]=this._binomial(s-1,h);for(let h=0;h<s;h++){const o=t[h],l=a[h],u=Math.pow(e,h),c=Math.pow(1-e,s-1-h);r+=o.x*c*u*l,n+=o.y*c*u*l}return{x:r,y:n}}_binomial(t,e){if(e===0||e===t)return 1;let s=1;for(let r=1;r<=e;r++)s=s*(t-r+1)/r;return s}}var at=(i=>(i[i.Region=0]="Region",i[i.BoundingBox=1]="BoundingBox",i[i.Mesh=2]="Mesh",i[i.LinkedMesh=3]="LinkedMesh",i[i.Path=4]="Path",i[i.Point=5]="Point",i[i.Clipping=6]="Clipping",i))(at||{});class gl{constructor(t,e=new Array,s=0,r=new DataView(t.buffer)){this.strings=e,this.index=s,this.buffer=r}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){const t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){const t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return e&128&&(e=this.readByte(),s|=(e&127)<<7,e&128&&(e=this.readByte(),s|=(e&127)<<14,e&128&&(e=this.readByte(),s|=(e&127)<<21,e&128&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){const t=this.readInt(!0);return t==0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s<t;){const r=this.readUnsignedByte();switch(r>>4){case 12:case 13:e+=String.fromCharCode((r&31)<<6|this.readByte()&63),s+=2;break;case 14:e+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:e+=String.fromCharCode(r),s++}}return e}readFloat(){const t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}}var S=(i=>(i[i.setup=0]="setup",i[i.first=1]="first",i[i.replace=2]="replace",i[i.add=3]="add",i))(S||{}),At=(i=>(i[i.mixIn=0]="mixIn",i[i.mixOut=1]="mixOut",i))(At||{}),ne=(i=>(i[i.Fixed=0]="Fixed",i[i.Percent=1]="Percent",i))(ne||{}),Fe=(i=>(i[i.Tangent=0]="Tangent",i[i.Chain=1]="Chain",i[i.ChainScale=2]="ChainScale",i))(Fe||{}),vt=(i=>(i[i.Normal=0]="Normal",i[i.OnlyTranslation=1]="OnlyTranslation",i[i.NoRotationOrReflection=2]="NoRotationOrReflection",i[i.NoScale=3]="NoScale",i[i.NoScaleOrReflection=4]="NoScaleOrReflection",i))(vt||{});function E_(i){switch(i.toLowerCase()){case"nearest":return Ye.Nearest;case"linear":return Ye.Linear;case"mipmap":return Ye.MipMap;case"mipmapnearestnearest":return Ye.MipMapNearestNearest;case"mipmaplinearnearest":return Ye.MipMapLinearNearest;case"mipmapnearestlinear":return Ye.MipMapNearestLinear;case"mipmaplinearlinear":return Ye.MipMapLinearLinear;default:throw new Error(`Unknown texture filter ${i}`)}}var Ye=(i=>(i[i.Nearest=9728]="Nearest",i[i.Linear=9729]="Linear",i[i.MipMap=9987]="MipMap",i[i.MipMapNearestNearest=9984]="MipMapNearestNearest",i[i.MipMapLinearNearest=9985]="MipMapLinearNearest",i[i.MipMapNearestLinear=9986]="MipMapNearestLinear",i[i.MipMapLinearLinear=9987]="MipMapLinearLinear",i))(Ye||{}),Ui=(i=>(i[i.MirroredRepeat=33648]="MirroredRepeat",i[i.ClampToEdge=33071]="ClampToEdge",i[i.Repeat=10497]="Repeat",i))(Ui||{});class Vu{constructor(){this.size=null,this.names=null,this.values=null,this.renderObject=null}get width(){const t=this.texture;return t.trim?t.trim.width:t.orig.width}get height(){const t=this.texture;return t.trim?t.trim.height:t.orig.height}get u(){return this.texture._uvs.x0}get v(){return this.texture._uvs.y0}get u2(){return this.texture._uvs.x2}get v2(){return this.texture._uvs.y2}get offsetX(){const t=this.texture;return t.trim?t.trim.x:0}get offsetY(){return this.spineOffsetY}get pixiOffsetY(){const t=this.texture;return t.trim?t.trim.y:0}get spineOffsetY(){const t=this.texture;return this.originalHeight-this.height-(t.trim?t.trim.y:0)}get originalWidth(){return this.texture.orig.width}get originalHeight(){return this.texture.orig.height}get x(){return this.texture.frame.x}get y(){return this.texture.frame.y}get rotate(){return this.texture.rotate!==0}get degrees(){return(360-this.texture.rotate*45)%360}}class BS{constructor(){this.x=0,this.y=0,this.width=0,this.height=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0,this.rotate=0,this.index=0}}class Uu{constructor(t,e,s){this.pages=new Array,this.regions=new Array,t&&this.addSpineAtlas(t,e,s)}addTexture(t,e){const s=this.pages;let r=null;for(let a=0;a<s.length;a++)if(s[a].baseTexture===e.baseTexture){r=s[a];break}if(r===null){r=new T_,r.name="texturePage";const a=e.baseTexture;r.width=a.realWidth,r.height=a.realHeight,r.baseTexture=a,r.minFilter=r.magFilter=Ye.Nearest,r.uWrap=Ui.ClampToEdge,r.vWrap=Ui.ClampToEdge,s.push(r)}const n=new A_;return n.name=t,n.page=r,n.texture=e,n.index=-1,this.regions.push(n),n}addTextureHash(t,e){for(const s in t)t.hasOwnProperty(s)&&this.addTexture(e&&s.indexOf(".")!==-1?s.substr(0,s.lastIndexOf(".")):s,t[s])}addSpineAtlas(t,e,s){return this.load(t,e,s)}load(t,e,s){if(e==null)throw new Error("textureLoader cannot be null.");const r=new DS(t),n=new Array(4);let a=null;const h={};let o=null;h.size=()=>{a.width=parseInt(n[1]),a.height=parseInt(n[2])},h.format=()=>{},h.filter=()=>{a.minFilter=E_(n[1]),a.magFilter=E_(n[2])},h.repeat=()=>{n[1].indexOf("x")!=-1&&(a.uWrap=Ui.Repeat),n[1].indexOf("y")!=-1&&(a.vWrap=Ui.Repeat)},h.pma=()=>{a.pma=n[1]=="true"};const l={};l.xy=()=>{o.x=parseInt(n[1]),o.y=parseInt(n[2])},l.size=()=>{o.width=parseInt(n[1]),o.height=parseInt(n[2])},l.bounds=()=>{o.x=parseInt(n[1]),o.y=parseInt(n[2]),o.width=parseInt(n[3]),o.height=parseInt(n[4])},l.offset=()=>{o.offsetX=parseInt(n[1]),o.offsetY=parseInt(n[2])},l.orig=()=>{o.originalWidth=parseInt(n[1]),o.originalHeight=parseInt(n[2])},l.offsets=()=>{o.offsetX=parseInt(n[1]),o.offsetY=parseInt(n[2]),o.originalWidth=parseInt(n[3]),o.originalHeight=parseInt(n[4])},l.rotate=()=>{const d=n[1];let f=0;d.toLocaleLowerCase()=="true"?f=6:d.toLocaleLowerCase()=="false"?f=0:f=(720-parseFloat(d))%360/45,o.rotate=f},l.index=()=>{o.index=parseInt(n[1])};let u=r.readLine();for(;u!=null&&u.trim().length==0;)u=r.readLine();for(;!(u==null||u.trim().length==0||r.readEntry(n,u)==0);)u=r.readLine();const c=()=>{for(;;){if(u==null)return s&&s(this);if(u.trim().length==0)a=null,u=r.readLine();else if(a===null){for(a=new T_,a.name=u.trim();r.readEntry(n,u=r.readLine())!=0;){const d=h[n[0]];d&&d()}this.pages.push(a),e(a.name,d=>{if(d===null)return this.pages.splice(this.pages.indexOf(a),1),s&&s(null);a.baseTexture=d,a.pma&&(d.alphaMode=Re.PMA),d.valid||d.setSize(a.width,a.height),a.setFilters(),(!a.width||!a.height)&&(a.width=d.realWidth,a.height=d.realHeight,(!a.width||!a.height)&&console.log(`ERROR spine atlas page ${a.name}: meshes wont work if you dont specify size in atlas (http://www.html5gamedevs.com/topic/18888-pixi-spines-and-meshes/?p=107121)`)),c()});break}else{o=new BS;const d=new A_;d.name=u,d.page=a;let f=null,p=null;for(;;){const v=r.readEntry(n,u=r.readLine());if(v==0)break;const b=l[n[0]];if(b)b();else{f==null&&(f=[],p=[]),f.push(n[0]);const w=[];for(let E=0;E<v;E++)w.push(parseInt(n[E+1]));p.push(w)}}o.originalWidth==0&&o.originalHeight==0&&(o.originalWidth=o.width,o.originalHeight=o.height);const m=a.baseTexture.resolution;o.x/=m,o.y/=m,o.width/=m,o.height/=m,o.originalWidth/=m,o.originalHeight/=m,o.offsetX/=m,o.offsetY/=m;const g=o.rotate%4!==0,_=new rt(o.x,o.y,g?o.height:o.width,g?o.width:o.height),x=new rt(0,0,o.originalWidth,o.originalHeight),y=new rt(o.offsetX,o.originalHeight-o.height-o.offsetY,o.width,o.height);d.texture=new q(d.page.baseTexture,_,x,y,o.rotate),d.index=o.index,d.texture.updateUvs(),this.regions.push(d)}}};c()}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].baseTexture.dispose()}}class DS{constructor(t){this.index=0,this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(e==null||(e=e.trim(),e.length==0))return 0;const s=e.indexOf(":");if(s==-1)return 0;t[0]=e.substr(0,s).trim();for(let r=1,n=s+1;;r++){const a=e.indexOf(",",n);if(a==-1)return t[r]=e.substr(n).trim(),r;if(t[r]=e.substr(n,a-n).trim(),n=a+1,r==4)return 4}}}class T_{constructor(){this.minFilter=Ye.Nearest,this.magFilter=Ye.Nearest,this.uWrap=Ui.ClampToEdge,this.vWrap=Ui.ClampToEdge}setFilters(){const t=this.baseTexture,e=this.minFilter;e==Ye.Linear?t.scaleMode=je.LINEAR:this.minFilter==Ye.Nearest?t.scaleMode=je.NEAREST:(t.mipmap=vs.POW2,e==Ye.MipMapNearestNearest?t.scaleMode=je.NEAREST:t.scaleMode=je.LINEAR)}}class A_ extends Vu{}class OS{constructor(){this.array=new Array}add(t){const e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}}class LS{constructor(){this.entries={},this.size=0}add(t){const e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){const e=this.size;for(let s=0,r=t.length;s<r;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}}const Gi=class{constructor(i=0,t=0,e=0,s=0){this.r=i,this.g=t,this.b=e,this.a=s}set(i,t,e,s){return this.r=i,this.g=t,this.b=e,this.a=s,this.clamp()}setFromColor(i){return this.r=i.r,this.g=i.g,this.b=i.b,this.a=i.a,this}setFromString(i){return i=i.charAt(0)=="#"?i.substr(1):i,this.r=parseInt(i.substr(0,2),16)/255,this.g=parseInt(i.substr(2,2),16)/255,this.b=parseInt(i.substr(4,2),16)/255,this.a=i.length!=8?1:parseInt(i.substr(6,2),16)/255,this}add(i,t,e,s){return this.r+=i,this.g+=t,this.b+=e,this.a+=s,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(i,t){i.r=((t&4278190080)>>>24)/255,i.g=((t&16711680)>>>16)/255,i.b=((t&65280)>>>8)/255,i.a=(t&255)/255}static rgb888ToColor(i,t){i.r=((t&16711680)>>>16)/255,i.g=((t&65280)>>>8)/255,i.b=(t&255)/255}static fromString(i){return new Gi().setFromString(i)}};let X=Gi;X.WHITE=new Gi(1,1,1,1),X.RED=new Gi(1,0,0,1),X.GREEN=new Gi(0,1,0,1),X.BLUE=new Gi(0,0,1,1),X.MAGENTA=new Gi(1,0,1,1);const Sr=class{static clamp(i,t,e){return i<t?t:i>e?e:i}static cosDeg(i){return Math.cos(i*Sr.degRad)}static sinDeg(i){return Math.sin(i*Sr.degRad)}static signum(i){return Math.sign(i)}static toInt(i){return i>0?Math.floor(i):Math.ceil(i)}static cbrt(i){const t=Math.pow(Math.abs(i),.3333333333333333);return i<0?-t:t}static randomTriangular(i,t){return Sr.randomTriangularWith(i,t,(i+t)*.5)}static randomTriangularWith(i,t,e){const s=Math.random(),r=t-i;return s<=(e-i)/r?i+Math.sqrt(s*r*(e-i)):t-Math.sqrt((1-s)*r*(t-e))}static isPowerOfTwo(i){return i&&(i&i-1)===0}};let D=Sr;D.PI=3.1415927,D.PI2=Sr.PI*2,D.radiansToDegrees=180/Sr.PI,D.radDeg=Sr.radiansToDegrees,D.degreesToRadians=Sr.PI/180,D.degRad=Sr.degreesToRadians;class NS{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class VS extends NS{constructor(t){super(),this.power=2,this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}}class S_ extends VS{applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}const Pn=class{static arrayCopy(i,t,e,s,r){for(let n=t,a=s;n<t+r;n++,a++)e[a]=i[n]}static arrayFill(i,t,e,s){for(let r=t;r<e;r++)i[r]=s}static setArraySize(i,t,e=0){const s=i.length;if(s==t)return i;if(i.length=t,s<t)for(let r=s;r<t;r++)i[r]=e;return i}static ensureArrayCapacity(i,t,e=0){return i.length>=t?i:Pn.setArraySize(i,t,e)}static newArray(i,t){const e=new Array(i);for(let s=0;s<i;s++)e[s]=t;return e}static newFloatArray(i){if(Pn.SUPPORTS_TYPED_ARRAYS)return new Float32Array(i);const t=new Array(i);for(let e=0;e<t.length;e++)t[e]=0;return t}static newShortArray(i){if(Pn.SUPPORTS_TYPED_ARRAYS)return new Int16Array(i);const t=new Array(i);for(let e=0;e<t.length;e++)t[e]=0;return t}static toFloatArray(i){return Pn.SUPPORTS_TYPED_ARRAYS?new Float32Array(i):i}static toSinglePrecision(i){return Pn.SUPPORTS_TYPED_ARRAYS?Math.fround(i):i}static webkit602BugfixHelper(i,t){}static contains(i,t,e=!0){for(let s=0;s<i.length;s++)if(i[s]==t)return!0;return!1}static enumValue(i,t){return i[t[0].toUpperCase()+t.slice(1)]}};let B=Pn;B.SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";class US{constructor(t){this.items=new Array,this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}}class GS{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){const t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){const t=this.length();return t!=0&&(this.x/=t,this.y/=t),this}}const XS={yDown:!0,FAIL_ON_NON_EXISTING_SKIN:!1,GLOBAL_AUTO_UPDATE:!0,GLOBAL_DELAY_LIMIT:0},ti=[0,0,0];class $S extends qe{constructor(){super(...arguments),this.region=null,this.attachment=null}}class YS extends RT{constructor(t,e,s,r,n){super(t,e,s,r,n),this.region=null,this.attachment=null}}const C_=class extends Bt{constructor(i){if(super(),!i)throw new Error("The spineData param is required.");if(typeof i=="string")throw new Error('spineData param cant be string. Please use spine.Spine.fromAtlas("YOUR_RESOURCE_NAME") from now on.');this.spineData=i,this.createSkeleton(i),this.slotContainers=[],this.tempClipContainers=[];for(let t=0,e=this.skeleton.slots.length;t<e;t++){const s=this.skeleton.slots[t],r=s.getAttachment(),n=this.newContainer();if(this.slotContainers.push(n),this.addChild(n),this.tempClipContainers.push(null),!!r)if(r.type===at.Region){const a=r.name,h=this.createSprite(s,r,a);s.currentSprite=h,s.currentSpriteName=a,n.addChild(h)}else if(r.type===at.Mesh){const a=this.createMesh(s,r);s.currentMesh=a,s.currentMeshId=r.id,s.currentMeshName=r.name,n.addChild(a)}else r.type===at.Clipping&&(this.createGraphics(s,r),n.addChild(s.clippingContainer),n.addChild(s.currentGraphics))}this.tintRgb=new Float32Array([1,1,1]),this.autoUpdate=!0,this.visible=!0}get debug(){return this._debug}set debug(i){var t;i!=this._debug&&((t=this._debug)==null||t.unregisterSpine(this),i==null||i.registerSpine(this),this._debug=i)}get autoUpdate(){return this._autoUpdate}set autoUpdate(i){i!==this._autoUpdate&&(this._autoUpdate=i,this.updateTransform=i?C_.prototype.autoUpdateTransform:Bt.prototype.updateTransform)}get tint(){return eo(this.tintRgb)}set tint(i){this.tintRgb=sp(i,this.tintRgb)}get delayLimit(){return(typeof this.localDelayLimit<"u"?this.localDelayLimit:XS.GLOBAL_DELAY_LIMIT)||Number.MAX_VALUE}update(i){var l;const t=this.delayLimit;if(i>t&&(i=t),this.state.update(i),this.state.apply(this.skeleton),!this.skeleton)return;this.skeleton.updateWorldTransform();const e=this.skeleton.slots,s=this.color;let r=null,n=null;s?(r=s.light,n=s.dark):r=this.tintRgb;for(let u=0,c=e.length;u<c;u++){const d=e[u],f=d.getAttachment(),p=this.slotContainers[u];if(!f){p.visible=!1;continue}let m=null;f.sequence&&f.sequence.apply(d,f);let g=f.region;const _=f.color;switch(f!=null&&f.type){case at.Region:if(p.transform.setFromMatrix(d.bone.matrix),g=f.region,d.currentMesh&&(d.currentMesh.visible=!1,d.currentMesh=null,d.currentMeshId=void 0,d.currentMeshName=void 0),!g){d.currentSprite&&(d.currentSprite.renderable=!1);break}if(!d.currentSpriteName||d.currentSpriteName!==f.name){const v=f.name;if(d.currentSprite&&(d.currentSprite.visible=!1),d.sprites=d.sprites||{},d.sprites[v]!==void 0)d.sprites[v].visible=!0;else{const b=this.createSprite(d,f,v);p.addChild(b)}d.currentSprite=d.sprites[v],d.currentSpriteName=v}d.currentSprite.renderable=!0,d.hackRegion||this.setSpriteRegion(f,d.currentSprite,g),d.currentSprite.color?m=d.currentSprite.color:(ti[0]=r[0]*d.color.r*_.r,ti[1]=r[1]*d.color.g*_.g,ti[2]=r[2]*d.color.b*_.b,d.currentSprite.tint=eo(ti)),d.currentSprite.blendMode=d.blendMode;break;case at.Mesh:if(d.currentSprite){d.currentSprite.visible=!1,d.currentSprite=null,d.currentSpriteName=void 0;const v=new ma;v._parentID=-1,v._worldID=p.transform._worldID,p.transform=v}if(!g){d.currentMesh&&(d.currentMesh.renderable=!1);break}const y=f.id;if(d.currentMeshId===void 0||d.currentMeshId!==y){const v=y;if(d.currentMesh&&(d.currentMesh.visible=!1),d.meshes=d.meshes||{},d.meshes[v]!==void 0)d.meshes[v].visible=!0;else{const b=this.createMesh(d,f);p.addChild(b)}d.currentMesh=d.meshes[v],d.currentMeshName=f.name,d.currentMeshId=v}d.currentMesh.renderable=!0,f.computeWorldVerticesOld(d,d.currentMesh.vertices),d.currentMesh.color?m=d.currentMesh.color:(ti[0]=r[0]*d.color.r*_.r,ti[1]=r[1]*d.color.g*_.g,ti[2]=r[2]*d.color.b*_.b,d.currentMesh.tint=eo(ti)),d.currentMesh.blendMode=d.blendMode,d.hackRegion||this.setMeshRegion(f,d.currentMesh,g);break;case at.Clipping:d.currentGraphics||(this.createGraphics(d,f),p.addChild(d.clippingContainer),p.addChild(d.currentGraphics)),this.updateGraphics(d,f),p.alpha=1,p.visible=!0;continue;default:p.visible=!1;continue}if(p.visible=!0,m){let x=d.color.r*_.r,y=d.color.g*_.g,v=d.color.b*_.b;m.setLight(r[0]*x+n[0]*(1-x),r[1]*y+n[1]*(1-y),r[2]*v+n[2]*(1-v)),d.darkColor?(x=d.darkColor.r,y=d.darkColor.g,v=d.darkColor.b):(x=0,y=0,v=0),m.setDark(r[0]*x+n[0]*(1-x),r[1]*y+n[1]*(1-y),r[2]*v+n[2]*(1-v))}p.alpha=d.color.a}const a=this.skeleton.drawOrder;let h=null,o=null;for(let u=0,c=a.length;u<c;u++){const d=e[a[u].data.index],f=this.slotContainers[a[u].data.index];if(o||f.parent!==null&&f.parent!==this&&(f.parent.removeChild(f),f.parent=this),d.currentGraphics&&d.getAttachment())o=d.clippingContainer,h=d.getAttachment(),o.children.length=0,this.children[u]=f,h.endSlot===d.data&&(h.endSlot=null);else if(o){let p=this.tempClipContainers[u];p||(p=this.tempClipContainers[u]=this.newContainer(),p.visible=!1),this.children[u]=p,f.parent=null,o.addChild(f),h.endSlot==d.data&&(o.renderable=!0,o=null,h=null)}else this.children[u]=f}(l=this._debug)==null||l.renderDebug(this)}setSpriteRegion(i,t,e){t.attachment===i&&t.region===e||(t.region=e,t.attachment=i,t.texture=e.texture,t.rotation=i.rotation*D.degRad,t.position.x=i.x,t.position.y=i.y,t.alpha=i.color.a,e.size?(t.scale.x=e.size.width/e.originalWidth,t.scale.y=-e.size.height/e.originalHeight):(t.scale.x=i.scaleX*i.width/e.originalWidth,t.scale.y=-i.scaleY*i.height/e.originalHeight))}setMeshRegion(i,t,e){t.attachment===i&&t.region===e||(t.region=e,t.attachment=i,t.texture=e.texture,e.texture.updateUvs(),t.uvBuffer.update(i.regionUVs))}autoUpdateTransform(){{this.lastTime=this.lastTime||Date.now();const i=(Date.now()-this.lastTime)*.001;this.lastTime=Date.now(),this.update(i)}Bt.prototype.updateTransform.call(this)}createSprite(i,t,e){let s=t.region;i.hackAttachment===t&&(s=i.hackRegion);const r=s?s.texture:null,n=this.newSprite(r);return n.anchor.set(.5),s&&this.setSpriteRegion(t,n,t.region),i.sprites=i.sprites||{},i.sprites[e]=n,n}createMesh(i,t){let e=t.region;i.hackAttachment===t&&(e=i.hackRegion,i.hackAttachment=null,i.hackRegion=null);const s=this.newMesh(e?e.texture:null,new Float32Array(t.regionUVs.length),t.regionUVs,new Uint16Array(t.triangles),xs.TRIANGLES);return typeof s._canvasPadding<"u"&&(s._canvasPadding=1.5),s.alpha=t.color.a,s.region=t.region,e&&this.setMeshRegion(t,s,e),i.meshes=i.meshes||{},i.meshes[t.id]=s,s}createGraphics(i,t){const e=this.newGraphics(),s=new Nr([]);return e.clear(),e.beginFill(16777215,1),e.drawPolygon(s),e.renderable=!1,i.currentGraphics=e,i.clippingContainer=this.newContainer(),i.clippingContainer.mask=i.currentGraphics,e}updateGraphics(i,t){const e=i.currentGraphics.geometry,s=e.graphicsData[0].shape.points,r=t.worldVerticesLength;s.length=r,t.computeWorldVertices(i,0,r,s,0,2),e.invalidate()}hackTextureBySlotIndex(i,t=null,e=null){const s=this.skeleton.slots[i];if(!s)return!1;const r=s.getAttachment();let n=r.region;return t?(n=new Vu,n.texture=t,n.size=e,s.hackRegion=n,s.hackAttachment=r):(s.hackRegion=null,s.hackAttachment=null),s.currentSprite?this.setSpriteRegion(r,s.currentSprite,n):s.currentMesh&&this.setMeshRegion(r,s.currentMesh,n),!0}hackTextureBySlotName(i,t=null,e=null){const s=this.skeleton.findSlotIndex(i);return s==-1?!1:this.hackTextureBySlotIndex(s,t,e)}hackTextureAttachment(i,t,e,s=null){const r=this.skeleton.findSlotIndex(i),n=this.skeleton.getAttachmentByName(i,t);n.region.texture=e;const a=this.skeleton.slots[r];if(!a)return!1;const h=a.getAttachment();if(t===h.name){let o=n.region;return e?(o=new Vu,o.texture=e,o.size=s,a.hackRegion=o,a.hackAttachment=h):(a.hackRegion=null,a.hackAttachment=null),a.currentSprite&&a.currentSprite.region!=o?(this.setSpriteRegion(h,a.currentSprite,o),a.currentSprite.region=o):a.currentMesh&&a.currentMesh.region!=o&&this.setMeshRegion(h,a.currentMesh,o),!0}return!1}newContainer(){return new Bt}newSprite(i){return new $S(i)}newGraphics(){return new hs}newMesh(i,t,e,s,r){return new YS(i,t,e,s,r)}transformHack(){return 1}hackAttachmentGroups(i,t,e){if(!i)return;const s=[],r=[];for(let n=0,a=this.skeleton.slots.length;n<a;n++){const h=this.skeleton.slots[n],o=h.currentSpriteName||h.currentMeshName||"",l=h.currentSprite||h.currentMesh;o.endsWith(i)?(l.parentGroup=t,r.push(l)):e&&l&&(l.parentGroup=e,s.push(l))}return[s,r]}destroy(i){this.debug=null;for(let t=0,e=this.skeleton.slots.length;t<e;t++){const s=this.skeleton.slots[t];for(const r in s.meshes)s.meshes[r].destroy(i);s.meshes=null;for(const r in s.sprites)s.sprites[r].destroy(i);s.sprites=null}for(let t=0,e=this.slotContainers.length;t<e;t++)this.slotContainers[t].destroy(i);this.spineData=null,this.skeleton=null,this.slotContainers=null,this.stateData=null,this.state=null,this.tempClipContainers=null,super.destroy(i)}};let Gu=C_;Gu.clippingPolygon=[],Object.defineProperty(Gu.prototype,"visible",{get(){return this._visible},set(i){i!==this._visible&&(this._visible=i,i&&(this.lastTime=0))}});let I_=class{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}};const P_=class extends I_{constructor(t){super(t),this.id=(P_.nextID++&65535)<<11,this.worldVerticesLength=0,this.deformAttachment=this}computeWorldVerticesOld(t,e){this.computeWorldVertices(t,0,this.worldVerticesLength,e,0,2)}computeWorldVertices(t,e,s,r,n,a){s=n+(s>>1)*a;const h=t.bone.skeleton,o=t.deform;let l=this.vertices;const u=this.bones;if(u==null){o.length>0&&(l=o);const p=t.bone.matrix,m=p.tx,g=p.ty,_=p.a,x=p.c,y=p.b,v=p.d;for(let b=e,w=n;w<s;b+=2,w+=a){const E=l[b],T=l[b+1];r[w]=E*_+T*x+m,r[w+1]=E*y+T*v+g}return}let c=0,d=0;for(let p=0;p<e;p+=2){const m=u[c];c+=m+1,d+=m}const f=h.bones;if(o.length==0)for(let p=n,m=d*3;p<s;p+=a){let g=0,_=0,x=u[c++];for(x+=c;c<x;c++,m+=3){const y=f[u[c]].matrix,v=l[m],b=l[m+1],w=l[m+2];g+=(v*y.a+b*y.c+y.tx)*w,_+=(v*y.b+b*y.d+y.ty)*w}r[p]=g,r[p+1]=_}else{const p=o;for(let m=n,g=d*3,_=d<<1;m<s;m+=a){let x=0,y=0,v=u[c++];for(v+=c;c<v;c++,g+=3,_+=2){const b=f[u[c]].matrix,w=l[g]+p[_],E=l[g+1]+p[_+1],T=l[g+2];x+=(w*b.a+E*b.c+b.tx)*T,y+=(w*b.b+E*b.d+b.ty)*T}r[m]=x,r[m+1]=y}}}copyTo(t){this.bones!=null?(t.bones=new Array(this.bones.length),B.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices!=null?(t.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)):t.vertices=null,t.worldVerticesLength=this.worldVerticesLength,t.deformAttachment=this.deformAttachment}};let Xi=P_;Xi.nextID=0;let HS=class ay extends Xi{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}copy(){const t=new ay(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},WS=class ly extends Xi{constructor(t){super(t),this.type=at.Clipping,this.color=new X(.2275,.2275,.8078,1)}copy(){const t=new ly(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},Xu=class wd extends Xi{constructor(t){super(t),this.type=at.Mesh,this.color=new X(1,1,1,1),this.tempColor=new X(0,0,0,0)}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t!=null&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh!=null)return this.newLinkedMesh();const t=new wd(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Float32Array(this.regionUVs.length),B.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=new Array(this.triangles.length),B.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges!=null&&(t.edges=new Array(this.edges.length),B.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}newLinkedMesh(){const t=new wd(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),t.deformAttachment=this.deformAttachment,t.setParentMesh(this.parentMesh!=null?this.parentMesh:this),t}},_l=class hy extends Xi{constructor(t){super(t),this.type=at.Path,this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}copy(){const t=new hy(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),B.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},zS=class cy extends Xi{constructor(t){super(t),this.type=at.Point,this.color=new X(.38,.94,0,1)}computeWorldPosition(t,e){const s=t.matrix;return e.x=this.x*s.a+this.y*s.c+t.worldX,e.y=this.x*s.b+this.y*s.d+t.worldY,e}computeWorldRotation(t){const e=t.matrix,s=D.cosDeg(this.rotation),r=D.sinDeg(this.rotation),n=s*e.a+r*e.c,a=s*e.b+r*e.d;return Math.atan2(a,n)*D.radDeg}copy(){const t=new cy(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},R_=class{constructor(t,e){if(this.deform=new Array,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new X,this.darkColor=t.darkColor==null?null:new X,this.setToSetupPose(),this.blendMode=this.data.blendMode}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.deform.length=0)}setAttachmentTime(t){this.attachmentTime=this.bone.skeleton.time-t}getAttachmentTime(){return this.bone.skeleton.time-this.attachmentTime}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor!=null&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName==null?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))}};const _e=class extends I_{constructor(t){super(t),this.type=at.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new X(1,1,1,1),this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new X(1,1,1,1)}updateOffset(){const t=this.width/this.region.originalWidth*this.scaleX,e=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*t,r=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=r+this.region.height*e,h=this.rotation*Math.PI/180,o=Math.cos(h),l=Math.sin(h),u=s*o+this.x,c=s*l,d=r*o+this.y,f=r*l,p=n*o+this.x,m=n*l,g=a*o+this.y,_=a*l,x=this.offset;x[_e.OX1]=u-f,x[_e.OY1]=d+c,x[_e.OX2]=u-_,x[_e.OY2]=g+c,x[_e.OX3]=p-_,x[_e.OY3]=g+m,x[_e.OX4]=p-f,x[_e.OY4]=d+m}setRegion(t){this.region=t;const e=this.uvs;t.rotate?(e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v,e[0]=t.u2,e[1]=t.v2):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,r){const n=this.offset,a=t instanceof R_?t.bone.matrix:t.matrix,h=a.tx,o=a.ty,l=a.a,u=a.c,c=a.b,d=a.d;let f=0,p=0;f=n[_e.OX1],p=n[_e.OY1],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[_e.OX2],p=n[_e.OY2],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[_e.OX3],p=n[_e.OY3],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[_e.OX4],p=n[_e.OY4],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o}copy(){const t=new _e(this.name);return t.region=this.region,t.rendererObject=this.rendererObject,t.path=this.path,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,B.arrayCopy(this.uvs,0,t.uvs,0,8),B.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t}};let it=_e;it.OX1=0,it.OY1=1,it.OX2=2,it.OY2=3,it.OX3=4,it.OY3=5,it.OX4=6,it.OY4=7,it.X1=0,it.Y1=1,it.C1R=2,it.C1G=3,it.C1B=4,it.C1A=5,it.U1=6,it.V1=7,it.X2=8,it.Y2=9,it.C2R=10,it.C2G=11,it.C2B=12,it.C2A=13,it.U2=14,it.V2=15,it.X3=16,it.Y3=17,it.C3R=18,it.C3G=19,it.C3B=20,it.C3A=21,it.U3=22,it.V3=23,it.X4=24,it.Y4=25,it.C4R=26,it.C4G=27,it.C4B=28,it.C4A=29,it.U4=30,it.V4=31,new S_(2);let oe=class{constructor(t,e,s){if(t==null)throw new Error("name cannot be null.");if(e==null)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.timelineIds=[];for(let r=0;r<e.length;r++)this.timelineIds[e[r].getPropertyId()]=!0;this.duration=s}hasTimeline(t){return this.timelineIds[t]==!0}apply(t,e,s,r,n,a,h,o){if(t==null)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let u=0,c=l.length;u<c;u++)l[u].apply(t,e,s,n,a,h,o)}static binarySearch(t,e,s=1){let r=0,n=t.length/s-2;if(n==0)return s;let a=n>>>1;for(;;){if(t[(a+1)*s]<=e?r=a+1:n=a,r==n)return(r+1)*s;a=r+n>>>1}}static linearSearch(t,e,s){for(let r=0,n=t.length-s;r<=n;r+=s)if(t[r]>e)return r;return-1}};const ee=class{constructor(t){if(t<=0)throw new Error(`frameCount must be > 0: ${t}`);this.curves=B.newFloatArray((t-1)*ee.BEZIER_SIZE)}getFrameCount(){return this.curves.length/ee.BEZIER_SIZE+1}setLinear(t){this.curves[t*ee.BEZIER_SIZE]=ee.LINEAR}setStepped(t){this.curves[t*ee.BEZIER_SIZE]=ee.STEPPED}getCurveType(t){const e=t*ee.BEZIER_SIZE;if(e==this.curves.length)return ee.LINEAR;const s=this.curves[e];return s==ee.LINEAR?ee.LINEAR:s==ee.STEPPED?ee.STEPPED:ee.BEZIER}setCurve(t,e,s,r,n){const a=(-e*2+r)*.03,h=(-s*2+n)*.03,o=((e-r)*3+1)*.006,l=((s-n)*3+1)*.006;let u=a*2+o,c=h*2+l,d=e*.3+a+o*.16666667,f=s*.3+h+l*.16666667,p=t*ee.BEZIER_SIZE;const m=this.curves;m[p++]=ee.BEZIER;let g=d,_=f;for(let x=p+ee.BEZIER_SIZE-1;p<x;p+=2)m[p]=g,m[p+1]=_,d+=u,f+=c,u+=o,c+=l,g+=d,_+=f}getCurvePercent(t,e){e=D.clamp(e,0,1);const s=this.curves;let r=t*ee.BEZIER_SIZE;const n=s[r];if(n==ee.LINEAR)return e;if(n==ee.STEPPED)return 0;r++;let a=0;for(let o=r,l=r+ee.BEZIER_SIZE-1;r<l;r+=2)if(a=s[r],a>=e){let u,c;return r==o?(u=0,c=0):(u=s[r-2],c=s[r-1]),c+(s[r+1]-c)*(e-u)/(a-u)}const h=s[r-1];return h+(1-h)*(e-a)/(1-a)}};let es=ee;es.LINEAR=0,es.STEPPED=1,es.BEZIER=2,es.BEZIER_SIZE=10*2-1;const ei=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+ei.ROTATION]=s}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.rotation=l.data.rotation;return;case S.first:const m=l.data.rotation-l.rotation;l.rotation+=(m-(16384-(16384.499999999996-m/360|0))*360)*n}return}if(s>=o[o.length-ei.ENTRIES]){let m=o[o.length+ei.PREV_ROTATION];switch(a){case S.setup:l.rotation=l.data.rotation+m*n;break;case S.first:case S.replace:m+=l.data.rotation-l.rotation,m-=(16384-(16384.499999999996-m/360|0))*360;case S.add:l.rotation+=m*n}return}const u=oe.binarySearch(o,s,ei.ENTRIES),c=o[u+ei.PREV_ROTATION],d=o[u],f=this.getCurvePercent((u>>1)-1,1-(s-d)/(o[u+ei.PREV_TIME]-d));let p=o[u+ei.ROTATION]-c;switch(p=c+(p-(16384-(16384.499999999996-p/360|0))*360)*f,a){case S.setup:l.rotation=l.data.rotation+(p-(16384-(16384.499999999996-p/360|0))*360)*n;break;case S.first:case S.replace:p+=l.data.rotation-l.rotation;case S.add:l.rotation+=(p-(16384-(16384.499999999996-p/360|0))*360)*n}}};let Ie=ei;Ie.ENTRIES=2,Ie.PREV_TIME=-2,Ie.PREV_ROTATION=-1,Ie.ROTATION=1;const ke=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*ke.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(t,e,s,r){t*=ke.ENTRIES,this.frames[t]=e,this.frames[t+ke.X]=s,this.frames[t+ke.Y]=r}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.x=l.data.x,l.y=l.data.y;return;case S.first:l.x+=(l.data.x-l.x)*n,l.y+=(l.data.y-l.y)*n}return}let u=0,c=0;if(s>=o[o.length-ke.ENTRIES])u=o[o.length+ke.PREV_X],c=o[o.length+ke.PREV_Y];else{const d=oe.binarySearch(o,s,ke.ENTRIES);u=o[d+ke.PREV_X],c=o[d+ke.PREV_Y];const f=o[d],p=this.getCurvePercent(d/ke.ENTRIES-1,1-(s-f)/(o[d+ke.PREV_TIME]-f));u+=(o[d+ke.X]-u)*p,c+=(o[d+ke.Y]-c)*p}switch(a){case S.setup:l.x=l.data.x+u*n,l.y=l.data.y+c*n;break;case S.first:case S.replace:l.x+=(l.data.x+u-l.x)*n,l.y+=(l.data.y+c-l.y)*n;break;case S.add:l.x+=u*n,l.y+=c*n}}};let ps=ke;ps.ENTRIES=3,ps.PREV_TIME=-3,ps.PREV_X=-2,ps.PREV_Y=-1,ps.X=1,ps.Y=2;let M_=class Bs extends ps{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.scaleX=l.data.scaleX,l.scaleY=l.data.scaleY;return;case S.first:l.scaleX+=(l.data.scaleX-l.scaleX)*n,l.scaleY+=(l.data.scaleY-l.scaleY)*n}return}let u=0,c=0;if(s>=o[o.length-Bs.ENTRIES])u=o[o.length+Bs.PREV_X]*l.data.scaleX,c=o[o.length+Bs.PREV_Y]*l.data.scaleY;else{const d=oe.binarySearch(o,s,Bs.ENTRIES);u=o[d+Bs.PREV_X],c=o[d+Bs.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Bs.ENTRIES-1,1-(s-f)/(o[d+Bs.PREV_TIME]-f));u=(u+(o[d+Bs.X]-u)*p)*l.data.scaleX,c=(c+(o[d+Bs.Y]-c)*p)*l.data.scaleY}if(n==1)a==S.add?(l.scaleX+=u-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=u,l.scaleY=c);else{let d=0,f=0;if(h==At.mixOut)switch(a){case S.setup:d=l.data.scaleX,f=l.data.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.first:case S.replace:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.add:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-l.data.scaleX)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-l.data.scaleY)*n}else switch(a){case S.setup:d=Math.abs(l.data.scaleX)*D.signum(u),f=Math.abs(l.data.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.first:case S.replace:d=Math.abs(l.scaleX)*D.signum(u),f=Math.abs(l.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.add:d=D.signum(u),f=D.signum(c),l.scaleX=Math.abs(l.scaleX)*d+(u-Math.abs(l.data.scaleX)*d)*n,l.scaleY=Math.abs(l.scaleY)*f+(c-Math.abs(l.data.scaleY)*f)*n}}}},F_=class Ds extends ps{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.shearX=l.data.shearX,l.shearY=l.data.shearY;return;case S.first:l.shearX+=(l.data.shearX-l.shearX)*n,l.shearY+=(l.data.shearY-l.shearY)*n}return}let u=0,c=0;if(s>=o[o.length-Ds.ENTRIES])u=o[o.length+Ds.PREV_X],c=o[o.length+Ds.PREV_Y];else{const d=oe.binarySearch(o,s,Ds.ENTRIES);u=o[d+Ds.PREV_X],c=o[d+Ds.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Ds.ENTRIES-1,1-(s-f)/(o[d+Ds.PREV_TIME]-f));u=u+(o[d+Ds.X]-u)*p,c=c+(o[d+Ds.Y]-c)*p}switch(a){case S.setup:l.shearX=l.data.shearX+u*n,l.shearY=l.data.shearY+c*n;break;case S.first:case S.replace:l.shearX+=(l.data.shearX+u-l.shearX)*n,l.shearY+=(l.data.shearY+c-l.shearY)*n;break;case S.add:l.shearX+=u*n,l.shearY+=c*n}}};const Xt=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Xt.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(t,e,s,r,n,a){t*=Xt.ENTRIES,this.frames[t]=e,this.frames[t+Xt.R]=s,this.frames[t+Xt.G]=r,this.frames[t+Xt.B]=n,this.frames[t+Xt.A]=a}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.color.setFromColor(o.data.color);return;case S.first:const p=o.color,m=o.data.color;p.add((m.r-p.r)*n,(m.g-p.g)*n,(m.b-p.b)*n,(m.a-p.a)*n)}return}let u=0,c=0,d=0,f=0;if(s>=l[l.length-Xt.ENTRIES]){const p=l.length;u=l[p+Xt.PREV_R],c=l[p+Xt.PREV_G],d=l[p+Xt.PREV_B],f=l[p+Xt.PREV_A]}else{const p=oe.binarySearch(l,s,Xt.ENTRIES);u=l[p+Xt.PREV_R],c=l[p+Xt.PREV_G],d=l[p+Xt.PREV_B],f=l[p+Xt.PREV_A];const m=l[p],g=this.getCurvePercent(p/Xt.ENTRIES-1,1-(s-m)/(l[p+Xt.PREV_TIME]-m));u+=(l[p+Xt.R]-u)*g,c+=(l[p+Xt.G]-c)*g,d+=(l[p+Xt.B]-d)*g,f+=(l[p+Xt.A]-f)*g}if(n==1)o.color.set(u,c,d,f);else{const p=o.color;a==S.setup&&p.setFromColor(o.data.color),p.add((u-p.r)*n,(c-p.g)*n,(d-p.b)*n,(f-p.a)*n)}}};let He=Xt;He.ENTRIES=5,He.PREV_TIME=-5,He.PREV_R=-4,He.PREV_G=-3,He.PREV_B=-2,He.PREV_A=-1,He.R=1,He.G=2,He.B=3,He.A=4;const dt=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*dt.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(t,e,s,r,n,a,h,o,l){t*=dt.ENTRIES,this.frames[t]=e,this.frames[t+dt.R]=s,this.frames[t+dt.G]=r,this.frames[t+dt.B]=n,this.frames[t+dt.A]=a,this.frames[t+dt.R2]=h,this.frames[t+dt.G2]=o,this.frames[t+dt.B2]=l}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.color.setFromColor(o.data.color),o.darkColor.setFromColor(o.data.darkColor);return;case S.first:const _=o.color,x=o.darkColor,y=o.data.color,v=o.data.darkColor;_.add((y.r-_.r)*n,(y.g-_.g)*n,(y.b-_.b)*n,(y.a-_.a)*n),x.add((v.r-x.r)*n,(v.g-x.g)*n,(v.b-x.b)*n,0)}return}let u=0,c=0,d=0,f=0,p=0,m=0,g=0;if(s>=l[l.length-dt.ENTRIES]){const _=l.length;u=l[_+dt.PREV_R],c=l[_+dt.PREV_G],d=l[_+dt.PREV_B],f=l[_+dt.PREV_A],p=l[_+dt.PREV_R2],m=l[_+dt.PREV_G2],g=l[_+dt.PREV_B2]}else{const _=oe.binarySearch(l,s,dt.ENTRIES);u=l[_+dt.PREV_R],c=l[_+dt.PREV_G],d=l[_+dt.PREV_B],f=l[_+dt.PREV_A],p=l[_+dt.PREV_R2],m=l[_+dt.PREV_G2],g=l[_+dt.PREV_B2];const x=l[_],y=this.getCurvePercent(_/dt.ENTRIES-1,1-(s-x)/(l[_+dt.PREV_TIME]-x));u+=(l[_+dt.R]-u)*y,c+=(l[_+dt.G]-c)*y,d+=(l[_+dt.B]-d)*y,f+=(l[_+dt.A]-f)*y,p+=(l[_+dt.R2]-p)*y,m+=(l[_+dt.G2]-m)*y,g+=(l[_+dt.B2]-g)*y}if(n==1)o.color.set(u,c,d,f),o.darkColor.set(p,m,g,1);else{const _=o.color,x=o.darkColor;a==S.setup&&(_.setFromColor(o.data.color),x.setFromColor(o.data.darkColor)),_.add((u-_.r)*n,(c-_.g)*n,(d-_.b)*n,(f-_.a)*n),x.add((p-x.r)*n,(m-x.g)*n,(g-x.b)*n,0)}}};let ae=dt;ae.ENTRIES=8,ae.PREV_TIME=-8,ae.PREV_R=-7,ae.PREV_G=-6,ae.PREV_B=-5,ae.PREV_A=-4,ae.PREV_R2=-3,ae.PREV_G2=-2,ae.PREV_B2=-1,ae.R=1,ae.G=2,ae.B=3,ae.A=4,ae.R2=5,ae.G2=6,ae.B2=7;let Rn=class{constructor(t){this.frames=B.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;if(h==At.mixOut){a==S.setup&&this.setAttachment(t,o,o.data.attachmentName);return}const l=this.frames;if(s<l[0]){(a==S.setup||a==S.first)&&this.setAttachment(t,o,o.data.attachmentName);return}let u=0;s>=l[l.length-1]?u=l.length-1:u=oe.binarySearch(l,s,1)-1;const c=this.attachmentNames[u];t.slots[this.slotIndex].setAttachment(c==null?null:t.getAttachment(this.slotIndex,c))}setAttachment(t,e,s){e.setAttachment(s==null?null:t.getAttachment(this.slotIndex,s))}},k_=null,B_=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t),this.frameVertices=new Array(t),k_==null&&(k_=B.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(t,e,s){this.frames[t]=e,this.frameVertices[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.getAttachment();if(!(l instanceof Xi)||l.deformAttachment!=this.attachment)return;const u=o.deform;u.length==0&&(a=S.setup);const c=this.frameVertices,d=c[0].length,f=this.frames;if(s<f[0]){const v=l;switch(a){case S.setup:u.length=0;return;case S.first:if(n==1){u.length=0;break}const b=B.setArraySize(u,d);if(v.bones==null){const w=v.vertices;for(let E=0;E<d;E++)b[E]+=(w[E]-b[E])*n}else{n=1-n;for(let w=0;w<d;w++)b[w]*=n}}return}const p=B.setArraySize(u,d);if(s>=f[f.length-1]){const v=c[f.length-1];if(n==1)if(a==S.add){const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=v[E]-w[E]}else for(let w=0;w<d;w++)p[w]+=v[w]}else B.arrayCopy(v,0,p,0,d);else switch(a){case S.setup:{const w=l;if(w.bones==null){const E=w.vertices;for(let T=0;T<d;T++){const A=E[T];p[T]=A+(v[T]-A)*n}}else for(let E=0;E<d;E++)p[E]=v[E]*n;break}case S.first:case S.replace:for(let w=0;w<d;w++)p[w]+=(v[w]-p[w])*n;break;case S.add:const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=(v[E]-w[E])*n}else for(let w=0;w<d;w++)p[w]+=v[w]*n}return}const m=oe.binarySearch(f,s),g=c[m-1],_=c[m],x=f[m],y=this.getCurvePercent(m-1,1-(s-x)/(f[m-1]-x));if(n==1)if(a==S.add){const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=E+(_[w]-E)*y-b[w]}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=w+(_[b]-w)*y}}else for(let v=0;v<d;v++){const b=g[v];p[v]=b+(_[v]-b)*y}else switch(a){case S.setup:{const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++){const T=g[E],A=w[E];p[E]=A+(T+(_[E]-T)*y-A)*n}}else for(let w=0;w<d;w++){const E=g[w];p[w]=(E+(_[w]-E)*y)*n}break}case S.first:case S.replace:for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y-p[b])*n}break;case S.add:const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=(E+(_[w]-E)*y-b[w])*n}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y)*n}}}},$u=class{constructor(t){this.frames=B.newFloatArray(t),this.events=new Array(t)}getPropertyId(){return 7<<24}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,r,n,a,h){if(r==null)return;const o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,r,n,a,h),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let u=0;if(e<o[0])u=0;else{u=oe.binarySearch(o,e);const c=o[u];for(;u>0&&o[u-1]==c;)u--}for(;u<l&&s>=o[u];u++)r.push(this.events[u])}},Io=class{constructor(t){this.frames=B.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,r,n,a,h){const o=t.drawOrder,l=t.slots;if(h==At.mixOut&&a==S.setup){B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const u=this.frames;if(s<u[0]){(a==S.setup||a==S.first)&&B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let c=0;s>=u[u.length-1]?c=u.length-1:c=oe.binarySearch(u,s)-1;const d=this.drawOrders[c];if(d==null)B.arrayCopy(l,0,o,0,l.length);else for(let f=0,p=d.length;f<p;f++)o[f]=l[d[f]]}};const mt=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*mt.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(t,e,s,r,n,a,h){t*=mt.ENTRIES,this.frames[t]=e,this.frames[t+mt.MIX]=s,this.frames[t+mt.SOFTNESS]=r,this.frames[t+mt.BEND_DIRECTION]=n,this.frames[t+mt.COMPRESS]=a?1:0,this.frames[t+mt.STRETCH]=h?1:0}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.ikConstraints[this.ikConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.mix=l.data.mix,l.softness=l.data.softness,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch;return;case S.first:l.mix+=(l.data.mix-l.mix)*n,l.softness+=(l.data.softness-l.softness)*n,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch}return}if(s>=o[o.length-mt.ENTRIES]){a==S.setup?(l.mix=l.data.mix+(o[o.length+mt.PREV_MIX]-l.data.mix)*n,l.softness=l.data.softness+(o[o.length+mt.PREV_SOFTNESS]-l.data.softness)*n,h==At.mixOut?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=o[o.length+mt.PREV_BEND_DIRECTION],l.compress=o[o.length+mt.PREV_COMPRESS]!=0,l.stretch=o[o.length+mt.PREV_STRETCH]!=0)):(l.mix+=(o[o.length+mt.PREV_MIX]-l.mix)*n,l.softness+=(o[o.length+mt.PREV_SOFTNESS]-l.softness)*n,h==At.mixIn&&(l.bendDirection=o[o.length+mt.PREV_BEND_DIRECTION],l.compress=o[o.length+mt.PREV_COMPRESS]!=0,l.stretch=o[o.length+mt.PREV_STRETCH]!=0));return}const u=oe.binarySearch(o,s,mt.ENTRIES),c=o[u+mt.PREV_MIX],d=o[u+mt.PREV_SOFTNESS],f=o[u],p=this.getCurvePercent(u/mt.ENTRIES-1,1-(s-f)/(o[u+mt.PREV_TIME]-f));a==S.setup?(l.mix=l.data.mix+(c+(o[u+mt.MIX]-c)*p-l.data.mix)*n,l.softness=l.data.softness+(d+(o[u+mt.SOFTNESS]-d)*p-l.data.softness)*n,h==At.mixOut?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=o[u+mt.PREV_BEND_DIRECTION],l.compress=o[u+mt.PREV_COMPRESS]!=0,l.stretch=o[u+mt.PREV_STRETCH]!=0)):(l.mix+=(c+(o[u+mt.MIX]-c)*p-l.mix)*n,l.softness+=(d+(o[u+mt.SOFTNESS]-d)*p-l.softness)*n,h==At.mixIn&&(l.bendDirection=o[u+mt.PREV_BEND_DIRECTION],l.compress=o[u+mt.PREV_COMPRESS]!=0,l.stretch=o[u+mt.PREV_STRETCH]!=0))}};let Pe=mt;Pe.ENTRIES=6,Pe.PREV_TIME=-6,Pe.PREV_MIX=-5,Pe.PREV_SOFTNESS=-4,Pe.PREV_BEND_DIRECTION=-3,Pe.PREV_COMPRESS=-2,Pe.PREV_STRETCH=-1,Pe.MIX=1,Pe.SOFTNESS=2,Pe.BEND_DIRECTION=3,Pe.COMPRESS=4,Pe.STRETCH=5;const $t=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*$t.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(t,e,s,r,n,a){t*=$t.ENTRIES,this.frames[t]=e,this.frames[t+$t.ROTATE]=s,this.frames[t+$t.TRANSLATE]=r,this.frames[t+$t.SCALE]=n,this.frames[t+$t.SHEAR]=a}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.transformConstraints[this.transformConstraintIndex];if(!l.active)return;if(s<o[0]){const p=l.data;switch(a){case S.setup:l.rotateMix=p.rotateMix,l.translateMix=p.translateMix,l.scaleMix=p.scaleMix,l.shearMix=p.shearMix;return;case S.first:l.rotateMix+=(p.rotateMix-l.rotateMix)*n,l.translateMix+=(p.translateMix-l.translateMix)*n,l.scaleMix+=(p.scaleMix-l.scaleMix)*n,l.shearMix+=(p.shearMix-l.shearMix)*n}return}let u=0,c=0,d=0,f=0;if(s>=o[o.length-$t.ENTRIES]){const p=o.length;u=o[p+$t.PREV_ROTATE],c=o[p+$t.PREV_TRANSLATE],d=o[p+$t.PREV_SCALE],f=o[p+$t.PREV_SHEAR]}else{const p=oe.binarySearch(o,s,$t.ENTRIES);u=o[p+$t.PREV_ROTATE],c=o[p+$t.PREV_TRANSLATE],d=o[p+$t.PREV_SCALE],f=o[p+$t.PREV_SHEAR];const m=o[p],g=this.getCurvePercent(p/$t.ENTRIES-1,1-(s-m)/(o[p+$t.PREV_TIME]-m));u+=(o[p+$t.ROTATE]-u)*g,c+=(o[p+$t.TRANSLATE]-c)*g,d+=(o[p+$t.SCALE]-d)*g,f+=(o[p+$t.SHEAR]-f)*g}if(a==S.setup){const p=l.data;l.rotateMix=p.rotateMix+(u-p.rotateMix)*n,l.translateMix=p.translateMix+(c-p.translateMix)*n,l.scaleMix=p.scaleMix+(d-p.scaleMix)*n,l.shearMix=p.shearMix+(f-p.shearMix)*n}else l.rotateMix+=(u-l.rotateMix)*n,l.translateMix+=(c-l.translateMix)*n,l.scaleMix+=(d-l.scaleMix)*n,l.shearMix+=(f-l.shearMix)*n}};let We=$t;We.ENTRIES=5,We.PREV_TIME=-5,We.PREV_ROTATE=-4,We.PREV_TRANSLATE=-3,We.PREV_SCALE=-2,We.PREV_SHEAR=-1,We.ROTATE=1,We.TRANSLATE=2,We.SCALE=3,We.SHEAR=4;const Is=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Is.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(t,e,s){t*=Is.ENTRIES,this.frames[t]=e,this.frames[t+Is.VALUE]=s}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.position=l.data.position;return;case S.first:l.position+=(l.data.position-l.position)*n}return}let u=0;if(s>=o[o.length-Is.ENTRIES])u=o[o.length+Is.PREV_VALUE];else{const c=oe.binarySearch(o,s,Is.ENTRIES);u=o[c+Is.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/Is.ENTRIES-1,1-(s-d)/(o[c+Is.PREV_TIME]-d));u+=(o[c+Is.VALUE]-u)*f}a==S.setup?l.position=l.data.position+(u-l.data.position)*n:l.position+=(u-l.position)*n}};let Cr=Is;Cr.ENTRIES=2,Cr.PREV_TIME=-2,Cr.PREV_VALUE=-1,Cr.VALUE=1;let D_=class ci extends Cr{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.spacing=l.data.spacing;return;case S.first:l.spacing+=(l.data.spacing-l.spacing)*n}return}let u=0;if(s>=o[o.length-ci.ENTRIES])u=o[o.length+ci.PREV_VALUE];else{const c=oe.binarySearch(o,s,ci.ENTRIES);u=o[c+ci.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/ci.ENTRIES-1,1-(s-d)/(o[c+ci.PREV_TIME]-d));u+=(o[c+ci.VALUE]-u)*f}a==S.setup?l.spacing=l.data.spacing+(u-l.data.spacing)*n:l.spacing+=(u-l.spacing)*n}};const Be=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Be.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(t,e,s,r){t*=Be.ENTRIES,this.frames[t]=e,this.frames[t+Be.ROTATE]=s,this.frames[t+Be.TRANSLATE]=r}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.rotateMix=l.data.rotateMix,l.translateMix=l.data.translateMix;return;case S.first:l.rotateMix+=(l.data.rotateMix-l.rotateMix)*n,l.translateMix+=(l.data.translateMix-l.translateMix)*n}return}let u=0,c=0;if(s>=o[o.length-Be.ENTRIES])u=o[o.length+Be.PREV_ROTATE],c=o[o.length+Be.PREV_TRANSLATE];else{const d=oe.binarySearch(o,s,Be.ENTRIES);u=o[d+Be.PREV_ROTATE],c=o[d+Be.PREV_TRANSLATE];const f=o[d],p=this.getCurvePercent(d/Be.ENTRIES-1,1-(s-f)/(o[d+Be.PREV_TIME]-f));u+=(o[d+Be.ROTATE]-u)*p,c+=(o[d+Be.TRANSLATE]-c)*p}a==S.setup?(l.rotateMix=l.data.rotateMix+(u-l.data.rotateMix)*n,l.translateMix=l.data.translateMix+(c-l.data.translateMix)*n):(l.rotateMix+=(u-l.rotateMix)*n,l.translateMix+=(c-l.translateMix)*n)}};let or=Be;or.ENTRIES=3,or.PREV_TIME=-3,or.PREV_ROTATE=-2,or.PREV_TRANSLATE=-1,or.ROTATE=1,or.TRANSLATE=2;const Yt=class{constructor(i){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new O_(this),this.propertyIDs=new OS,this.animationsChanged=!1,this.trackEntryPool=new US(()=>new Yu),this.data=i}update(i){i*=this.timeScale;const t=this.tracks;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r==null)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let n=i*r.timeScale;if(r.delay>0){if(r.delay-=n,r.delay>0)continue;n=-r.delay,r.delay=0}let a=r.next;if(a!=null){const h=r.trackLast-a.delay;if(h>=0){for(a.delay=0,a.trackTime+=r.timeScale==0?0:(h/r.timeScale+i)*a.timeScale,r.trackTime+=n,this.setCurrent(e,a,!0);a.mixingFrom!=null;)a.mixTime+=i,a=a.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&r.mixingFrom==null){t[e]=null,this.queue.end(r),this.disposeNext(r);continue}if(r.mixingFrom!=null&&this.updateMixingFrom(r,i)){let h=r.mixingFrom;for(r.mixingFrom=null,h!=null&&(h.mixingTo=null);h!=null;)this.queue.end(h),h=h.mixingFrom}r.trackTime+=n}this.queue.drain()}updateMixingFrom(i,t){const e=i.mixingFrom;if(e==null)return!0;const s=this.updateMixingFrom(e,t);return e.animationLast=e.nextAnimationLast,e.trackLast=e.nextTrackLast,i.mixTime>0&&i.mixTime>=i.mixDuration?((e.totalAlpha==0||i.mixDuration==0)&&(i.mixingFrom=e.mixingFrom,e.mixingFrom!=null&&(e.mixingFrom.mixingTo=i),i.interruptAlpha=e.interruptAlpha,this.queue.end(e)),s):(e.trackTime+=t*e.timeScale,i.mixTime+=t,!1)}apply(i){if(i==null)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const t=this.events,e=this.tracks;let s=!1;for(let a=0,h=e.length;a<h;a++){const o=e[a];if(o==null||o.delay>0)continue;s=!0;const l=a==0?S.first:o.mixBlend;let u=o.alpha;o.mixingFrom!=null?u*=this.applyMixingFrom(o,i,l):o.trackTime>=o.trackEnd&&o.next==null&&(u=0);const c=o.animationLast,d=o.getAnimationTime(),f=o.animation.timelines.length,p=o.animation.timelines;if(a==0&&u==1||l==S.add)for(let m=0;m<f;m++){const g=p[m];g instanceof Rn?this.applyAttachmentTimeline(g,i,d,l,!0):g.apply(i,c,d,t,u,l,At.mixIn)}else{const m=o.timelineMode,g=o.timelinesRotation.length==0;g&&B.setArraySize(o.timelinesRotation,f<<1,null);const _=o.timelinesRotation;for(let x=0;x<f;x++){const y=p[x],v=m[x]==Yt.SUBSEQUENT?l:S.setup;y instanceof Ie?this.applyRotateTimeline(y,i,d,u,v,_,x<<1,g):y instanceof Rn?this.applyAttachmentTimeline(y,i,d,l,!0):y.apply(i,c,d,t,u,v,At.mixIn)}}this.queueEvents(o,d),t.length=0,o.nextAnimationLast=d,o.nextTrackLast=o.trackTime}const r=this.unkeyedState+Yt.SETUP,n=i.slots;for(let a=0,h=i.slots.length;a<h;a++){const o=n[a];if(o.attachmentState==r){const l=o.data.attachmentName;o.setAttachment(l==null?null:i.getAttachment(o.data.index,l))}}return this.unkeyedState+=2,this.queue.drain(),s}applyMixingFrom(i,t,e){const s=i.mixingFrom;s.mixingFrom!=null&&this.applyMixingFrom(s,t,e);let r=0;i.mixDuration==0?(r=1,e==S.first&&(e=S.setup)):(r=i.mixTime/i.mixDuration,r>1&&(r=1),e!=S.first&&(e=s.mixBlend));const n=r<s.eventThreshold?this.events:null,a=r<s.attachmentThreshold,h=r<s.drawOrderThreshold,o=s.animationLast,l=s.getAnimationTime(),u=s.animation.timelines.length,c=s.animation.timelines,d=s.alpha*i.interruptAlpha,f=d*(1-r);if(e==S.add)for(let p=0;p<u;p++)c[p].apply(t,o,l,n,f,e,At.mixOut);else{const p=s.timelineMode,m=s.timelineHoldMix,g=s.timelinesRotation.length==0;g&&B.setArraySize(s.timelinesRotation,u<<1,null);const _=s.timelinesRotation;s.totalAlpha=0;for(let x=0;x<u;x++){const y=c[x];let v=At.mixOut,b,w=0;switch(p[x]){case Yt.SUBSEQUENT:if(!h&&y instanceof Io)continue;b=e,w=f;break;case Yt.FIRST:b=S.setup,w=f;break;case Yt.HOLD_SUBSEQUENT:b=e,w=d;break;case Yt.HOLD_FIRST:b=S.setup,w=d;break;default:b=S.setup;const E=m[x];w=d*Math.max(0,1-E.mixTime/E.mixDuration);break}s.totalAlpha+=w,y instanceof Ie?this.applyRotateTimeline(y,t,l,w,b,_,x<<1,g):y instanceof Rn?this.applyAttachmentTimeline(y,t,l,b,a):(h&&y instanceof Io&&b==S.setup&&(v=At.mixIn),y.apply(t,o,l,n,w,b,v))}}return i.mixDuration>0&&this.queueEvents(s,l),this.events.length=0,s.nextAnimationLast=l,s.nextTrackLast=s.trackTime,r}applyAttachmentTimeline(i,t,e,s,r){const n=t.slots[i.slotIndex];if(!n.bone.active)return;const a=i.frames;if(e<a[0])(s==S.setup||s==S.first)&&this.setAttachment(t,n,n.data.attachmentName,r);else{let h;e>=a[a.length-1]?h=a.length-1:h=oe.binarySearch(a,e)-1,this.setAttachment(t,n,i.attachmentNames[h],r)}n.attachmentState<=this.unkeyedState&&(n.attachmentState=this.unkeyedState+Yt.SETUP)}setAttachment(i,t,e,s){t.setAttachment(e==null?null:i.getAttachment(t.data.index,e)),s&&(t.attachmentState=this.unkeyedState+Yt.CURRENT)}applyRotateTimeline(i,t,e,s,r,n,a,h){if(h&&(n[a]=0),s==1){i.apply(t,0,e,null,1,r,At.mixIn);return}const o=i,l=o.frames,u=t.bones[o.boneIndex];if(!u.active)return;let c=0,d=0;if(e<l[0])switch(r){case S.setup:u.rotation=u.data.rotation;default:return;case S.first:c=u.rotation,d=u.data.rotation}else if(c=r==S.setup?u.data.rotation:u.rotation,e>=l[l.length-Ie.ENTRIES])d=u.data.rotation+l[l.length+Ie.PREV_ROTATION];else{const m=oe.binarySearch(l,e,Ie.ENTRIES),g=l[m+Ie.PREV_ROTATION],_=l[m],x=o.getCurvePercent((m>>1)-1,1-(e-_)/(l[m+Ie.PREV_TIME]-_));d=l[m+Ie.ROTATION]-g,d-=(16384-(16384.499999999996-d/360|0))*360,d=g+d*x+u.data.rotation,d-=(16384-(16384.499999999996-d/360|0))*360}let f=0,p=d-c;if(p-=(16384-(16384.499999999996-p/360|0))*360,p==0)f=n[a];else{let m=0,g=0;h?(m=0,g=p):(m=n[a],g=n[a+1]);const _=p>0;let x=m>=0;D.signum(g)!=D.signum(p)&&Math.abs(g)<=90&&(Math.abs(m)>180&&(m+=360*D.signum(m)),x=_),f=p+m-m%360,x!=_&&(f+=360*D.signum(m)),n[a]=f}n[a+1]=p,c+=f*s,u.rotation=c-(16384-(16384.499999999996-c/360|0))*360}queueEvents(i,t){const e=i.animationStart,s=i.animationEnd,r=s-e,n=i.trackLast%r,a=this.events;let h=0;const o=a.length;for(;h<o;h++){const u=a[h];if(u.time<n)break;u.time>s||this.queue.event(i,u)}let l=!1;for(i.loop?l=r==0||n>i.trackTime%r:l=t>=s&&i.animationLast<s,l&&this.queue.complete(i);h<o;h++)a[h].time<e||this.queue.event(i,a[h])}clearTracks(){const i=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,e=this.tracks.length;t<e;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=i,this.queue.drain()}clearTrack(i){if(i>=this.tracks.length)return;const t=this.tracks[i];if(t==null)return;this.queue.end(t),this.disposeNext(t);let e=t;for(;;){const s=e.mixingFrom;if(s==null)break;this.queue.end(s),e.mixingFrom=null,e.mixingTo=null,e=s}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(i,t,e){const s=this.expandToIndex(i);this.tracks[i]=t,s!=null&&(e&&this.queue.interrupt(s),t.mixingFrom=s,s.mixingTo=t,t.mixTime=0,s.mixingFrom!=null&&s.mixDuration>0&&(t.interruptAlpha*=Math.min(1,s.mixTime/s.mixDuration)),s.timelinesRotation.length=0),this.queue.start(t)}setAnimation(i,t,e){const s=this.data.skeletonData.findAnimation(t);if(s==null)throw new Error(`Animation not found: ${t}`);return this.setAnimationWith(i,s,e)}setAnimationWith(i,t,e){if(t==null)throw new Error("animation cannot be null.");let s=!0,r=this.expandToIndex(i);r!=null&&(r.nextTrackLast==-1?(this.tracks[i]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.disposeNext(r),r=r.mixingFrom,s=!1):this.disposeNext(r));const n=this.trackEntry(i,t,e,r);return this.setCurrent(i,n,s),this.queue.drain(),n}addAnimation(i,t,e,s){const r=this.data.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);return this.addAnimationWith(i,r,e,s)}addAnimationWith(i,t,e,s){if(t==null)throw new Error("animation cannot be null.");let r=this.expandToIndex(i);if(r!=null)for(;r.next!=null;)r=r.next;const n=this.trackEntry(i,t,e,r);if(r==null)this.setCurrent(i,n,!0),this.queue.drain();else if(r.next=n,s<=0){const a=r.animationEnd-r.animationStart;a!=0?(r.loop?s+=a*(1+(r.trackTime/a|0)):s+=Math.max(a,r.trackTime),s-=this.data.getMix(r.animation,t)):s=r.trackTime}return n.delay=s,n}setEmptyAnimation(i,t){const e=this.setAnimationWith(i,Yt.emptyAnimation,!1);return e.mixDuration=t,e.trackEnd=t,e}addEmptyAnimation(i,t,e){e<=0&&(e-=t);const s=this.addAnimationWith(i,Yt.emptyAnimation,!1,e);return s.mixDuration=t,s.trackEnd=t,s}setEmptyAnimations(i){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++){const r=this.tracks[e];r!=null&&this.setEmptyAnimation(r.trackIndex,i)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(i){return i<this.tracks.length?this.tracks[i]:(B.ensureArrayCapacity(this.tracks,i+1,null),this.tracks.length=i+1,null)}trackEntry(i,t,e,s){const r=this.trackEntryPool.obtain();return r.trackIndex=i,r.animation=t,r.loop=e,r.holdPrevious=!1,r.eventThreshold=0,r.attachmentThreshold=0,r.drawOrderThreshold=0,r.animationStart=0,r.animationEnd=t.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.interruptAlpha=1,r.mixTime=0,r.mixDuration=s==null?0:this.data.getMix(s.animation,t),r.mixBlend=S.replace,r}disposeNext(i){let t=i.next;for(;t!=null;)this.queue.dispose(t),t=t.next;i.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();for(let i=0,t=this.tracks.length;i<t;i++){let e=this.tracks[i];if(e!=null){for(;e.mixingFrom!=null;)e=e.mixingFrom;do(e.mixingFrom==null||e.mixBlend!=S.add)&&this.computeHold(e),e=e.mixingTo;while(e!=null)}}}computeHold(i){const t=i.mixingTo,e=i.animation.timelines,s=i.animation.timelines.length,r=B.setArraySize(i.timelineMode,s);i.timelineHoldMix.length=0;const n=B.setArraySize(i.timelineHoldMix,s),a=this.propertyIDs;if(t!=null&&t.holdPrevious){for(let h=0;h<s;h++)r[h]=a.add(e[h].getPropertyId())?Yt.HOLD_FIRST:Yt.HOLD_SUBSEQUENT;return}t:for(let h=0;h<s;h++){const o=e[h],l=o.getPropertyId();if(!a.add(l))r[h]=Yt.SUBSEQUENT;else if(t==null||o instanceof Rn||o instanceof Io||o instanceof $u||!t.animation.hasTimeline(l))r[h]=Yt.FIRST;else{for(let u=t.mixingTo;u!=null;u=u.mixingTo)if(!u.animation.hasTimeline(l)){if(i.mixDuration>0){r[h]=Yt.HOLD_MIX,n[h]=u;continue t}break}r[h]=Yt.HOLD_FIRST}}}getCurrent(i){return i>=this.tracks.length?null:this.tracks[i]}addListener(i){if(i==null)throw new Error("listener cannot be null.");this.listeners.push(i)}removeListener(i){const t=this.listeners.indexOf(i);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(i,t,e){Yt.deprecatedWarning1||(Yt.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(i,t,e)}addAnimationByName(i,t,e,s){Yt.deprecatedWarning2||(Yt.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(i,t,e,s)}hasAnimation(i){return this.data.skeletonData.findAnimation(i)!==null}hasAnimationByName(i){return Yt.deprecatedWarning3||(Yt.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(i)}};let ms=Yt;ms.emptyAnimation=new oe("<empty>",[],0),ms.SUBSEQUENT=0,ms.FIRST=1,ms.HOLD_SUBSEQUENT=2,ms.HOLD_FIRST=3,ms.HOLD_MIX=4,ms.SETUP=1,ms.CURRENT=2,ms.deprecatedWarning1=!1,ms.deprecatedWarning2=!1,ms.deprecatedWarning3=!1;const Ir=class{constructor(){this.mixBlend=S.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}reset(){this.next=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){const i=this.animationEnd-this.animationStart;return i==0?this.animationStart:this.trackTime%i+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(i){this.animationLast=i,this.nextAnimationLast=i}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}get time(){return Ir.deprecatedWarning1||(Ir.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(i){Ir.deprecatedWarning1||(Ir.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=i}get endTime(){return Ir.deprecatedWarning2||(Ir.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(i){Ir.deprecatedWarning2||(Ir.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=i}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};let Yu=Ir;Yu.deprecatedWarning1=!1,Yu.deprecatedWarning2=!1;const Hu=class{constructor(i){this.objects=[],this.drainDisabled=!1,this.animState=i}start(i){this.objects.push(ss.start),this.objects.push(i),this.animState.animationsChanged=!0}interrupt(i){this.objects.push(ss.interrupt),this.objects.push(i)}end(i){this.objects.push(ss.end),this.objects.push(i),this.animState.animationsChanged=!0}dispose(i){this.objects.push(ss.dispose),this.objects.push(i)}complete(i){this.objects.push(ss.complete),this.objects.push(i)}event(i,t){this.objects.push(ss.event),this.objects.push(i),this.objects.push(t)}deprecateStuff(){return Hu.deprecatedWarning1||(Hu.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: onComplete, onStart, onEnd, onEvent art deprecated, please use listeners from now on. 'state.addListener({ complete: function(track, event) { } })'")),!0}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;const i=this.objects,t=this.animState.listeners;for(let e=0;e<i.length;e+=2){const s=i[e],r=i[e+1];switch(s){case ss.start:r.listener!=null&&r.listener.start&&r.listener.start(r);for(let h=0;h<t.length;h++)t[h].start&&t[h].start(r);r.onStart&&this.deprecateStuff()&&r.onStart(r.trackIndex),this.animState.onStart&&this.deprecateStuff()&&this.deprecateStuff&&this.animState.onStart(r.trackIndex);break;case ss.interrupt:r.listener!=null&&r.listener.interrupt&&r.listener.interrupt(r);for(let h=0;h<t.length;h++)t[h].interrupt&&t[h].interrupt(r);break;case ss.end:r.listener!=null&&r.listener.end&&r.listener.end(r);for(let h=0;h<t.length;h++)t[h].end&&t[h].end(r);r.onEnd&&this.deprecateStuff()&&r.onEnd(r.trackIndex),this.animState.onEnd&&this.deprecateStuff()&&this.animState.onEnd(r.trackIndex);case ss.dispose:r.listener!=null&&r.listener.dispose&&r.listener.dispose(r);for(let h=0;h<t.length;h++)t[h].dispose&&t[h].dispose(r);this.animState.trackEntryPool.free(r);break;case ss.complete:r.listener!=null&&r.listener.complete&&r.listener.complete(r);for(let h=0;h<t.length;h++)t[h].complete&&t[h].complete(r);const n=D.toInt(r.loopsCount());r.onComplete&&this.deprecateStuff()&&r.onComplete(r.trackIndex,n),this.animState.onComplete&&this.deprecateStuff()&&this.animState.onComplete(r.trackIndex,n);break;case ss.event:const a=i[e+++2];r.listener!=null&&r.listener.event&&r.listener.event(r,a);for(let h=0;h<t.length;h++)t[h].event&&t[h].event(r,a);r.onEvent&&this.deprecateStuff()&&r.onEvent(r.trackIndex,a),this.animState.onEvent&&this.deprecateStuff()&&this.animState.onEvent(r.trackIndex,a);break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}};let O_=Hu;O_.deprecatedWarning1=!1;var ss=(i=>(i[i.start=0]="start",i[i.interrupt=1]="interrupt",i[i.end=2]="end",i[i.dispose=3]="dispose",i[i.complete=4]="complete",i[i.event=5]="event",i))(ss||{});const Wu=class{constructor(i){if(this.animationToMixTime={},this.defaultMix=0,i==null)throw new Error("skeletonData cannot be null.");this.skeletonData=i}setMix(i,t,e){const s=this.skeletonData.findAnimation(i);if(s==null)throw new Error(`Animation not found: ${i}`);const r=this.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);this.setMixWith(s,r,e)}setMixByName(i,t,e){Wu.deprecatedWarning1||(Wu.deprecatedWarning1=!0,console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.")),this.setMix(i,t,e)}setMixWith(i,t,e){if(i==null)throw new Error("from cannot be null.");if(t==null)throw new Error("to cannot be null.");const s=`${i.name}.${t.name}`;this.animationToMixTime[s]=e}getMix(i,t){const e=`${i.name}.${t.name}`,s=this.animationToMixTime[e];return s===void 0?this.defaultMix:s}};let L_=Wu;L_.deprecatedWarning1=!1;let N_=class{constructor(t){this.atlas=t}newRegionAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);const n=new it(e);return n.region=r,n}newMeshAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);const n=new Xu(e);return n.region=r,n}newBoundingBoxAttachment(t,e){return new HS(e)}newPathAttachment(t,e){return new _l(e)}newPointAttachment(t,e){return new zS(e)}newClippingAttachment(t,e){return new WS(e)}};class V_{constructor(t,e,s){if(this.matrix=new Rt,this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.appliedValid=!1,this.sorted=!1,this.active=!1,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}get worldX(){return this.matrix.tx}get worldY(){return this.matrix.ty}isActive(){return this.active}update(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,r,n,a,h){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=r,this.ascaleY=n,this.ashearX=a,this.ashearY=h,this.appliedValid=!0;const o=this.parent,l=this.matrix,u=this.skeleton.scaleX,c=-this.skeleton.scaleY;if(o==null){const g=this.skeleton,_=s+90+h;l.a=D.cosDeg(s+a)*r*u,l.c=D.cosDeg(_)*n*u,l.b=D.sinDeg(s+a)*r*c,l.d=D.sinDeg(_)*n*c,l.tx=t*u+g.x,l.ty=e*c+g.y;return}let d=o.matrix.a,f=o.matrix.c,p=o.matrix.b,m=o.matrix.d;switch(l.tx=d*t+f*e+o.matrix.tx,l.ty=p*t+m*e+o.matrix.ty,this.data.transformMode){case vt.Normal:{const g=s+90+h,_=D.cosDeg(s+a)*r,x=D.cosDeg(g)*n,y=D.sinDeg(s+a)*r,v=D.sinDeg(g)*n;l.a=d*_+f*y,l.c=d*x+f*v,l.b=p*_+m*y,l.d=p*x+m*v;return}case vt.OnlyTranslation:{const g=s+90+h;l.a=D.cosDeg(s+a)*r,l.c=D.cosDeg(g)*n,l.b=D.sinDeg(s+a)*r,l.d=D.sinDeg(g)*n;break}case vt.NoRotationOrReflection:{let g=d*d+p*p,_=0;g>1e-4?(g=Math.abs(d*m-f*p)/g,d/=this.skeleton.scaleX,p/=this.skeleton.scaleY,f=p*g,m=d*g,_=Math.atan2(p,d)*D.radDeg):(d=0,p=0,_=90-Math.atan2(m,f)*D.radDeg);const x=s+a-_,y=s+h-_+90,v=D.cosDeg(x)*r,b=D.cosDeg(y)*n,w=D.sinDeg(x)*r,E=D.sinDeg(y)*n;l.a=d*v-f*w,l.c=d*b-f*E,l.b=p*v+m*w,l.d=p*b+m*E;break}case vt.NoScale:case vt.NoScaleOrReflection:{const g=D.cosDeg(s),_=D.sinDeg(s);let x=(d*g+f*_)/u,y=(p*g+m*_)/c,v=Math.sqrt(x*x+y*y);v>1e-5&&(v=1/v),x*=v,y*=v,v=Math.sqrt(x*x+y*y),this.data.transformMode==vt.NoScale&&d*m-f*p<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY>0)&&(v=-v);const b=Math.PI/2+Math.atan2(y,x),w=Math.cos(b)*v,E=Math.sin(b)*v,T=D.cosDeg(a)*r,A=D.cosDeg(90+h)*n,I=D.sinDeg(a)*r,M=D.sinDeg(90+h)*n;l.a=x*T+w*I,l.c=x*A+w*M,l.b=y*T+E*I,l.d=y*A+E*M;break}}l.a*=u,l.c*=u,l.b*=c,l.d*=c}setToSetupPose(){const t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY}getWorldRotationX(){return Math.atan2(this.matrix.b,this.matrix.a)*D.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*D.radDeg}getWorldScaleX(){const t=this.matrix;return Math.sqrt(t.a*t.a+t.c*t.c)}getWorldScaleY(){const t=this.matrix;return Math.sqrt(t.b*t.b+t.d*t.d)}updateAppliedTransform(){this.appliedValid=!0;const t=this.parent,e=this.matrix;if(t==null){this.ax=e.tx,this.ay=e.ty,this.arotation=Math.atan2(e.b,e.a)*D.radDeg,this.ascaleX=Math.sqrt(e.a*e.a+e.b*e.b),this.ascaleY=Math.sqrt(e.c*e.c+e.d*e.d),this.ashearX=0,this.ashearY=Math.atan2(e.a*e.c+e.b*e.d,e.a*e.d-e.b*e.c)*D.radDeg;return}const s=t.matrix,r=1/(s.a*s.d-s.b*s.c),n=e.tx-s.tx,a=e.ty-s.ty;this.ax=n*s.d*r-a*s.c*r,this.ay=a*s.a*r-n*s.b*r;const h=r*s.d,o=r*s.a,l=r*s.c,u=r*s.b,c=h*e.a-l*e.b,d=h*e.c-l*e.d,f=o*e.b-u*e.a,p=o*e.d-u*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(c*c+f*f),this.ascaleX>1e-4){const m=c*p-d*f;this.ascaleY=m/this.ascaleX,this.ashearY=Math.atan2(c*d+f*p,m)*D.radDeg,this.arotation=Math.atan2(f,c)*D.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,d)*D.radDeg}worldToLocal(t){const e=this.matrix,s=e.a,r=e.c,n=e.b,a=e.d,h=1/(s*a-r*n),o=t.x-e.tx,l=t.y-e.ty;return t.x=o*a*h-l*r*h,t.y=l*s*h-o*n*h,t}localToWorld(t){const e=this.matrix,s=t.x,r=t.y;return t.x=s*e.a+r*e.c+e.tx,t.y=s*e.b+r*e.d+e.ty,t}worldToLocalRotation(t){const e=D.sinDeg(t),s=D.cosDeg(t),r=this.matrix;return Math.atan2(r.a*e-r.b*s,r.d*s-r.c*e)*D.radDeg}localToWorldRotation(t){const e=D.sinDeg(t),s=D.cosDeg(t),r=this.matrix;return Math.atan2(s*r.b+e*r.d,s*r.a+e*r.c)*D.radDeg}rotateWorld(t){const e=this.matrix,s=e.a,r=e.c,n=e.b,a=e.d,h=D.cosDeg(t),o=D.sinDeg(t);e.a=h*s-o*n,e.c=h*r-o*a,e.b=o*s+h*n,e.d=o*r+h*a,this.appliedValid=!1}}let U_=class{constructor(t,e,s){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=vt.Normal,this.skinRequired=!1,this.color=new X,t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},zu=class{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},G_=class{constructor(t,e){if(e==null)throw new Error("data cannot be null.");this.time=t,this.data=e}},X_=class{constructor(t){this.name=t}};class jS{constructor(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(let s=0;s<t.bones.length;s++)this.bones.push(e.findBone(t.bones[s].name));this.target=e.findBone(t.target.name)}isActive(){return this.active}apply(){this.update()}update(){const t=this.target,e=this.bones;switch(e.length){case 1:this.apply1(e[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.softness,this.mix);break}}apply1(t,e,s,r,n,a,h){t.appliedValid||t.updateAppliedTransform();const o=t.parent.matrix,l=o.a;let u=o.c;const c=o.b;let d=o.d,f=-t.ashearX-t.arotation,p=0,m=0;switch(t.data.transformMode){case vt.OnlyTranslation:p=e-t.worldX,m=s-t.worldY;break;case vt.NoRotationOrReflection:const x=Math.abs(l*d-u*c)/(l*l+c*c),y=l/t.skeleton.scaleX,v=c/t.skeleton.scaleY;u=-v*x*t.skeleton.scaleX,d=y*x*t.skeleton.scaleY,f+=Math.atan2(v,y)*D.radDeg;default:const b=e-o.tx,w=s-o.ty,E=l*d-u*c;p=(b*d-w*u)/E-t.ax,m=(w*l-b*c)/E-t.ay}f+=Math.atan2(m,p)*D.radDeg,t.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let g=t.ascaleX,_=t.ascaleY;if(r||n){switch(t.data.transformMode){case vt.NoScale:case vt.NoScaleOrReflection:p=e-t.worldX,m=s-t.worldY}const x=t.data.length*g,y=Math.sqrt(p*p+m*m);if(r&&y<x||n&&y>x&&x>1e-4){const v=(y/x-1)*h+1;g*=v,a&&(_*=v)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*h,g,_,t.ashearX,t.ashearY)}apply2(t,e,s,r,n,a,h,o){if(o==0){e.updateWorldTransform();return}t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();const l=t.ax,u=t.ay;let c=t.ascaleX,d=c,f=t.ascaleY,p=e.ascaleX;const m=t.matrix;let g=0,_=0,x=0;c<0?(c=-c,g=180,x=-1):(g=0,x=1),f<0&&(f=-f,x=-x),p<0?(p=-p,_=180):_=0;const y=e.ax;let v=0,b=0,w=0,E=m.a,T=m.c,A=m.b,I=m.d;const M=Math.abs(c-f)<=1e-4;M?(v=e.ay,b=E*y+T*v+m.tx,w=A*y+I*v+m.ty):(v=0,b=E*y+m.tx,w=A*y+m.ty);const R=t.parent.matrix;E=R.a,T=R.c,A=R.b,I=R.d;const C=1/(E*I-T*A);let P=b-R.tx,k=w-R.ty;const U=(P*I-k*T)*C-l,V=(k*E-P*A)*C-u,L=Math.sqrt(U*U+V*V);let $=e.data.length*p,O,N;if(L<1e-4){this.apply1(t,s,r,!1,a,!1,o),e.updateWorldTransformWith(y,v,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}P=s-R.tx,k=r-R.ty;let Z=(P*I-k*T)*C-l,Q=(k*E-P*A)*C-u,H=Z*Z+Q*Q;if(h!=0){h*=c*(p+1)/2;const _t=Math.sqrt(H),kt=_t-L-$*c+h;if(kt>0){let zt=Math.min(1,kt/(h*2))-1;zt=(kt-h*(1-zt*zt))/_t,Z-=zt*Z,Q-=zt*Q,H=Z*Z+Q*Q}}t:if(M){$*=c;let _t=(H-L*L-$*$)/(2*L*$);_t<-1?_t=-1:_t>1&&(_t=1,a&&(d*=(Math.sqrt(H)/(L+$)-1)*o+1)),N=Math.acos(_t)*n,E=L+$*_t,T=$*Math.sin(N),O=Math.atan2(Q*E-Z*T,Z*E+Q*T)}else{E=c*$,T=f*$;const _t=E*E,kt=T*T,zt=Math.atan2(Q,Z);A=kt*L*L+_t*H-_t*kt;const Qt=-2*kt*L,Pt=kt-_t;if(I=Qt*Qt-4*Pt*A,I>=0){let Bn=Math.sqrt(I);Qt<0&&(Bn=-Bn),Bn=-(Qt+Bn)/2;const ey=Bn/Pt,sy=A/Bn,Dn=Math.abs(ey)<Math.abs(sy)?ey:sy;if(Dn*Dn<=H){k=Math.sqrt(H-Dn*Dn)*n,O=zt-Math.atan2(k,Dn),N=Math.atan2(k/f,(Dn-L)/c);break t}}let jt=D.PI,Ot=L-E,ze=Ot*Ot,is=0,li=0,kn=L+E,hi=kn*kn,ty=0;A=-E*L/(_t-kt),A>=-1&&A<=1&&(A=Math.acos(A),P=E*Math.cos(A)+L,k=T*Math.sin(A),I=P*P+k*k,I<ze&&(jt=A,ze=I,Ot=P,is=k),I>hi&&(li=A,hi=I,kn=P,ty=k)),H<=(ze+hi)/2?(O=zt-Math.atan2(is*n,Ot),N=jt*n):(O=zt-Math.atan2(ty*n,kn),N=li*n)}const lt=Math.atan2(v,y)*x;let Tt=t.arotation;O=(O-lt)*D.radDeg+g-Tt,O>180?O-=360:O<-180&&(O+=360),t.updateWorldTransformWith(l,u,Tt+O*o,d,t.ascaleY,0,0),Tt=e.arotation,N=((N+lt)*D.radDeg-e.ashearX)*x+_-Tt,N>180?N-=360:N<-180&&(N+=360),e.updateWorldTransformWith(y,v,Tt+N*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}let $_=class extends zu{constructor(t){super(t,0,!1),this.bones=new Array,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}},Y_=class extends zu{constructor(t){super(t,0,!1),this.bones=new Array}};var be=(i=>(i[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",i))(be||{});const $i=class{constructor(i,t){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,i==null)throw new Error("data cannot be null.");if(t==null)throw new Error("skeleton cannot be null.");this.data=i,this.bones=new Array;for(let e=0,s=i.bones.length;e<s;e++)this.bones.push(t.findBone(i.bones[e].name));this.target=t.findSlot(i.target.name),this.position=i.position,this.spacing=i.spacing,this.rotateMix=i.rotateMix,this.translateMix=i.translateMix}isActive(){return this.active}apply(){this.update()}update(){const i=this.target.getAttachment();if(!(i instanceof _l))return;const t=this.rotateMix,e=this.translateMix,s=e>0,r=t>0;if(!s&&!r)return;const n=this.data,a=n.spacingMode,h=a==be.Length,o=n.rotateMode,l=o==Fe.Tangent,u=o==Fe.ChainScale,c=this.bones.length,d=l?c:c+1,f=this.bones,p=B.setArraySize(this.spaces,d);let m=null;const g=this.spacing;if(u||h){u&&(m=B.setArraySize(this.lengths,c));for(let w=0,E=d-1;w<E;){const T=f[w],A=T.data.length;if(A<$i.epsilon)u&&(m[w]=0),p[++w]=0;else{const I=A*T.matrix.a,M=A*T.matrix.b,R=Math.sqrt(I*I+M*M);u&&(m[w]=R),p[++w]=(h?A+g:g)*R/A}}}else for(let w=1;w<d;w++)p[w]=g;const _=this.computeWorldPositions(i,d,l,n.positionMode==ne.Percent,a==be.Percent);let x=_[0],y=_[1],v=n.offsetRotation,b=!1;if(v==0)b=o==Fe.Chain;else{b=!1;const w=this.target.bone.matrix;v*=w.a*w.d-w.b*w.c>0?D.degRad:-D.degRad}for(let w=0,E=3;w<c;w++,E+=3){const T=f[w],A=T.matrix;A.tx+=(x-A.tx)*e,A.ty+=(y-A.ty)*e;const I=_[E],M=_[E+1],R=I-x,C=M-y;if(u){const P=m[w];if(P!=0){const k=(Math.sqrt(R*R+C*C)/P-1)*t+1;A.a*=k,A.b*=k}}if(x=I,y=M,r){const P=A.a,k=A.c,U=A.b,V=A.d;let L=0,$=0,O=0;if(l&&(l?L=_[E-1]:p[w+1]==0?L=_[E+2]:L=Math.atan2(C,R)),L-=Math.atan2(U,P),b){$=Math.cos(L),O=Math.sin(L);const N=T.data.length;x+=(N*($*P-O*U)-R)*t,y+=(N*(O*P+$*U)-C)*t}else L+=v;L>D.PI?L-=D.PI2:L<-D.PI&&(L+=D.PI2),L*=t,$=Math.cos(L),O=Math.sin(L),A.a=$*P-O*U,A.c=$*k-O*V,A.b=O*P+$*U,A.d=O*k+$*V}T.appliedValid=!1}}computeWorldPositions(i,t,e,s,r){const n=this.target;let a=this.position;const h=this.spaces,o=B.setArraySize(this.positions,t*3+2);let l=null;const u=i.closed;let c=i.worldVerticesLength,d=c/6,f=$i.NONE;if(!i.constantSpeed){const L=i.lengths;d-=u?1:2;const $=L[d];if(s&&(a*=$),r)for(let O=0;O<t;O++)h[O]*=$;l=B.setArraySize(this.world,8);for(let O=0,N=0,Z=0;O<t;O++,N+=3){const Q=h[O];a+=Q;let H=a;if(u)H%=$,H<0&&(H+=$),Z=0;else if(H<0){f!=$i.BEFORE&&(f=$i.BEFORE,i.computeWorldVertices(n,2,4,l,0,2)),this.addBeforePosition(H,l,0,o,N);continue}else if(H>$){f!=$i.AFTER&&(f=$i.AFTER,i.computeWorldVertices(n,c-6,4,l,0,2)),this.addAfterPosition(H-$,l,0,o,N);continue}for(;;Z++){const lt=L[Z];if(!(H>lt)){if(Z==0)H/=lt;else{const Tt=L[Z-1];H=(H-Tt)/(lt-Tt)}break}}Z!=f&&(f=Z,u&&Z==d?(i.computeWorldVertices(n,c-4,4,l,0,2),i.computeWorldVertices(n,0,4,l,4,2)):i.computeWorldVertices(n,Z*6+2,8,l,0,2)),this.addCurvePosition(H,l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],o,N,e||O>0&&Q==0)}return o}u?(c+=2,l=B.setArraySize(this.world,c),i.computeWorldVertices(n,2,c-4,l,0,2),i.computeWorldVertices(n,0,2,l,c-4,2),l[c-2]=l[0],l[c-1]=l[1]):(d--,c-=4,l=B.setArraySize(this.world,c),i.computeWorldVertices(n,2,c,l,0,2));const p=B.setArraySize(this.curves,d);let m=0,g=l[0],_=l[1],x=0,y=0,v=0,b=0,w=0,E=0,T=0,A=0,I=0,M=0,R=0,C=0,P=0,k=0;for(let L=0,$=2;L<d;L++,$+=6)x=l[$],y=l[$+1],v=l[$+2],b=l[$+3],w=l[$+4],E=l[$+5],T=(g-x*2+v)*.1875,A=(_-y*2+b)*.1875,I=((x-v)*3-g+w)*.09375,M=((y-b)*3-_+E)*.09375,R=T*2+I,C=A*2+M,P=(x-g)*.75+T+I*.16666667,k=(y-_)*.75+A+M*.16666667,m+=Math.sqrt(P*P+k*k),P+=R,k+=C,R+=I,C+=M,m+=Math.sqrt(P*P+k*k),P+=R,k+=C,m+=Math.sqrt(P*P+k*k),P+=R+I,k+=C+M,m+=Math.sqrt(P*P+k*k),p[L]=m,g=w,_=E;if(s&&(a*=m),r)for(let L=0;L<t;L++)h[L]*=m;const U=this.segments;let V=0;for(let L=0,$=0,O=0,N=0;L<t;L++,$+=3){const Z=h[L];a+=Z;let Q=a;if(u)Q%=m,Q<0&&(Q+=m),O=0;else if(Q<0){this.addBeforePosition(Q,l,0,o,$);continue}else if(Q>m){this.addAfterPosition(Q-m,l,c-4,o,$);continue}for(;;O++){const H=p[O];if(!(Q>H)){if(O==0)Q/=H;else{const lt=p[O-1];Q=(Q-lt)/(H-lt)}break}}if(O!=f){f=O;let H=O*6;for(g=l[H],_=l[H+1],x=l[H+2],y=l[H+3],v=l[H+4],b=l[H+5],w=l[H+6],E=l[H+7],T=(g-x*2+v)*.03,A=(_-y*2+b)*.03,I=((x-v)*3-g+w)*.006,M=((y-b)*3-_+E)*.006,R=T*2+I,C=A*2+M,P=(x-g)*.3+T+I*.16666667,k=(y-_)*.3+A+M*.16666667,V=Math.sqrt(P*P+k*k),U[0]=V,H=1;H<8;H++)P+=R,k+=C,R+=I,C+=M,V+=Math.sqrt(P*P+k*k),U[H]=V;P+=R,k+=C,V+=Math.sqrt(P*P+k*k),U[8]=V,P+=R+I,k+=C+M,V+=Math.sqrt(P*P+k*k),U[9]=V,N=0}for(Q*=V;;N++){const H=U[N];if(!(Q>H)){if(N==0)Q/=H;else{const lt=U[N-1];Q=N+(Q-lt)/(H-lt)}break}}this.addCurvePosition(Q*.1,g,_,x,y,v,b,w,E,o,$,e||L>0&&Z==0)}return o}addBeforePosition(i,t,e,s,r){const n=t[e],a=t[e+1],h=t[e+2]-n,o=t[e+3]-a,l=Math.atan2(o,h);s[r]=n+i*Math.cos(l),s[r+1]=a+i*Math.sin(l),s[r+2]=l}addAfterPosition(i,t,e,s,r){const n=t[e+2],a=t[e+3],h=n-t[e],o=a-t[e+1],l=Math.atan2(o,h);s[r]=n+i*Math.cos(l),s[r+1]=a+i*Math.sin(l),s[r+2]=l}addCurvePosition(i,t,e,s,r,n,a,h,o,l,u,c){(i==0||isNaN(i))&&(i=1e-4);const d=i*i,f=d*i,p=1-i,m=p*p,g=m*p,_=p*i,x=_*3,y=p*x,v=x*i,b=t*g+s*y+n*v+h*f,w=e*g+r*y+a*v+o*f;l[u]=b,l[u+1]=w,c&&(l[u+2]=Math.atan2(w-(e*m+r*_*2+a*d),b-(t*m+s*_*2+n*d)))}};let Po=$i;Po.NONE=-1,Po.BEFORE=-2,Po.AFTER=-3,Po.epsilon=1e-5;class qS{constructor(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new GS,this.active=!1,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix,this.scaleMix=t.scaleMix,this.shearMix=t.shearMix,this.bones=new Array;for(let s=0;s<t.bones.length;s++)this.bones.push(e.findBone(t.bones[s].name));this.target=e.findBone(t.target.name)}isActive(){return this.active}apply(){this.update()}update(){this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld()}applyAbsoluteWorld(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target,a=n.matrix,h=a.a,o=a.c,l=a.b,u=a.d,c=h*u-o*l>0?D.degRad:-D.degRad,d=this.data.offsetRotation*c,f=this.data.offsetShearY*c,p=this.bones;for(let m=0,g=p.length;m<g;m++){const _=p[m];let x=!1;const y=_.matrix;if(t!=0){const v=y.a,b=y.c,w=y.b,E=y.d;let T=Math.atan2(l,h)-Math.atan2(w,v)+d;T>D.PI?T-=D.PI2:T<-D.PI&&(T+=D.PI2),T*=t;const A=Math.cos(T),I=Math.sin(T);y.a=A*v-I*w,y.c=A*b-I*E,y.b=I*v+A*w,y.d=I*b+A*E,x=!0}if(e!=0){const v=this.temp;n.localToWorld(v.set(this.data.offsetX,this.data.offsetY)),y.tx+=(v.x-y.tx)*e,y.ty+=(v.y-y.ty)*e,x=!0}if(s>0){let v=Math.sqrt(y.a*y.a+y.b*y.b),b=Math.sqrt(h*h+l*l);v>1e-5&&(v=(v+(b-v+this.data.offsetScaleX)*s)/v),y.a*=v,y.b*=v,v=Math.sqrt(y.c*y.c+y.d*y.d),b=Math.sqrt(o*o+u*u),v>1e-5&&(v=(v+(b-v+this.data.offsetScaleY)*s)/v),y.c*=v,y.d*=v,x=!0}if(r>0){const v=y.c,b=y.d,w=Math.atan2(b,v);let E=Math.atan2(u,o)-Math.atan2(l,h)-(w-Math.atan2(y.b,y.a));E>D.PI?E-=D.PI2:E<-D.PI&&(E+=D.PI2),E=w+(E+f)*r;const T=Math.sqrt(v*v+b*b);y.c=Math.cos(E)*T,y.d=Math.sin(E)*T,x=!0}x&&(_.appliedValid=!1)}}applyRelativeWorld(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target,a=n.matrix,h=a.a,o=a.c,l=a.b,u=a.d,c=h*u-o*l>0?D.degRad:-D.degRad,d=this.data.offsetRotation*c,f=this.data.offsetShearY*c,p=this.bones;for(let m=0,g=p.length;m<g;m++){const _=p[m];let x=!1;const y=_.matrix;if(t!=0){const v=y.a,b=y.c,w=y.b,E=y.d;let T=Math.atan2(l,h)+d;T>D.PI?T-=D.PI2:T<-D.PI&&(T+=D.PI2),T*=t;const A=Math.cos(T),I=Math.sin(T);y.a=A*v-I*w,y.c=A*b-I*E,y.b=I*v+A*w,y.d=I*b+A*E,x=!0}if(e!=0){const v=this.temp;n.localToWorld(v.set(this.data.offsetX,this.data.offsetY)),y.tx+=v.x*e,y.ty+=v.y*e,x=!0}if(s>0){let v=(Math.sqrt(h*h+l*l)-1+this.data.offsetScaleX)*s+1;y.a*=v,y.b*=v,v=(Math.sqrt(o*o+u*u)-1+this.data.offsetScaleY)*s+1,y.c*=v,y.d*=v,x=!0}if(r>0){let v=Math.atan2(u,o)-Math.atan2(l,h);v>D.PI?v-=D.PI2:v<-D.PI&&(v+=D.PI2);const b=y.c,w=y.d;v=Math.atan2(w,b)+(v-D.PI/2+f)*r;const E=Math.sqrt(b*b+w*w);y.c=Math.cos(v)*E,y.d=Math.sin(v)*E,x=!0}x&&(_.appliedValid=!1)}}applyAbsoluteLocal(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const a=this.bones;for(let h=0,o=a.length;h<o;h++){const l=a[h];l.appliedValid||l.updateAppliedTransform();let u=l.arotation;if(t!=0){let g=n.arotation-u+this.data.offsetRotation;g-=(16384-(16384.499999999996-g/360|0))*360,u+=g*t}let c=l.ax,d=l.ay;e!=0&&(c+=(n.ax-c+this.data.offsetX)*e,d+=(n.ay-d+this.data.offsetY)*e);let f=l.ascaleX,p=l.ascaleY;s>0&&(f>1e-5&&(f=(f+(n.ascaleX-f+this.data.offsetScaleX)*s)/f),p>1e-5&&(p=(p+(n.ascaleY-p+this.data.offsetScaleY)*s)/p));const m=l.ashearY;if(r>0){let g=n.ashearY-m+this.data.offsetShearY;g-=(16384-(16384.499999999996-g/360|0))*360,l.shearY+=g*r}l.updateWorldTransformWith(c,d,u,f,p,l.ashearX,m)}}applyRelativeLocal(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const a=this.bones;for(let h=0,o=a.length;h<o;h++){const l=a[h];l.appliedValid||l.updateAppliedTransform();let u=l.arotation;t!=0&&(u+=(n.arotation+this.data.offsetRotation)*t);let c=l.ax,d=l.ay;e!=0&&(c+=(n.ax+this.data.offsetX)*e,d+=(n.ay+this.data.offsetY)*e);let f=l.ascaleX,p=l.ascaleY;s>0&&(f>1e-5&&(f*=(n.ascaleX-1+this.data.offsetScaleX)*s+1),p>1e-5&&(p*=(n.ascaleY-1+this.data.offsetScaleY)*s+1));let m=l.ashearY;r>0&&(m+=(n.ashearY+this.data.offsetShearY)*r),l.updateWorldTransformWith(c,d,u,f,p,l.ashearX,m)}}}const Ro=class{constructor(i){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,i==null)throw new Error("data cannot be null.");this.data=i,this.bones=new Array;for(let t=0;t<i.bones.length;t++){const e=i.bones[t];let s;if(e.parent==null)s=new V_(e,this,null);else{const r=this.bones[e.parent.index];s=new V_(e,this,r),r.children.push(s)}this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<i.slots.length;t++){const e=i.slots[t],s=this.bones[e.boneData.index],r=new R_(e,s);this.slots.push(r),this.drawOrder.push(r)}this.ikConstraints=new Array;for(let t=0;t<i.ikConstraints.length;t++){const e=i.ikConstraints[t];this.ikConstraints.push(new jS(e,this))}this.transformConstraints=new Array;for(let t=0;t<i.transformConstraints.length;t++){const e=i.transformConstraints[t];this.transformConstraints.push(new qS(e,this))}this.pathConstraints=new Array;for(let t=0;t<i.pathConstraints.length;t++){const e=i.pathConstraints[t];this.pathConstraints.push(new Po(e,this))}this.color=new X(1,1,1,1),this.updateCache()}updateCache(){const i=this._updateCache;i.length=0,this.updateCacheReset.length=0;const t=this.bones;for(let l=0,u=t.length;l<u;l++){const c=t[l];c.sorted=c.data.skinRequired,c.active=!c.sorted}if(this.skin!=null){const l=this.skin.bones;for(let u=0,c=this.skin.bones.length;u<c;u++){let d=this.bones[l[u].index];do d.sorted=!1,d.active=!0,d=d.parent;while(d!=null)}}const e=this.ikConstraints,s=this.transformConstraints,r=this.pathConstraints,n=e.length,a=s.length,h=r.length,o=n+a+h;t:for(let l=0;l<o;l++){for(let u=0;u<n;u++){const c=e[u];if(c.data.order==l){this.sortIkConstraint(c);continue t}}for(let u=0;u<a;u++){const c=s[u];if(c.data.order==l){this.sortTransformConstraint(c);continue t}}for(let u=0;u<h;u++){const c=r[u];if(c.data.order==l){this.sortPathConstraint(c);continue t}}}for(let l=0,u=t.length;l<u;l++)this.sortBone(t[l])}sortIkConstraint(i){if(i.active=i.target.isActive()&&(!i.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,i.data,!0)),!i.active)return;const t=i.target;this.sortBone(t);const e=i.bones,s=e[0];if(this.sortBone(s),e.length>1){const r=e[e.length-1];this._updateCache.indexOf(r)>-1||this.updateCacheReset.push(r)}this._updateCache.push(i),this.sortReset(s.children),e[e.length-1].sorted=!0}sortPathConstraint(i){if(i.active=i.target.bone.isActive()&&(!i.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,i.data,!0)),!i.active)return;const t=i.target,e=t.data.index,s=t.bone;this.skin!=null&&this.sortPathConstraintAttachment(this.skin,e,s),this.data.defaultSkin!=null&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,e,s);for(let h=0,o=this.data.skins.length;h<o;h++)this.sortPathConstraintAttachment(this.data.skins[h],e,s);const r=t.getAttachment();r instanceof _l&&this.sortPathConstraintAttachmentWith(r,s);const n=i.bones,a=n.length;for(let h=0;h<a;h++)this.sortBone(n[h]);this._updateCache.push(i);for(let h=0;h<a;h++)this.sortReset(n[h].children);for(let h=0;h<a;h++)n[h].sorted=!0}sortTransformConstraint(i){if(i.active=i.target.isActive()&&(!i.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,i.data,!0)),!i.active)return;this.sortBone(i.target);const t=i.bones,e=t.length;if(i.data.local)for(let s=0;s<e;s++){const r=t[s];this.sortBone(r.parent),this._updateCache.indexOf(r)>-1||this.updateCacheReset.push(r)}else for(let s=0;s<e;s++)this.sortBone(t[s]);this._updateCache.push(i);for(let s=0;s<e;s++)this.sortReset(t[s].children);for(let s=0;s<e;s++)t[s].sorted=!0}sortPathConstraintAttachment(i,t,e){const s=i.attachments[t];if(s)for(const r in s)this.sortPathConstraintAttachmentWith(s[r],e)}sortPathConstraintAttachmentWith(i,t){if(!(i instanceof _l))return;const e=i.bones;if(e==null)this.sortBone(t);else{const s=this.bones;let r=0;for(;r<e.length;){const n=e[r++];for(let a=r+n;r<a;r++){const h=e[r];this.sortBone(s[h])}}}}sortBone(i){if(i.sorted)return;const t=i.parent;t!=null&&this.sortBone(t),i.sorted=!0,this._updateCache.push(i)}sortReset(i){for(let t=0,e=i.length;t<e;t++){const s=i[t];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(){const i=this.updateCacheReset;for(let e=0,s=i.length;e<s;e++){const r=i[e];r.ax=r.x,r.ay=r.y,r.arotation=r.rotation,r.ascaleX=r.scaleX,r.ascaleY=r.scaleY,r.ashearX=r.shearX,r.ashearY=r.shearY,r.appliedValid=!0}const t=this._updateCache;for(let e=0,s=t.length;e<s;e++)t[e].update()}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){const i=this.bones;for(let r=0,n=i.length;r<n;r++)i[r].setToSetupPose();const t=this.ikConstraints;for(let r=0,n=t.length;r<n;r++){const a=t[r];a.mix=a.data.mix,a.softness=a.data.softness,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch}const e=this.transformConstraints;for(let r=0,n=e.length;r<n;r++){const a=e[r],h=a.data;a.rotateMix=h.rotateMix,a.translateMix=h.translateMix,a.scaleMix=h.scaleMix,a.shearMix=h.shearMix}const s=this.pathConstraints;for(let r=0,n=s.length;r<n;r++){const a=s[r],h=a.data;a.position=h.position,a.spacing=h.spacing,a.rotateMix=h.rotateMix,a.translateMix=h.translateMix}}setSlotsToSetupPose(){const i=this.slots;B.arrayCopy(i,0,this.drawOrder,0,i.length);for(let t=0,e=i.length;t<e;t++)i[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(i){if(i==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findBoneIndex(i){if(i==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,s=t.length;e<s;e++)if(t[e].data.name==i)return e;return-1}findSlot(i){if(i==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findSlotIndex(i){if(i==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,s=t.length;e<s;e++)if(t[e].data.name==i)return e;return-1}setSkinByName(i){const t=this.data.findSkin(i);if(t==null)throw new Error(`Skin not found: ${i}`);this.setSkin(t)}setSkin(i){if(i!=this.skin){if(i!=null)if(this.skin!=null)i.attachAll(this,this.skin);else{const t=this.slots;for(let e=0,s=t.length;e<s;e++){const r=t[e],n=r.data.attachmentName;if(n!=null){const a=i.getAttachment(e,n);a!=null&&r.setAttachment(a)}}}this.skin=i,this.updateCache()}}getAttachmentByName(i,t){return this.getAttachment(this.data.findSlotIndex(i),t)}getAttachment(i,t){if(t==null)throw new Error("attachmentName cannot be null.");if(this.skin!=null){const e=this.skin.getAttachment(i,t);if(e!=null)return e}return this.data.defaultSkin!=null?this.data.defaultSkin.getAttachment(i,t):null}setAttachment(i,t){if(i==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.data.name==i){let a=null;if(t!=null&&(a=this.getAttachment(s,t),a==null))throw new Error(`Attachment not found: ${t}, for slot: ${i}`);n.setAttachment(a);return}}throw new Error(`Slot not found: ${i}`)}findIkConstraint(i){if(i==null)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findTransformConstraint(i){if(i==null)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findPathConstraint(i){if(i==null)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}getBounds(i,t,e=new Array(2)){if(i==null)throw new Error("offset cannot be null.");if(t==null)throw new Error("size cannot be null.");const s=this.drawOrder;let r=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let o=0,l=s.length;o<l;o++){const u=s[o];if(!u.bone.active)continue;let c=0,d=null;const f=u.getAttachment();if(f instanceof it)c=8,d=B.setArraySize(e,c,0),f.computeWorldVertices(u.bone,d,0,2);else if(f instanceof Xu){const p=f;c=p.worldVerticesLength,d=B.setArraySize(e,c,0),p.computeWorldVertices(u,0,c,d,0,2)}if(d!=null)for(let p=0,m=d.length;p<m;p+=2){const g=d[p],_=d[p+1];r=Math.min(r,g),n=Math.min(n,_),a=Math.max(a,g),h=Math.max(h,_)}}i.set(r,n),t.set(a-r,h-n)}update(i){this.time+=i}get flipX(){return this.scaleX==-1}set flipX(i){Ro.deprecatedWarning1||(Ro.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleX=i?1:-1}get flipY(){return this.scaleY==-1}set flipY(i){Ro.deprecatedWarning1||(Ro.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleY=i?1:-1}};let H_=Ro;H_.deprecatedWarning1=!1;let W_=class{constructor(){this.bones=new Array,this.slots=new Array,this.skins=new Array,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.fps=0}findBone(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findBoneIndex(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSlot(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findSlotIndex(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSkin(t){if(t==null)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findEvent(t){if(t==null)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(t==null)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}},z_=class{constructor(t,e,s){if(this.color=new X(1,1,1,1),t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");if(s==null)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},j_=class extends zu{constructor(t){super(t,0,!1),this.bones=new Array,this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}},q_=class{constructor(t,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},ju=class{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,t==null)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(s==null)throw new Error("attachment cannot be null.");const r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];this.setAttachment(r.slotIndex,r.name,r.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];r.attachment!=null&&(r.attachment instanceof Xu?(r.attachment=r.attachment.newLinkedMesh(),this.setAttachment(r.slotIndex,r.name,r.attachment)):(r.attachment=r.attachment.copy(),this.setAttachment(r.slotIndex,r.name,r.attachment)))}}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){const s=this.attachments[t];s&&(s[e]=null)}getAttachments(){const t=new Array;for(let e=0;e<this.attachments.length;e++){const s=this.attachments[e];if(s)for(const r in s){const n=s[r];n&&t.push(new q_(e,r,n))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const r in s){const n=s[r];n&&e.push(new q_(t,r,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){const n=t.slots[r],a=n.getAttachment();if(a&&s<e.attachments.length){const h=e.attachments[s];for(const o in h){const l=h[o];if(a==l){const u=this.getAttachment(s,o);u!=null&&n.setAttachment(u);break}}}s++}}};const Kt=class{constructor(i){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=i}readSkeletonData(i){const t=this.scale,e=new W_;e.name="";const s=new gl(i);e.hash=s.readString(),e.version=s.readString(),e.version==="3.8.75"&&console.error("Unsupported skeleton data, 3.8.75 is deprecated, please export with a newer version of Spine."),e.x=s.readFloat(),e.y=s.readFloat(),e.width=s.readFloat(),e.height=s.readFloat();const r=s.readBoolean();r&&(e.fps=s.readFloat(),e.imagesPath=s.readString(),e.audioPath=s.readString());let n=0;n=s.readInt(!0);for(let h=0;h<n;h++)s.strings.push(s.readString());n=s.readInt(!0);for(let h=0;h<n;h++){const o=s.readString(),l=h==0?null:e.bones[s.readInt(!0)],u=new U_(h,o,l);u.rotation=s.readFloat(),u.x=s.readFloat()*t,u.y=s.readFloat()*t,u.scaleX=s.readFloat(),u.scaleY=s.readFloat(),u.shearX=s.readFloat(),u.shearY=s.readFloat(),u.length=s.readFloat()*t,u.transformMode=Kt.TransformModeValues[s.readInt(!0)],u.skinRequired=s.readBoolean(),r&&X.rgba8888ToColor(u.color,s.readInt32()),e.bones.push(u)}n=s.readInt(!0);for(let h=0;h<n;h++){const o=s.readString(),l=e.bones[s.readInt(!0)],u=new z_(h,o,l);X.rgba8888ToColor(u.color,s.readInt32());const c=s.readInt32();c!=-1&&X.rgb888ToColor(u.darkColor=new X,c),u.attachmentName=s.readStringRef(),u.blendMode=Kt.BlendModeValues[s.readInt(!0)],e.slots.push(u)}n=s.readInt(!0);for(let h=0,o;h<n;h++){const l=new $_(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),o=s.readInt(!0);for(let u=0;u<o;u++)l.bones.push(e.bones[s.readInt(!0)]);l.target=e.bones[s.readInt(!0)],l.mix=s.readFloat(),l.softness=s.readFloat()*t,l.bendDirection=s.readByte(),l.compress=s.readBoolean(),l.stretch=s.readBoolean(),l.uniform=s.readBoolean(),e.ikConstraints.push(l)}n=s.readInt(!0);for(let h=0,o;h<n;h++){const l=new j_(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),o=s.readInt(!0);for(let u=0;u<o;u++)l.bones.push(e.bones[s.readInt(!0)]);l.target=e.bones[s.readInt(!0)],l.local=s.readBoolean(),l.relative=s.readBoolean(),l.offsetRotation=s.readFloat(),l.offsetX=s.readFloat()*t,l.offsetY=s.readFloat()*t,l.offsetScaleX=s.readFloat(),l.offsetScaleY=s.readFloat(),l.offsetShearY=s.readFloat(),l.rotateMix=s.readFloat(),l.translateMix=s.readFloat(),l.scaleMix=s.readFloat(),l.shearMix=s.readFloat(),e.transformConstraints.push(l)}n=s.readInt(!0);for(let h=0,o;h<n;h++){const l=new Y_(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),o=s.readInt(!0);for(let u=0;u<o;u++)l.bones.push(e.bones[s.readInt(!0)]);l.target=e.slots[s.readInt(!0)],l.positionMode=Kt.PositionModeValues[s.readInt(!0)],l.spacingMode=Kt.SpacingModeValues[s.readInt(!0)],l.rotateMode=Kt.RotateModeValues[s.readInt(!0)],l.offsetRotation=s.readFloat(),l.position=s.readFloat(),l.positionMode==ne.Fixed&&(l.position*=t),l.spacing=s.readFloat(),(l.spacingMode==be.Length||l.spacingMode==be.Fixed)&&(l.spacing*=t),l.rotateMix=s.readFloat(),l.translateMix=s.readFloat(),e.pathConstraints.push(l)}const a=this.readSkin(s,e,!0,r);a!=null&&(e.defaultSkin=a,e.skins.push(a));{let h=e.skins.length;for(B.setArraySize(e.skins,n=h+s.readInt(!0));h<n;h++)e.skins[h]=this.readSkin(s,e,!1,r)}n=this.linkedMeshes.length;for(let h=0;h<n;h++){const o=this.linkedMeshes[h],l=o.skin==null?e.defaultSkin:e.findSkin(o.skin);if(l==null)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(u==null)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.deformAttachment=o.inheritDeform?u:o.mesh,o.mesh.setParentMesh(u)}this.linkedMeshes.length=0,n=s.readInt(!0);for(let h=0;h<n;h++){const o=new X_(s.readStringRef());o.intValue=s.readInt(!1),o.floatValue=s.readFloat(),o.stringValue=s.readString(),o.audioPath=s.readString(),o.audioPath!=null&&(o.volume=s.readFloat(),o.balance=s.readFloat()),e.events.push(o)}n=s.readInt(!0);for(let h=0;h<n;h++)e.animations.push(this.readAnimation(s,s.readString(),e));return e}readSkin(i,t,e,s){let r=null,n=0;if(e){if(n=i.readInt(!0),n==0)return null;r=new ju("default")}else{r=new ju(i.readStringRef()),r.bones.length=i.readInt(!0);for(let a=0,h=r.bones.length;a<h;a++)r.bones[a]=t.bones[i.readInt(!0)];for(let a=0,h=i.readInt(!0);a<h;a++)r.constraints.push(t.ikConstraints[i.readInt(!0)]);for(let a=0,h=i.readInt(!0);a<h;a++)r.constraints.push(t.transformConstraints[i.readInt(!0)]);for(let a=0,h=i.readInt(!0);a<h;a++)r.constraints.push(t.pathConstraints[i.readInt(!0)]);n=i.readInt(!0)}for(let a=0;a<n;a++){const h=i.readInt(!0);for(let o=0,l=i.readInt(!0);o<l;o++){const u=i.readStringRef(),c=this.readAttachment(i,t,r,h,u,s);c!=null&&r.setAttachment(h,u,c)}}return r}readAttachment(i,t,e,s,r,n){const a=this.scale;let h=i.readStringRef();h==null&&(h=r);const o=i.readByte();switch(Kt.AttachmentTypeValues[o]){case at.Region:{let u=i.readStringRef();const c=i.readFloat(),d=i.readFloat(),f=i.readFloat(),p=i.readFloat(),m=i.readFloat(),g=i.readFloat(),_=i.readFloat(),x=i.readInt32();u==null&&(u=h);const y=this.attachmentLoader.newRegionAttachment(e,h,u);return y==null?null:(y.path=u,y.x=d*a,y.y=f*a,y.scaleX=p,y.scaleY=m,y.rotation=c,y.width=g*a,y.height=_*a,X.rgba8888ToColor(y.color,x),y)}case at.BoundingBox:{const u=i.readInt(!0),c=this.readVertices(i,u),d=n?i.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(e,h);return f==null?null:(f.worldVerticesLength=u<<1,f.vertices=c.vertices,f.bones=c.bones,n&&X.rgba8888ToColor(f.color,d),f)}case at.Mesh:{let u=i.readStringRef();const c=i.readInt32(),d=i.readInt(!0),f=this.readFloatArray(i,d<<1,1),p=this.readShortArray(i),m=this.readVertices(i,d),g=i.readInt(!0);let _=null,x=0,y=0;n&&(_=this.readShortArray(i),x=i.readFloat(),y=i.readFloat()),u==null&&(u=h);const v=this.attachmentLoader.newMeshAttachment(e,h,u);return v==null?null:(v.path=u,X.rgba8888ToColor(v.color,c),v.bones=m.bones,v.vertices=m.vertices,v.worldVerticesLength=d<<1,v.triangles=p,v.regionUVs=new Float32Array(f),v.hullLength=g<<1,n&&(v.edges=_,v.width=x*a,v.height=y*a),v)}case at.LinkedMesh:{let u=i.readStringRef();const c=i.readInt32(),d=i.readStringRef(),f=i.readStringRef(),p=i.readBoolean();let m=0,g=0;n&&(m=i.readFloat(),g=i.readFloat()),u==null&&(u=h);const _=this.attachmentLoader.newMeshAttachment(e,h,u);return _==null?null:(_.path=u,X.rgba8888ToColor(_.color,c),n&&(_.width=m*a,_.height=g*a),this.linkedMeshes.push(new ZS(_,d,s,f,p)),_)}case at.Path:{const u=i.readBoolean(),c=i.readBoolean(),d=i.readInt(!0),f=this.readVertices(i,d),p=B.newArray(d/3,0);for(let _=0,x=p.length;_<x;_++)p[_]=i.readFloat()*a;const m=n?i.readInt32():0,g=this.attachmentLoader.newPathAttachment(e,h);return g==null?null:(g.closed=u,g.constantSpeed=c,g.worldVerticesLength=d<<1,g.vertices=f.vertices,g.bones=f.bones,g.lengths=p,n&&X.rgba8888ToColor(g.color,m),g)}case at.Point:{const u=i.readFloat(),c=i.readFloat(),d=i.readFloat(),f=n?i.readInt32():0,p=this.attachmentLoader.newPointAttachment(e,h);return p==null?null:(p.x=c*a,p.y=d*a,p.rotation=u,n&&X.rgba8888ToColor(p.color,f),p)}case at.Clipping:{const u=i.readInt(!0),c=i.readInt(!0),d=this.readVertices(i,c),f=n?i.readInt32():0,p=this.attachmentLoader.newClippingAttachment(e,h);return p==null?null:(p.endSlot=t.slots[u],p.worldVerticesLength=c<<1,p.vertices=d.vertices,p.bones=d.bones,n&&X.rgba8888ToColor(p.color,f),p)}}return null}readVertices(i,t){const e=t<<1,s=new KS,r=this.scale;if(!i.readBoolean())return s.vertices=this.readFloatArray(i,e,r),s;const n=new Array,a=new Array;for(let h=0;h<t;h++){const o=i.readInt(!0);a.push(o);for(let l=0;l<o;l++)a.push(i.readInt(!0)),n.push(i.readFloat()*r),n.push(i.readFloat()*r),n.push(i.readFloat())}return s.vertices=B.toFloatArray(n),s.bones=a,s}readFloatArray(i,t,e){const s=new Array(t);if(e==1)for(let r=0;r<t;r++)s[r]=i.readFloat();else for(let r=0;r<t;r++)s[r]=i.readFloat()*e;return s}readShortArray(i){const t=i.readInt(!0),e=new Array(t);for(let s=0;s<t;s++)e[s]=i.readShort();return e}readAnimation(i,t,e){const s=new Array,r=this.scale;let n=0;const a=new X,h=new X;for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0);for(let f=0,p=i.readInt(!0);f<p;f++){const m=i.readByte(),g=i.readInt(!0);switch(m){case Kt.SLOT_ATTACHMENT:{const _=new Rn(g);_.slotIndex=d;for(let x=0;x<g;x++)_.setFrame(x,i.readFloat(),i.readStringRef());s.push(_),n=Math.max(n,_.frames[g-1]);break}case Kt.SLOT_COLOR:{const _=new He(g);_.slotIndex=d;for(let x=0;x<g;x++){const y=i.readFloat();X.rgba8888ToColor(a,i.readInt32()),_.setFrame(x,y,a.r,a.g,a.b,a.a),x<g-1&&this.readCurve(i,x,_)}s.push(_),n=Math.max(n,_.frames[(g-1)*He.ENTRIES]);break}case Kt.SLOT_TWO_COLOR:{const _=new ae(g);_.slotIndex=d;for(let x=0;x<g;x++){const y=i.readFloat();X.rgba8888ToColor(a,i.readInt32()),X.rgb888ToColor(h,i.readInt32()),_.setFrame(x,y,a.r,a.g,a.b,a.a,h.r,h.g,h.b),x<g-1&&this.readCurve(i,x,_)}s.push(_),n=Math.max(n,_.frames[(g-1)*ae.ENTRIES]);break}}}}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0);for(let f=0,p=i.readInt(!0);f<p;f++){const m=i.readByte(),g=i.readInt(!0);switch(m){case Kt.BONE_ROTATE:{const _=new Ie(g);_.boneIndex=d;for(let x=0;x<g;x++)_.setFrame(x,i.readFloat(),i.readFloat()),x<g-1&&this.readCurve(i,x,_);s.push(_),n=Math.max(n,_.frames[(g-1)*Ie.ENTRIES]);break}case Kt.BONE_TRANSLATE:case Kt.BONE_SCALE:case Kt.BONE_SHEAR:{let _,x=1;m==Kt.BONE_SCALE?_=new M_(g):m==Kt.BONE_SHEAR?_=new F_(g):(_=new ps(g),x=r),_.boneIndex=d;for(let y=0;y<g;y++)_.setFrame(y,i.readFloat(),i.readFloat()*x,i.readFloat()*x),y<g-1&&this.readCurve(i,y,_);s.push(_),n=Math.max(n,_.frames[(g-1)*ps.ENTRIES]);break}}}}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0),f=i.readInt(!0),p=new Pe(f);p.ikConstraintIndex=d;for(let m=0;m<f;m++)p.setFrame(m,i.readFloat(),i.readFloat(),i.readFloat()*r,i.readByte(),i.readBoolean(),i.readBoolean()),m<f-1&&this.readCurve(i,m,p);s.push(p),n=Math.max(n,p.frames[(f-1)*Pe.ENTRIES])}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0),f=i.readInt(!0),p=new We(f);p.transformConstraintIndex=d;for(let m=0;m<f;m++)p.setFrame(m,i.readFloat(),i.readFloat(),i.readFloat(),i.readFloat(),i.readFloat()),m<f-1&&this.readCurve(i,m,p);s.push(p),n=Math.max(n,p.frames[(f-1)*We.ENTRIES])}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0),f=e.pathConstraints[d];for(let p=0,m=i.readInt(!0);p<m;p++){const g=i.readByte(),_=i.readInt(!0);switch(g){case Kt.PATH_POSITION:case Kt.PATH_SPACING:{let x,y=1;g==Kt.PATH_SPACING?(x=new D_(_),(f.spacingMode==be.Length||f.spacingMode==be.Fixed)&&(y=r)):(x=new Cr(_),f.positionMode==ne.Fixed&&(y=r)),x.pathConstraintIndex=d;for(let v=0;v<_;v++)x.setFrame(v,i.readFloat(),i.readFloat()*y),v<_-1&&this.readCurve(i,v,x);s.push(x),n=Math.max(n,x.frames[(_-1)*Cr.ENTRIES]);break}case Kt.PATH_MIX:{const x=new or(_);x.pathConstraintIndex=d;for(let y=0;y<_;y++)x.setFrame(y,i.readFloat(),i.readFloat(),i.readFloat()),y<_-1&&this.readCurve(i,y,x);s.push(x),n=Math.max(n,x.frames[(_-1)*or.ENTRIES]);break}}}}for(let u=0,c=i.readInt(!0);u<c;u++){const d=e.skins[i.readInt(!0)];for(let f=0,p=i.readInt(!0);f<p;f++){const m=i.readInt(!0);for(let g=0,_=i.readInt(!0);g<_;g++){const x=d.getAttachment(m,i.readStringRef()),y=x.bones!=null,v=x.vertices,b=y?v.length/3*2:v.length,w=i.readInt(!0),E=new B_(w);E.slotIndex=m,E.attachment=x;for(let T=0;T<w;T++){const A=i.readFloat();let I,M=i.readInt(!0);if(M==0)I=y?B.newFloatArray(b):v;else{I=B.newFloatArray(b);const R=i.readInt(!0);if(M+=R,r==1)for(let C=R;C<M;C++)I[C]=i.readFloat();else for(let C=R;C<M;C++)I[C]=i.readFloat()*r;if(!y)for(let C=0,P=I.length;C<P;C++)I[C]+=v[C]}E.setFrame(T,A,I),T<w-1&&this.readCurve(i,T,E)}s.push(E),n=Math.max(n,E.frames[w-1])}}}const o=i.readInt(!0);if(o>0){const u=new Io(o),c=e.slots.length;for(let d=0;d<o;d++){const f=i.readFloat(),p=i.readInt(!0),m=B.newArray(c,0);for(let y=c-1;y>=0;y--)m[y]=-1;const g=B.newArray(c-p,0);let _=0,x=0;for(let y=0;y<p;y++){const v=i.readInt(!0);for(;_!=v;)g[x++]=_++;m[_+i.readInt(!0)]=_++}for(;_<c;)g[x++]=_++;for(let y=c-1;y>=0;y--)m[y]==-1&&(m[y]=g[--x]);u.setFrame(d,f,m)}s.push(u),n=Math.max(n,u.frames[o-1])}const l=i.readInt(!0);if(l>0){const u=new $u(l);for(let c=0;c<l;c++){const d=i.readFloat(),f=e.events[i.readInt(!0)],p=new G_(d,f);p.intValue=i.readInt(!1),p.floatValue=i.readFloat(),p.stringValue=i.readBoolean()?i.readString():f.stringValue,p.data.audioPath!=null&&(p.volume=i.readFloat(),p.balance=i.readFloat()),u.setFrame(c,p)}s.push(u),n=Math.max(n,u.frames[l-1])}return new oe(t,s,n)}readCurve(i,t,e){switch(i.readByte()){case Kt.CURVE_STEPPED:e.setStepped(t);break;case Kt.CURVE_BEZIER:this.setCurve(e,t,i.readFloat(),i.readFloat(),i.readFloat(),i.readFloat());break}}setCurve(i,t,e,s,r,n){i.setCurve(t,e,s,r,n)}};let le=Kt;le.AttachmentTypeValues=[0,1,2,3,4,5,6],le.TransformModeValues=[vt.Normal,vt.OnlyTranslation,vt.NoRotationOrReflection,vt.NoScale,vt.NoScaleOrReflection],le.PositionModeValues=[ne.Fixed,ne.Percent],le.SpacingModeValues=[be.Length,be.Fixed,be.Percent],le.RotateModeValues=[Fe.Tangent,Fe.Chain,Fe.ChainScale],le.BlendModeValues=[W.NORMAL,W.ADD,W.MULTIPLY,W.SCREEN],le.BONE_ROTATE=0,le.BONE_TRANSLATE=1,le.BONE_SCALE=2,le.BONE_SHEAR=3,le.SLOT_ATTACHMENT=0,le.SLOT_COLOR=1,le.SLOT_TWO_COLOR=2,le.PATH_POSITION=0,le.PATH_SPACING=1,le.PATH_MIX=2,le.CURVE_LINEAR=0,le.CURVE_STEPPED=1,le.CURVE_BEZIER=2;let ZS=class{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritDeform=n}},KS=class{constructor(t=null,e=null){this.bones=t,this.vertices=e}},QS=class Un{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new W_,r=typeof t=="string"?JSON.parse(t):t,n=r.skeleton;if(n!=null){if(s.hash=n.hash,s.version=n.spine,s.version.substr(0,3)!=="3.8"){const a=`Spine 3.8 loader cant load version ${n.spine}. Please configure your pixi-spine bundle`;console.error(a)}s.version==="3.8.75"&&console.error("Unsupported skeleton data, 3.8.75 is deprecated, please export with a newer version of Spine."),s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.fps=n.fps,s.imagesPath=n.images}if(r.bones)for(let a=0;a<r.bones.length;a++){const h=r.bones[a];let o=null;const l=this.getValue(h,"parent",null);if(l!=null&&(o=s.findBone(l),o==null))throw new Error(`Parent bone not found: ${l}`);const u=new U_(s.bones.length,h.name,o);u.length=this.getValue(h,"length",0)*e,u.x=this.getValue(h,"x",0)*e,u.y=this.getValue(h,"y",0)*e,u.rotation=this.getValue(h,"rotation",0),u.scaleX=this.getValue(h,"scaleX",1),u.scaleY=this.getValue(h,"scaleY",1),u.shearX=this.getValue(h,"shearX",0),u.shearY=this.getValue(h,"shearY",0),u.transformMode=Un.transformModeFromString(this.getValue(h,"transform","normal")),u.skinRequired=this.getValue(h,"skin",!1),s.bones.push(u)}if(r.slots)for(let a=0;a<r.slots.length;a++){const h=r.slots[a],o=h.name,l=h.bone,u=s.findBone(l);if(u==null)throw new Error(`Slot bone not found: ${l}`);const c=new z_(s.slots.length,o,u),d=this.getValue(h,"color",null);d!=null&&c.color.setFromString(d);const f=this.getValue(h,"dark",null);f!=null&&(c.darkColor=new X(1,1,1,1),c.darkColor.setFromString(f)),c.attachmentName=this.getValue(h,"attachment",null),c.blendMode=Un.blendModeFromString(this.getValue(h,"blend","normal")),s.slots.push(c)}if(r.ik)for(let a=0;a<r.ik.length;a++){const h=r.ik[a],o=new $_(h.name);o.order=this.getValue(h,"order",0),o.skinRequired=this.getValue(h,"skin",!1);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`IK bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`IK target bone not found: ${l}`);o.mix=this.getValue(h,"mix",1),o.softness=this.getValue(h,"softness",0)*e,o.bendDirection=this.getValue(h,"bendPositive",!0)?1:-1,o.compress=this.getValue(h,"compress",!1),o.stretch=this.getValue(h,"stretch",!1),o.uniform=this.getValue(h,"uniform",!1),s.ikConstraints.push(o)}if(r.transform)for(let a=0;a<r.transform.length;a++){const h=r.transform[a],o=new j_(h.name);o.order=this.getValue(h,"order",0),o.skinRequired=this.getValue(h,"skin",!1);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`Transform constraint target bone not found: ${l}`);o.local=this.getValue(h,"local",!1),o.relative=this.getValue(h,"relative",!1),o.offsetRotation=this.getValue(h,"rotation",0),o.offsetX=this.getValue(h,"x",0)*e,o.offsetY=this.getValue(h,"y",0)*e,o.offsetScaleX=this.getValue(h,"scaleX",0),o.offsetScaleY=this.getValue(h,"scaleY",0),o.offsetShearY=this.getValue(h,"shearY",0),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),o.scaleMix=this.getValue(h,"scaleMix",1),o.shearMix=this.getValue(h,"shearMix",1),s.transformConstraints.push(o)}if(r.path)for(let a=0;a<r.path.length;a++){const h=r.path[a],o=new Y_(h.name);o.order=this.getValue(h,"order",0),o.skinRequired=this.getValue(h,"skin",!1);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findSlot(l),o.target==null)throw new Error(`Path target slot not found: ${l}`);o.positionMode=Un.positionModeFromString(this.getValue(h,"positionMode","percent")),o.spacingMode=Un.spacingModeFromString(this.getValue(h,"spacingMode","length")),o.rotateMode=Un.rotateModeFromString(this.getValue(h,"rotateMode","tangent")),o.offsetRotation=this.getValue(h,"rotation",0),o.position=this.getValue(h,"position",0),o.positionMode==ne.Fixed&&(o.position*=e),o.spacing=this.getValue(h,"spacing",0),(o.spacingMode==be.Length||o.spacingMode==be.Fixed)&&(o.spacing*=e),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),s.pathConstraints.push(o)}if(r.skins)for(let a=0;a<r.skins.length;a++){const h=r.skins[a],o=new ju(h.name);if(h.bones)for(let l=0;l<h.bones.length;l++){const u=s.findBone(h.bones[l]);if(u==null)throw new Error(`Skin bone not found: ${h.bones[a]}`);o.bones.push(u)}if(h.ik)for(let l=0;l<h.ik.length;l++){const u=s.findIkConstraint(h.ik[l]);if(u==null)throw new Error(`Skin IK constraint not found: ${h.ik[a]}`);o.constraints.push(u)}if(h.transform)for(let l=0;l<h.transform.length;l++){const u=s.findTransformConstraint(h.transform[l]);if(u==null)throw new Error(`Skin transform constraint not found: ${h.transform[a]}`);o.constraints.push(u)}if(h.path)for(let l=0;l<h.path.length;l++){const u=s.findPathConstraint(h.path[l]);if(u==null)throw new Error(`Skin path constraint not found: ${h.path[a]}`);o.constraints.push(u)}for(const l in h.attachments){const u=s.findSlot(l);if(u==null)throw new Error(`Slot not found: ${l}`);const c=h.attachments[l];for(const d in c){const f=this.readAttachment(c[d],o,u.index,d,s);f!=null&&o.setAttachment(u.index,d,f)}}s.skins.push(o),o.name=="default"&&(s.defaultSkin=o)}for(let a=0,h=this.linkedMeshes.length;a<h;a++){const o=this.linkedMeshes[a],l=o.skin==null?s.defaultSkin:s.findSkin(o.skin);if(l==null)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(u==null)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.deformAttachment=o.inheritDeform?u:o.mesh,o.mesh.setParentMesh(u)}if(this.linkedMeshes.length=0,r.events)for(const a in r.events){const h=r.events[a],o=new X_(a);o.intValue=this.getValue(h,"int",0),o.floatValue=this.getValue(h,"float",0),o.stringValue=this.getValue(h,"string",""),o.audioPath=this.getValue(h,"audio",null),o.audioPath!=null&&(o.volume=this.getValue(h,"volume",1),o.balance=this.getValue(h,"balance",0)),s.events.push(o)}if(r.animations)for(const a in r.animations){const h=r.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,r,n){const a=this.scale;switch(r=this.getValue(t,"name",r),this.getValue(t,"type","region")){case"region":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newRegionAttachment(e,r,o);if(l==null)return null;l.path=o,l.x=this.getValue(t,"x",0)*a,l.y=this.getValue(t,"y",0)*a,l.scaleX=this.getValue(t,"scaleX",1),l.scaleY=this.getValue(t,"scaleY",1),l.rotation=this.getValue(t,"rotation",0),l.width=t.width*a,l.height=t.height*a;const u=this.getValue(t,"color",null);return u!=null&&l.color.setFromString(u),l}case"boundingbox":{const o=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(o==null)return null;this.readVertices(t,o,t.vertexCount<<1);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"mesh":case"linkedmesh":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newMeshAttachment(e,r,o);if(l==null)return null;l.path=o;const u=this.getValue(t,"color",null);u!=null&&l.color.setFromString(u),l.width=this.getValue(t,"width",0)*a,l.height=this.getValue(t,"height",0)*a;const c=this.getValue(t,"parent",null);if(c!=null)return this.linkedMeshes.push(new JS(l,this.getValue(t,"skin",null),s,c,this.getValue(t,"deform",!0))),l;const d=t.uvs;return this.readVertices(t,l,d.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(d),l.edges=this.getValue(t,"edges",null),l.hullLength=this.getValue(t,"hull",0)*2,l}case"path":{const o=this.attachmentLoader.newPathAttachment(e,r);if(o==null)return null;o.closed=this.getValue(t,"closed",!1),o.constantSpeed=this.getValue(t,"constantSpeed",!0);const l=t.vertexCount;this.readVertices(t,o,l<<1);const u=B.newArray(l/3,0);for(let d=0;d<t.lengths.length;d++)u[d]=t.lengths[d]*a;o.lengths=u;const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}case"point":{const o=this.attachmentLoader.newPointAttachment(e,r);if(o==null)return null;o.x=this.getValue(t,"x",0)*a,o.y=this.getValue(t,"y",0)*a,o.rotation=this.getValue(t,"rotation",0);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"clipping":{const o=this.attachmentLoader.newClippingAttachment(e,r);if(o==null)return null;const l=this.getValue(t,"end",null);if(l!=null){const d=n.findSlot(l);if(d==null)throw new Error(`Clipping end slot not found: ${l}`);o.endSlot=d}const u=t.vertexCount;this.readVertices(t,o,u<<1);const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}}return null}readVertices(t,e,s){const r=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(r!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=r;e.vertices=o;return}const a=new Array,h=new Array;for(let o=0,l=n.length;o<l;){const u=n[o++];h.push(u);for(let c=o+u*4;o<c;o+=4)h.push(n[o]),a.push(n[o+1]*r),a.push(n[o+2]*r),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const r=this.scale,n=new Array;let a=0;if(t.slots)for(const o in t.slots){const l=t.slots[o],u=s.findSlotIndex(o);if(u==-1)throw new Error(`Slot not found: ${o}`);for(const c in l){const d=l[c];if(c=="attachment"){const f=new Rn(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p++,this.getValue(g,"time",0),g.name)}n.push(f),a=Math.max(a,f.frames[f.getFrameCount()-1])}else if(c=="color"){const f=new He(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X;_.setFromString(g.color||"ffffffff"),f.setFrame(p,this.getValue(g,"time",0),_.r,_.g,_.b,_.a),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*He.ENTRIES])}else if(c=="twoColor"){const f=new ae(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X,x=new X;_.setFromString(g.light),x.setFromString(g.dark),f.setFrame(p,this.getValue(g,"time",0),_.r,_.g,_.b,_.a,x.r,x.g,x.b),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ae.ENTRIES])}else throw new Error(`Invalid timeline type for a slot: ${c} (${o})`)}}if(t.bones)for(const o in t.bones){const l=t.bones[o],u=s.findBoneIndex(o);if(u==-1)throw new Error(`Bone not found: ${o}`);for(const c in l){const d=l[c];if(c==="rotate"){const f=new Ie(d.length);f.boneIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p,this.getValue(g,"time",0),this.getValue(g,"angle",0)),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*Ie.ENTRIES])}else if(c==="translate"||c==="scale"||c==="shear"){let f=null,p=1,m=0;c==="scale"?(f=new M_(d.length),m=1):c==="shear"?f=new F_(d.length):(f=new ps(d.length),p=r),f.boneIndex=u;let g=0;for(let _=0;_<d.length;_++){const x=d[_],y=this.getValue(x,"x",m),v=this.getValue(x,"y",m);f.setFrame(g,this.getValue(x,"time",0),y*p,v*p),this.readCurve(x,f,g),g++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ps.ENTRIES])}else throw new Error(`Invalid timeline type for a bone: ${c} (${o})`)}}if(t.ik)for(const o in t.ik){const l=t.ik[o],u=s.findIkConstraint(o),c=new Pe(l.length);c.ikConstraintIndex=s.ikConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,this.getValue(p,"time",0),this.getValue(p,"mix",1),this.getValue(p,"softness",0)*r,this.getValue(p,"bendPositive",!0)?1:-1,this.getValue(p,"compress",!1),this.getValue(p,"stretch",!1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*Pe.ENTRIES])}if(t.transform)for(const o in t.transform){const l=t.transform[o],u=s.findTransformConstraint(o),c=new We(l.length);c.transformConstraintIndex=s.transformConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,this.getValue(p,"time",0),this.getValue(p,"rotateMix",1),this.getValue(p,"translateMix",1),this.getValue(p,"scaleMix",1),this.getValue(p,"shearMix",1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*We.ENTRIES])}if(t.path)for(const o in t.path){const l=t.path[o],u=s.findPathConstraintIndex(o);if(u==-1)throw new Error(`Path constraint not found: ${o}`);const c=s.pathConstraints[u];for(const d in l){const f=l[d];if(d==="position"||d==="spacing"){let p=null,m=1;d==="spacing"?(p=new D_(f.length),(c.spacingMode==be.Length||c.spacingMode==be.Fixed)&&(m=r)):(p=new Cr(f.length),c.positionMode==ne.Fixed&&(m=r)),p.pathConstraintIndex=u;let g=0;for(let _=0;_<f.length;_++){const x=f[_];p.setFrame(g,this.getValue(x,"time",0),this.getValue(x,d,0)*m),this.readCurve(x,p,g),g++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*Cr.ENTRIES])}else if(d==="mix"){const p=new or(f.length);p.pathConstraintIndex=u;let m=0;for(let g=0;g<f.length;g++){const _=f[g];p.setFrame(m,this.getValue(_,"time",0),this.getValue(_,"rotateMix",1),this.getValue(_,"translateMix",1)),this.readCurve(_,p,m),m++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*or.ENTRIES])}}}if(t.deform)for(const o in t.deform){const l=t.deform[o],u=s.findSkin(o);if(u!=null)for(const c in l){const d=l[c],f=s.findSlotIndex(c);if(f==-1)throw new Error(`Slot not found: ${d.name}`);for(const p in d){const m=d[p],g=u.getAttachment(f,p);if(g==null)throw new Error(`Deform attachment not found: ${m.name}`);const _=g.bones!=null,x=g.vertices,y=_?x.length/3*2:x.length,v=new B_(m.length);v.slotIndex=f,v.attachment=g;let b=0;for(let w=0;w<m.length;w++){const E=m[w];let T;const A=this.getValue(E,"vertices",null);if(A==null)T=_?B.newFloatArray(y):x;else{T=B.newFloatArray(y);const I=this.getValue(E,"offset",0);if(B.arrayCopy(A,0,T,I,A.length),r!=1)for(let M=I,R=M+A.length;M<R;M++)T[M]*=r;if(!_)for(let M=0;M<y;M++)T[M]+=x[M]}v.setFrame(b,this.getValue(E,"time",0),T),this.readCurve(E,v,b),b++}n.push(v),a=Math.max(a,v.frames[v.getFrameCount()-1])}}}let h=t.drawOrder;if(h==null&&(h=t.draworder),h!=null){const o=new Io(h.length),l=s.slots.length;let u=0;for(let c=0;c<h.length;c++){const d=h[c];let f=null;const p=this.getValue(d,"offsets",null);if(p!=null){f=B.newArray(l,-1);const m=B.newArray(l-p.length,0);let g=0,_=0;for(let x=0;x<p.length;x++){const y=p[x],v=s.findSlotIndex(y.slot);if(v==-1)throw new Error(`Slot not found: ${y.slot}`);for(;g!=v;)m[_++]=g++;f[g+y.offset]=g++}for(;g<l;)m[_++]=g++;for(let x=l-1;x>=0;x--)f[x]==-1&&(f[x]=m[--_])}o.setFrame(u++,this.getValue(d,"time",0),f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(t.events){const o=new $u(t.events.length);let l=0;for(let u=0;u<t.events.length;u++){const c=t.events[u],d=s.findEvent(c.name);if(d==null)throw new Error(`Event not found: ${c.name}`);const f=new G_(B.toSinglePrecision(this.getValue(c,"time",0)),d);f.intValue=this.getValue(c,"int",d.intValue),f.floatValue=this.getValue(c,"float",d.floatValue),f.stringValue=this.getValue(c,"string",d.stringValue),f.data.audioPath!=null&&(f.volume=this.getValue(c,"volume",1),f.balance=this.getValue(c,"balance",0)),o.setFrame(l++,f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(isNaN(a))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new oe(e,n,a))}readCurve(t,e,s){if(t.hasOwnProperty("curve"))if(t.curve==="stepped")e.setStepped(s);else{const r=t.curve;e.setCurve(s,r,this.getValue(t,"c2",0),this.getValue(t,"c3",1),this.getValue(t,"c4",1))}}getValue(t,e,s){return t[e]!==void 0?t[e]:s}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return W.NORMAL;if(t=="additive")return W.ADD;if(t=="multiply")return W.MULTIPLY;if(t=="screen")return W.SCREEN;throw new Error(`Unknown blend mode: ${t}`)}static positionModeFromString(t){if(t=t.toLowerCase(),t=="fixed")return ne.Fixed;if(t=="percent")return ne.Percent;throw new Error(`Unknown position mode: ${t}`)}static spacingModeFromString(t){if(t=t.toLowerCase(),t=="length")return be.Length;if(t=="fixed")return be.Fixed;if(t=="percent")return be.Percent;throw new Error(`Unknown position mode: ${t}`)}static rotateModeFromString(t){if(t=t.toLowerCase(),t=="tangent")return Fe.Tangent;if(t=="chain")return Fe.Chain;if(t=="chainscale")return Fe.ChainScale;throw new Error(`Unknown rotate mode: ${t}`)}static transformModeFromString(t){if(t=t.toLowerCase(),t=="normal")return vt.Normal;if(t=="onlytranslation")return vt.OnlyTranslation;if(t=="norotationorreflection")return vt.NoRotationOrReflection;if(t=="noscale")return vt.NoScale;if(t=="noscaleorreflection")return vt.NoScaleOrReflection;throw new Error(`Unknown transform mode: ${t}`)}},JS=class{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritDeform=n}};class tC extends Gu{createSkeleton(t){this.skeleton=new H_(t),this.skeleton.updateWorldTransform(),this.stateData=new L_(t),this.state=new ms(this.stateData)}}const eC={extension:Y.Asset,loader:{extension:{type:Y.LoadParser,priority:Ne.Normal},test(i){return Le(i,".atlas")},async load(i){return await(await z.ADAPTER.fetch(i)).text()},testParse(i,t){const e=Le(t.src,".atlas"),s=typeof i=="string";return Promise.resolve(e&&s)},async parse(i,t,e){const s=t.data;let r=bt.dirname(t.src);r&&r.lastIndexOf("/")!==r.length-1&&(r+="/");let n=null,a=null;const h=new Promise((u,c)=>{n=u,a=c});let o;const l=u=>{u||a(`Something went terribly wrong loading a spine .atlas file
1170
- Most likely your texture failed to load.`),n(o)};if(s.image||s.images){const u=Object.assign(s.image?{default:s.image}:{},s.images);o=new Uu(i,(c,d)=>{const f=u[c]||u.default;f&&f.baseTexture?d(f.baseTexture):d(f)},l)}else o=new Uu(i,Z_(e,r,s.imageMetadata),l);return await h},unload(i){i.dispose()}}},Z_=(i,t,e)=>async(s,r)=>{const n=bt.normalize([...t.split(bt.sep),s].join(bt.sep)),a=await i.load({src:n,data:e});r(a.baseTexture)};K.add(eC);function K_(i){return i.hasOwnProperty("bones")}function sC(i){return i instanceof ArrayBuffer}class rC{constructor(){}installLoader(){const t=this,e={extension:Y.Asset,loader:{extension:{type:Y.LoadParser,priority:Ne.Normal},test(s){return Le(s,".skel")},async load(s){return await(await z.ADAPTER.fetch(s)).arrayBuffer()},testParse(s,r){var o;const n=Le(r.src,".json")&&K_(s),a=Le(r.src,".skel")&&sC(s),h=((o=r.data)==null?void 0:o.spineAtlas)===!1;return Promise.resolve(n&&!h||a)},async parse(s,r,n){const a=bt.extname(r.src).toLowerCase(),h=bt.basename(r.src,a);let o=bt.dirname(r.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");const l=Le(r.src,".json")&&K_(s);let u=null,c=s;l?u=t.createJsonParser():(u=t.createBinaryParser(),c=new Uint8Array(s));const d=r.data||{},f=(d==null?void 0:d.spineSkeletonScale)??null;f&&(u.scale=f);const p=d.spineAtlas;if(p&&p.pages)return t.parseData(u,p,c);const m=d.atlasRawData;if(m){let x=null,y=null;const v=new Promise((E,T)=>{x=E,y=T}),b=new Uu(m,Z_(n,o,d.imageMetadata),E=>{E||y(`Something went terribly wrong loading a spine .atlas file
1171
- Most likely your texture failed to load.`),x(b)}),w=await v;return t.parseData(u,w,c)}let g=d.spineAtlasFile;g||(g=`${o+h}.atlas`);const _=await n.load({src:g,data:d,alias:d.spineAtlasAlias});return t.parseData(u,_,c)}}};return K.add(e),e}}let Q_=class{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}};const J_=class extends Q_{constructor(t){super(t),this.id=(J_.nextID++&65535)<<11,this.worldVerticesLength=0}computeWorldVerticesOld(t,e){this.computeWorldVertices(t,0,this.worldVerticesLength,e,0,2)}computeWorldVertices(t,e,s,r,n,a){s=n+(s>>1)*a;const h=t.bone.skeleton,o=t.attachmentVertices;let l=this.vertices;const u=this.bones;if(u==null){o.length>0&&(l=o);const p=t.bone.matrix,m=p.tx,g=p.ty,_=p.a,x=p.c,y=p.b,v=p.d;for(let b=e,w=n;w<s;b+=2,w+=a){const E=l[b],T=l[b+1];r[w]=E*_+T*x+m,r[w+1]=E*y+T*v+g}return}let c=0,d=0;for(let p=0;p<e;p+=2){const m=u[c];c+=m+1,d+=m}const f=h.bones;if(o.length==0)for(let p=n,m=d*3;p<s;p+=a){let g=0,_=0,x=u[c++];for(x+=c;c<x;c++,m+=3){const y=f[u[c]].matrix,v=l[m],b=l[m+1],w=l[m+2];g+=(v*y.a+b*y.c+y.tx)*w,_+=(v*y.b+b*y.d+y.ty)*w}r[p]=g,r[p+1]=_}else{const p=o;for(let m=n,g=d*3,_=d<<1;m<s;m+=a){let x=0,y=0,v=u[c++];for(v+=c;c<v;c++,g+=3,_+=2){const b=f[u[c]].matrix,w=l[g]+p[_],E=l[g+1]+p[_+1],T=l[g+2];x+=(w*b.a+E*b.c+b.tx)*T,y+=(w*b.b+E*b.d+b.ty)*T}r[m]=x,r[m+1]=y}}}applyDeform(t){return this==t}};let Yi=J_;Yi.nextID=0;let iC=class extends Yi{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}},nC=class extends Yi{constructor(t){super(t),this.type=at.Clipping,this.color=new X(.2275,.2275,.8078,1)}},oC=class extends Yi{constructor(t){super(t),this.type=at.Mesh,this.color=new X(1,1,1,1),this.inheritDeform=!1,this.tempColor=new X(0,0,0,0)}applyDeform(t){return this==t||this.inheritDeform&&this.parentMesh==t}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t!=null&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}},aC=class extends Yi{constructor(t){super(t),this.type=at.Path,this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}},lC=class extends Yi{constructor(t){super(t),this.type=at.Point,this.color=new X(.38,.94,0,1)}computeWorldPosition(t,e){const s=t.matrix;return e.x=this.x*s.a+this.y*s.c+t.worldX,e.y=this.x*s.b+this.y*s.d+t.worldY,e}computeWorldRotation(t){const e=t.matrix,s=D.cosDeg(this.rotation),r=D.sinDeg(this.rotation),n=s*e.a+r*e.c,a=s*e.b+r*e.d;return Math.atan2(a,n)*D.radDeg}};class hC{constructor(t,e){if(this.attachmentVertices=new Array,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new X,this.darkColor=t.darkColor==null?null:new X,this.setToSetupPose(),this.blendMode=this.data.blendMode}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.attachmentVertices.length=0)}setAttachmentTime(t){this.attachmentTime=this.bone.skeleton.time-t}getAttachmentTime(){return this.bone.skeleton.time-this.attachmentTime}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor!=null&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName==null?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))}}const we=class extends Q_{constructor(t){super(t),this.type=at.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new X(1,1,1,1),this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new X(1,1,1,1)}updateOffset(){const t=this.width/this.region.originalWidth*this.scaleX,e=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*t,r=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=r+this.region.height*e,h=this.rotation*Math.PI/180,o=Math.cos(h),l=Math.sin(h),u=s*o+this.x,c=s*l,d=r*o+this.y,f=r*l,p=n*o+this.x,m=n*l,g=a*o+this.y,_=a*l,x=this.offset;x[we.OX1]=u-f,x[we.OY1]=d+c,x[we.OX2]=u-_,x[we.OY2]=g+c,x[we.OX3]=p-_,x[we.OY3]=g+m,x[we.OX4]=p-f,x[we.OY4]=d+m}setRegion(t){this.region=t;const e=this.uvs;t.rotate?(e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v,e[0]=t.u2,e[1]=t.v2):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,r){const n=this.offset,a=t instanceof hC?t.bone.matrix:t.matrix,h=a.tx,o=a.ty,l=a.a,u=a.c,c=a.b,d=a.d;let f=0,p=0;f=n[we.OX1],p=n[we.OY1],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[we.OX2],p=n[we.OY2],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[we.OX3],p=n[we.OY3],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[we.OX4],p=n[we.OY4],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o}};let nt=we;nt.OX1=0,nt.OY1=1,nt.OX2=2,nt.OY2=3,nt.OX3=4,nt.OY3=5,nt.OX4=6,nt.OY4=7,nt.X1=0,nt.Y1=1,nt.C1R=2,nt.C1G=3,nt.C1B=4,nt.C1A=5,nt.U1=6,nt.V1=7,nt.X2=8,nt.Y2=9,nt.C2R=10,nt.C2G=11,nt.C2B=12,nt.C2A=13,nt.U2=14,nt.V2=15,nt.X3=16,nt.Y3=17,nt.C3R=18,nt.C3G=19,nt.C3B=20,nt.C3A=21,nt.U3=22,nt.V3=23,nt.X4=24,nt.Y4=25,nt.C4R=26,nt.C4G=27,nt.C4B=28,nt.C4A=29,nt.U4=30,nt.V4=31,new S_(2);let Ee=class{constructor(t,e,s){if(t==null)throw new Error("name cannot be null.");if(e==null)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.duration=s}apply(t,e,s,r,n,a,h,o){if(t==null)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let u=0,c=l.length;u<c;u++)l[u].apply(t,e,s,n,a,h,o)}static binarySearch(t,e,s=1){let r=0,n=t.length/s-2;if(n==0)return s;let a=n>>>1;for(;;){if(t[(a+1)*s]<=e?r=a+1:n=a,r==n)return(r+1)*s;a=r+n>>>1}}static linearSearch(t,e,s){for(let r=0,n=t.length-s;r<=n;r+=s)if(t[r]>e)return r;return-1}};const se=class{constructor(i){if(i<=0)throw new Error(`frameCount must be > 0: ${i}`);this.curves=B.newFloatArray((i-1)*se.BEZIER_SIZE)}getFrameCount(){return this.curves.length/se.BEZIER_SIZE+1}setLinear(i){this.curves[i*se.BEZIER_SIZE]=se.LINEAR}setStepped(i){this.curves[i*se.BEZIER_SIZE]=se.STEPPED}getCurveType(i){const t=i*se.BEZIER_SIZE;if(t==this.curves.length)return se.LINEAR;const e=this.curves[t];return e==se.LINEAR?se.LINEAR:e==se.STEPPED?se.STEPPED:se.BEZIER}setCurve(i,t,e,s,r){const n=(-t*2+s)*.03,a=(-e*2+r)*.03,h=((t-s)*3+1)*.006,o=((e-r)*3+1)*.006;let l=n*2+h,u=a*2+o,c=t*.3+n+h*.16666667,d=e*.3+a+o*.16666667,f=i*se.BEZIER_SIZE;const p=this.curves;p[f++]=se.BEZIER;let m=c,g=d;for(let _=f+se.BEZIER_SIZE-1;f<_;f+=2)p[f]=m,p[f+1]=g,c+=l,d+=u,l+=h,u+=o,m+=c,g+=d}getCurvePercent(i,t){t=D.clamp(t,0,1);const e=this.curves;let s=i*se.BEZIER_SIZE;const r=e[s];if(r==se.LINEAR)return t;if(r==se.STEPPED)return 0;s++;let n=0;for(let h=s,o=s+se.BEZIER_SIZE-1;s<o;s+=2)if(n=e[s],n>=t){let l,u;return s==h?(l=0,u=0):(l=e[s-2],u=e[s-1]),u+(e[s+1]-u)*(t-l)/(n-l)}const a=e[s-1];return a+(1-a)*(t-n)/(1-n)}};let rs=se;rs.LINEAR=0,rs.STEPPED=1,rs.BEZIER=2,rs.BEZIER_SIZE=10*2-1;const si=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(i,t,e){i<<=1,this.frames[i]=t,this.frames[i+si.ROTATION]=e}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.bones[this.boneIndex];if(e<h[0]){switch(n){case S.setup:o.rotation=o.data.rotation;return;case S.first:const p=o.data.rotation-o.rotation;o.rotation+=(p-(16384-(16384.499999999996-p/360|0))*360)*r}return}if(e>=h[h.length-si.ENTRIES]){let p=h[h.length+si.PREV_ROTATION];switch(n){case S.setup:o.rotation=o.data.rotation+p*r;break;case S.first:case S.replace:p+=o.data.rotation-o.rotation,p-=(16384-(16384.499999999996-p/360|0))*360;case S.add:o.rotation+=p*r}return}const l=Ee.binarySearch(h,e,si.ENTRIES),u=h[l+si.PREV_ROTATION],c=h[l],d=this.getCurvePercent((l>>1)-1,1-(e-c)/(h[l+si.PREV_TIME]-c));let f=h[l+si.ROTATION]-u;switch(f=u+(f-(16384-(16384.499999999996-f/360|0))*360)*d,n){case S.setup:o.rotation=o.data.rotation+(f-(16384-(16384.499999999996-f/360|0))*360)*r;break;case S.first:case S.replace:f+=o.data.rotation-o.rotation;case S.add:o.rotation+=(f-(16384-(16384.499999999996-f/360|0))*360)*r}}};let Mn=si;Mn.ENTRIES=2,Mn.PREV_TIME=-2,Mn.PREV_ROTATION=-1,Mn.ROTATION=1;const De=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*De.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(i,t,e,s){i*=De.ENTRIES,this.frames[i]=t,this.frames[i+De.X]=e,this.frames[i+De.Y]=s}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.bones[this.boneIndex];if(e<h[0]){switch(n){case S.setup:o.x=o.data.x,o.y=o.data.y;return;case S.first:o.x+=(o.data.x-o.x)*r,o.y+=(o.data.y-o.y)*r}return}let l=0,u=0;if(e>=h[h.length-De.ENTRIES])l=h[h.length+De.PREV_X],u=h[h.length+De.PREV_Y];else{const c=Ee.binarySearch(h,e,De.ENTRIES);l=h[c+De.PREV_X],u=h[c+De.PREV_Y];const d=h[c],f=this.getCurvePercent(c/De.ENTRIES-1,1-(e-d)/(h[c+De.PREV_TIME]-d));l+=(h[c+De.X]-l)*f,u+=(h[c+De.Y]-u)*f}switch(n){case S.setup:o.x=o.data.x+l*r,o.y=o.data.y+u*r;break;case S.first:case S.replace:o.x+=(o.data.x+l-o.x)*r,o.y+=(o.data.y+u-o.y)*r;break;case S.add:o.x+=l*r,o.y+=u*r}}};let ar=De;ar.ENTRIES=3,ar.PREV_TIME=-3,ar.PREV_X=-2,ar.PREV_Y=-1,ar.X=1,ar.Y=2;let cC=class Os extends ar{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(s<o[0]){switch(a){case S.setup:l.scaleX=l.data.scaleX,l.scaleY=l.data.scaleY;return;case S.first:l.scaleX+=(l.data.scaleX-l.scaleX)*n,l.scaleY+=(l.data.scaleY-l.scaleY)*n}return}let u=0,c=0;if(s>=o[o.length-Os.ENTRIES])u=o[o.length+Os.PREV_X]*l.data.scaleX,c=o[o.length+Os.PREV_Y]*l.data.scaleY;else{const d=Ee.binarySearch(o,s,Os.ENTRIES);u=o[d+Os.PREV_X],c=o[d+Os.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Os.ENTRIES-1,1-(s-f)/(o[d+Os.PREV_TIME]-f));u=(u+(o[d+Os.X]-u)*p)*l.data.scaleX,c=(c+(o[d+Os.Y]-c)*p)*l.data.scaleY}if(n==1)a==S.add?(l.scaleX+=u-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=u,l.scaleY=c);else{let d=0,f=0;if(h==At.mixOut)switch(a){case S.setup:d=l.data.scaleX,f=l.data.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.first:case S.replace:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.add:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-l.data.scaleX)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-l.data.scaleY)*n}else switch(a){case S.setup:d=Math.abs(l.data.scaleX)*D.signum(u),f=Math.abs(l.data.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.first:case S.replace:d=Math.abs(l.scaleX)*D.signum(u),f=Math.abs(l.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.add:d=D.signum(u),f=D.signum(c),l.scaleX=Math.abs(l.scaleX)*d+(u-Math.abs(l.data.scaleX)*d)*n,l.scaleY=Math.abs(l.scaleY)*f+(c-Math.abs(l.data.scaleY)*f)*n}}}},uC=class Ls extends ar{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(s<o[0]){switch(a){case S.setup:l.shearX=l.data.shearX,l.shearY=l.data.shearY;return;case S.first:l.shearX+=(l.data.shearX-l.shearX)*n,l.shearY+=(l.data.shearY-l.shearY)*n}return}let u=0,c=0;if(s>=o[o.length-Ls.ENTRIES])u=o[o.length+Ls.PREV_X],c=o[o.length+Ls.PREV_Y];else{const d=Ee.binarySearch(o,s,Ls.ENTRIES);u=o[d+Ls.PREV_X],c=o[d+Ls.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Ls.ENTRIES-1,1-(s-f)/(o[d+Ls.PREV_TIME]-f));u=u+(o[d+Ls.X]-u)*p,c=c+(o[d+Ls.Y]-c)*p}switch(a){case S.setup:l.shearX=l.data.shearX+u*n,l.shearY=l.data.shearY+c*n;break;case S.first:case S.replace:l.shearX+=(l.data.shearX+u-l.shearX)*n,l.shearY+=(l.data.shearY+c-l.shearY)*n;break;case S.add:l.shearX+=u*n,l.shearY+=c*n}}};const Ht=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Ht.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(i,t,e,s,r,n){i*=Ht.ENTRIES,this.frames[i]=t,this.frames[i+Ht.R]=e,this.frames[i+Ht.G]=s,this.frames[i+Ht.B]=r,this.frames[i+Ht.A]=n}apply(i,t,e,s,r,n,a){const h=i.slots[this.slotIndex],o=this.frames;if(e<o[0]){switch(n){case S.setup:h.color.setFromColor(h.data.color);return;case S.first:const f=h.color,p=h.data.color;f.add((p.r-f.r)*r,(p.g-f.g)*r,(p.b-f.b)*r,(p.a-f.a)*r)}return}let l=0,u=0,c=0,d=0;if(e>=o[o.length-Ht.ENTRIES]){const f=o.length;l=o[f+Ht.PREV_R],u=o[f+Ht.PREV_G],c=o[f+Ht.PREV_B],d=o[f+Ht.PREV_A]}else{const f=Ee.binarySearch(o,e,Ht.ENTRIES);l=o[f+Ht.PREV_R],u=o[f+Ht.PREV_G],c=o[f+Ht.PREV_B],d=o[f+Ht.PREV_A];const p=o[f],m=this.getCurvePercent(f/Ht.ENTRIES-1,1-(e-p)/(o[f+Ht.PREV_TIME]-p));l+=(o[f+Ht.R]-l)*m,u+=(o[f+Ht.G]-u)*m,c+=(o[f+Ht.B]-c)*m,d+=(o[f+Ht.A]-d)*m}if(r==1)h.color.set(l,u,c,d);else{const f=h.color;n==S.setup&&f.setFromColor(h.data.color),f.add((l-f.r)*r,(u-f.g)*r,(c-f.b)*r,(d-f.a)*r)}}};let gs=Ht;gs.ENTRIES=5,gs.PREV_TIME=-5,gs.PREV_R=-4,gs.PREV_G=-3,gs.PREV_B=-2,gs.PREV_A=-1,gs.R=1,gs.G=2,gs.B=3,gs.A=4;const ft=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*ft.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(i,t,e,s,r,n,a,h,o){i*=ft.ENTRIES,this.frames[i]=t,this.frames[i+ft.R]=e,this.frames[i+ft.G]=s,this.frames[i+ft.B]=r,this.frames[i+ft.A]=n,this.frames[i+ft.R2]=a,this.frames[i+ft.G2]=h,this.frames[i+ft.B2]=o}apply(i,t,e,s,r,n,a){const h=i.slots[this.slotIndex],o=this.frames;if(e<o[0]){switch(n){case S.setup:h.color.setFromColor(h.data.color),h.darkColor.setFromColor(h.data.darkColor);return;case S.first:const g=h.color,_=h.darkColor,x=h.data.color,y=h.data.darkColor;g.add((x.r-g.r)*r,(x.g-g.g)*r,(x.b-g.b)*r,(x.a-g.a)*r),_.add((y.r-_.r)*r,(y.g-_.g)*r,(y.b-_.b)*r,0)}return}let l=0,u=0,c=0,d=0,f=0,p=0,m=0;if(e>=o[o.length-ft.ENTRIES]){const g=o.length;l=o[g+ft.PREV_R],u=o[g+ft.PREV_G],c=o[g+ft.PREV_B],d=o[g+ft.PREV_A],f=o[g+ft.PREV_R2],p=o[g+ft.PREV_G2],m=o[g+ft.PREV_B2]}else{const g=Ee.binarySearch(o,e,ft.ENTRIES);l=o[g+ft.PREV_R],u=o[g+ft.PREV_G],c=o[g+ft.PREV_B],d=o[g+ft.PREV_A],f=o[g+ft.PREV_R2],p=o[g+ft.PREV_G2],m=o[g+ft.PREV_B2];const _=o[g],x=this.getCurvePercent(g/ft.ENTRIES-1,1-(e-_)/(o[g+ft.PREV_TIME]-_));l+=(o[g+ft.R]-l)*x,u+=(o[g+ft.G]-u)*x,c+=(o[g+ft.B]-c)*x,d+=(o[g+ft.A]-d)*x,f+=(o[g+ft.R2]-f)*x,p+=(o[g+ft.G2]-p)*x,m+=(o[g+ft.B2]-m)*x}if(r==1)h.color.set(l,u,c,d),h.darkColor.set(f,p,m,1);else{const g=h.color,_=h.darkColor;n==S.setup&&(g.setFromColor(h.data.color),_.setFromColor(h.data.darkColor)),g.add((l-g.r)*r,(u-g.g)*r,(c-g.b)*r,(d-g.a)*r),_.add((f-_.r)*r,(p-_.g)*r,(m-_.b)*r,0)}}};let ye=ft;ye.ENTRIES=8,ye.PREV_TIME=-8,ye.PREV_R=-7,ye.PREV_G=-6,ye.PREV_B=-5,ye.PREV_A=-4,ye.PREV_R2=-3,ye.PREV_G2=-2,ye.PREV_B2=-1,ye.R=1,ye.G=2,ye.B=3,ye.A=4,ye.R2=5,ye.G2=6,ye.B2=7;let dC=class{constructor(t){this.frames=B.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(h==At.mixOut&&a==S.setup){const d=o.data.attachmentName;o.setAttachment(d==null?null:t.getAttachment(this.slotIndex,d));return}const l=this.frames;if(s<l[0]){if(a==S.setup||a==S.first){const d=o.data.attachmentName;o.setAttachment(d==null?null:t.getAttachment(this.slotIndex,d))}return}let u=0;s>=l[l.length-1]?u=l.length-1:u=Ee.binarySearch(l,s,1)-1;const c=this.attachmentNames[u];t.slots[this.slotIndex].setAttachment(c==null?null:t.getAttachment(this.slotIndex,c))}},t0=null,fC=class extends rs{constructor(t){super(t),this.frames=B.newFloatArray(t),this.frameVertices=new Array(t),t0==null&&(t0=B.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(t,e,s){this.frames[t]=e,this.frameVertices[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex],l=o.getAttachment();if(!(l instanceof Yi)||!l.applyDeform(this.attachment))return;const u=o.attachmentVertices;u.length==0&&(a=S.setup);const c=this.frameVertices,d=c[0].length,f=this.frames;if(s<f[0]){const v=l;switch(a){case S.setup:u.length=0;return;case S.first:if(n==1){u.length=0;break}const b=B.setArraySize(u,d);if(v.bones==null){const w=v.vertices;for(let E=0;E<d;E++)b[E]+=(w[E]-b[E])*n}else{n=1-n;for(let w=0;w<d;w++)b[w]*=n}}return}const p=B.setArraySize(u,d);if(s>=f[f.length-1]){const v=c[f.length-1];if(n==1)if(a==S.add){const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=v[E]-w[E]}else for(let w=0;w<d;w++)p[w]+=v[w]}else B.arrayCopy(v,0,p,0,d);else switch(a){case S.setup:{const w=l;if(w.bones==null){const E=w.vertices;for(let T=0;T<d;T++){const A=E[T];p[T]=A+(v[T]-A)*n}}else for(let E=0;E<d;E++)p[E]=v[E]*n;break}case S.first:case S.replace:for(let w=0;w<d;w++)p[w]+=(v[w]-p[w])*n;case S.add:const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=(v[E]-w[E])*n}else for(let w=0;w<d;w++)p[w]+=v[w]*n}return}const m=Ee.binarySearch(f,s),g=c[m-1],_=c[m],x=f[m],y=this.getCurvePercent(m-1,1-(s-x)/(f[m-1]-x));if(n==1)if(a==S.add){const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=E+(_[w]-E)*y-b[w]}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=w+(_[b]-w)*y}}else for(let v=0;v<d;v++){const b=g[v];p[v]=b+(_[v]-b)*y}else switch(a){case S.setup:{const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++){const T=g[E],A=w[E];p[E]=A+(T+(_[E]-T)*y-A)*n}}else for(let w=0;w<d;w++){const E=g[w];p[w]=(E+(_[w]-E)*y)*n}break}case S.first:case S.replace:for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y-p[b])*n}break;case S.add:const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=(E+(_[w]-E)*y-b[w])*n}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y)*n}}}},pC=class{constructor(t){this.frames=B.newFloatArray(t),this.events=new Array(t)}getPropertyId(){return 7<<24}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,r,n,a,h){if(r==null)return;const o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,r,n,a,h),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let u=0;if(e<o[0])u=0;else{u=Ee.binarySearch(o,e);const c=o[u];for(;u>0&&o[u-1]==c;)u--}for(;u<l&&s>=o[u];u++)r.push(this.events[u])}},mC=class{constructor(t){this.frames=B.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,r,n,a,h){const o=t.drawOrder,l=t.slots;if(h==At.mixOut&&a==S.setup){B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const u=this.frames;if(s<u[0]){(a==S.setup||a==S.first)&&B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let c=0;s>=u[u.length-1]?c=u.length-1:c=Ee.binarySearch(u,s)-1;const d=this.drawOrders[c];if(d==null)B.arrayCopy(l,0,o,0,l.length);else for(let f=0,p=d.length;f<p;f++)o[f]=l[d[f]]}};const St=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*St.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(i,t,e,s,r,n){i*=St.ENTRIES,this.frames[i]=t,this.frames[i+St.MIX]=e,this.frames[i+St.BEND_DIRECTION]=s,this.frames[i+St.COMPRESS]=r?1:0,this.frames[i+St.STRETCH]=n?1:0}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.ikConstraints[this.ikConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.mix=o.data.mix,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch;return;case S.first:o.mix+=(o.data.mix-o.mix)*r,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}if(e>=h[h.length-St.ENTRIES]){n==S.setup?(o.mix=o.data.mix+(h[h.length+St.PREV_MIX]-o.data.mix)*r,a==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=h[h.length+St.PREV_BEND_DIRECTION],o.compress=h[h.length+St.PREV_COMPRESS]!=0,o.stretch=h[h.length+St.PREV_STRETCH]!=0)):(o.mix+=(h[h.length+St.PREV_MIX]-o.mix)*r,a==At.mixIn&&(o.bendDirection=h[h.length+St.PREV_BEND_DIRECTION],o.compress=h[h.length+St.PREV_COMPRESS]!=0,o.stretch=h[h.length+St.PREV_STRETCH]!=0));return}const l=Ee.binarySearch(h,e,St.ENTRIES),u=h[l+St.PREV_MIX],c=h[l],d=this.getCurvePercent(l/St.ENTRIES-1,1-(e-c)/(h[l+St.PREV_TIME]-c));n==S.setup?(o.mix=o.data.mix+(u+(h[l+St.MIX]-u)*d-o.data.mix)*r,a==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=h[l+St.PREV_BEND_DIRECTION],o.compress=h[l+St.PREV_COMPRESS]!=0,o.stretch=h[l+St.PREV_STRETCH]!=0)):(o.mix+=(u+(h[l+St.MIX]-u)*d-o.mix)*r,a==At.mixIn&&(o.bendDirection=h[l+St.PREV_BEND_DIRECTION],o.compress=h[l+St.PREV_COMPRESS]!=0,o.stretch=h[l+St.PREV_STRETCH]!=0))}};let _s=St;_s.ENTRIES=5,_s.PREV_TIME=-5,_s.PREV_MIX=-4,_s.PREV_BEND_DIRECTION=-3,_s.PREV_COMPRESS=-2,_s.PREV_STRETCH=-1,_s.MIX=1,_s.BEND_DIRECTION=2,_s.COMPRESS=3,_s.STRETCH=4;const Wt=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Wt.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(i,t,e,s,r,n){i*=Wt.ENTRIES,this.frames[i]=t,this.frames[i+Wt.ROTATE]=e,this.frames[i+Wt.TRANSLATE]=s,this.frames[i+Wt.SCALE]=r,this.frames[i+Wt.SHEAR]=n}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.transformConstraints[this.transformConstraintIndex];if(e<h[0]){const f=o.data;switch(n){case S.setup:o.rotateMix=f.rotateMix,o.translateMix=f.translateMix,o.scaleMix=f.scaleMix,o.shearMix=f.shearMix;return;case S.first:o.rotateMix+=(f.rotateMix-o.rotateMix)*r,o.translateMix+=(f.translateMix-o.translateMix)*r,o.scaleMix+=(f.scaleMix-o.scaleMix)*r,o.shearMix+=(f.shearMix-o.shearMix)*r}return}let l=0,u=0,c=0,d=0;if(e>=h[h.length-Wt.ENTRIES]){const f=h.length;l=h[f+Wt.PREV_ROTATE],u=h[f+Wt.PREV_TRANSLATE],c=h[f+Wt.PREV_SCALE],d=h[f+Wt.PREV_SHEAR]}else{const f=Ee.binarySearch(h,e,Wt.ENTRIES);l=h[f+Wt.PREV_ROTATE],u=h[f+Wt.PREV_TRANSLATE],c=h[f+Wt.PREV_SCALE],d=h[f+Wt.PREV_SHEAR];const p=h[f],m=this.getCurvePercent(f/Wt.ENTRIES-1,1-(e-p)/(h[f+Wt.PREV_TIME]-p));l+=(h[f+Wt.ROTATE]-l)*m,u+=(h[f+Wt.TRANSLATE]-u)*m,c+=(h[f+Wt.SCALE]-c)*m,d+=(h[f+Wt.SHEAR]-d)*m}if(n==S.setup){const f=o.data;o.rotateMix=f.rotateMix+(l-f.rotateMix)*r,o.translateMix=f.translateMix+(u-f.translateMix)*r,o.scaleMix=f.scaleMix+(c-f.scaleMix)*r,o.shearMix=f.shearMix+(d-f.shearMix)*r}else o.rotateMix+=(l-o.rotateMix)*r,o.translateMix+=(u-o.translateMix)*r,o.scaleMix+=(c-o.scaleMix)*r,o.shearMix+=(d-o.shearMix)*r}};let ys=Wt;ys.ENTRIES=5,ys.PREV_TIME=-5,ys.PREV_ROTATE=-4,ys.PREV_TRANSLATE=-3,ys.PREV_SCALE=-2,ys.PREV_SHEAR=-1,ys.ROTATE=1,ys.TRANSLATE=2,ys.SCALE=3,ys.SHEAR=4;const Ps=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Ps.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(i,t,e){i*=Ps.ENTRIES,this.frames[i]=t,this.frames[i+Ps.VALUE]=e}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.pathConstraints[this.pathConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.position=o.data.position;return;case S.first:o.position+=(o.data.position-o.position)*r}return}let l=0;if(e>=h[h.length-Ps.ENTRIES])l=h[h.length+Ps.PREV_VALUE];else{const u=Ee.binarySearch(h,e,Ps.ENTRIES);l=h[u+Ps.PREV_VALUE];const c=h[u],d=this.getCurvePercent(u/Ps.ENTRIES-1,1-(e-c)/(h[u+Ps.PREV_TIME]-c));l+=(h[u+Ps.VALUE]-l)*d}n==S.setup?o.position=o.data.position+(l-o.data.position)*r:o.position+=(l-o.position)*r}};let Hi=Ps;Hi.ENTRIES=2,Hi.PREV_TIME=-2,Hi.PREV_VALUE=-1,Hi.VALUE=1;let gC=class ui extends Hi{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(s<o[0]){switch(a){case S.setup:l.spacing=l.data.spacing;return;case S.first:l.spacing+=(l.data.spacing-l.spacing)*n}return}let u=0;if(s>=o[o.length-ui.ENTRIES])u=o[o.length+ui.PREV_VALUE];else{const c=Ee.binarySearch(o,s,ui.ENTRIES);u=o[c+ui.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/ui.ENTRIES-1,1-(s-d)/(o[c+ui.PREV_TIME]-d));u+=(o[c+ui.VALUE]-u)*f}a==S.setup?l.spacing=l.data.spacing+(u-l.data.spacing)*n:l.spacing+=(u-l.spacing)*n}};const Oe=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Oe.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(i,t,e,s){i*=Oe.ENTRIES,this.frames[i]=t,this.frames[i+Oe.ROTATE]=e,this.frames[i+Oe.TRANSLATE]=s}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.pathConstraints[this.pathConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.rotateMix=o.data.rotateMix,o.translateMix=o.data.translateMix;return;case S.first:o.rotateMix+=(o.data.rotateMix-o.rotateMix)*r,o.translateMix+=(o.data.translateMix-o.translateMix)*r}return}let l=0,u=0;if(e>=h[h.length-Oe.ENTRIES])l=h[h.length+Oe.PREV_ROTATE],u=h[h.length+Oe.PREV_TRANSLATE];else{const c=Ee.binarySearch(h,e,Oe.ENTRIES);l=h[c+Oe.PREV_ROTATE],u=h[c+Oe.PREV_TRANSLATE];const d=h[c],f=this.getCurvePercent(c/Oe.ENTRIES-1,1-(e-d)/(h[c+Oe.PREV_TIME]-d));l+=(h[c+Oe.ROTATE]-l)*f,u+=(h[c+Oe.TRANSLATE]-u)*f}n==S.setup?(o.rotateMix=o.data.rotateMix+(l-o.data.rotateMix)*r,o.translateMix=o.data.translateMix+(u-o.data.translateMix)*r):(o.rotateMix+=(l-o.rotateMix)*r,o.translateMix+=(u-o.translateMix)*r)}};let ri=Oe;ri.ENTRIES=3,ri.PREV_TIME=-3,ri.PREV_ROTATE=-2,ri.PREV_TRANSLATE=-1,ri.ROTATE=1,ri.TRANSLATE=2,new Ee("<empty>",[],0);let _C=class{constructor(t){this.atlas=t}newRegionAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);const n=new nt(e);return n.region=r,n}newMeshAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);const n=new oC(e);return n.region=r,n}newBoundingBoxAttachment(t,e){return new iC(e)}newPathAttachment(t,e){return new aC(e)}newPointAttachment(t,e){return new lC(e)}newClippingAttachment(t,e){return new nC(e)}},yC=class{constructor(t,e,s){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=vt.Normal,t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},xC=class{constructor(t,e){if(e==null)throw new Error("data cannot be null.");this.time=t,this.data=e}},vC=class{constructor(t){this.name=t}},bC=class{constructor(t){this.order=0,this.bones=new Array,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.name=t}},wC=class{constructor(t){this.order=0,this.bones=new Array,this.name=t}};var ii=(i=>(i[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",i))(ii||{});let EC=class{constructor(){this.bones=new Array,this.slots=new Array,this.skins=new Array,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.fps=0}findBone(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findBoneIndex(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSlot(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findSlotIndex(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSkin(t){if(t==null)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findEvent(t){if(t==null)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(t==null)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}},TC=class{constructor(t,e,s){if(this.color=new X(1,1,1,1),t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");if(s==null)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},AC=class{constructor(t){if(this.order=0,this.bones=new Array,this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1,t==null)throw new Error("name cannot be null.");this.name=t}},SC=class{constructor(t){if(this.attachments=new Array,t==null)throw new Error("name cannot be null.");this.name=t}addAttachment(t,e,s){if(s==null)throw new Error("attachment cannot be null.");const r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){const n=t.slots[r],a=n.getAttachment();if(a&&s<e.attachments.length){const h=e.attachments[s];for(const o in h){const l=h[o];if(a==l){const u=this.getAttachment(s,o);u!=null&&n.setAttachment(u);break}}}s++}}},CC=class Gn{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new EC,r=typeof t=="string"?JSON.parse(t):t,n=r.skeleton;if(n!=null&&(s.hash=n.hash,s.version=n.spine,s.width=n.width,s.height=n.height,s.fps=n.fps,s.imagesPath=n.images),r.bones)for(let a=0;a<r.bones.length;a++){const h=r.bones[a];let o=null;const l=this.getValue(h,"parent",null);if(l!=null&&(o=s.findBone(l),o==null))throw new Error(`Parent bone not found: ${l}`);const u=new yC(s.bones.length,h.name,o);u.length=this.getValue(h,"length",0)*e,u.x=this.getValue(h,"x",0)*e,u.y=this.getValue(h,"y",0)*e,u.rotation=this.getValue(h,"rotation",0),u.scaleX=this.getValue(h,"scaleX",1),u.scaleY=this.getValue(h,"scaleY",1),u.shearX=this.getValue(h,"shearX",0),u.shearY=this.getValue(h,"shearY",0),u.transformMode=Gn.transformModeFromString(this.getValue(h,"transform","normal")),s.bones.push(u)}if(r.slots)for(let a=0;a<r.slots.length;a++){const h=r.slots[a],o=h.name,l=h.bone,u=s.findBone(l);if(u==null)throw new Error(`Slot bone not found: ${l}`);const c=new TC(s.slots.length,o,u),d=this.getValue(h,"color",null);d!=null&&c.color.setFromString(d);const f=this.getValue(h,"dark",null);f!=null&&(c.darkColor=new X(1,1,1,1),c.darkColor.setFromString(f)),c.attachmentName=this.getValue(h,"attachment",null),c.blendMode=Gn.blendModeFromString(this.getValue(h,"blend","normal")),s.slots.push(c)}if(r.ik)for(let a=0;a<r.ik.length;a++){const h=r.ik[a],o=new bC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`IK bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`IK target bone not found: ${l}`);o.bendDirection=this.getValue(h,"bendPositive",!0)?1:-1,o.mix=this.getValue(h,"mix",1),s.ikConstraints.push(o)}if(r.transform)for(let a=0;a<r.transform.length;a++){const h=r.transform[a],o=new AC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`Transform constraint target bone not found: ${l}`);o.local=this.getValue(h,"local",!1),o.relative=this.getValue(h,"relative",!1),o.offsetRotation=this.getValue(h,"rotation",0),o.offsetX=this.getValue(h,"x",0)*e,o.offsetY=this.getValue(h,"y",0)*e,o.offsetScaleX=this.getValue(h,"scaleX",0),o.offsetScaleY=this.getValue(h,"scaleY",0),o.offsetShearY=this.getValue(h,"shearY",0),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),o.scaleMix=this.getValue(h,"scaleMix",1),o.shearMix=this.getValue(h,"shearMix",1),s.transformConstraints.push(o)}if(r.path)for(let a=0;a<r.path.length;a++){const h=r.path[a],o=new wC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findSlot(l),o.target==null)throw new Error(`Path target slot not found: ${l}`);o.positionMode=Gn.positionModeFromString(this.getValue(h,"positionMode","percent")),o.spacingMode=Gn.spacingModeFromString(this.getValue(h,"spacingMode","length")),o.rotateMode=Gn.rotateModeFromString(this.getValue(h,"rotateMode","tangent")),o.offsetRotation=this.getValue(h,"rotation",0),o.position=this.getValue(h,"position",0),o.positionMode==ne.Fixed&&(o.position*=e),o.spacing=this.getValue(h,"spacing",0),(o.spacingMode==ii.Length||o.spacingMode==ii.Fixed)&&(o.spacing*=e),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),s.pathConstraints.push(o)}if(r.skins)for(const a in r.skins){const h=r.skins[a],o=new SC(a);for(const l in h){const u=s.findSlotIndex(l);if(u==-1)throw new Error(`Slot not found: ${l}`);const c=h[l];for(const d in c){const f=this.readAttachment(c[d],o,u,d,s);f!=null&&o.addAttachment(u,d,f)}}s.skins.push(o),o.name=="default"&&(s.defaultSkin=o)}for(let a=0,h=this.linkedMeshes.length;a<h;a++){const o=this.linkedMeshes[a],l=o.skin==null?s.defaultSkin:s.findSkin(o.skin);if(l==null)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(u==null)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.setParentMesh(u)}if(this.linkedMeshes.length=0,r.events)for(const a in r.events){const h=r.events[a],o=new vC(a);o.intValue=this.getValue(h,"int",0),o.floatValue=this.getValue(h,"float",0),o.stringValue=this.getValue(h,"string",""),o.audioPath=this.getValue(h,"audio",null),o.audioPath!=null&&(o.volume=this.getValue(h,"volume",1),o.balance=this.getValue(h,"balance",0)),s.events.push(o)}if(r.animations)for(const a in r.animations){const h=r.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,r,n){const a=this.scale;switch(r=this.getValue(t,"name",r),this.getValue(t,"type","region")){case"region":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newRegionAttachment(e,r,o);if(l==null)return null;l.path=o,l.x=this.getValue(t,"x",0)*a,l.y=this.getValue(t,"y",0)*a,l.scaleX=this.getValue(t,"scaleX",1),l.scaleY=this.getValue(t,"scaleY",1),l.rotation=this.getValue(t,"rotation",0),l.width=t.width*a,l.height=t.height*a;const u=this.getValue(t,"color",null);return u!=null&&l.color.setFromString(u),l}case"boundingbox":{const o=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(o==null)return null;this.readVertices(t,o,t.vertexCount<<1);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"mesh":case"linkedmesh":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newMeshAttachment(e,r,o);if(l==null)return null;l.path=o;const u=this.getValue(t,"color",null);u!=null&&l.color.setFromString(u);const c=this.getValue(t,"parent",null);if(c!=null)return l.inheritDeform=this.getValue(t,"deform",!0),this.linkedMeshes.push(new IC(l,this.getValue(t,"skin",null),s,c)),l;const d=t.uvs;return this.readVertices(t,l,d.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(d),l.hullLength=this.getValue(t,"hull",0)*2,l}case"path":{const o=this.attachmentLoader.newPathAttachment(e,r);if(o==null)return null;o.closed=this.getValue(t,"closed",!1),o.constantSpeed=this.getValue(t,"constantSpeed",!0);const l=t.vertexCount;this.readVertices(t,o,l<<1);const u=B.newArray(l/3,0);for(let d=0;d<t.lengths.length;d++)u[d]=t.lengths[d]*a;o.lengths=u;const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}case"point":{const o=this.attachmentLoader.newPointAttachment(e,r);if(o==null)return null;o.x=this.getValue(t,"x",0)*a,o.y=this.getValue(t,"y",0)*a,o.rotation=this.getValue(t,"rotation",0);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"clipping":{const o=this.attachmentLoader.newClippingAttachment(e,r);if(o==null)return null;const l=this.getValue(t,"end",null);if(l!=null){const d=n.findSlot(l);if(d==null)throw new Error(`Clipping end slot not found: ${l}`);o.endSlot=d}const u=t.vertexCount;this.readVertices(t,o,u<<1);const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}}return null}readVertices(t,e,s){const r=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(r!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=r;e.vertices=o;return}const a=new Array,h=new Array;for(let o=0,l=n.length;o<l;){const u=n[o++];h.push(u);for(let c=o+u*4;o<c;o+=4)h.push(n[o]),a.push(n[o+1]*r),a.push(n[o+2]*r),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const r=this.scale,n=new Array;let a=0;if(t.slots)for(const o in t.slots){const l=t.slots[o],u=s.findSlotIndex(o);if(u==-1)throw new Error(`Slot not found: ${o}`);for(const c in l){const d=l[c];if(c=="attachment"){const f=new dC(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p++,g.time,g.name)}n.push(f),a=Math.max(a,f.frames[f.getFrameCount()-1])}else if(c=="color"){const f=new gs(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X;_.setFromString(g.color||"ffffffff"),f.setFrame(p,g.time,_.r,_.g,_.b,_.a),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*gs.ENTRIES])}else if(c=="twoColor"){const f=new ye(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X,x=new X;_.setFromString(g.light),x.setFromString(g.dark),f.setFrame(p,g.time,_.r,_.g,_.b,_.a,x.r,x.g,x.b),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ye.ENTRIES])}else throw new Error(`Invalid timeline type for a slot: ${c} (${o})`)}}if(t.bones)for(const o in t.bones){const l=t.bones[o],u=s.findBoneIndex(o);if(u==-1)throw new Error(`Bone not found: ${o}`);for(const c in l){const d=l[c];if(c==="rotate"){const f=new Mn(d.length);f.boneIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p,g.time,g.angle),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*Mn.ENTRIES])}else if(c==="translate"||c==="scale"||c==="shear"){let f=null,p=1;c==="scale"?f=new cC(d.length):c==="shear"?f=new uC(d.length):(f=new ar(d.length),p=r),f.boneIndex=u;let m=0;for(let g=0;g<d.length;g++){const _=d[g],x=this.getValue(_,"x",0),y=this.getValue(_,"y",0);f.setFrame(m,_.time,x*p,y*p),this.readCurve(_,f,m),m++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ar.ENTRIES])}else throw new Error(`Invalid timeline type for a bone: ${c} (${o})`)}}if(t.ik)for(const o in t.ik){const l=t.ik[o],u=s.findIkConstraint(o),c=new _s(l.length);c.ikConstraintIndex=s.ikConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,p.time,this.getValue(p,"mix",1),this.getValue(p,"bendPositive",!0)?1:-1,this.getValue(p,"compress",!1),this.getValue(p,"stretch",!1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*_s.ENTRIES])}if(t.transform)for(const o in t.transform){const l=t.transform[o],u=s.findTransformConstraint(o),c=new ys(l.length);c.transformConstraintIndex=s.transformConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,p.time,this.getValue(p,"rotateMix",1),this.getValue(p,"translateMix",1),this.getValue(p,"scaleMix",1),this.getValue(p,"shearMix",1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*ys.ENTRIES])}if(t.paths)for(const o in t.paths){const l=t.paths[o],u=s.findPathConstraintIndex(o);if(u==-1)throw new Error(`Path constraint not found: ${o}`);const c=s.pathConstraints[u];for(const d in l){const f=l[d];if(d==="position"||d==="spacing"){let p=null,m=1;d==="spacing"?(p=new gC(f.length),(c.spacingMode==ii.Length||c.spacingMode==ii.Fixed)&&(m=r)):(p=new Hi(f.length),c.positionMode==ne.Fixed&&(m=r)),p.pathConstraintIndex=u;let g=0;for(let _=0;_<f.length;_++){const x=f[_];p.setFrame(g,x.time,this.getValue(x,d,0)*m),this.readCurve(x,p,g),g++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*Hi.ENTRIES])}else if(d==="mix"){const p=new ri(f.length);p.pathConstraintIndex=u;let m=0;for(let g=0;g<f.length;g++){const _=f[g];p.setFrame(m,_.time,this.getValue(_,"rotateMix",1),this.getValue(_,"translateMix",1)),this.readCurve(_,p,m),m++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*ri.ENTRIES])}}}if(t.deform)for(const o in t.deform){const l=t.deform[o],u=s.findSkin(o);if(u!=null)for(const c in l){const d=l[c],f=s.findSlotIndex(c);if(f==-1)throw new Error(`Slot not found: ${d.name}`);for(const p in d){const m=d[p],g=u.getAttachment(f,p);if(g==null)throw new Error(`Deform attachment not found: ${m.name}`);const _=g.bones!=null,x=g.vertices,y=_?x.length/3*2:x.length,v=new fC(m.length);v.slotIndex=f,v.attachment=g;let b=0;for(let w=0;w<m.length;w++){const E=m[w];let T;const A=this.getValue(E,"vertices",null);if(A==null)T=_?B.newFloatArray(y):x;else{T=B.newFloatArray(y);const I=this.getValue(E,"offset",0);if(B.arrayCopy(A,0,T,I,A.length),r!=1)for(let M=I,R=M+A.length;M<R;M++)T[M]*=r;if(!_)for(let M=0;M<y;M++)T[M]+=x[M]}v.setFrame(b,E.time,T),this.readCurve(E,v,b),b++}n.push(v),a=Math.max(a,v.frames[v.getFrameCount()-1])}}}let h=t.drawOrder;if(h==null&&(h=t.draworder),h!=null){const o=new mC(h.length),l=s.slots.length;let u=0;for(let c=0;c<h.length;c++){const d=h[c];let f=null;const p=this.getValue(d,"offsets",null);if(p!=null){f=B.newArray(l,-1);const m=B.newArray(l-p.length,0);let g=0,_=0;for(let x=0;x<p.length;x++){const y=p[x],v=s.findSlotIndex(y.slot);if(v==-1)throw new Error(`Slot not found: ${y.slot}`);for(;g!=v;)m[_++]=g++;f[g+y.offset]=g++}for(;g<l;)m[_++]=g++;for(let x=l-1;x>=0;x--)f[x]==-1&&(f[x]=m[--_])}o.setFrame(u++,d.time,f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(t.events){const o=new pC(t.events.length);let l=0;for(let u=0;u<t.events.length;u++){const c=t.events[u],d=s.findEvent(c.name);if(d==null)throw new Error(`Event not found: ${c.name}`);const f=new xC(B.toSinglePrecision(c.time),d);f.intValue=this.getValue(c,"int",d.intValue),f.floatValue=this.getValue(c,"float",d.floatValue),f.stringValue=this.getValue(c,"string",d.stringValue),f.data.audioPath!=null&&(f.volume=this.getValue(c,"volume",1),f.balance=this.getValue(c,"balance",0)),o.setFrame(l++,f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(isNaN(a))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new Ee(e,n,a))}readCurve(t,e,s){if(t.curve){if(t.curve==="stepped")e.setStepped(s);else if(Object.prototype.toString.call(t.curve)==="[object Array]"){const r=t.curve;e.setCurve(s,r[0],r[1],r[2],r[3])}}}getValue(t,e,s){return t[e]!==void 0?t[e]:s}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return W.NORMAL;if(t=="additive")return W.ADD;if(t=="multiply")return W.MULTIPLY;if(t=="screen")return W.SCREEN;throw new Error(`Unknown blend mode: ${t}`)}static positionModeFromString(t){if(t=t.toLowerCase(),t=="fixed")return ne.Fixed;if(t=="percent")return ne.Percent;throw new Error(`Unknown position mode: ${t}`)}static spacingModeFromString(t){if(t=t.toLowerCase(),t=="length")return ii.Length;if(t=="fixed")return ii.Fixed;if(t=="percent")return ii.Percent;throw new Error(`Unknown position mode: ${t}`)}static rotateModeFromString(t){if(t=t.toLowerCase(),t=="tangent")return Fe.Tangent;if(t=="chain")return Fe.Chain;if(t=="chainscale")return Fe.ChainScale;throw new Error(`Unknown rotate mode: ${t}`)}static transformModeFromString(t){if(t=t.toLowerCase(),t=="normal")return vt.Normal;if(t=="onlytranslation")return vt.OnlyTranslation;if(t=="norotationorreflection")return vt.NoRotationOrReflection;if(t=="noscale")return vt.NoScale;if(t=="noscaleorreflection")return vt.NoScaleOrReflection;throw new Error(`Unknown transform mode: ${t}`)}},IC=class{constructor(t,e,s,r){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r}};class e0{constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}}const s0=class extends e0{constructor(i){super(i),this.id=s0.nextID++,this.bones=null,this.vertices=[],this.worldVerticesLength=0,this.timelineAttachment=this}computeWorldVerticesOld(i,t){this.computeWorldVertices(i,0,this.worldVerticesLength,t,0,2)}computeWorldVertices(i,t,e,s,r,n){e=r+(e>>1)*n;const a=i.bone.skeleton,h=i.deform;let o=this.vertices;const l=this.bones;if(!l){h.length>0&&(o=h);const f=i.bone.matrix,p=f.tx,m=f.ty,g=f.a,_=f.c,x=f.b,y=f.d;for(let v=t,b=r;b<e;v+=2,b+=n){const w=o[v],E=o[v+1];s[b]=w*g+E*_+p,s[b+1]=w*x+E*y+m}return}let u=0,c=0;for(let f=0;f<t;f+=2){const p=l[u];u+=p+1,c+=p}const d=a.bones;if(h.length==0)for(let f=r,p=c*3;f<e;f+=n){let m=0,g=0,_=l[u++];for(_+=u;u<_;u++,p+=3){const x=d[l[u]].matrix,y=o[p],v=o[p+1],b=o[p+2];m+=(y*x.a+v*x.c+x.tx)*b,g+=(y*x.b+v*x.d+x.ty)*b}s[f]=m,s[f+1]=g}else{const f=h;for(let p=r,m=c*3,g=c<<1;p<e;p+=n){let _=0,x=0,y=l[u++];for(y+=u;u<y;u++,m+=3,g+=2){const v=d[l[u]].matrix,b=o[m]+f[g],w=o[m+1]+f[g+1],E=o[m+2];_+=(b*v.a+w*v.c+v.tx)*E,x+=(b*v.b+w*v.d+v.ty)*E}s[p]=_,s[p+1]=x}}}copyTo(i){this.bones?(i.bones=new Array(this.bones.length),B.arrayCopy(this.bones,0,i.bones,0,this.bones.length)):i.bones=null,this.vertices&&(i.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,i.vertices,0,this.vertices.length)),i.worldVerticesLength=this.worldVerticesLength,i.timelineAttachment=this.timelineAttachment}};let ni=s0;ni.nextID=0;class qu extends ni{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}copy(){const t=new qu(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class Zu extends ni{constructor(t){super(t),this.type=at.Clipping,this.endSlot=null,this.color=new X(.2275,.2275,.8078,1)}copy(){const t=new Zu(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class Mo extends ni{constructor(t,e){super(t),this.type=at.Mesh,this.region=null,this.triangles=[],this.color=new X(1,1,1,1),this.width=0,this.height=0,this.hullLength=0,this.edges=[],this.parentMesh=null,this.sequence=null,this.tempColor=new X(0,0,0,0),this.path=e}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();const t=new Mo(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Float32Array(this.regionUVs.length),B.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=new Array(this.triangles.length),B.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),B.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,r,n,a){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,r,n,a)}newLinkedMesh(){const t=new Mo(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),t}}class Ku extends ni{constructor(t){super(t),this.type=at.Path,this.lengths=[],this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}copy(){const t=new Ku(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),B.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class Qu extends ni{constructor(t){super(t),this.type=at.Point,this.x=0,this.y=0,this.rotation=0,this.color=new X(.38,.94,0,1)}computeWorldPosition(t,e){const s=t.matrix;return e.x=this.x*s.a+this.y*s.c+t.worldX,e.y=this.x*s.b+this.y*s.d+t.worldY,e}computeWorldRotation(t){const e=t.matrix,s=D.cosDeg(this.rotation),r=D.sinDeg(this.rotation),n=s*e.a+r*e.c,a=s*e.b+r*e.d;return Math.atan2(a,n)*D.radDeg}copy(){const t=new Qu(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}const r0=class extends e0{constructor(i,t){super(i),this.type=at.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new X(1,1,1,1),this.rendererObject=null,this.region=null,this.sequence=null,this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new X(1,1,1,1),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");const i=this.region,t=this.width/this.region.originalWidth*this.scaleX,e=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*t,r=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=r+this.region.height*e,h=this.rotation*Math.PI/180,o=Math.cos(h),l=Math.sin(h),u=this.x,c=this.y,d=s*o+u,f=s*l,p=r*o+c,m=r*l,g=n*o+u,_=n*l,x=a*o+c,y=a*l,v=this.offset;v[0]=d-m,v[1]=p+f,v[2]=d-y,v[3]=x+f,v[4]=g-y,v[5]=x+_,v[6]=g-m,v[7]=p+_;const b=this.uvs;i.degrees==90?(b[2]=i.u,b[3]=i.v2,b[4]=i.u,b[5]=i.v,b[6]=i.u2,b[7]=i.v,b[0]=i.u2,b[1]=i.v2):(b[0]=i.u,b[1]=i.v2,b[2]=i.u,b[3]=i.v,b[4]=i.u2,b[5]=i.v,b[6]=i.u2,b[7]=i.v2)}computeWorldVertices(i,t,e,s){this.sequence!=null&&this.sequence.apply(i,this);const r=i.bone,n=this.offset,a=r.matrix,h=a.tx,o=a.ty,l=a.a,u=a.c,c=a.b,d=a.d;let f=0,p=0;f=n[0],p=n[1],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[2],p=n[3],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[4],p=n[5],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[6],p=n[7],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o}copy(){const i=new r0(this.name,this.path);return i.region=this.region,i.rendererObject=this.rendererObject,i.x=this.x,i.y=this.y,i.scaleX=this.scaleX,i.scaleY=this.scaleY,i.rotation=this.rotation,i.width=this.width,i.height=this.height,B.arrayCopy(this.uvs,0,i.uvs,0,8),B.arrayCopy(this.offset,0,i.offset,0,8),i.color.setFromColor(this.color),i.sequence=this.sequence!=null?this.sequence.copy():null,i}};let gt=r0;gt.X1=0,gt.Y1=1,gt.C1R=2,gt.C1G=3,gt.C1B=4,gt.C1A=5,gt.U1=6,gt.V1=7,gt.X2=8,gt.Y2=9,gt.C2R=10,gt.C2G=11,gt.C2B=12,gt.C2A=13,gt.U2=14,gt.V2=15,gt.X3=16,gt.Y3=17,gt.C3R=18,gt.C3G=19,gt.C3B=20,gt.C3A=21,gt.U3=22,gt.V3=23,gt.X4=24,gt.Y4=25,gt.C4R=26,gt.C4G=27,gt.C4B=28,gt.C4A=29,gt.U4=30,gt.V4=31;const yl=class{constructor(i){this.id=yl.nextID(),this.start=0,this.digits=0,this.setupIndex=0,this.regions=new Array(i)}copy(){const i=new yl(this.regions.length);return B.arrayCopy(this.regions,0,i.regions,0,this.regions.length),i.start=this.start,i.digits=this.digits,i.setupIndex=this.setupIndex,i}apply(i,t){let e=i.sequenceIndex;e==-1&&(e=this.setupIndex),e>=this.regions.length&&(e=this.regions.length-1);const s=this.regions[e];t.region!=s&&(t.region=s)}getPath(i,t){let e=i;const s=(this.start+t).toString();for(let r=this.digits-s.length;r>0;r--)e+="0";return e+=s,e}static nextID(){return yl._nextID++}};let Ju=yl;Ju._nextID=0;var Pr=(i=>(i[i.hold=0]="hold",i[i.once=1]="once",i[i.loop=2]="loop",i[i.pingpong=3]="pingpong",i[i.onceReverse=4]="onceReverse",i[i.loopReverse=5]="loopReverse",i[i.pingpongReverse=6]="pingpongReverse",i))(Pr||{});const i0=[0,1,2,3,4,5,6];class td{constructor(t,e,s){if(this.timelines=[],this.timelineIds=new LS,!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(let e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,r,n,a,h,o){if(!t)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let u=0,c=l.length;u<c;u++)l[u].apply(t,e,s,n,a,h,o)}}const yt={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,rgb:7,alpha:8,rgb2:9,attachment:10,deform:11,event:12,drawOrder:13,ikConstraint:14,transformConstraint:15,pathConstraintPosition:16,pathConstraintSpacing:17,pathConstraintMix:18,sequence:19};class he{constructor(t,e){this.propertyIds=e,this.frames=B.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){const s=t.length;for(let r=1;r<s;r++)if(t[r]>e)return r-1;return s-1}static search(t,e,s){const r=t.length;for(let n=s;n<r;n+=s)if(t[n]>e)return n-s;return r-s}}class lr extends he{constructor(t,e,s){super(t,s),this.curves=B.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){const e=this.getFrameCount()+t*18;if(this.curves.length>e){const s=B.newFloatArray(e);B.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,r,n,a,h,o,l,u,c){const d=this.curves;let f=this.getFrameCount()+t*18;s==0&&(d[e]=2+f);const p=(r-a*2+o)*.03,m=(n-h*2+l)*.03,g=((a-o)*3-r+u)*.006,_=((h-l)*3-n+c)*.006;let x=p*2+g,y=m*2+_,v=(a-r)*.3+p+g*.16666667,b=(h-n)*.3+m+_*.16666667,w=r+v,E=n+b;for(let T=f+18;f<T;f+=2)d[f]=w,d[f+1]=E,v+=x,b+=y,x+=g,y+=_,w+=v,E+=b}getBezierValue(t,e,s,r){const n=this.curves;if(n[r]>t){const l=this.frames[e],u=this.frames[e+s];return u+(t-l)/(n[r]-l)*(n[r+1]-u)}const a=r+18;for(r+=2;r<a;r+=2)if(n[r]>=t){const l=n[r-2],u=n[r-1];return u+(t-l)/(n[r]-l)*(n[r+1]-u)}e+=this.getFrameEntries();const h=n[a-2],o=n[a-1];return o+(t-h)/(this.frames[e]-h)*(this.frames[e+s]-o)}}class hr extends lr{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){const e=this.frames;let s=e.length-2;for(let n=2;n<=s;n+=2)if(e[n]>t){s=n-2;break}const r=this.curves[s>>1];switch(r){case 0:const n=e[s],a=e[s+1];return a+(t-n)/(e[s+2]-n)*(e[s+2+1]-a);case 1:return e[s+1]}return this.getBezierValue(t,s,1,r-2)}}class ed extends lr{constructor(t,e,s,r){super(t,e,[s,r])}getFrameEntries(){return 3}setFrame(t,e,s,r){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r}}class n0 extends hr{constructor(t,e,s){super(t,e,`${yt.rotate}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.rotation=o.data.rotation;return;case S.first:o.rotation+=(o.data.rotation-o.rotation)*n}return}let u=this.getCurveValue(s);switch(a){case S.setup:o.rotation=o.data.rotation+u*n;break;case S.first:case S.replace:u+=o.data.rotation-o.rotation;case S.add:o.rotation+=u*n}}}class o0 extends ed{constructor(t,e,s){super(t,e,`${yt.x}|${s}`,`${yt.y}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.x=o.data.x,o.y=o.data.y;return;case S.first:o.x+=(o.data.x-o.x)*n,o.y+=(o.data.y-o.y)*n}return}let u=0,c=0;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(a){case S.setup:o.x=o.data.x+u*n,o.y=o.data.y+c*n;break;case S.first:case S.replace:o.x+=(o.data.x+u-o.x)*n,o.y+=(o.data.y+c-o.y)*n;break;case S.add:o.x+=u*n,o.y+=c*n}}}class a0 extends hr{constructor(t,e,s){super(t,e,`${yt.x}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.x=o.data.x;return;case S.first:o.x+=(o.data.x-o.x)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.x=o.data.x+u*n;break;case S.first:case S.replace:o.x+=(o.data.x+u-o.x)*n;break;case S.add:o.x+=u*n}}}class l0 extends hr{constructor(t,e,s){super(t,e,`${yt.y}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.y=o.data.y;return;case S.first:o.y+=(o.data.y-o.y)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.y=o.data.y+u*n;break;case S.first:case S.replace:o.y+=(o.data.y+u-o.y)*n;break;case S.add:o.y+=u*n}}}class h0 extends ed{constructor(t,e,s){super(t,e,`${yt.scaleX}|${s}`,`${yt.scaleY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleX=o.data.scaleX,o.scaleY=o.data.scaleY;return;case S.first:o.scaleX+=(o.data.scaleX-o.scaleX)*n,o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}let u,c;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}if(u*=o.data.scaleX,c*=o.data.scaleY,n==1)a==S.add?(o.scaleX+=u-o.data.scaleX,o.scaleY+=c-o.data.scaleY):(o.scaleX=u,o.scaleY=c);else{let p=0,m=0;if(h==At.mixOut)switch(a){case S.setup:p=o.data.scaleX,m=o.data.scaleY,o.scaleX=p+(Math.abs(u)*D.signum(p)-p)*n,o.scaleY=m+(Math.abs(c)*D.signum(m)-m)*n;break;case S.first:case S.replace:p=o.scaleX,m=o.scaleY,o.scaleX=p+(Math.abs(u)*D.signum(p)-p)*n,o.scaleY=m+(Math.abs(c)*D.signum(m)-m)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n,o.scaleY+=(c-o.data.scaleY)*n}else switch(a){case S.setup:p=Math.abs(o.data.scaleX)*D.signum(u),m=Math.abs(o.data.scaleY)*D.signum(c),o.scaleX=p+(u-p)*n,o.scaleY=m+(c-m)*n;break;case S.first:case S.replace:p=Math.abs(o.scaleX)*D.signum(u),m=Math.abs(o.scaleY)*D.signum(c),o.scaleX=p+(u-p)*n,o.scaleY=m+(c-m)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n,o.scaleY+=(c-o.data.scaleY)*n}}}}class c0 extends hr{constructor(t,e,s){super(t,e,`${yt.scaleX}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleX=o.data.scaleX;return;case S.first:o.scaleX+=(o.data.scaleX-o.scaleX)*n}return}const u=this.getCurveValue(s)*o.data.scaleX;if(n==1)a==S.add?o.scaleX+=u-o.data.scaleX:o.scaleX=u;else{let c=0;if(h==At.mixOut)switch(a){case S.setup:c=o.data.scaleX,o.scaleX=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.first:case S.replace:c=o.scaleX,o.scaleX=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n}else switch(a){case S.setup:c=Math.abs(o.data.scaleX)*D.signum(u),o.scaleX=c+(u-c)*n;break;case S.first:case S.replace:c=Math.abs(o.scaleX)*D.signum(u),o.scaleX=c+(u-c)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n}}}}class u0 extends hr{constructor(t,e,s){super(t,e,`${yt.scaleY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleY=o.data.scaleY;return;case S.first:o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}const u=this.getCurveValue(s)*o.data.scaleY;if(n==1)a==S.add?o.scaleY+=u-o.data.scaleY:o.scaleY=u;else{let c=0;if(h==At.mixOut)switch(a){case S.setup:c=o.data.scaleY,o.scaleY=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.first:case S.replace:c=o.scaleY,o.scaleY=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.add:o.scaleY+=(u-o.data.scaleY)*n}else switch(a){case S.setup:c=Math.abs(o.data.scaleY)*D.signum(u),o.scaleY=c+(u-c)*n;break;case S.first:case S.replace:c=Math.abs(o.scaleY)*D.signum(u),o.scaleY=c+(u-c)*n;break;case S.add:o.scaleY+=(u-o.data.scaleY)*n}}}}class d0 extends ed{constructor(t,e,s){super(t,e,`${yt.shearX}|${s}`,`${yt.shearY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearX=o.data.shearX,o.shearY=o.data.shearY;return;case S.first:o.shearX+=(o.data.shearX-o.shearX)*n,o.shearY+=(o.data.shearY-o.shearY)*n}return}let u=0,c=0;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(a){case S.setup:o.shearX=o.data.shearX+u*n,o.shearY=o.data.shearY+c*n;break;case S.first:case S.replace:o.shearX+=(o.data.shearX+u-o.shearX)*n,o.shearY+=(o.data.shearY+c-o.shearY)*n;break;case S.add:o.shearX+=u*n,o.shearY+=c*n}}}class f0 extends hr{constructor(t,e,s){super(t,e,`${yt.shearX}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearX=o.data.shearX;return;case S.first:o.shearX+=(o.data.shearX-o.shearX)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.shearX=o.data.shearX+u*n;break;case S.first:case S.replace:o.shearX+=(o.data.shearX+u-o.shearX)*n;break;case S.add:o.shearX+=u*n}}}class p0 extends hr{constructor(t,e,s){super(t,e,`${yt.shearY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearY=o.data.shearY;return;case S.first:o.shearY+=(o.data.shearY-o.shearY)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.shearY=o.data.shearY+u*n;break;case S.first:case S.replace:o.shearY+=(o.data.shearY+u-o.shearY)*n;break;case S.add:o.shearY+=u*n}}}class m0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.alpha}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,r,n,a){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color;if(s<l[0]){const _=o.data.color;switch(a){case S.setup:u.setFromColor(_);return;case S.first:u.add((_.r-u.r)*n,(_.g-u.g)*n,(_.b-u.b)*n,(_.a-u.a)*n)}return}let c=0,d=0,f=0,p=0;const m=he.search(l,s,5),g=this.curves[m/5];switch(g){case 0:const _=l[m];c=l[m+1],d=l[m+2],f=l[m+3],p=l[m+4];const x=(s-_)/(l[m+5]-_);c+=(l[m+5+1]-c)*x,d+=(l[m+5+2]-d)*x,f+=(l[m+5+3]-f)*x,p+=(l[m+5+4]-p)*x;break;case 1:c=l[m+1],d=l[m+2],f=l[m+3],p=l[m+4];break;default:c=this.getBezierValue(s,m,1,g-2),d=this.getBezierValue(s,m,2,g+18-2),f=this.getBezierValue(s,m,3,g+18*2-2),p=this.getBezierValue(s,m,4,g+18*3-2)}n==1?u.set(c,d,f,p):(a==S.setup&&u.setFromColor(o.data.color),u.add((c-u.r)*n,(d-u.g)*n,(f-u.b)*n,(p-u.a)*n))}}class g0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,n){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color;if(s<l[0]){const g=o.data.color;switch(a){case S.setup:u.r=g.r,u.g=g.g,u.b=g.b;return;case S.first:u.r+=(g.r-u.r)*n,u.g+=(g.g-u.g)*n,u.b+=(g.b-u.b)*n}return}let c=0,d=0,f=0;const p=he.search(l,s,4),m=this.curves[p>>2];switch(m){case 0:const g=l[p];c=l[p+1],d=l[p+2],f=l[p+3];const _=(s-g)/(l[p+4]-g);c+=(l[p+4+1]-c)*_,d+=(l[p+4+2]-d)*_,f+=(l[p+4+3]-f)*_;break;case 1:c=l[p+1],d=l[p+2],f=l[p+3];break;default:c=this.getBezierValue(s,p,1,m-2),d=this.getBezierValue(s,p,2,m+18-2),f=this.getBezierValue(s,p,3,m+18*2-2)}if(n==1)u.r=c,u.g=d,u.b=f;else{if(a==S.setup){const g=o.data.color;u.r=g.r,u.g=g.g,u.b=g.b}u.r+=(c-u.r)*n,u.g+=(d-u.g)*n,u.b+=(f-u.b)*n}}}class _0 extends hr{constructor(t,e,s){super(t,e,`${yt.alpha}|${s}`),this.slotIndex=0,this.slotIndex=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.color;if(s<this.frames[0]){const c=o.data.color;switch(a){case S.setup:l.a=c.a;return;case S.first:l.a+=(c.a-l.a)*n}return}const u=this.getCurveValue(s);n==1?l.a=u:(a==S.setup&&(l.a=o.data.color.a),l.a+=(u-l.a)*n)}}class y0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.alpha}|${s}`,`${yt.rgb2}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,r,n,a,h,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a,this.frames[t+5]=h,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color,c=o.darkColor;if(s<l[0]){const b=o.data.color,w=o.data.darkColor;switch(a){case S.setup:u.setFromColor(b),c.r=w.r,c.g=w.g,c.b=w.b;return;case S.first:u.add((b.r-u.r)*n,(b.g-u.g)*n,(b.b-u.b)*n,(b.a-u.a)*n),c.r+=(w.r-c.r)*n,c.g+=(w.g-c.g)*n,c.b+=(w.b-c.b)*n}return}let d=0,f=0,p=0,m=0,g=0,_=0,x=0;const y=he.search(l,s,8),v=this.curves[y>>3];switch(v){case 0:const b=l[y];d=l[y+1],f=l[y+2],p=l[y+3],m=l[y+4],g=l[y+5],_=l[y+6],x=l[y+7];const w=(s-b)/(l[y+8]-b);d+=(l[y+8+1]-d)*w,f+=(l[y+8+2]-f)*w,p+=(l[y+8+3]-p)*w,m+=(l[y+8+4]-m)*w,g+=(l[y+8+5]-g)*w,_+=(l[y+8+6]-_)*w,x+=(l[y+8+7]-x)*w;break;case 1:d=l[y+1],f=l[y+2],p=l[y+3],m=l[y+4],g=l[y+5],_=l[y+6],x=l[y+7];break;default:d=this.getBezierValue(s,y,1,v-2),f=this.getBezierValue(s,y,2,v+18-2),p=this.getBezierValue(s,y,3,v+18*2-2),m=this.getBezierValue(s,y,4,v+18*3-2),g=this.getBezierValue(s,y,5,v+18*4-2),_=this.getBezierValue(s,y,6,v+18*5-2),x=this.getBezierValue(s,y,7,v+18*6-2)}if(n==1)u.set(d,f,p,m),c.r=g,c.g=_,c.b=x;else{if(a==S.setup){u.setFromColor(o.data.color);const b=o.data.darkColor;c.r=b.r,c.g=b.g,c.b=b.b}u.add((d-u.r)*n,(f-u.g)*n,(p-u.b)*n,(m-u.a)*n),c.r+=(g-c.r)*n,c.g+=(_-c.g)*n,c.b+=(x-c.b)*n}}}class x0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.rgb2}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,n,a,h,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a,this.frames[t+5]=h,this.frames[t+6]=o}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color,c=o.darkColor;if(s<l[0]){const v=o.data.color,b=o.data.darkColor;switch(a){case S.setup:u.r=v.r,u.g=v.g,u.b=v.b,c.r=b.r,c.g=b.g,c.b=b.b;return;case S.first:u.r+=(v.r-u.r)*n,u.g+=(v.g-u.g)*n,u.b+=(v.b-u.b)*n,c.r+=(b.r-c.r)*n,c.g+=(b.g-c.g)*n,c.b+=(b.b-c.b)*n}return}let d=0,f=0,p=0,m=0,g=0,_=0;const x=he.search(l,s,7),y=this.curves[x/7];switch(y){case 0:const v=l[x];d=l[x+1],f=l[x+2],p=l[x+3],m=l[x+4],g=l[x+5],_=l[x+6];const b=(s-v)/(l[x+7]-v);d+=(l[x+7+1]-d)*b,f+=(l[x+7+2]-f)*b,p+=(l[x+7+3]-p)*b,m+=(l[x+7+4]-m)*b,g+=(l[x+7+5]-g)*b,_+=(l[x+7+6]-_)*b;break;case 1:d=l[x+1],f=l[x+2],p=l[x+3],m=l[x+4],g=l[x+5],_=l[x+6];break;default:d=this.getBezierValue(s,x,1,y-2),f=this.getBezierValue(s,x,2,y+18-2),p=this.getBezierValue(s,x,3,y+18*2-2),m=this.getBezierValue(s,x,4,y+18*3-2),g=this.getBezierValue(s,x,5,y+18*4-2),_=this.getBezierValue(s,x,6,y+18*5-2)}if(n==1)u.r=d,u.g=f,u.b=p,c.r=m,c.g=g,c.b=_;else{if(a==S.setup){const v=o.data.color,b=o.data.darkColor;u.r=v.r,u.g=v.g,u.b=v.b,c.r=b.r,c.g=b.g,c.b=b.b}u.r+=(d-u.r)*n,u.g+=(f-u.g)*n,u.b+=(p-u.b)*n,c.r+=(m-c.r)*n,c.g+=(g-c.g)*n,c.b+=(_-c.b)*n}}}class v0 extends he{constructor(t,e){super(t,[`${yt.attachment}|${e}`]),this.slotIndex=0,this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(o.bone.active){if(h==At.mixOut){a==S.setup&&this.setAttachment(t,o,o.data.attachmentName);return}if(s<this.frames[0]){(a==S.setup||a==S.first)&&this.setAttachment(t,o,o.data.attachmentName);return}this.setAttachment(t,o,this.attachmentNames[he.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class b0 extends lr{constructor(t,e,s,r){super(t,e,[`${yt.deform}|${s}|${r.id}`]),this.slotIndex=0,this.slotIndex=s,this.attachment=r,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,r,n,a,h,o,l,u,c){const d=this.curves;let f=this.getFrameCount()+t*18;s==0&&(d[e]=2+f);const p=(r-a*2+o)*.03,m=l*.03-h*.06,g=((a-o)*3-r+u)*.006,_=(h-l+.33333333)*.018;let x=p*2+g,y=m*2+_,v=(a-r)*.3+p+g*.16666667,b=h*.3+m+_*.16666667,w=r+v,E=b;for(let T=f+18;f<T;f+=2)d[f]=w,d[f+1]=E,v+=x,b+=y,x+=g,y+=_,w+=v,E+=b}getCurvePercent(t,e){const s=this.curves;let r=s[e];switch(r){case 0:const o=this.frames[e];return(t-o)/(this.frames[e+this.getFrameEntries()]-o);case 1:return 0}if(r-=2,s[r]>t){const o=this.frames[e];return s[r+1]*(t-o)/(s[r]-o)}const n=r+18;for(r+=2;r<n;r+=2)if(s[r]>=t){const o=s[r-2],l=s[r-1];return l+(t-o)/(s[r]-o)*(s[r+1]-l)}const a=s[n-2],h=s[n-1];return h+(1-h)*(t-a)/(this.frames[e+this.getFrameEntries()]-a)}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.getAttachment();if(!l||!(l instanceof ni)||l.timelineAttachment!=this.attachment)return;const u=o.deform;u.length==0&&(a=S.setup);const c=this.vertices,d=c[0].length,f=this.frames;if(s<f[0]){switch(a){case S.setup:u.length=0;return;case S.first:if(n==1){u.length=0;return}u.length=d;const x=l;if(x.bones){n=1-n;for(let y=0;y<d;y++)u[y]*=n}else{const y=x.vertices;for(let v=0;v<d;v++)u[v]+=(y[v]-u[v])*n}}return}if(u.length=d,s>=f[f.length-1]){const x=c[f.length-1];if(n==1)if(a==S.add){const y=l;if(y.bones)for(let v=0;v<d;v++)u[v]+=x[v];else{const v=y.vertices;for(let b=0;b<d;b++)u[b]+=x[b]-v[b]}}else B.arrayCopy(x,0,u,0,d);else switch(a){case S.setup:{const v=l;if(v.bones)for(let b=0;b<d;b++)u[b]=x[b]*n;else{const b=v.vertices;for(let w=0;w<d;w++){const E=b[w];u[w]=E+(x[w]-E)*n}}break}case S.first:case S.replace:for(let v=0;v<d;v++)u[v]+=(x[v]-u[v])*n;break;case S.add:const y=l;if(y.bones)for(let v=0;v<d;v++)u[v]+=x[v]*n;else{const v=y.vertices;for(let b=0;b<d;b++)u[b]+=(x[b]-v[b])*n}}return}const p=he.search1(f,s),m=this.getCurvePercent(s,p),g=c[p],_=c[p+1];if(n==1)if(a==S.add){const x=l;if(x.bones)for(let y=0;y<d;y++){const v=g[y];u[y]+=v+(_[y]-v)*m}else{const y=x.vertices;for(let v=0;v<d;v++){const b=g[v];u[v]+=b+(_[v]-b)*m-y[v]}}}else for(let x=0;x<d;x++){const y=g[x];u[x]=y+(_[x]-y)*m}else switch(a){case S.setup:{const y=l;if(y.bones)for(let v=0;v<d;v++){const b=g[v];u[v]=(b+(_[v]-b)*m)*n}else{const v=y.vertices;for(let b=0;b<d;b++){const w=g[b],E=v[b];u[b]=E+(w+(_[b]-w)*m-E)*n}}break}case S.first:case S.replace:for(let y=0;y<d;y++){const v=g[y];u[y]+=(v+(_[y]-v)*m-u[y])*n}break;case S.add:const x=l;if(x.bones)for(let y=0;y<d;y++){const v=g[y];u[y]+=(v+(_[y]-v)*m)*n}else{const y=x.vertices;for(let v=0;v<d;v++){const b=g[v];u[v]+=(b+(_[v]-b)*m-y[v])*n}}}}}const w0=class extends he{constructor(i){super(i,w0.propertyIds),this.events=new Array(i)}getFrameCount(){return this.frames.length}setFrame(i,t){this.frames[i]=t.time,this.events[i]=t}apply(i,t,e,s,r,n,a){if(!s)return;const h=this.frames,o=this.frames.length;if(t>e)this.apply(i,t,Number.MAX_VALUE,s,r,n,a),t=-1;else if(t>=h[o-1])return;if(e<h[0])return;let l=0;if(t<h[0])l=0;else{l=he.search1(h,t)+1;const u=h[l];for(;l>0&&h[l-1]==u;)l--}for(;l<o&&e>=h[l];l++)s.push(this.events[l])}};let sd=w0;sd.propertyIds=[`${yt.event}`];const E0=class extends he{constructor(i){super(i,E0.propertyIds),this.drawOrders=new Array(i)}getFrameCount(){return this.frames.length}setFrame(i,t,e){this.frames[i]=t,this.drawOrders[i]=e}apply(i,t,e,s,r,n,a){if(a==At.mixOut){n==S.setup&&B.arrayCopy(i.slots,0,i.drawOrder,0,i.slots.length);return}if(e<this.frames[0]){(n==S.setup||n==S.first)&&B.arrayCopy(i.slots,0,i.drawOrder,0,i.slots.length);return}const h=he.search1(this.frames,e),o=this.drawOrders[h];if(!o)B.arrayCopy(i.slots,0,i.drawOrder,0,i.slots.length);else{const l=i.drawOrder,u=i.slots;for(let c=0,d=o.length;c<d;c++)l[c]=u[o[c]]}}};let rd=E0;rd.propertyIds=[`${yt.drawOrder}`];class T0 extends lr{constructor(t,e,s){super(t,e,[`${yt.ikConstraint}|${s}`]),this.ikConstraintIndex=0,this.ikConstraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,r,n,a,h){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a?1:0,this.frames[t+5]=h?1:0}apply(t,e,s,r,n,a,h){const o=t.ikConstraints[this.ikConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.mix=o.data.mix,o.softness=o.data.softness,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch;return;case S.first:o.mix+=(o.data.mix-o.mix)*n,o.softness+=(o.data.softness-o.softness)*n,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}let u=0,c=0;const d=he.search(l,s,6),f=this.curves[d/6];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+6]-p);u+=(l[d+6+1]-u)*m,c+=(l[d+6+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}a==S.setup?(o.mix=o.data.mix+(u-o.data.mix)*n,o.softness=o.data.softness+(c-o.data.softness)*n,h==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=l[d+3],o.compress=l[d+4]!=0,o.stretch=l[d+5]!=0)):(o.mix+=(u-o.mix)*n,o.softness+=(c-o.softness)*n,h==At.mixIn&&(o.bendDirection=l[d+3],o.compress=l[d+4]!=0,o.stretch=l[d+5]!=0))}}class A0 extends lr{constructor(t,e,s){super(t,e,[`${yt.transformConstraint}|${s}`]),this.transformConstraintIndex=0,this.transformConstraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,n,a,h,o){const l=this.frames;t*=7,l[t]=e,l[t+1]=s,l[t+2]=r,l[t+3]=n,l[t+4]=a,l[t+5]=h,l[t+6]=o}apply(t,e,s,r,n,a,h){const o=t.transformConstraints[this.transformConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){const x=o.data;switch(a){case S.setup:o.mixRotate=x.mixRotate,o.mixX=x.mixX,o.mixY=x.mixY,o.mixScaleX=x.mixScaleX,o.mixScaleY=x.mixScaleY,o.mixShearY=x.mixShearY;return;case S.first:o.mixRotate+=(x.mixRotate-o.mixRotate)*n,o.mixX+=(x.mixX-o.mixX)*n,o.mixY+=(x.mixY-o.mixY)*n,o.mixScaleX+=(x.mixScaleX-o.mixScaleX)*n,o.mixScaleY+=(x.mixScaleY-o.mixScaleY)*n,o.mixShearY+=(x.mixShearY-o.mixShearY)*n}return}let u,c,d,f,p,m;const g=he.search(l,s,7),_=this.curves[g/7];switch(_){case 0:const x=l[g];u=l[g+1],c=l[g+2],d=l[g+3],f=l[g+4],p=l[g+5],m=l[g+6];const y=(s-x)/(l[g+7]-x);u+=(l[g+7+1]-u)*y,c+=(l[g+7+2]-c)*y,d+=(l[g+7+3]-d)*y,f+=(l[g+7+4]-f)*y,p+=(l[g+7+5]-p)*y,m+=(l[g+7+6]-m)*y;break;case 1:u=l[g+1],c=l[g+2],d=l[g+3],f=l[g+4],p=l[g+5],m=l[g+6];break;default:u=this.getBezierValue(s,g,1,_-2),c=this.getBezierValue(s,g,2,_+18-2),d=this.getBezierValue(s,g,3,_+18*2-2),f=this.getBezierValue(s,g,4,_+18*3-2),p=this.getBezierValue(s,g,5,_+18*4-2),m=this.getBezierValue(s,g,6,_+18*5-2)}if(a==S.setup){const x=o.data;o.mixRotate=x.mixRotate+(u-x.mixRotate)*n,o.mixX=x.mixX+(c-x.mixX)*n,o.mixY=x.mixY+(d-x.mixY)*n,o.mixScaleX=x.mixScaleX+(f-x.mixScaleX)*n,o.mixScaleY=x.mixScaleY+(p-x.mixScaleY)*n,o.mixShearY=x.mixShearY+(m-x.mixShearY)*n}else o.mixRotate+=(u-o.mixRotate)*n,o.mixX+=(c-o.mixX)*n,o.mixY+=(d-o.mixY)*n,o.mixScaleX+=(f-o.mixScaleX)*n,o.mixScaleY+=(p-o.mixScaleY)*n,o.mixShearY+=(m-o.mixShearY)*n}}class S0 extends hr{constructor(t,e,s){super(t,e,`${yt.pathConstraintPosition}|${s}`),this.pathConstraintIndex=0,this.pathConstraintIndex=s}apply(t,e,s,r,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.position=o.data.position;return;case S.first:o.position+=(o.data.position-o.position)*n}return}const u=this.getCurveValue(s);a==S.setup?o.position=o.data.position+(u-o.data.position)*n:o.position+=(u-o.position)*n}}class C0 extends hr{constructor(t,e,s){super(t,e,`${yt.pathConstraintSpacing}|${s}`),this.pathConstraintIndex=0,this.pathConstraintIndex=s}apply(t,e,s,r,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.spacing=o.data.spacing;return;case S.first:o.spacing+=(o.data.spacing-o.spacing)*n}return}const u=this.getCurveValue(s);a==S.setup?o.spacing=o.data.spacing+(u-o.data.spacing)*n:o.spacing+=(u-o.spacing)*n}}class I0 extends lr{constructor(t,e,s){super(t,e,[`${yt.pathConstraintMix}|${s}`]),this.pathConstraintIndex=0,this.pathConstraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,n){const a=this.frames;t<<=2,a[t]=e,a[t+1]=s,a[t+2]=r,a[t+3]=n}apply(t,e,s,r,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,o.mixY=o.data.mixY;return;case S.first:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*n,o.mixX+=(o.data.mixX-o.mixX)*n,o.mixY+=(o.data.mixY-o.mixY)*n}return}let u,c,d;const f=he.search(l,s,4),p=this.curves[f>>2];switch(p){case 0:const m=l[f];u=l[f+1],c=l[f+2],d=l[f+3];const g=(s-m)/(l[f+4]-m);u+=(l[f+4+1]-u)*g,c+=(l[f+4+2]-c)*g,d+=(l[f+4+3]-d)*g;break;case 1:u=l[f+1],c=l[f+2],d=l[f+3];break;default:u=this.getBezierValue(s,f,1,p-2),c=this.getBezierValue(s,f,2,p+18-2),d=this.getBezierValue(s,f,3,p+18*2-2)}if(a==S.setup){const m=o.data;o.mixRotate=m.mixRotate+(u-m.mixRotate)*n,o.mixX=m.mixX+(c-m.mixX)*n,o.mixY=m.mixY+(d-m.mixY)*n}else o.mixRotate+=(u-o.mixRotate)*n,o.mixX+=(c-o.mixX)*n,o.mixY+=(d-o.mixY)*n}}const oi=class extends he{constructor(i,t,e){super(i,[`${yt.sequence}|${t}|${e.sequence.id}`]),this.slotIndex=t,this.attachment=e}getFrameEntries(){return oi.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(i,t,e,s,r){const n=this.frames;i*=oi.ENTRIES,n[i]=t,n[i+oi.MODE]=e|s<<4,n[i+oi.DELAY]=r}apply(i,t,e,s,r,n,a){const h=i.slots[this.slotIndex];if(!h.bone.active)return;const o=h.attachment,l=this.attachment;if(o!=l&&(!(o instanceof ni)||o.timelineAttachment!=l))return;const u=this.frames;if(e<u[0]){(n==S.setup||n==S.first)&&(h.sequenceIndex=-1);return}const c=he.search(u,e,oi.ENTRIES),d=u[c],f=u[c+oi.MODE],p=u[c+oi.DELAY];if(!this.attachment.sequence)return;let m=f>>4;const g=this.attachment.sequence.regions.length,_=i0[f&15];if(_!=Pr.hold)switch(m+=(e-d)/p+1e-5|0,_){case Pr.once:m=Math.min(g-1,m);break;case Pr.loop:m%=g;break;case Pr.pingpong:{const x=(g<<1)-2;m=x==0?0:m%x,m>=g&&(m=x-m);break}case Pr.onceReverse:m=Math.max(g-1-m,0);break;case Pr.loopReverse:m=g-1-m%g;break;case Pr.pingpongReverse:{const x=(g<<1)-2;m=x==0?0:(m+g-1)%x,m>=g&&(m=x-m)}}h.sequenceIndex=m}};let Fo=oi;Fo.ENTRIES=3,Fo.MODE=1,Fo.DELAY=2,new td("<empty>",[],0);class P0{constructor(t){this.atlas=t}loadSequence(t,e,s){const r=s.regions;for(let n=0,a=r.length;n<a;n++){const h=s.getPath(e,n),o=this.atlas.findRegion(h);if(o==null)throw new Error(`Region not found in atlas: ${h} (sequence: ${t})`);r[n]=o,r[n].renderObject=r[n]}}newRegionAttachment(t,e,s,r){const n=new gt(e,s);if(r!=null)this.loadSequence(e,s,r);else{const a=this.atlas.findRegion(s);if(!a)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);a.renderObject=a,n.region=a}return n}newMeshAttachment(t,e,s,r){const n=new Mo(e,s);if(r!=null)this.loadSequence(e,s,r);else{const a=this.atlas.findRegion(s);if(!a)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);a.renderObject=a,n.region=a}return n}newBoundingBoxAttachment(t,e){return new qu(e)}newPathAttachment(t,e){return new Ku(e)}newPointAttachment(t,e){return new Qu(e)}newClippingAttachment(t,e){return new Zu(e)}}class R0{constructor(t,e,s){if(this.index=0,this.parent=null,this.length=0,this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=vt.Normal,this.skinRequired=!1,this.color=new X,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}}class id{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}let M0=class{constructor(t,e){if(this.intValue=0,this.floatValue=0,this.stringValue=null,this.time=0,this.volume=0,this.balance=0,!e)throw new Error("data cannot be null.");this.time=t,this.data=e}};class F0{constructor(t){this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=t}}class k0 extends id{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class B0 extends id{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.positionMode=ne.Fixed,this.spacingMode=Rs.Fixed,this.rotateMode=Fe.Chain,this.offsetRotation=0,this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}}var Rs=(i=>(i[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",i[i.Proportional=3]="Proportional",i))(Rs||{});class D0{constructor(){this.name=null,this.bones=new Array,this.slots=new Array,this.skins=new Array,this.defaultSkin=null,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.x=0,this.y=0,this.width=0,this.height=0,this.version=null,this.hash=null,this.fps=0,this.imagesPath=null,this.audioPath=null}findBone(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findBoneIndex(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSlot(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findSlotIndex(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSkin(t){if(!t)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}}class O0{constructor(t,e,s){if(this.index=0,this.color=new X(1,1,1,1),this.darkColor=null,this.attachmentName=null,this.blendMode=W.NORMAL,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}}class L0 extends id{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class N0{constructor(t,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class nd{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");const r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];this.setAttachment(r.slotIndex,r.name,r.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];r.attachment&&(r.attachment instanceof Mo?(r.attachment=r.attachment.newLinkedMesh(),this.setAttachment(r.slotIndex,r.name,r.attachment)):(r.attachment=r.attachment.copy(),this.setAttachment(r.slotIndex,r.name,r.attachment)))}}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){const s=this.attachments[t];s&&delete s[e]}getAttachments(){const t=new Array;for(let e=0;e<this.attachments.length;e++){const s=this.attachments[e];if(s)for(const r in s){const n=s[r];n&&t.push(new N0(e,r,n))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const r in s){const n=s[r];n&&e.push(new N0(t,r,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){const n=t.slots[r],a=n.getAttachment();if(a&&s<e.attachments.length){const h=e.attachments[s];for(const o in h){const l=h[o];if(a==l){const u=this.getAttachment(s,o);u&&n.setAttachment(u);break}}}s++}}}class V0{constructor(t){this.ver40=!1,this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new D0;s.name="";const r=new gl(t),n=r.readInt32(),a=r.readInt32();s.hash=a==0&&n==0?null:a.toString(16)+n.toString(16),s.version=r.readString();const h=s.version.substr(0,3);if(h!=="4.0"&&h!=="4.1"){const c=`Spine 4.1 loader cant load version ${s.version}. Please configure your pixi-spine bundle`;console.error(c)}this.ver40=h==="4.0",s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat();const o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let l=0;l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("String in string table must not be null.");r.strings.push(d)}l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("Bone name must not be null.");const f=c==0?null:s.bones[r.readInt(!0)],p=new R0(c,d,f);p.rotation=r.readFloat(),p.x=r.readFloat()*e,p.y=r.readFloat()*e,p.scaleX=r.readFloat(),p.scaleY=r.readFloat(),p.shearX=r.readFloat(),p.shearY=r.readFloat(),p.length=r.readFloat()*e,p.transformMode=r.readInt(!0),p.skinRequired=r.readBoolean(),o&&X.rgba8888ToColor(p.color,r.readInt32()),s.bones.push(p)}l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("Slot name must not be null.");const f=s.bones[r.readInt(!0)],p=new O0(c,d,f);X.rgba8888ToColor(p.color,r.readInt32());const m=r.readInt32();m!=-1&&X.rgb888ToColor(p.darkColor=new X,m),p.attachmentName=r.readStringRef(),p.blendMode=r.readInt(!0),s.slots.push(p)}l=r.readInt(!0);for(let c=0,d;c<l;c++){const f=r.readString();if(!f)throw new Error("IK constraint data name must not be null.");const p=new k0(f);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[r.readInt(!0)]);p.target=s.bones[r.readInt(!0)],p.mix=r.readFloat(),p.softness=r.readFloat()*e,p.bendDirection=r.readByte(),p.compress=r.readBoolean(),p.stretch=r.readBoolean(),p.uniform=r.readBoolean(),s.ikConstraints.push(p)}l=r.readInt(!0);for(let c=0,d;c<l;c++){const f=r.readString();if(!f)throw new Error("Transform constraint data name must not be null.");const p=new L0(f);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[r.readInt(!0)]);p.target=s.bones[r.readInt(!0)],p.local=r.readBoolean(),p.relative=r.readBoolean(),p.offsetRotation=r.readFloat(),p.offsetX=r.readFloat()*e,p.offsetY=r.readFloat()*e,p.offsetScaleX=r.readFloat(),p.offsetScaleY=r.readFloat(),p.offsetShearY=r.readFloat(),p.mixRotate=r.readFloat(),p.mixX=r.readFloat(),p.mixY=r.readFloat(),p.mixScaleX=r.readFloat(),p.mixScaleY=r.readFloat(),p.mixShearY=r.readFloat(),s.transformConstraints.push(p)}l=r.readInt(!0);for(let c=0,d;c<l;c++){const f=r.readString();if(!f)throw new Error("Path constraint data name must not be null.");const p=new B0(f);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[r.readInt(!0)]);p.target=s.slots[r.readInt(!0)],p.positionMode=r.readInt(!0),p.spacingMode=r.readInt(!0),p.rotateMode=r.readInt(!0),p.offsetRotation=r.readFloat(),p.position=r.readFloat(),p.positionMode==ne.Fixed&&(p.position*=e),p.spacing=r.readFloat(),(p.spacingMode==Rs.Length||p.spacingMode==Rs.Fixed)&&(p.spacing*=e),p.mixRotate=r.readFloat(),p.mixX=r.readFloat(),p.mixY=r.readFloat(),s.pathConstraints.push(p)}const u=this.readSkin(r,s,!0,o);u&&(s.defaultSkin=u,s.skins.push(u));{let c=s.skins.length;for(B.setArraySize(s.skins,l=c+r.readInt(!0));c<l;c++){const d=this.readSkin(r,s,!1,o);if(!d)throw new Error("readSkin() should not have returned null.");s.skins[c]=d}}l=this.linkedMeshes.length;for(let c=0;c<l;c++){const d=this.linkedMeshes[c],f=d.skin?s.findSkin(d.skin):s.defaultSkin;if(!f)throw new Error("Not skin found for linked mesh.");if(!d.parent)throw new Error("Linked mesh parent must not be null");const p=f.getAttachment(d.slotIndex,d.parent);if(!p)throw new Error(`Parent mesh not found: ${d.parent}`);d.mesh.timelineAttachment=d.inheritTimeline?p:d.mesh,d.mesh.setParentMesh(p)}this.linkedMeshes.length=0,l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readStringRef();if(!d)throw new Error;const f=new F0(d);f.intValue=r.readInt(!1),f.floatValue=r.readFloat(),f.stringValue=r.readString(),f.audioPath=r.readString(),f.audioPath&&(f.volume=r.readFloat(),f.balance=r.readFloat()),s.events.push(f)}l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,d,s))}return s}readSkin(t,e,s,r){let n=null,a=0;if(s){if(a=t.readInt(!0),a==0)return null;n=new nd("default")}else{const h=t.readStringRef();if(!h)throw new Error("Skin name must not be null.");n=new nd(h),n.bones.length=t.readInt(!0);for(let o=0,l=n.bones.length;o<l;o++)n.bones[o]=e.bones[t.readInt(!0)];for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);a=t.readInt(!0)}for(let h=0;h<a;h++){const o=t.readInt(!0);for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readStringRef();if(!c)throw new Error("Attachment name must not be null");const d=this.readAttachment(t,e,n,o,c,r);d&&n.setAttachment(o,c,d)}}return n}readAttachment(t,e,s,r,n,a){const h=this.scale;let o=t.readStringRef();switch(o||(o=n),t.readByte()){case at.Region:{let l=t.readStringRef();const u=t.readFloat(),c=t.readFloat(),d=t.readFloat(),f=t.readFloat(),p=t.readFloat(),m=t.readFloat(),g=t.readFloat(),_=t.readInt32(),x=this.readSequence(t);l||(l=o);const y=this.attachmentLoader.newRegionAttachment(s,o,l,x);return y?(y.path=l,y.x=c*h,y.y=d*h,y.scaleX=f,y.scaleY=p,y.rotation=u,y.width=m*h,y.height=g*h,X.rgba8888ToColor(y.color,_),y.sequence=x,x==null&&y.updateRegion(),y):null}case at.BoundingBox:{const l=t.readInt(!0),u=this.readVertices(t,l),c=a?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,o);return d?(d.worldVerticesLength=l<<1,d.vertices=u.vertices,d.bones=u.bones,a&&X.rgba8888ToColor(d.color,c),d):null}case at.Mesh:{let l=t.readStringRef();const u=t.readInt32(),c=t.readInt(!0),d=this.readFloatArray(t,c<<1,1),f=this.readShortArray(t),p=this.readVertices(t,c),m=t.readInt(!0),g=this.readSequence(t);let _=[],x=0,y=0;a&&(_=this.readShortArray(t),x=t.readFloat(),y=t.readFloat()),l||(l=o);const v=this.attachmentLoader.newMeshAttachment(s,o,l,g);return v?(v.path=l,X.rgba8888ToColor(v.color,u),v.bones=p.bones,v.vertices=p.vertices,v.worldVerticesLength=c<<1,v.triangles=f,v.regionUVs=new Float32Array(d),v.hullLength=m<<1,v.sequence=g,a&&(v.edges=_,v.width=x*h,v.height=y*h),v):null}case at.LinkedMesh:{let l=t.readStringRef();const u=t.readInt32(),c=t.readStringRef(),d=t.readStringRef(),f=t.readBoolean(),p=this.readSequence(t);let m=0,g=0;a&&(m=t.readFloat(),g=t.readFloat()),l||(l=o);const _=this.attachmentLoader.newMeshAttachment(s,o,l,p);return _?(_.path=l,X.rgba8888ToColor(_.color,u),_.sequence=p,a&&(_.width=m*h,_.height=g*h),this.linkedMeshes.push(new PC(_,c,r,d,f)),_):null}case at.Path:{const l=t.readBoolean(),u=t.readBoolean(),c=t.readInt(!0),d=this.readVertices(t,c),f=B.newArray(c/3,0);for(let g=0,_=f.length;g<_;g++)f[g]=t.readFloat()*h;const p=a?t.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,o);return m?(m.closed=l,m.constantSpeed=u,m.worldVerticesLength=c<<1,m.vertices=d.vertices,m.bones=d.bones,m.lengths=f,a&&X.rgba8888ToColor(m.color,p),m):null}case at.Point:{const l=t.readFloat(),u=t.readFloat(),c=t.readFloat(),d=a?t.readInt32():0,f=this.attachmentLoader.newPointAttachment(s,o);return f?(f.x=u*h,f.y=c*h,f.rotation=l,a&&X.rgba8888ToColor(f.color,d),f):null}case at.Clipping:{const l=t.readInt(!0),u=t.readInt(!0),c=this.readVertices(t,u),d=a?t.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,o);return f?(f.endSlot=e.slots[l],f.worldVerticesLength=u<<1,f.vertices=c.vertices,f.bones=c.bones,a&&X.rgba8888ToColor(f.color,d),f):null}}return null}readSequence(t){if(this.ver40||!t.readBoolean())return null;const e=new Ju(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readDeformTimelineType(t){return this.ver40?U0:t.readByte()}readVertices(t,e){const s=this.scale,r=e<<1,n=new RC;if(!t.readBoolean())return n.vertices=this.readFloatArray(t,r,s),n;const a=new Array,h=new Array;for(let o=0;o<e;o++){const l=t.readInt(!0);h.push(l);for(let u=0;u<l;u++)h.push(t.readInt(!0)),a.push(t.readFloat()*s),a.push(t.readFloat()*s),a.push(t.readFloat())}return n.vertices=B.toFloatArray(a),n.bones=h,n}readFloatArray(t,e,s){const r=new Array(e);if(s==1)for(let n=0;n<e;n++)r[n]=t.readFloat();else for(let n=0;n<e;n++)r[n]=t.readFloat()*s;return r}readShortArray(t){const e=t.readInt(!0),s=new Array(e);for(let r=0;r<e;r++)s[r]=t.readShort();return s}readAnimation(t,e,s){t.readInt(!0);const r=new Array,n=this.scale;for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0);for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readByte(),m=t.readInt(!0),g=m-1;switch(p){case GC:{const _=new v0(m,c);for(let x=0;x<m;x++)_.setFrame(x,t.readFloat(),t.readStringRef());r.push(_);break}case XC:{const _=t.readInt(!0),x=new m0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255;for(let T=0,A=0;x.setFrame(T,y,v,b,w,E),T!=g;T++){const I=t.readFloat(),M=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:x.setStepped(T);break;case Fs:ct(t,x,A++,T,0,y,I,v,M,1),ct(t,x,A++,T,1,y,I,b,R,1),ct(t,x,A++,T,2,y,I,w,C,1),ct(t,x,A++,T,3,y,I,E,P,1)}y=I,v=M,b=R,w=C,E=P}r.push(x);break}case $C:{const _=t.readInt(!0),x=new g0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255;for(let E=0,T=0;x.setFrame(E,y,v,b,w),E!=g;E++){const A=t.readFloat(),I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:x.setStepped(E);break;case Fs:ct(t,x,T++,E,0,y,A,v,I,1),ct(t,x,T++,E,1,y,A,b,M,1),ct(t,x,T++,E,2,y,A,w,R,1)}y=A,v=I,b=M,w=R}r.push(x);break}case YC:{const _=t.readInt(!0),x=new y0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255;for(let M=0,R=0;x.setFrame(M,y,v,b,w,E,T,A,I),M!=g;M++){const C=t.readFloat(),P=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,$=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:x.setStepped(M);break;case Fs:ct(t,x,R++,M,0,y,C,v,P,1),ct(t,x,R++,M,1,y,C,b,k,1),ct(t,x,R++,M,2,y,C,w,U,1),ct(t,x,R++,M,3,y,C,E,V,1),ct(t,x,R++,M,4,y,C,T,L,1),ct(t,x,R++,M,5,y,C,A,$,1),ct(t,x,R++,M,6,y,C,I,O,1)}y=C,v=P,b=k,w=U,E=V,T=L,A=$,I=O}r.push(x);break}case HC:{const _=t.readInt(!0),x=new x0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255;for(let I=0,M=0;x.setFrame(I,y,v,b,w,E,T,A),I!=g;I++){const R=t.readFloat(),C=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:x.setStepped(I);break;case Fs:ct(t,x,M++,I,0,y,R,v,C,1),ct(t,x,M++,I,1,y,R,b,P,1),ct(t,x,M++,I,2,y,R,w,k,1),ct(t,x,M++,I,3,y,R,E,U,1),ct(t,x,M++,I,4,y,R,T,V,1),ct(t,x,M++,I,5,y,R,A,L,1)}y=R,v=C,b=P,w=k,E=U,T=V,A=L}r.push(x);break}case WC:{const _=new _0(m,t.readInt(!0),c);let x=t.readFloat(),y=t.readUnsignedByte()/255;for(let v=0,b=0;_.setFrame(v,x,y),v!=g;v++){const w=t.readFloat(),E=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:_.setStepped(v);break;case Fs:ct(t,_,b++,v,0,x,w,y,E,1)}x=w,y=E}r.push(_)}}}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0);for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readByte(),m=t.readInt(!0),g=t.readInt(!0);switch(p){case MC:r.push(Rr(t,new n0(m,g,c),1));break;case FC:r.push(od(t,new o0(m,g,c),n));break;case kC:r.push(Rr(t,new a0(m,g,c),n));break;case BC:r.push(Rr(t,new l0(m,g,c),n));break;case DC:r.push(od(t,new h0(m,g,c),1));break;case OC:r.push(Rr(t,new c0(m,g,c),1));break;case LC:r.push(Rr(t,new u0(m,g,c),1));break;case NC:r.push(od(t,new d0(m,g,c),1));break;case VC:r.push(Rr(t,new f0(m,g,c),1));break;case UC:r.push(Rr(t,new p0(m,g,c),1))}}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=t.readInt(!0),f=d-1,p=new T0(d,t.readInt(!0),c);let m=t.readFloat(),g=t.readFloat(),_=t.readFloat()*n;for(let x=0,y=0;p.setFrame(x,m,g,_,t.readByte(),t.readBoolean(),t.readBoolean()),x!=f;x++){const v=t.readFloat(),b=t.readFloat(),w=t.readFloat()*n;switch(t.readByte()){case Ms:p.setStepped(x);break;case Fs:ct(t,p,y++,x,0,m,v,g,b,1),ct(t,p,y++,x,1,m,v,_,w,n)}m=v,g=b,_=w}r.push(p)}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=t.readInt(!0),f=d-1,p=new A0(d,t.readInt(!0),c);let m=t.readFloat(),g=t.readFloat(),_=t.readFloat(),x=t.readFloat(),y=t.readFloat(),v=t.readFloat(),b=t.readFloat();for(let w=0,E=0;p.setFrame(w,m,g,_,x,y,v,b),w!=f;w++){const T=t.readFloat(),A=t.readFloat(),I=t.readFloat(),M=t.readFloat(),R=t.readFloat(),C=t.readFloat(),P=t.readFloat();switch(t.readByte()){case Ms:p.setStepped(w);break;case Fs:ct(t,p,E++,w,0,m,T,g,A,1),ct(t,p,E++,w,1,m,T,_,I,1),ct(t,p,E++,w,2,m,T,x,M,1),ct(t,p,E++,w,3,m,T,y,R,1),ct(t,p,E++,w,4,m,T,v,C,1),ct(t,p,E++,w,5,m,T,b,P,1)}m=T,g=A,_=I,x=M,y=R,v=C,b=P}r.push(p)}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=s.pathConstraints[c];for(let f=0,p=t.readInt(!0);f<p;f++)switch(t.readByte()){case jC:r.push(Rr(t,new S0(t.readInt(!0),t.readInt(!0),c),d.positionMode==ne.Fixed?n:1));break;case qC:r.push(Rr(t,new C0(t.readInt(!0),t.readInt(!0),c),d.spacingMode==Rs.Length||d.spacingMode==Rs.Fixed?n:1));break;case ZC:const m=new I0(t.readInt(!0),t.readInt(!0),c);let g=t.readFloat(),_=t.readFloat(),x=t.readFloat(),y=t.readFloat();for(let v=0,b=0,w=m.getFrameCount()-1;m.setFrame(v,g,_,x,y),v!=w;v++){const E=t.readFloat(),T=t.readFloat(),A=t.readFloat(),I=t.readFloat();switch(t.readByte()){case Ms:m.setStepped(v);break;case Fs:ct(t,m,b++,v,0,g,E,_,T,1),ct(t,m,b++,v,1,g,E,x,A,1),ct(t,m,b++,v,2,g,E,y,I,1)}g=E,_=T,x=A,y=I}r.push(m)}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=s.skins[t.readInt(!0)];for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readInt(!0);for(let m=0,g=t.readInt(!0);m<g;m++){const _=t.readStringRef();if(!_)throw new Error("attachmentName must not be null.");const x=c.getAttachment(p,_),y=this.readDeformTimelineType(t),v=t.readInt(!0),b=v-1;switch(y){case U0:{const w=x,E=w.bones,T=w.vertices,A=E?T.length/3*2:T.length,I=t.readInt(!0),M=new b0(v,I,p,w);let R=t.readFloat();for(let C=0,P=0;;C++){let k,U=t.readInt(!0);if(U==0)k=E?B.newFloatArray(A):T;else{k=B.newFloatArray(A);const L=t.readInt(!0);if(U+=L,n==1)for(let $=L;$<U;$++)k[$]=t.readFloat();else for(let $=L;$<U;$++)k[$]=t.readFloat()*n;if(!E)for(let $=0,O=k.length;$<O;$++)k[$]+=T[$]}if(M.setFrame(C,R,k),C==b)break;const V=t.readFloat();switch(t.readByte()){case Ms:M.setStepped(C);break;case Fs:ct(t,M,P++,C,0,R,V,0,1,1)}R=V}r.push(M);break}case zC:{const w=new Fo(v,p,x);for(let E=0;E<v;E++){const T=t.readFloat(),A=t.readInt32();w.setFrame(E,T,i0[A&15],A>>4,t.readFloat())}r.push(w);break}}}}}const a=t.readInt(!0);if(a>0){const l=new rd(a),u=s.slots.length;for(let c=0;c<a;c++){const d=t.readFloat(),f=t.readInt(!0),p=B.newArray(u,0);for(let x=u-1;x>=0;x--)p[x]=-1;const m=B.newArray(u-f,0);let g=0,_=0;for(let x=0;x<f;x++){const y=t.readInt(!0);for(;g!=y;)m[_++]=g++;p[g+t.readInt(!0)]=g++}for(;g<u;)m[_++]=g++;for(let x=u-1;x>=0;x--)p[x]==-1&&(p[x]=m[--_]);l.setFrame(c,d,p)}r.push(l)}const h=t.readInt(!0);if(h>0){const l=new sd(h);for(let u=0;u<h;u++){const c=t.readFloat(),d=s.events[t.readInt(!0)],f=new M0(c,d);f.intValue=t.readInt(!1),f.floatValue=t.readFloat(),f.stringValue=t.readBoolean()?t.readString():d.stringValue,f.data.audioPath&&(f.volume=t.readFloat(),f.balance=t.readFloat()),l.setFrame(u,f)}r.push(l)}let o=0;for(let l=0,u=r.length;l<u;l++)o=Math.max(o,r[l].getDuration());return new td(e,r,o)}}V0.BlendModeValues=[W.NORMAL,W.ADD,W.MULTIPLY,W.SCREEN];let PC=class{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=n}};class RC{constructor(t=null,e=null){this.bones=t,this.vertices=e}}function Rr(i,t,e){let s=i.readFloat(),r=i.readFloat()*e;for(let n=0,a=0,h=t.getFrameCount()-1;t.setFrame(n,s,r),n!=h;n++){const o=i.readFloat(),l=i.readFloat()*e;switch(i.readByte()){case Ms:t.setStepped(n);break;case Fs:ct(i,t,a++,n,0,s,o,r,l,e)}s=o,r=l}return t}function od(i,t,e){let s=i.readFloat(),r=i.readFloat()*e,n=i.readFloat()*e;for(let a=0,h=0,o=t.getFrameCount()-1;t.setFrame(a,s,r,n),a!=o;a++){const l=i.readFloat(),u=i.readFloat()*e,c=i.readFloat()*e;switch(i.readByte()){case Ms:t.setStepped(a);break;case Fs:ct(i,t,h++,a,0,s,l,r,u,e),ct(i,t,h++,a,1,s,l,n,c,e)}s=l,r=u,n=c}return t}function ct(i,t,e,s,r,n,a,h,o,l){t.setBezier(e,s,r,n,h,i.readFloat(),i.readFloat()*l,i.readFloat(),i.readFloat()*l,a,o)}const MC=0,FC=1,kC=2,BC=3,DC=4,OC=5,LC=6,NC=7,VC=8,UC=9,GC=0,XC=1,$C=2,YC=3,HC=4,WC=5,U0=0,zC=1,jC=0,qC=1,ZC=2,Ms=1,Fs=2;class ad{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new D0,r=typeof t=="string"?JSON.parse(t):t,n=r.skeleton;if(n){s.hash=n.hash,s.version=n.spine;const a=s.version.substr(0,3);if(a!=="4.0"&&a!=="4.1"){const h=`Spine 4.1 loader cant load version ${n.spine}. Please configure your pixi-spine bundle`;console.error(h)}s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.fps=n.fps,s.imagesPath=n.images}if(r.bones)for(let a=0;a<r.bones.length;a++){const h=r.bones[a];let o=null;const l=F(h,"parent",null);if(l!=null&&(o=s.findBone(l),o==null))throw new Error(`Parent bone not found: ${l}`);const u=new R0(s.bones.length,h.name,o);u.length=F(h,"length",0)*e,u.x=F(h,"x",0)*e,u.y=F(h,"y",0)*e,u.rotation=F(h,"rotation",0),u.scaleX=F(h,"scaleX",1),u.scaleY=F(h,"scaleY",1),u.shearX=F(h,"shearX",0),u.shearY=F(h,"shearY",0),u.transformMode=B.enumValue(vt,F(h,"transform","Normal")),u.skinRequired=F(h,"skin",!1);const c=F(h,"color",null);c&&u.color.setFromString(c),s.bones.push(u)}if(r.slots)for(let a=0;a<r.slots.length;a++){const h=r.slots[a],o=s.findBone(h.bone);if(!o)throw new Error(`Couldn't find bone ${h.bone} for slot ${h.name}`);const l=new O0(s.slots.length,h.name,o),u=F(h,"color",null);u&&l.color.setFromString(u);const c=F(h,"dark",null);c&&(l.darkColor=X.fromString(c)),l.attachmentName=F(h,"attachment",null),l.blendMode=ad.blendModeFromString(F(h,"blend","normal")),s.slots.push(l)}if(r.ik)for(let a=0;a<r.ik.length;a++){const h=r.ik[a],o=new k0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let l=0;l<h.bones.length;l++){const u=h.bones[l],c=s.findBone(u);if(c==null)throw new Error(`IK bone not found: ${u}`);o.bones.push(c)}o.target=s.findBone(h.target),o.mix=F(h,"mix",1),o.softness=F(h,"softness",0)*e,o.bendDirection=F(h,"bendPositive",!0)?1:-1,o.compress=F(h,"compress",!1),o.stretch=F(h,"stretch",!1),o.uniform=F(h,"uniform",!1),s.ikConstraints.push(o)}if(r.transform)for(let a=0;a<r.transform.length;a++){const h=r.transform[a],o=new L0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let c=0;c<h.bones.length;c++){const d=h.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for transform constraint ${h.name}.`);o.bones.push(f)}const l=h.target,u=s.findBone(l);if(!u)throw new Error(`Couldn't find target bone ${l} for transform constraint ${h.name}.`);o.target=u,o.local=F(h,"local",!1),o.relative=F(h,"relative",!1),o.offsetRotation=F(h,"rotation",0),o.offsetX=F(h,"x",0)*e,o.offsetY=F(h,"y",0)*e,o.offsetScaleX=F(h,"scaleX",0),o.offsetScaleY=F(h,"scaleY",0),o.offsetShearY=F(h,"shearY",0),o.mixRotate=F(h,"mixRotate",1),o.mixX=F(h,"mixX",1),o.mixY=F(h,"mixY",o.mixX),o.mixScaleX=F(h,"mixScaleX",1),o.mixScaleY=F(h,"mixScaleY",o.mixScaleX),o.mixShearY=F(h,"mixShearY",1),s.transformConstraints.push(o)}if(r.path)for(let a=0;a<r.path.length;a++){const h=r.path[a],o=new B0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let c=0;c<h.bones.length;c++){const d=h.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for path constraint ${h.name}.`);o.bones.push(f)}const l=h.target,u=s.findSlot(l);if(!u)throw new Error(`Couldn't find target slot ${l} for path constraint ${h.name}.`);o.target=u,o.positionMode=B.enumValue(ne,F(h,"positionMode","Percent")),o.spacingMode=B.enumValue(Rs,F(h,"spacingMode","Length")),o.rotateMode=B.enumValue(Fe,F(h,"rotateMode","Tangent")),o.offsetRotation=F(h,"rotation",0),o.position=F(h,"position",0),o.positionMode==ne.Fixed&&(o.position*=e),o.spacing=F(h,"spacing",0),(o.spacingMode==Rs.Length||o.spacingMode==Rs.Fixed)&&(o.spacing*=e),o.mixRotate=F(h,"mixRotate",1),o.mixX=F(h,"mixX",1),o.mixY=F(h,"mixY",o.mixX),s.pathConstraints.push(o)}if(r.skins)for(let a=0;a<r.skins.length;a++){const h=r.skins[a],o=new nd(h.name);if(h.bones)for(let l=0;l<h.bones.length;l++){const u=h.bones[l],c=s.findBone(u);if(!c)throw new Error(`Couldn't find bone ${u} for skin ${h.name}.`);o.bones.push(c)}if(h.ik)for(let l=0;l<h.ik.length;l++){const u=h.ik[l],c=s.findIkConstraint(u);if(!c)throw new Error(`Couldn't find IK constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}if(h.transform)for(let l=0;l<h.transform.length;l++){const u=h.transform[l],c=s.findTransformConstraint(u);if(!c)throw new Error(`Couldn't find transform constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}if(h.path)for(let l=0;l<h.path.length;l++){const u=h.path[l],c=s.findPathConstraint(u);if(!c)throw new Error(`Couldn't find path constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}for(const l in h.attachments){const u=s.findSlot(l);if(!u)throw new Error(`Couldn't find slot ${l} for skin ${h.name}.`);const c=h.attachments[l];for(const d in c){const f=this.readAttachment(c[d],o,u.index,d,s);f&&o.setAttachment(u.index,d,f)}}s.skins.push(o),o.name=="default"&&(s.defaultSkin=o)}for(let a=0,h=this.linkedMeshes.length;a<h;a++){const o=this.linkedMeshes[a],l=o.skin?s.findSkin(o.skin):s.defaultSkin;if(!l)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(!u)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.timelineAttachment=o.inheritTimeline?u:o.mesh,o.mesh.setParentMesh(u)}if(this.linkedMeshes.length=0,r.events)for(const a in r.events){const h=r.events[a],o=new F0(a);o.intValue=F(h,"int",0),o.floatValue=F(h,"float",0),o.stringValue=F(h,"string",""),o.audioPath=F(h,"audio",null),o.audioPath&&(o.volume=F(h,"volume",1),o.balance=F(h,"balance",0)),s.events.push(o)}if(r.animations)for(const a in r.animations){const h=r.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,r,n){const a=this.scale;switch(r=F(t,"name",r),F(t,"type","region")){case"region":{const h=F(t,"path",r),o=this.readSequence(F(t,"sequence",null)),l=this.attachmentLoader.newRegionAttachment(e,r,h,o);if(!l)return null;l.path=h,l.x=F(t,"x",0)*a,l.y=F(t,"y",0)*a,l.scaleX=F(t,"scaleX",1),l.scaleY=F(t,"scaleY",1),l.rotation=F(t,"rotation",0),l.width=t.width*a,l.height=t.height*a,l.sequence=o;const u=F(t,"color",null);return u&&l.color.setFromString(u),l}case"boundingbox":{const h=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(!h)return null;this.readVertices(t,h,t.vertexCount<<1);const o=F(t,"color",null);return o&&h.color.setFromString(o),h}case"mesh":case"linkedmesh":{const h=F(t,"path",r),o=this.readSequence(F(t,"sequence",null)),l=this.attachmentLoader.newMeshAttachment(e,r,h,o);if(!l)return null;l.path=h;const u=F(t,"color",null);u&&l.color.setFromString(u),l.width=F(t,"width",0)*a,l.height=F(t,"height",0)*a,l.sequence=o;const c=F(t,"parent",null);if(c)return this.linkedMeshes.push(new KC(l,F(t,"skin",null),s,c,F(t,"timelines",!0))),l;const d=t.uvs;return this.readVertices(t,l,d.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(d),l.edges=F(t,"edges",null),l.hullLength=F(t,"hull",0)*2,l}case"path":{const h=this.attachmentLoader.newPathAttachment(e,r);if(!h)return null;h.closed=F(t,"closed",!1),h.constantSpeed=F(t,"constantSpeed",!0);const o=t.vertexCount;this.readVertices(t,h,o<<1);const l=B.newArray(o/3,0);for(let c=0;c<t.lengths.length;c++)l[c]=t.lengths[c]*a;h.lengths=l;const u=F(t,"color",null);return u&&h.color.setFromString(u),h}case"point":{const h=this.attachmentLoader.newPointAttachment(e,r);if(!h)return null;h.x=F(t,"x",0)*a,h.y=F(t,"y",0)*a,h.rotation=F(t,"rotation",0);const o=F(t,"color",null);return o&&h.color.setFromString(o),h}case"clipping":{const h=this.attachmentLoader.newClippingAttachment(e,r);if(!h)return null;const o=F(t,"end",null);if(o!=null){const c=n.findSlot(o);if(c==null)throw new Error(`Clipping end slot not found: ${o}`);h.endSlot=c}const l=t.vertexCount;this.readVertices(t,h,l<<1);const u=F(t,"color",null);return u&&h.color.setFromString(u),h}}return null}readSequence(t){if(t==null)return null;const e=new Ju(F(t,"count",0));return e.start=F(t,"start",1),e.digits=F(t,"digits",0),e.setupIndex=F(t,"setup",0),e}readVertices(t,e,s){const r=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(r!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=r;e.vertices=o;return}const a=new Array,h=new Array;for(let o=0,l=n.length;o<l;){const u=n[o++];h.push(u);for(let c=o+u*4;o<c;o+=4)h.push(n[o]),a.push(n[o+1]*r),a.push(n[o+2]*r),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const r=this.scale,n=new Array;if(t.slots)for(const h in t.slots){const o=t.slots[h],l=s.findSlot(h);if(!l)throw new Error(`Slot not found: ${h}`);const u=l.index;for(const c in o){const d=o[c];if(!d)continue;const f=d.length;if(c=="attachment"){const p=new v0(f,u);for(let m=0;m<f;m++){const g=d[m];p.setFrame(m,F(g,"time",0),F(g,"name",null))}n.push(p)}else if(c=="rgba"){const p=new m0(f,f<<2,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.color);for(let x=0,y=0;;x++){p.setFrame(x,g,_.r,_.g,_.b,_.a);const v=d[x+1];if(!v){p.shrink(y);break}const b=F(v,"time",0),w=X.fromString(v.color),E=m.curve;E&&(y=pt(E,p,y,x,0,g,b,_.r,w.r,1),y=pt(E,p,y,x,1,g,b,_.g,w.g,1),y=pt(E,p,y,x,2,g,b,_.b,w.b,1),y=pt(E,p,y,x,3,g,b,_.a,w.a,1)),g=b,_=w,m=v}n.push(p)}else if(c=="rgb"){const p=new g0(f,f*3,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.color);for(let x=0,y=0;;x++){p.setFrame(x,g,_.r,_.g,_.b);const v=d[x+1];if(!v){p.shrink(y);break}const b=F(v,"time",0),w=X.fromString(v.color),E=m.curve;E&&(y=pt(E,p,y,x,0,g,b,_.r,w.r,1),y=pt(E,p,y,x,1,g,b,_.g,w.g,1),y=pt(E,p,y,x,2,g,b,_.b,w.b,1)),g=b,_=w,m=v}n.push(p)}else if(c=="alpha")n.push(cr(d,new _0(f,f,u),0,1));else if(c=="rgba2"){const p=new y0(f,f*7,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.light),x=X.fromString(m.dark);for(let y=0,v=0;;y++){p.setFrame(y,g,_.r,_.g,_.b,_.a,x.r,x.g,x.b);const b=d[y+1];if(!b){p.shrink(v);break}const w=F(b,"time",0),E=X.fromString(b.light),T=X.fromString(b.dark),A=m.curve;A&&(v=pt(A,p,v,y,0,g,w,_.r,E.r,1),v=pt(A,p,v,y,1,g,w,_.g,E.g,1),v=pt(A,p,v,y,2,g,w,_.b,E.b,1),v=pt(A,p,v,y,3,g,w,_.a,E.a,1),v=pt(A,p,v,y,4,g,w,x.r,T.r,1),v=pt(A,p,v,y,5,g,w,x.g,T.g,1),v=pt(A,p,v,y,6,g,w,x.b,T.b,1)),g=w,_=E,x=T,m=b}n.push(p)}else if(c=="rgb2"){const p=new x0(f,f*6,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.light),x=X.fromString(m.dark);for(let y=0,v=0;;y++){p.setFrame(y,g,_.r,_.g,_.b,x.r,x.g,x.b);const b=d[y+1];if(!b){p.shrink(v);break}const w=F(b,"time",0),E=X.fromString(b.light),T=X.fromString(b.dark),A=m.curve;A&&(v=pt(A,p,v,y,0,g,w,_.r,E.r,1),v=pt(A,p,v,y,1,g,w,_.g,E.g,1),v=pt(A,p,v,y,2,g,w,_.b,E.b,1),v=pt(A,p,v,y,3,g,w,x.r,T.r,1),v=pt(A,p,v,y,4,g,w,x.g,T.g,1),v=pt(A,p,v,y,5,g,w,x.b,T.b,1)),g=w,_=E,x=T,m=b}n.push(p)}}}if(t.bones)for(const h in t.bones){const o=t.bones[h],l=s.findBone(h);if(!l)throw new Error(`Bone not found: ${h}`);const u=l.index;for(const c in o){const d=o[c],f=d.length;if(f!=0){if(c==="rotate")n.push(cr(d,new n0(f,f,u),0,1));else if(c==="translate"){const p=new o0(f,f<<1,u);n.push(ld(d,p,"x","y",0,r))}else if(c==="translatex"){const p=new a0(f,f,u);n.push(cr(d,p,0,r))}else if(c==="translatey"){const p=new l0(f,f,u);n.push(cr(d,p,0,r))}else if(c==="scale"){const p=new h0(f,f<<1,u);n.push(ld(d,p,"x","y",1,1))}else if(c==="scalex"){const p=new c0(f,f,u);n.push(cr(d,p,1,1))}else if(c==="scaley"){const p=new u0(f,f,u);n.push(cr(d,p,1,1))}else if(c==="shear"){const p=new d0(f,f<<1,u);n.push(ld(d,p,"x","y",0,1))}else if(c==="shearx"){const p=new f0(f,f,u);n.push(cr(d,p,0,1))}else if(c==="sheary"){const p=new p0(f,f,u);n.push(cr(d,p,0,1))}}}}if(t.ik)for(const h in t.ik){const o=t.ik[h];let l=o[0];if(!l)continue;const u=s.findIkConstraint(h);if(!u)throw new Error(`IK Constraint not found: ${h}`);const c=s.ikConstraints.indexOf(u),d=new T0(o.length,o.length<<1,c);let f=F(l,"time",0),p=F(l,"mix",1),m=F(l,"softness",0)*r;for(let g=0,_=0;;g++){d.setFrame(g,f,p,m,F(l,"bendPositive",!0)?1:-1,F(l,"compress",!1),F(l,"stretch",!1));const x=o[g+1];if(!x){d.shrink(_);break}const y=F(x,"time",0),v=F(x,"mix",1),b=F(x,"softness",0)*r,w=l.curve;w&&(_=pt(w,d,_,g,0,f,y,p,v,1),_=pt(w,d,_,g,1,f,y,m,b,r)),f=y,p=v,m=b,l=x}n.push(d)}if(t.transform)for(const h in t.transform){const o=t.transform[h];let l=o[0];if(!l)continue;const u=s.findTransformConstraint(h);if(!u)throw new Error(`Transform constraint not found: ${h}`);const c=s.transformConstraints.indexOf(u),d=new A0(o.length,o.length*6,c);let f=F(l,"time",0),p=F(l,"mixRotate",1),m=F(l,"mixX",1),g=F(l,"mixY",m),_=F(l,"mixScaleX",1),x=F(l,"mixScaleY",_);const y=F(l,"mixShearY",1);for(let v=0,b=0;;v++){d.setFrame(v,f,p,m,g,_,x,y);const w=o[v+1];if(!w){d.shrink(b);break}const E=F(w,"time",0),T=F(w,"mixRotate",1),A=F(w,"mixX",1),I=F(w,"mixY",A),M=F(w,"mixScaleX",1),R=F(w,"mixScaleY",M),C=F(w,"mixShearY",1),P=l.curve;P&&(b=pt(P,d,b,v,0,f,E,p,T,1),b=pt(P,d,b,v,1,f,E,m,A,1),b=pt(P,d,b,v,2,f,E,g,I,1),b=pt(P,d,b,v,3,f,E,_,M,1),b=pt(P,d,b,v,4,f,E,x,R,1),b=pt(P,d,b,v,5,f,E,y,C,1)),f=E,p=T,m=A,g=I,_=M,x=R,_=M,l=w}n.push(d)}if(t.path)for(const h in t.path){const o=t.path[h],l=s.findPathConstraint(h);if(!l)throw new Error(`Path constraint not found: ${h}`);const u=s.pathConstraints.indexOf(l);for(const c in o){const d=o[c];let f=d[0];if(!f)continue;const p=d.length;if(c==="position"){const m=new S0(p,p,u);n.push(cr(d,m,0,l.positionMode==ne.Fixed?r:1))}else if(c==="spacing"){const m=new C0(p,p,u);n.push(cr(d,m,0,l.spacingMode==Rs.Length||l.spacingMode==Rs.Fixed?r:1))}else if(c==="mix"){const m=new I0(p,p*3,u);let g=F(f,"time",0),_=F(f,"mixRotate",1),x=F(f,"mixX",1),y=F(f,"mixY",x);for(let v=0,b=0;;v++){m.setFrame(v,g,_,x,y);const w=d[v+1];if(!w){m.shrink(b);break}const E=F(w,"time",0),T=F(w,"mixRotate",1),A=F(w,"mixX",1),I=F(w,"mixY",A),M=f.curve;M&&(b=pt(M,m,b,v,0,g,E,_,T,1),b=pt(M,m,b,v,1,g,E,x,A,1),b=pt(M,m,b,v,2,g,E,y,I,1)),g=E,_=T,x=A,y=I,f=w}n.push(m)}}}if(t.deform){t.attachments={};for(const h in t.deform){const o=t.deform[h],l=t.attachments[h]={};for(const u in o){const c=o[u],d=l[u]={};for(const f in c)d[f]={deform:c[f]}}}}if(t.attachments)for(const h in t.attachments){const o=t.attachments[h],l=s.findSkin(h);if(l!=null)for(const u in o){const c=o[u],d=s.findSlot(u);if(!d)throw new Error(`Slot not found: ${u}`);const f=d.index;for(const p in c){const m=c[p],g=l.getAttachment(f,p);for(const _ in m){const x=m[_];let y=x[0];if(y){if(_=="deform"){const v=g.bones,b=g.vertices,w=v?b.length/3*2:b.length,E=new b0(x.length,x.length,f,g);let T=F(y,"time",0);for(let A=0,I=0;;A++){let M;const R=F(y,"vertices",null);if(!R)M=v?B.newFloatArray(w):b;else{M=B.newFloatArray(w);const U=F(y,"offset",0);if(B.arrayCopy(R,0,M,U,R.length),r!=1)for(let V=U,L=V+R.length;V<L;V++)M[V]*=r;if(!v)for(let V=0;V<w;V++)M[V]+=b[V]}E.setFrame(A,T,M);const C=x[A+1];if(!C){E.shrink(I);break}const P=F(C,"time",0),k=y.curve;k&&(I=pt(k,E,I,A,0,T,P,0,1,1)),T=P,y=C}n.push(E)}else if(_=="sequence"){const v=new Fo(x.length,f,g);let b=0;for(let w=0;w<x.length;w++){const E=F(y,"delay",b),T=F(y,"time",0),A=Pr[F(y,"mode","hold")],I=F(y,"index",0);v.setFrame(w,T,A,I,E),b=E,y=x[w+1]}n.push(v)}}}}}}if(t.drawOrder){const h=new rd(t.drawOrder.length),o=s.slots.length;let l=0;for(let u=0;u<t.drawOrder.length;u++,l++){const c=t.drawOrder[u];let d=null;const f=F(c,"offsets",null);if(f){d=B.newArray(o,-1);const p=B.newArray(o-f.length,0);let m=0,g=0;for(let _=0;_<f.length;_++){const x=f[_],y=s.findSlot(x.slot);if(!y)throw new Error(`Slot not found: ${y}`);const v=y.index;for(;m!=v;)p[g++]=m++;d[m+x.offset]=m++}for(;m<o;)p[g++]=m++;for(let _=o-1;_>=0;_--)d[_]==-1&&(d[_]=p[--g])}h.setFrame(l,F(c,"time",0),d)}n.push(h)}if(t.events){const h=new sd(t.events.length);let o=0;for(let l=0;l<t.events.length;l++,o++){const u=t.events[l],c=s.findEvent(u.name);if(!c)throw new Error(`Event not found: ${u.name}`);const d=new M0(B.toSinglePrecision(F(u,"time",0)),c);d.intValue=F(u,"int",c.intValue),d.floatValue=F(u,"float",c.floatValue),d.stringValue=F(u,"string",c.stringValue),d.data.audioPath&&(d.volume=F(u,"volume",1),d.balance=F(u,"balance",0)),h.setFrame(o,d)}n.push(h)}let a=0;for(let h=0,o=n.length;h<o;h++)a=Math.max(a,n[h].getDuration());if(isNaN(a))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new td(e,n,a))}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return W.NORMAL;if(t=="additive")return W.ADD;if(t=="multiply")return W.MULTIPLY;if(t=="screen")return W.SCREEN;throw new Error(`Unknown blend mode: ${t}`)}}class KC{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=n}}function cr(i,t,e,s){let r=i[0],n=F(r,"time",0),a=F(r,"value",e)*s,h=0;for(let o=0;;o++){t.setFrame(o,n,a);const l=i[o+1];if(!l)return t.shrink(h),t;const u=F(l,"time",0),c=F(l,"value",e)*s;r.curve&&(h=pt(r.curve,t,h,o,0,n,u,a,c,s)),n=u,a=c,r=l}}function ld(i,t,e,s,r,n){let a=i[0],h=F(a,"time",0),o=F(a,e,r)*n,l=F(a,s,r)*n,u=0;for(let c=0;;c++){t.setFrame(c,h,o,l);const d=i[c+1];if(!d)return t.shrink(u),t;const f=F(d,"time",0),p=F(d,e,r)*n,m=F(d,s,r)*n,g=a.curve;g&&(u=pt(g,t,u,c,0,h,f,o,p,n),u=pt(g,t,u,c,1,h,f,l,m,n)),h=f,o=p,l=m,a=d}}function pt(i,t,e,s,r,n,a,h,o,l){if(i=="stepped")return t.setStepped(s),e;const u=r<<2,c=i[u],d=i[u+1]*l,f=i[u+2],p=i[u+3]*l;return t.setBezier(e,s,r,n,h,c,d,f,p,a,o),e+1}function F(i,t,e){return i[t]!==void 0?i[t]:e}var ai=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.VER37=37]="VER37",i[i.VER38=38]="VER38",i[i.VER40=40]="VER40",i[i.VER41=41]="VER41",i))(ai||{});function hd(i){const t=i.substr(0,3),e=Math.floor(Number(t)*10+.001);return t==="3.7"?37:t==="3.8"?38:t==="4.0"?40:t==="4.1"?41:e<37?37:0}class QC{constructor(){this.scale=1}readSkeletonData(t,e){let s=null,r=this.readVersionOldFormat(e),n=hd(r);if(n===ai.VER38&&(s=new le(new N_(t))),r=this.readVersionNewFormat(e),n=hd(r),(n===ai.VER40||n===ai.VER41)&&(s=new V0(new P0(t))),!s){const a=`Unsupported version of spine model ${r}, please update pixi-spine`;console.error(a)}return s.scale=this.scale,s.readSkeletonData(e)}readVersionOldFormat(t){const e=new gl(t);let s;try{e.readString(),s=e.readString()}catch{s=""}return s||""}readVersionNewFormat(t){const e=new gl(t);e.readInt32(),e.readInt32();let s;try{s=e.readString()}catch{s=""}return s||""}}class JC{constructor(){this.scale=1}readSkeletonData(t,e){const s=e.skeleton.spine,r=hd(s);let n=null;if(r===ai.VER37&&(n=new CC(new _C(t))),r===ai.VER38&&(n=new QS(new N_(t))),(r===ai.VER40||r===ai.VER41)&&(n=new ad(new P0(t))),!n){const a=`Unsupported version of spine model ${s}, please update pixi-spine`;console.error(a)}return n.scale=this.scale,n.readSkeletonData(e)}}class tI extends rC{createBinaryParser(){return new QC}createJsonParser(){return new JC}parseData(t,e,s){return{spineData:t.readSkeletonData(e,s),spineAtlas:e}}}new tI().installLoader();class eI extends tC{constructor(t,e){const{followPointList:s,visible:r=!1}=e||{};let n;typeof t=="string"?n=Gr.get(t).spineData:n=t.spineData,super(n),this._followDots=[],this._isStart=!1,this.visible=r,this.autoUpdate=!1,s!=null&&s.length&&(s==null||s.forEach(a=>{a.follow.alpha=0,this._followDots.push({point:this.skeleton.findBone(a.boneName),follow:a.follow,onUpdate:a.onUpdate,angleFollow:a.angleFollow||!1,scaleFollow:a.scaleFollow||!0})})),this._loopFn=this._loop.bind(this),wt.system.add(this._loopFn)}setAnimation(t="animation",e=!1){return new Promise(s=>{this.visible=!0,this.state.setAnimation(0,t,e).listener={complete:()=>{s()}}})}addAnimation(t="animation",e=!1,s=0){return new Promise(r=>{this.visible=!0,this.state.addAnimation(0,t,e,s).listener={complete:()=>{r()}}})}setSkin(t){this.skeleton.setSkinByName(t)}destroyAll(){wt.system.remove(this._loopFn),this.destroy({children:!0})}_loop(){if(this.destroyed){wt.system.remove(this._loopFn);return}this.update(wt.system.deltaMS/1e3),this._updateFollowPoint()}_updateFollowPoint(){this._followDots.length!==0&&(this._followDots.forEach(t=>{const{worldX:e,worldY:s}=t.point,r=t.point.getWorldRotationX()*(Math.PI/180),n=t.point.getWorldScaleX(),a=t.point.getWorldScaleY();t.onUpdate?t.onUpdate({x:e,y:s,rotate:r,scaleX:n,scaleY:a}):(t.angleFollow&&(t.follow.rotation=r),t.scaleFollow&&t.follow.scale.set(n,a),t.follow.position.set(e+1920/2-t.follow.width/2,s+1080/2-t.follow.height/2))}),this._isStart||(this._isStart=!0,this._followDots.forEach(t=>{xt.to(t.follow,{alpha:1,duration:.25,delay:.15})})))}}const Mr=(i,t,e,s=!1)=>{i.cursor="pointer",i.eventMode="static";const r=n=>{n.button!==2&&e(n)};s?i.once(t,r):i.on(t,r)};class sI extends Bt{constructor(t){super(),this.disabled=!1;const{texture:e,hoverTexture:s,tintColor:r,hoverTintColor:n="#fff",disabledColor:a="#999"}=t;this._texture=e,this._hoverTexture=s,this._tintColor=r,this._disabledColor=a,this._btn=new qe(e),this.addChild(this._btn),this._btn.anchor.set(.5),r&&(this._btn.tint=r),Mr(this._btn,"pointerenter",()=>{this.disabled||(this._btn.tint=n,this._hoverTexture&&(this._btn._texture=this._hoverTexture))}),Mr(this._btn,"pointerleave",()=>{this.disabled||(this._btn._texture=this._texture,r&&(this._btn.tint=r))})}toggleTexture(t,e){this._texture=t,this._hoverTexture=e,this._btn._texture=e}setDisabled(t){this.disabled=t,this._btn.tint=t?this._disabledColor:this._tintColor||"#fff",this._btn.texture=this._texture}}class rI extends Ao{constructor(t){const{sprite:e,onClick:s}=t;super(e.width,e.height),this.addChild(e),e.anchor.set(.5),e.x=e.width/2,e.y=e.height/2,Mr(this,"pointerenter",()=>{xt.to(e,{duration:.25,rotation:180*(Math.PI/180)})}),Mr(this,"pointerleave",()=>{e.alpha=1,xt.to(e,{duration:.25,rotation:0})}),Mr(this,"pointerdown",()=>{e.alpha=.5}),Mr(this,"pointerup",()=>{s()})}}class iI extends Bt{constructor(t){super(),this._maskUI=new du({bgColor:"#000",width:1080,height:1920}),this.addChild(this._maskUI),this._maskUI.alpha=0,this._maskUI.eventMode="static",this._drawerContainer=t,this.addChild(this._drawerContainer),this._drawerContainer.y=this._maskUI.height,xt.to(this._maskUI,{duration:.25,alpha:.5}),xt.to(this._drawerContainer,{duration:.25,ease:"power1.out",y:this._maskUI.height-this._drawerContainer.height})}async close(){xt.to(this._drawerContainer,{duration:.25,y:this._maskUI.height}),await xt.to(this._maskUI,{duration:.25,delay:.125,alpha:0})}}class nI extends Bt{constructor(t){super(),this.COLLECT_TIME=5*1e3,this._nowTime=0,this._lastTime=0,this._drawCount=0,this._maxDrawCount=0,this._tempMaxDrawCount=0,this._lastCollectTime=0,this._paramTxts=[];for(let e=0;e<3;e++){const s=new Nu({text:"",fontWeight:"bold",fontSize:36,shadow:["#000",45,3,5],fontColor:"#fff"});this._paramTxts[e]=s,s.x=0,s.y=s.height*e,this.addChild(s),s.alpha=.75}this._renderer=t.renderer,this._drawElements=this._renderer.gl.drawElements,this.init()}init(){this._renderer.gl.drawElements=(...t)=>{this._drawElements.call(this._renderer.gl,...t),this._drawCount++},wt.shared.add(()=>{const t=wt.system.FPS;this._nowTime=performance.now(),this._nowTime-this._lastTime>=100&&(this._setTxtInfo(0,Math.floor(t).toFixed(0)),this._lastTime=this._nowTime),this._nowTime-this._lastCollectTime<this.COLLECT_TIME?this._tempMaxDrawCount<this._drawCount&&(this._tempMaxDrawCount=this._drawCount):(this._maxDrawCount=this._tempMaxDrawCount,this._tempMaxDrawCount=0,this._lastCollectTime=this._nowTime),this._setTxtInfo(1,this._drawCount),this._setTxtInfo(2,this._maxDrawCount),this._drawCount=0},Vr.UTILITY)}_setTxtInfo(t,e){const s=a=>{this._paramTxts[t].style.fill="#fff",a<=30&&(this._paramTxts[t].style.fill="yellow"),a<=20&&(this._paramTxts[t].style.fill="red")},r=a=>{this._paramTxts[t].style.fill="#fff",a>=75&&(this._paramTxts[t].style.fill="yellow"),a>=100&&(this._paramTxts[t].style.fill="red")},n=[()=>(s(e),`Fps:${e}`),()=>(r(e),`Draw Call:${e}`),()=>(r(e),`Max Draw Call:${e}`)];this._paramTxts[t].text=n[t]()}}class oI extends Bt{constructor(t){super();const{bgWidth:e,bgHeight:s,barWidth:r,barHeight:n,bgTexture:a,barTexture:h}=t,o=new qe(a);this.addChild(o),this._progressBar=new qe(h),this.addChild(this._progressBar),this._progressBar.x=(e-r)/2,this._progressBar.y=(s-n)/2;const l=new hs;l.beginFill(16777215),l.drawRect(0,0,0,this._progressBar.height),l.endFill(),this._progressBar.addChild(l),this._progressBar.mask=l,this._maskGraphics=l}setProgress(t){const e=Math.max(0,Math.min(1,t));this._maskGraphics.clear(),this._maskGraphics.beginFill(16777215),this._maskGraphics.drawRect(0,0,this._progressBar.width*e,this._progressBar.height),this._maskGraphics.endFill()}}class aI extends Ao{constructor(t){const{width:e,height:s,scrollContent:r,bottomMargin:n=50}=t;if(super(e,s),this._startY=0,this._velocity=0,this._startTime=0,this._startPosition=0,this._scrollSpeed=200,this._isDragging=!1,this._scrollContent=r,this._content=new Bt,this.addChild(this._content),this._content.addChild(this._scrollContent),n>0){const a=new qe;this._content.addChild(a),a.y=this._content.height+n}this._maskGraphics=new hs,this.addChild(this._maskGraphics),this._maskGraphics.clear(),this._maskGraphics.beginFill(0),this._maskGraphics.drawRect(0,0,e,s),this._maskGraphics.endFill(),this.mask=this._maskGraphics,this.eventMode="static",this.on("pointerdown",this._onDragStart,this),this.on("pointermove",this._onDragMove,this),this.on("pointerup",this._onDragEnd,this),this.on("pointerupoutside",this._onDragEnd,this),this.on("wheel",this._onWheelScroll,this)}setDimensions(t,e){this._maskGraphics.clear(),this._maskGraphics.beginFill(0),this._maskGraphics.drawRect(0,0,t,e),this._maskGraphics.endFill(),this.setSize(t,e)}scrollToTop(){xt.killTweensOf(this._content),this._content.y=0}addContent(t){this._scrollContent.addChild(t)}_onDragStart(t){if(this._content.height<=this._maskGraphics.height)return;const e=t.getLocalPosition(this);this._startY=e.y-this._content.y,this._isDragging=!0,this._velocity=0,this._startTime=Date.now(),this._startPosition=this._content.y,xt.killTweensOf(this._content)}_onDragMove(t){if(this._isDragging){const s=t.getLocalPosition(this).y-this._startY;this._content.y=s}}_onDragEnd(){this._isDragging=!1;const e=Date.now()-this._startTime;e<250?(this._velocity=(this._content.y-this._startPosition)/e,this._applyInertia()):this._velocity=0,this._limitScrollRange()}_onWheelScroll(t){if(this._content.height<=this._maskGraphics.height)return;let e=this._content.y-t.deltaY*(this._scrollSpeed/100);e>0?e=0:Math.abs(e)>=this._content.height-this._maskGraphics.height&&(e=-(this._content.height-this._maskGraphics.height)),xt.to(this._content,{duration:.25,ease:"power1.out",y:e})}_applyInertia(){xt.to(this._content,{y:this._content.y+this._velocity*250,duration:.5,ease:"power1.out",onUpdate:this._limitScrollRange.bind(this)})}_limitScrollRange(){if(this._content.y>0)xt.to(this._content,{duration:.75,y:0,ease:"elastic.out"});else if(Math.abs(this._content.y)>=this._content.height-this._maskGraphics.height)if(this._content.height>this._maskGraphics.height){const t=-(this._content.height-this._maskGraphics.height);xt.to(this._content,{duration:.75,y:t,ease:"elastic.out"})}else xt.to(this._content,{duration:.25,y:0})}}class lI extends Ao{constructor(t){const{width:e,height:s,content:r,slideCallback:n,scrollCallback:a,pageNum:h,pageHeight:o}=t;super(e,s),this._currentIndex=0,this._scrollHeight=0,this._slideHeight=0,this._startY=0,this._offsetY=0,this._pageNum=0,this._startTime=new Date().getTime(),this._isDragging=!1;const l=new hs;l.beginFill(16777215),l.drawRect(0,0,this.width,this.height),l.endFill(),this.addChild(l),this.mask=l,this._scrollHeight=s,this._slideHeight=o,this._slideArea=r,this._slideCallback=n,this._scrollCallback=a,this._pageNum=h-1,this.addChild(this._slideArea),this._slideArea.x=e/2,this._slideArea.y=this._scrollHeight/2,this.eventMode="static",this.cursor="pointer",this.on("pointerdown",this._onDragStart),window.addEventListener("pointermove",this._onDragMove.bind(this)),window.addEventListener("pointerup",this._onDragEnd.bind(this))}updatePosition(t,e){this._slideArea.y=t,this._currentIndex=e}slideTo(t,e=!0){var s;t<0?(xt.to(this._slideArea,{y:this._scrollHeight/2,duration:.25,onUpdate:()=>{var r;(r=this._scrollCallback)==null||r.call(this,this._slideArea.y,this._currentIndex)}}),this._currentIndex=0):t>this._pageNum?(xt.to(this._slideArea,{y:-this._pageNum*this._slideHeight+this._scrollHeight/2,duration:.5,onUpdate:()=>{var r;(r=this._scrollCallback)==null||r.call(this,this._slideArea.y,this._currentIndex)}}),this._currentIndex=this._pageNum):(this._currentIndex=t,xt.to(this._slideArea,{y:-this._currentIndex*this._slideHeight+this._scrollHeight/2,duration:e?.25:.01,onUpdate:()=>{var r;(r=this._scrollCallback)==null||r.call(this,this._slideArea.y,this._currentIndex)}})),(s=this._slideCallback)==null||s.call(this,this._currentIndex)}setDepth(t,e,s=0){const r=e-s,n=Math.floor(Math.abs(r)/70),a=Math.abs(r)%70/70,h=n-1,o=n+1,l=n+2,u=t[n];if(u.alpha=this.lerp(.5,1,1-a),u.scale.y=this.lerp(.85,1,1-a),o<t.length){const c=t[o];c.alpha=this.lerp(.5,1,a),c.scale.y=this.lerp(.85,1,a)}if(l<t.length){const c=t[l];c.alpha=this.lerp(.1,.5,a)}if(h>=0){const c=t[h];c.alpha=this.lerp(.1,.5,1-a)}}_onDragStart(t){this._isDragging=!0,this._startY=t.data.global.y,this._offsetY=this._slideArea.y,xt.killTweensOf(this._slideArea),this._startTime=new Date().getTime()}_onDragMove(t){var a;if(!this._isDragging)return;const e=t.pageY-this._startY;let s=this._offsetY+e;const r=this._scrollHeight/2,n=-this._pageNum*this._slideHeight+this._scrollHeight/2;s>r&&(s=r),s<n&&(s=n),this._slideArea.y=s,(a=this._scrollCallback)==null||a.call(this,this._slideArea.y,this._currentIndex)}_onDragEnd(t){if(!this._isDragging)return;this._isDragging=!1;const e=new Date().getTime()-this._startTime,s=this._startY-t.pageY,r=Math.abs(s)/e,n=.275,a=this._slideHeight/2,h=Math.round(s/this._slideHeight);(Math.abs(s)>a||r>n)&&(this._currentIndex+=h),this._currentIndex<0?this._currentIndex=0:this._currentIndex>this._pageNum&&(this._currentIndex=this._pageNum),this.slideTo(this._currentIndex)}lerp(t,e,s){return t*(1-s)+e*s}}const G0=i=>{const t=new hs;return t.beginFill(16777215),t.drawRect(0,0,i.width,i.height),t.endFill(),i.addChild(t),i.mask=t,t};class hI extends Ao{constructor(t,e,s,r){super(t,e),this._currentIndex=0,this._slideWidth=0,this._startX=0,this._offsetX=0,this._pageNum=0,this._startTime=new Date().getTime(),this._isDragging=!1,G0(this),this._slideWidth=t,this._slideArea=s,this.slideCallback=r,this._pageNum=Math.floor(s.width/this._slideWidth)-1,this.addChild(s),this.eventMode="static",this.cursor="pointer",this.on("pointerdown",this._onDragStart),window.addEventListener("pointermove",this._onDragMove.bind(this)),window.addEventListener("pointerup",this._onDragEnd.bind(this))}prev(){this._slideTo(this._currentIndex-1)}next(){this._slideTo(this._currentIndex+1)}_slideTo(t){t<0?(xt.to(this._slideArea,{x:0,duration:.25}),this._currentIndex=0):t>this._pageNum?(xt.to(this._slideArea,{x:-this._pageNum*this._slideWidth,duration:.5}),this._currentIndex=this._pageNum):(this._currentIndex=t,xt.to(this._slideArea,{x:-this._currentIndex*this._slideWidth,duration:.25})),this.slideCallback(this._currentIndex,this._pageNum)}_onDragStart(t){this._isDragging=!0,this._startX=t.global.x,this._offsetX=this._slideArea.x,xt.killTweensOf(this._slideArea),this._startTime=new Date().getTime()}_onDragMove(t){if(!this._isDragging)return;const e=t.pageX-this._startX;this._slideArea.x=this._offsetX+e}_onDragEnd(t){if(!this._isDragging)return;this._isDragging=!1;const e=new Date().getTime()-this._startTime,s=this._startX-t.pageX,r=Math.abs(s)/e,n=this._slideWidth/2,a=.275;(Math.abs(s)>n||r>a)&&(s>0?this._currentIndex++:this._currentIndex--),this._slideTo(this._currentIndex)}}class cI{constructor(t,e){this._currentIndex=0,this._numsLength=0,this._isDown=!1,this._onChange=e,this._numsLength=t,window.addEventListener("pointerup",()=>{this._isDown&&this._up()})}down(t){this._isDown=!0,this._handleChange(t),this._timerId=setTimeout(()=>{this._isDown&&(this._intervalId=setInterval(()=>{this._handleChange(t)},100))},100)}updateIndex(t){this._currentIndex=t}_up(){this._isDown=!1,clearTimeout(this._timerId),clearInterval(this._intervalId)}_handleChange(t){t==="add"?this._currentIndex<this._numsLength-1&&(this._currentIndex++,this._onChange(this._currentIndex)):t==="sub"&&this._currentIndex>0&&(this._currentIndex--,this._onChange(this._currentIndex))}}class uI{constructor(t){this._betAmountListLength=0;const{initialBetIndex:e,betAmountListLength:s,onAmountIndex:r,onDisabled:n}=t;this._onAmountIndex=r,this._onDisabled=n,this._betAmountListLength=s,this._baseNumSteper=new cI(s,a=>{this._onAmountIndex(a),this.minMaxUpdateIndex(a)}),this.minMaxUpdateIndex(e),this._baseNumSteper.updateIndex(e)}min(){this.minMaxUpdateIndex(0),this._onAmountIndex(0)}max(){const t=this._betAmountListLength-1;this.minMaxUpdateIndex(t),this._onAmountIndex(t)}sub(){this._baseNumSteper.down("sub")}add(){this._baseNumSteper.down("add")}minMaxUpdateIndex(t){t===0?this._onDisabled("min"):t===this._betAmountListLength-1?this._onDisabled("max"):this._onDisabled(),this._baseNumSteper.updateIndex(t)}}const X0=(i,t,e)=>{const s=t/i.width*i.scale.x,r=e?e/i.height*i.scale.y:s,n=Math.min(s,r);i.scale.set(n>1?1:n)};class dI extends Bt{constructor(t){super();const{data:e,cellWidth:s=130,cellHeight:r=100,fontColor:n="#fff",firstColumnFontColor:a="#fff",fontSize:h=30,lineWidth:o=2,lineColor:l="#5b5b5b",outsideBorder:u=!0,fontBold:c=!0}=t;this._data=e,this._rows=e.length,this._cols=e[0].length,this._cellWidth=s,this._cellHeight=r,this._fontColor=n,this._fontSize=h,this._lineWidth=o,this._lineColor=l,this._outsideBorder=u,this._fontBold=c,this._firstColumnFontColor=a,this._drawTable(),this.fillNumbers()}_drawTable(){const t=this._cellWidth*this._cols,e=this._cellHeight*this._rows,s=new hs;s.lineStyle(this._lineWidth,this._lineColor),this._outsideBorder&&s.drawRect(0,0,t,e);for(let r=1;r<this._rows;r++)s.moveTo(0,r*this._cellHeight),s.lineTo(t,r*this._cellHeight);for(let r=1;r<this._cols;r++)s.moveTo(r*this._cellWidth,0),s.lineTo(r*this._cellWidth,e);this.addChild(s)}fillNumbers(){for(let t=0;t<this._rows;t++)for(let e=0;e<this._cols;e++){const s=this._data[t][e];this._createNumberText(s,e,t)}}_createNumberText(t,e,s){const r=new za(t.toString(),{_fontSize:this._fontSize,fill:e===0?this._firstColumnFontColor:this._fontColor,fontWeight:this._fontBold?"bold":"normal"}),n=e*this._cellWidth+this._cellWidth/2,a=s*this._cellHeight+this._cellHeight/2;this.addChild(r),r.anchor.set(.5),r.position.set(n,a),X0(r,this._cellWidth*.9)}}var cd={};/*!
1169
+ */class ir{constructor(t,e,s){this.value=t,this.time=e,this.next=null,this.isStepped=!1,s?this.ease=typeof s=="function"?s:m_(s):this.ease=null}static createList(t){if("list"in t){const s=t.list;let r;const{value:n,time:a}=s[0],h=r=new ir(typeof n=="string"?pl(n):n,a,t.ease);if(s.length>2||s.length===2&&s[1].value!==n)for(let o=1;o<s.length;++o){const{value:l,time:u}=s[o];r.next=new ir(typeof l=="string"?pl(l):l,u),r=r.next}return h.isStepped=!!t.isStepped,h}const e=new ir(typeof t.start=="string"?pl(t.start):t.start,0);return t.end!==t.start&&(e.next=new ir(typeof t.end=="string"?pl(t.end):t.end,1)),e}}let So=q.from;const nr=Math.PI/180;function Ar(i,t){if(!i)return;const e=Math.sin(i),s=Math.cos(i),r=t.x*s-t.y*e,n=t.x*e+t.y*s;t.x=r,t.y=n}function fl(i,t,e){return i<<16|t<<8|e}function f_(i){return Math.sqrt(i.x*i.x+i.y*i.y)}function AS(i){const t=1/f_(i);i.x*=t,i.y*=t}function p_(i,t){i.x*=t,i.y*=t}function pl(i,t){t||(t={}),i.charAt(0)==="#"?i=i.substr(1):i.indexOf("0x")===0&&(i=i.substr(2));let e;return i.length===8&&(e=i.substr(0,2),i=i.substr(2)),t.r=parseInt(i.substr(0,2),16),t.g=parseInt(i.substr(2,2),16),t.b=parseInt(i.substr(4,2),16),e&&(t.a=parseInt(e,16)),t}function m_(i){const t=i.length,e=1/t;return function(s){const r=t*s|0,n=(s-r*e)*t,a=i[r]||i[t-1];return a.s+n*(2*(1-n)*(a.cp-a.s)+n*(a.e-a.s))}}function SS(i){return i?(i=i.toUpperCase().replace(/ /g,"_"),W[i]||W.NORMAL):W.NORMAL}class cu extends qe{constructor(t){super(),this.prevChild=this.nextChild=null,this.emitter=t,this.config={},this.anchor.x=this.anchor.y=.5,this.maxLife=0,this.age=0,this.agePercent=0,this.oneOverLife=0,this.next=null,this.prev=null,this.init=this.init,this.kill=this.kill}init(t){this.maxLife=t,this.age=this.agePercent=0,this.rotation=0,this.position.x=this.position.y=0,this.scale.x=this.scale.y=1,this.tint=16777215,this.alpha=1,this.oneOverLife=1/this.maxLife,this.visible=!0}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=this.next=this.prev=null,super.destroy()}}var Ft;(function(i){i[i.Spawn=0]="Spawn",i[i.Normal=2]="Normal",i[i.Late=5]="Late"})(Ft||(Ft={}));const uu=wt.shared,Vi=Symbol("Position particle per emitter position");class Et{constructor(t,e){this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],this.minLifetime=0,this.maxLifetime=0,this.customEase=null,this._frequency=1,this.spawnChance=1,this.maxParticles=1e3,this.emitterLifetime=-1,this.spawnPos=new st,this.particlesPerWave=1,this.rotation=0,this.ownerPos=new st,this._prevEmitterPos=new st,this._prevPosIsValid=!1,this._posChanged=!1,this._parent=null,this.addAtBack=!1,this.particleCount=0,this._emit=!1,this._spawnTimer=0,this._emitterLife=-1,this._activeParticlesFirst=null,this._activeParticlesLast=null,this._poolFirst=null,this._origConfig=null,this._autoUpdate=!1,this._destroyWhenComplete=!1,this._completeCallback=null,this.parent=t,e&&this.init(e),this.recycle=this.recycle,this.update=this.update,this.rotate=this.rotate,this.updateSpawnPos=this.updateSpawnPos,this.updateOwnerPos=this.updateOwnerPos}static registerBehavior(t){Et.knownBehaviors[t.type]=t}get frequency(){return this._frequency}set frequency(t){typeof t=="number"&&t>0?this._frequency=t:this._frequency=1}get parent(){return this._parent}set parent(t){this.cleanup(),this._parent=t}init(t){if(!t)return;this.cleanup(),this._origConfig=t,this.minLifetime=t.lifetime.min,this.maxLifetime=t.lifetime.max,t.ease?this.customEase=typeof t.ease=="function"?t.ease:m_(t.ease):this.customEase=null,this.particlesPerWave=1,t.particlesPerWave&&t.particlesPerWave>1&&(this.particlesPerWave=t.particlesPerWave),this.frequency=t.frequency,this.spawnChance=typeof t.spawnChance=="number"&&t.spawnChance>0?t.spawnChance:1,this.emitterLifetime=t.emitterLifetime||-1,this.maxParticles=t.maxParticles>0?t.maxParticles:1e3,this.addAtBack=!!t.addAtBack,this.rotation=0,this.ownerPos.set(0),t.pos?this.spawnPos.copyFrom(t.pos):this.spawnPos.set(0),this._prevEmitterPos.copyFrom(this.spawnPos),this._prevPosIsValid=!1,this._spawnTimer=0,this.emit=t.emit===void 0?!0:!!t.emit,this.autoUpdate=!!t.autoUpdate;const e=t.behaviors.map(s=>{const r=Et.knownBehaviors[s.type];return r?new r(s.config):(console.error(`Unknown behavior: ${s.type}`),null)}).filter(s=>!!s);e.push(Vi),e.sort((s,r)=>s===Vi?r.order===Ft.Spawn?1:-1:r===Vi?s.order===Ft.Spawn?-1:1:s.order-r.order),this.initBehaviors=e.slice(),this.updateBehaviors=e.filter(s=>s!==Vi&&s.updateParticle),this.recycleBehaviors=e.filter(s=>s!==Vi&&s.recycleParticle)}getBehavior(t){return Et.knownBehaviors[t]&&this.initBehaviors.find(e=>e instanceof Et.knownBehaviors[t])||null}fillPool(t){for(;t>0;--t){const e=new cu(this);e.next=this._poolFirst,this._poolFirst=e}}recycle(t,e=!1){for(let s=0;s<this.recycleBehaviors.length;++s)this.recycleBehaviors[s].recycleParticle(t,!e);t.next&&(t.next.prev=t.prev),t.prev&&(t.prev.next=t.next),t===this._activeParticlesLast&&(this._activeParticlesLast=t.prev),t===this._activeParticlesFirst&&(this._activeParticlesFirst=t.next),t.prev=null,t.next=this._poolFirst,this._poolFirst=t,t.parent&&t.parent.removeChild(t),--this.particleCount}rotate(t){if(this.rotation===t)return;const e=t-this.rotation;this.rotation=t,Ar(e,this.spawnPos),this._posChanged=!0}updateSpawnPos(t,e){this._posChanged=!0,this.spawnPos.x=t,this.spawnPos.y=e}updateOwnerPos(t,e){this._posChanged=!0,this.ownerPos.x=t,this.ownerPos.y=e}resetPositionTracking(){this._prevPosIsValid=!1}get emit(){return this._emit}set emit(t){this._emit=!!t,this._emitterLife=this.emitterLifetime}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){this._autoUpdate&&!t?uu.remove(this.update,this):!this._autoUpdate&&t&&uu.add(this.update,this),this._autoUpdate=!!t}playOnceAndDestroy(t){this.autoUpdate=!0,this.emit=!0,this._destroyWhenComplete=!0,this._completeCallback=t}playOnce(t){this.emit=!0,this._completeCallback=t}update(t){if(this._autoUpdate&&(t=uu.elapsedMS*.001),!this._parent)return;for(let a=this._activeParticlesFirst,h;a;a=h)if(h=a.next,a.age+=t,a.age>a.maxLife||a.age<0)this.recycle(a);else{let o=a.age*a.oneOverLife;this.customEase&&(this.customEase.length===4?o=this.customEase(o,0,1,1):o=this.customEase(o)),a.agePercent=o;for(let l=0;l<this.updateBehaviors.length;++l)if(this.updateBehaviors[l].updateParticle(a,t)){this.recycle(a);break}}let e,s;this._prevPosIsValid&&(e=this._prevEmitterPos.x,s=this._prevEmitterPos.y);const r=this.ownerPos.x+this.spawnPos.x,n=this.ownerPos.y+this.spawnPos.y;if(this._emit)for(this._spawnTimer-=t<0?0:t;this._spawnTimer<=0;){if(this._emitterLife>=0&&(this._emitterLife-=this._frequency,this._emitterLife<=0)){this._spawnTimer=0,this._emitterLife=0,this.emit=!1;break}if(this.particleCount>=this.maxParticles){this._spawnTimer+=this._frequency;continue}let a,h;if(this._prevPosIsValid&&this._posChanged){const u=1+this._spawnTimer/t;a=(r-e)*u+e,h=(n-s)*u+s}else a=r,h=n;let o=null,l=null;for(let u=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),c=0;c<u;++c){if(this.spawnChance<1&&Math.random()>=this.spawnChance)continue;let d;if(this.minLifetime===this.maxLifetime?d=this.minLifetime:d=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,-this._spawnTimer>=d)continue;let f;this._poolFirst?(f=this._poolFirst,this._poolFirst=this._poolFirst.next,f.next=null):f=new cu(this),f.init(d),this.addAtBack?this._parent.addChildAt(f,0):this._parent.addChild(f),o?(l.next=f,f.prev=l,l=f):l=o=f,++this.particleCount}if(o){this._activeParticlesLast?(this._activeParticlesLast.next=o,o.prev=this._activeParticlesLast,this._activeParticlesLast=l):(this._activeParticlesFirst=o,this._activeParticlesLast=l);for(let u=0;u<this.initBehaviors.length;++u){const c=this.initBehaviors[u];if(c===Vi)for(let d=o,f;d;d=f){f=d.next,this.rotation!==0&&(Ar(this.rotation,d.position),d.rotation+=this.rotation),d.position.x+=a,d.position.y+=h,d.age+=-this._spawnTimer;let p=d.age*d.oneOverLife;this.customEase&&(this.customEase.length===4?p=this.customEase(p,0,1,1):p=this.customEase(p)),d.agePercent=p}else c.initParticles(o)}for(let u=o,c;u;u=c){c=u.next;for(let d=0;d<this.updateBehaviors.length;++d)if(this.updateBehaviors[d].updateParticle(u,-this._spawnTimer)){this.recycle(u);break}}}this._spawnTimer+=this._frequency}if(this._posChanged&&(this._prevEmitterPos.x=r,this._prevEmitterPos.y=n,this._prevPosIsValid=!0,this._posChanged=!1),!this._emit&&!this._activeParticlesFirst){if(this._completeCallback){const a=this._completeCallback;this._completeCallback=null,a()}this._destroyWhenComplete&&this.destroy()}}emitNow(){const t=this.ownerPos.x+this.spawnPos.x,e=this.ownerPos.y+this.spawnPos.y;let s=null,r=null;for(let n=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),a=0;a<n;++a){if(this.spawnChance<1&&Math.random()>=this.spawnChance)continue;let h;this._poolFirst?(h=this._poolFirst,this._poolFirst=this._poolFirst.next,h.next=null):h=new cu(this);let o;this.minLifetime===this.maxLifetime?o=this.minLifetime:o=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,h.init(o),this.addAtBack?this._parent.addChildAt(h,0):this._parent.addChild(h),s?(r.next=h,h.prev=r,r=h):r=s=h,++this.particleCount}if(s){this._activeParticlesLast?(this._activeParticlesLast.next=s,s.prev=this._activeParticlesLast,this._activeParticlesLast=r):(this._activeParticlesFirst=s,this._activeParticlesLast=r);for(let n=0;n<this.initBehaviors.length;++n){const a=this.initBehaviors[n];if(a===Vi)for(let h=s,o;h;h=o)o=h.next,this.rotation!==0&&(Ar(this.rotation,h.position),h.rotation+=this.rotation),h.position.x+=t,h.position.y+=e;else a.initParticles(s)}}}cleanup(){let t,e;for(t=this._activeParticlesFirst;t;t=e)e=t.next,this.recycle(t,!0);this._activeParticlesFirst=this._activeParticlesLast=null,this.particleCount=0}get destroyed(){return!(this._parent&&this.initBehaviors.length)}destroy(){this.autoUpdate=!1,this.cleanup();let t;for(let e=this._poolFirst;e;e=t)t=e.next,e.destroy();this._poolFirst=this._parent=this.spawnPos=this.ownerPos=this.customEase=this._completeCallback=null,this.initBehaviors.length=this.updateBehaviors.length=this.recycleBehaviors.length=0}}Et.knownBehaviors={};class du{constructor(t){this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h}getRandPos(t){t.x=Math.random()*this.w+this.x,t.y=Math.random()*this.h+this.y}}du.type="rect",du.editorConfig=null;class ml{constructor(t){this.x=t.x||0,this.y=t.y||0,this.radius=t.radius,this.innerRadius=t.innerRadius||0,this.rotation=!!t.affectRotation}getRandPos(t){this.innerRadius!==this.radius?t.x=Math.random()*(this.radius-this.innerRadius)+this.innerRadius:t.x=this.radius,t.y=0;const e=Math.random()*Math.PI*2;this.rotation&&(t.rotation+=e),Ar(e,t.position),t.position.x+=this.x,t.position.y+=this.y}}ml.type="torus",ml.editorConfig=null;class fu{constructor(t){this.segments=[],this.countingLengths=[],this.totalLength=0,this.init(t)}init(t){if(!t||!t.length)this.segments.push({p1:{x:0,y:0},p2:{x:0,y:0},l:0});else if(Array.isArray(t[0]))for(let e=0;e<t.length;++e){const s=t[e];let r=s[0];for(let n=1;n<s.length;++n){const a=s[n];this.segments.push({p1:r,p2:a,l:0}),r=a}}else{let e=t[0];for(let s=1;s<t.length;++s){const r=t[s];this.segments.push({p1:e,p2:r,l:0}),e=r}}for(let e=0;e<this.segments.length;++e){const{p1:s,p2:r}=this.segments[e],n=Math.sqrt((r.x-s.x)*(r.x-s.x)+(r.y-s.y)*(r.y-s.y));this.segments[e].l=n,this.totalLength+=n,this.countingLengths.push(this.totalLength)}}getRandPos(t){const e=Math.random()*this.totalLength;let s,r;if(this.segments.length===1)s=this.segments[0],r=e;else for(let h=0;h<this.countingLengths.length;++h)if(e<this.countingLengths[h]){s=this.segments[h],r=h===0?e:e-this.countingLengths[h-1];break}r/=s.l||1;const{p1:n,p2:a}=s;t.x=n.x+r*(a.x-n.x),t.y=n.y+r*(a.y-n.y)}}fu.type="polygonalChain",fu.editorConfig=null;class pu{constructor(t){var e;this.order=Ft.Late,this.minStart=t.minStart,this.maxStart=t.maxStart,this.accel=t.accel,this.rotate=!!t.rotate,this.maxSpeed=(e=t.maxSpeed)!==null&&e!==void 0?e:0}initParticles(t){let e=t;for(;e;){const s=Math.random()*(this.maxStart-this.minStart)+this.minStart;e.config.velocity?e.config.velocity.set(s,0):e.config.velocity=new st(s,0),Ar(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=t.config.velocity,r=s.x,n=s.y;if(s.x+=this.accel.x*e,s.y+=this.accel.y*e,this.maxSpeed){const a=f_(s);a>this.maxSpeed&&p_(s,this.maxSpeed/a)}t.x+=(r+s.x)/2*e,t.y+=(n+s.y)/2*e,this.rotate&&(t.rotation=Math.atan2(s.y,s.x))}}pu.type="moveAcceleration",pu.editorConfig=null;function CS(i){return this.ease&&(i=this.ease(i)),(this.first.next.value-this.first.value)*i+this.first.value}function IS(i){this.ease&&(i=this.ease(i));const t=this.first.value,e=this.first.next.value,s=(e.r-t.r)*i+t.r,r=(e.g-t.g)*i+t.g,n=(e.b-t.b)*i+t.b;return fl(s,r,n)}function PS(i){this.ease&&(i=this.ease(i));let t=this.first,e=t.next;for(;i>e.time;)t=e,e=e.next;return i=(i-t.time)/(e.time-t.time),(e.value-t.value)*i+t.value}function RS(i){this.ease&&(i=this.ease(i));let t=this.first,e=t.next;for(;i>e.time;)t=e,e=e.next;i=(i-t.time)/(e.time-t.time);const s=t.value,r=e.value,n=(r.r-s.r)*i+s.r,a=(r.g-s.g)*i+s.g,h=(r.b-s.b)*i+s.b;return fl(n,a,h)}function MS(i){this.ease&&(i=this.ease(i));let t=this.first;for(;t.next&&i>t.next.time;)t=t.next;return t.value}function FS(i){this.ease&&(i=this.ease(i));let t=this.first;for(;t.next&&i>t.next.time;)t=t.next;const e=t.value;return fl(e.r,e.g,e.b)}class Co{constructor(t=!1){this.first=null,this.isColor=!!t,this.interpolate=null,this.ease=null}reset(t){this.first=t,t.next&&t.next.time>=1?this.interpolate=this.isColor?IS:CS:t.isStepped?this.interpolate=this.isColor?FS:MS:this.interpolate=this.isColor?RS:PS,this.ease=this.first.ease}}class mu{constructor(t){this.order=Ft.Normal,this.list=new Co(!1),this.list.reset(ir.createList(t.alpha))}initParticles(t){let e=t;for(;e;)e.alpha=this.list.first.value,e=e.next}updateParticle(t){t.alpha=this.list.interpolate(t.agePercent)}}mu.type="alpha",mu.editorConfig=null;class gu{constructor(t){this.order=Ft.Normal,this.value=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.value,e=e.next}}gu.type="alphaStatic",gu.editorConfig=null;function g_(i){const t=[];for(let e=0;e<i.length;++e){let s=i[e];if(typeof s=="string")t.push(So(s));else if(s instanceof q)t.push(s);else{let r=s.count||1;for(typeof s.texture=="string"?s=So(s.texture):s=s.texture;r>0;--r)t.push(s)}}return t}class _u{constructor(t){this.order=Ft.Normal,this.anims=[];for(let e=0;e<t.anims.length;++e){const s=t.anims[e],r=g_(s.textures),n=s.framerate<0?-1:s.framerate>0?s.framerate:60,a={textures:r,duration:n>0?r.length/n:0,framerate:n,loop:n>0?!!s.loop:!1};this.anims.push(a)}}initParticles(t){let e=t;for(;e;){const s=Math.floor(Math.random()*this.anims.length),r=e.config.anim=this.anims[s];e.texture=r.textures[0],e.config.animElapsed=0,r.framerate===-1?(e.config.animDuration=e.maxLife,e.config.animFramerate=r.textures.length/e.maxLife):(e.config.animDuration=r.duration,e.config.animFramerate=r.framerate),e=e.next}}updateParticle(t,e){const s=t.config,r=s.anim;s.animElapsed+=e,s.animElapsed>=s.animDuration&&(s.anim.loop?s.animElapsed=s.animElapsed%s.animDuration:s.animElapsed=s.animDuration-1e-6);const n=s.animElapsed*s.animFramerate+1e-7|0;t.texture=r.textures[n]||r.textures[r.textures.length-1]||q.EMPTY}}_u.type="animatedRandom",_u.editorConfig=null;class yu{constructor(t){this.order=Ft.Normal;const e=t.anim,s=g_(e.textures),r=e.framerate<0?-1:e.framerate>0?e.framerate:60;this.anim={textures:s,duration:r>0?s.length/r:0,framerate:r,loop:r>0?!!e.loop:!1}}initParticles(t){let e=t;const s=this.anim;for(;e;)e.texture=s.textures[0],e.config.animElapsed=0,s.framerate===-1?(e.config.animDuration=e.maxLife,e.config.animFramerate=s.textures.length/e.maxLife):(e.config.animDuration=s.duration,e.config.animFramerate=s.framerate),e=e.next}updateParticle(t,e){const s=this.anim,r=t.config;r.animElapsed+=e,r.animElapsed>=r.animDuration&&(s.loop?r.animElapsed=r.animElapsed%r.animDuration:r.animElapsed=r.animDuration-1e-6);const n=r.animElapsed*r.animFramerate+1e-7|0;t.texture=s.textures[n]||s.textures[s.textures.length-1]||q.EMPTY}}yu.type="animatedSingle",yu.editorConfig=null;class xu{constructor(t){this.order=Ft.Normal,this.value=t.blendMode}initParticles(t){let e=t;for(;e;)e.blendMode=SS(this.value),e=e.next}}xu.type="blendMode",xu.editorConfig=null;class vu{constructor(t){this.order=Ft.Spawn,this.spacing=t.spacing*nr,this.start=t.start*nr,this.distance=t.distance}initParticles(t){let e=0,s=t;for(;s;){let r;this.spacing?r=this.start+this.spacing*e:r=Math.random()*Math.PI*2,s.rotation=r,this.distance&&(s.position.x=this.distance,Ar(r,s.position)),s=s.next,++e}}}vu.type="spawnBurst",vu.editorConfig=null;class bu{constructor(t){this.order=Ft.Normal,this.list=new Co(!0),this.list.reset(ir.createList(t.color))}initParticles(t){let e=t;const s=this.list.first.value,r=fl(s.r,s.g,s.b);for(;e;)e.tint=r,e=e.next}updateParticle(t){t.tint=this.list.interpolate(t.agePercent)}}bu.type="color",bu.editorConfig=null;class wu{constructor(t){this.order=Ft.Normal;let e=t.color;e.charAt(0)==="#"?e=e.substr(1):e.indexOf("0x")===0&&(e=e.substr(2)),this.value=parseInt(e,16)}initParticles(t){let e=t;for(;e;)e.tint=this.value,e=e.next}}wu.type="colorStatic",wu.editorConfig=null;class Eu{constructor(t){this.order=Ft.Normal,this.index=0,this.textures=t.textures.map(e=>typeof e=="string"?So(e):e)}initParticles(t){let e=t;for(;e;)e.texture=this.textures[this.index],++this.index>=this.textures.length&&(this.index=0),e=e.next}}Eu.type="textureOrdered",Eu.editorConfig=null;const In=new st,__=["E","LN2","LN10","LOG2E","LOG10E","PI","SQRT1_2","SQRT2","abs","acos","acosh","asin","asinh","atan","atanh","atan2","cbrt","ceil","cos","cosh","exp","expm1","floor","fround","hypot","log","log1p","log10","log2","max","min","pow","random","round","sign","sin","sinh","sqrt","tan","tanh"],kS=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(__).join("|"),"g");function BS(i){const t=i.match(kS);for(let e=t.length-1;e>=0;--e)__.indexOf(t[e])>=0&&(t[e]=`Math.${t[e]}`);return i=t.join(""),new Function("x",`return ${i};`)}class Tu{constructor(t){var e;if(this.order=Ft.Late,t.path)if(typeof t.path=="function")this.path=t.path;else try{this.path=BS(t.path)}catch{this.path=null}else this.path=s=>s;this.list=new Co(!1),this.list.reset(ir.createList(t.speed)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){e.config.initRotation=e.rotation,e.config.initPosition?e.config.initPosition.copyFrom(e.position):e.config.initPosition=new st(e.x,e.y),e.config.movement=0;const s=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=s,e=e.next}}updateParticle(t,e){const s=this.list.interpolate(t.agePercent)*t.config.speedMult;t.config.movement+=s*e,In.x=t.config.movement,In.y=this.path(In.x),Ar(t.config.initRotation,In),t.position.x=t.config.initPosition.x+In.x,t.position.y=t.config.initPosition.y+In.y}}Tu.type="movePath",Tu.editorConfig=null;class Au{constructor(){this.order=Ft.Spawn}initParticles(t){}}Au.type="spawnPoint",Au.editorConfig=null;class Su{constructor(t){this.order=Ft.Normal,this.textures=t.textures.map(e=>typeof e=="string"?So(e):e)}initParticles(t){let e=t;for(;e;){const s=Math.floor(Math.random()*this.textures.length);e.texture=this.textures[s],e=e.next}}}Su.type="textureRandom",Su.editorConfig=null;class Cu{constructor(t){this.order=Ft.Normal,this.minStart=t.minStart*nr,this.maxStart=t.maxStart*nr,this.minSpeed=t.minSpeed*nr,this.maxSpeed=t.maxSpeed*nr,this.accel=t.accel*nr}initParticles(t){let e=t;for(;e;)this.minStart===this.maxStart?e.rotation+=this.maxStart:e.rotation+=Math.random()*(this.maxStart-this.minStart)+this.minStart,e.config.rotSpeed=Math.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed,e=e.next}updateParticle(t,e){if(this.accel){const s=t.config.rotSpeed;t.config.rotSpeed+=this.accel*e,t.rotation+=(t.config.rotSpeed+s)/2*e}else t.rotation+=t.config.rotSpeed*e}}Cu.type="rotation",Cu.editorConfig=null;class Iu{constructor(t){this.order=Ft.Normal,this.min=t.min*nr,this.max=t.max*nr}initParticles(t){let e=t;for(;e;)this.min===this.max?e.rotation+=this.max:e.rotation+=Math.random()*(this.max-this.min)+this.min,e=e.next}}Iu.type="rotationStatic",Iu.editorConfig=null;class Pu{constructor(t){this.order=Ft.Late+1,this.rotation=(t.rotation||0)*nr}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}}Pu.type="noRotation",Pu.editorConfig=null;class Ru{constructor(t){var e;this.order=Ft.Normal,this.list=new Co(!1),this.list.reset(ir.createList(t.scale)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const s=Math.random()*(1-this.minMult)+this.minMult;e.config.scaleMult=s,e.scale.x=e.scale.y=this.list.first.value*s,e=e.next}}updateParticle(t){t.scale.x=t.scale.y=this.list.interpolate(t.agePercent)*t.config.scaleMult}}Ru.type="scale",Ru.editorConfig=null;class Mu{constructor(t){this.order=Ft.Normal,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const s=Math.random()*(this.max-this.min)+this.min;e.scale.x=e.scale.y=s,e=e.next}}}Mu.type="scaleStatic",Mu.editorConfig=null;class Cs{constructor(t){this.order=Ft.Spawn;const e=Cs.shapes[t.type];if(!e)throw new Error(`No shape found with type '${t.type}'`);this.shape=new e(t.data)}static registerShape(t,e){Cs.shapes[e||t.type]=t}initParticles(t){let e=t;for(;e;)this.shape.getRandPos(e),e=e.next}}Cs.type="spawnShape",Cs.editorConfig=null,Cs.shapes={},Cs.registerShape(fu),Cs.registerShape(du),Cs.registerShape(ml),Cs.registerShape(ml,"circle");class Fu{constructor(t){this.order=Ft.Normal,this.texture=typeof t.texture=="string"?So(t.texture):t.texture}initParticles(t){let e=t;for(;e;)e.texture=this.texture,e=e.next}}Fu.type="textureSingle",Fu.editorConfig=null;class ku{constructor(t){var e;this.order=Ft.Late,this.list=new Co(!1),this.list.reset(ir.createList(t.speed)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const s=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=s,e.config.velocity?e.config.velocity.set(this.list.first.value*s,0):e.config.velocity=new st(this.list.first.value*s,0),Ar(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=this.list.interpolate(t.agePercent)*t.config.speedMult,r=t.config.velocity;AS(r),p_(r,s),t.x+=r.x*e,t.y+=r.y*e}}ku.type="moveSpeed",ku.editorConfig=null;class Bu{constructor(t){this.order=Ft.Late,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const s=Math.random()*(this.max-this.min)+this.min;e.config.velocity?e.config.velocity.set(s,0):e.config.velocity=new st(s,0),Ar(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=t.config.velocity;t.x+=s.x*e,t.y+=s.y*e}}Bu.type="moveSpeedStatic",Bu.editorConfig=null,Et.registerBehavior(pu),Et.registerBehavior(mu),Et.registerBehavior(gu),Et.registerBehavior(_u),Et.registerBehavior(yu),Et.registerBehavior(xu),Et.registerBehavior(vu),Et.registerBehavior(bu),Et.registerBehavior(wu),Et.registerBehavior(Eu),Et.registerBehavior(Tu),Et.registerBehavior(Au),Et.registerBehavior(Su),Et.registerBehavior(Cu),Et.registerBehavior(Iu),Et.registerBehavior(Pu),Et.registerBehavior(Ru),Et.registerBehavior(Mu),Et.registerBehavior(Cs),Et.registerBehavior(Fu),Et.registerBehavior(ku),Et.registerBehavior(Bu);class Du extends za{constructor(t){const{text:e,fontSize:s=36,fontColor:r=16777215,stroke:n,strokeColor:a,strokeThickness:h,fontFamily:o="Arial",fontWeight:l="normal",wordWrap:u=!1,wordWrapWidth:c=100,lineHeight:d=1.25,align:f="left",indent:p=0,shadow:m}=t,g=new vr({fontSize:s,wordWrap:u,wordWrapWidth:c,fontWeight:l,lineHeight:d*s,breakWords:u,fill:r,align:f,fontFamily:o,stroke:n?a:"transparent",strokeThickness:n?h:0,lineJoin:"round"});m&&(g.dropShadow=!0,g.dropShadowColor=m[0],g.dropShadowAngle=m[1]*(Math.PI/180),g.dropShadowBlur=m[2],g.dropShadowDistance=m[3]),super(e,g),this.position.x=p*s}}class DS extends Bt{constructor(t){super();const{start:e,control:s,end:r,json:n,duration:a,ease:h="power1.out",showControl:o=!1,loop:l=!1}=t;this._particleContainer=new kT,this.addChild(this._particleContainer);const u=new Et(this._particleContainer,n),c=this._createBezierPoints([e,...s,r],100,o),d={pathThrough:0};xt.to(d,{duration:a,pathThrough:c.length-1,repeat:l?-1:0,ease:h,onStart:()=>{u.emit=!0},onUpdate:()=>{const p=Math.floor(d.pathThrough),m=c[p];u.updateOwnerPos(m.x,m.y)},onComplete:()=>{xt.to(this,{alpha:0,duration:.5,onComplete:()=>{u.emit=!1,f.destroy(),this.removeFromParent()}})}});const f=new wt;f.add(()=>{u.update(1/75)}),f.start()}_createBezierPoints(t,e,s){const r=[];s&&t.forEach((n,a)=>{const h=new Du({text:a+1,fontSize:16});h.position.set(n.x,n.y),this.addChild(h)});for(let n=0;n<e;n++){const a=this._multiPointBezier(t,n/e);r.push(a)}return r}_multiPointBezier(t,e){const s=t.length;let r=0,n=0;const a=[];for(let h=0;h<s;h++)a[h]=this._binomial(s-1,h);for(let h=0;h<s;h++){const o=t[h],l=a[h],u=Math.pow(e,h),c=Math.pow(1-e,s-1-h);r+=o.x*c*u*l,n+=o.y*c*u*l}return{x:r,y:n}}_binomial(t,e){if(e===0||e===t)return 1;let s=1;for(let r=1;r<=e;r++)s=s*(t-r+1)/r;return s}}var at=(i=>(i[i.Region=0]="Region",i[i.BoundingBox=1]="BoundingBox",i[i.Mesh=2]="Mesh",i[i.LinkedMesh=3]="LinkedMesh",i[i.Path=4]="Path",i[i.Point=5]="Point",i[i.Clipping=6]="Clipping",i))(at||{});class gl{constructor(t,e=new Array,s=0,r=new DataView(t.buffer)){this.strings=e,this.index=s,this.buffer=r}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){const t=this.buffer.getInt16(this.index);return this.index+=2,t}readInt32(){const t=this.buffer.getInt32(this.index);return this.index+=4,t}readInt(t){let e=this.readByte(),s=e&127;return e&128&&(e=this.readByte(),s|=(e&127)<<7,e&128&&(e=this.readByte(),s|=(e&127)<<14,e&128&&(e=this.readByte(),s|=(e&127)<<21,e&128&&(e=this.readByte(),s|=(e&127)<<28)))),t?s:s>>>1^-(s&1)}readStringRef(){const t=this.readInt(!0);return t==0?null:this.strings[t-1]}readString(){let t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;let e="";for(let s=0;s<t;){const r=this.readUnsignedByte();switch(r>>4){case 12:case 13:e+=String.fromCharCode((r&31)<<6|this.readByte()&63),s+=2;break;case 14:e+=String.fromCharCode((r&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:e+=String.fromCharCode(r),s++}}return e}readFloat(){const t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}}var S=(i=>(i[i.setup=0]="setup",i[i.first=1]="first",i[i.replace=2]="replace",i[i.add=3]="add",i))(S||{}),At=(i=>(i[i.mixIn=0]="mixIn",i[i.mixOut=1]="mixOut",i))(At||{}),ne=(i=>(i[i.Fixed=0]="Fixed",i[i.Percent=1]="Percent",i))(ne||{}),Fe=(i=>(i[i.Tangent=0]="Tangent",i[i.Chain=1]="Chain",i[i.ChainScale=2]="ChainScale",i))(Fe||{}),vt=(i=>(i[i.Normal=0]="Normal",i[i.OnlyTranslation=1]="OnlyTranslation",i[i.NoRotationOrReflection=2]="NoRotationOrReflection",i[i.NoScale=3]="NoScale",i[i.NoScaleOrReflection=4]="NoScaleOrReflection",i))(vt||{});function y_(i){switch(i.toLowerCase()){case"nearest":return Ye.Nearest;case"linear":return Ye.Linear;case"mipmap":return Ye.MipMap;case"mipmapnearestnearest":return Ye.MipMapNearestNearest;case"mipmaplinearnearest":return Ye.MipMapLinearNearest;case"mipmapnearestlinear":return Ye.MipMapNearestLinear;case"mipmaplinearlinear":return Ye.MipMapLinearLinear;default:throw new Error(`Unknown texture filter ${i}`)}}var Ye=(i=>(i[i.Nearest=9728]="Nearest",i[i.Linear=9729]="Linear",i[i.MipMap=9987]="MipMap",i[i.MipMapNearestNearest=9984]="MipMapNearestNearest",i[i.MipMapLinearNearest=9985]="MipMapLinearNearest",i[i.MipMapNearestLinear=9986]="MipMapNearestLinear",i[i.MipMapLinearLinear=9987]="MipMapLinearLinear",i))(Ye||{}),Ui=(i=>(i[i.MirroredRepeat=33648]="MirroredRepeat",i[i.ClampToEdge=33071]="ClampToEdge",i[i.Repeat=10497]="Repeat",i))(Ui||{});class Ou{constructor(){this.size=null,this.names=null,this.values=null,this.renderObject=null}get width(){const t=this.texture;return t.trim?t.trim.width:t.orig.width}get height(){const t=this.texture;return t.trim?t.trim.height:t.orig.height}get u(){return this.texture._uvs.x0}get v(){return this.texture._uvs.y0}get u2(){return this.texture._uvs.x2}get v2(){return this.texture._uvs.y2}get offsetX(){const t=this.texture;return t.trim?t.trim.x:0}get offsetY(){return this.spineOffsetY}get pixiOffsetY(){const t=this.texture;return t.trim?t.trim.y:0}get spineOffsetY(){const t=this.texture;return this.originalHeight-this.height-(t.trim?t.trim.y:0)}get originalWidth(){return this.texture.orig.width}get originalHeight(){return this.texture.orig.height}get x(){return this.texture.frame.x}get y(){return this.texture.frame.y}get rotate(){return this.texture.rotate!==0}get degrees(){return(360-this.texture.rotate*45)%360}}class OS{constructor(){this.x=0,this.y=0,this.width=0,this.height=0,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0,this.rotate=0,this.index=0}}class Lu{constructor(t,e,s){this.pages=new Array,this.regions=new Array,t&&this.addSpineAtlas(t,e,s)}addTexture(t,e){const s=this.pages;let r=null;for(let a=0;a<s.length;a++)if(s[a].baseTexture===e.baseTexture){r=s[a];break}if(r===null){r=new x_,r.name="texturePage";const a=e.baseTexture;r.width=a.realWidth,r.height=a.realHeight,r.baseTexture=a,r.minFilter=r.magFilter=Ye.Nearest,r.uWrap=Ui.ClampToEdge,r.vWrap=Ui.ClampToEdge,s.push(r)}const n=new v_;return n.name=t,n.page=r,n.texture=e,n.index=-1,this.regions.push(n),n}addTextureHash(t,e){for(const s in t)t.hasOwnProperty(s)&&this.addTexture(e&&s.indexOf(".")!==-1?s.substr(0,s.lastIndexOf(".")):s,t[s])}addSpineAtlas(t,e,s){return this.load(t,e,s)}load(t,e,s){if(e==null)throw new Error("textureLoader cannot be null.");const r=new LS(t),n=new Array(4);let a=null;const h={};let o=null;h.size=()=>{a.width=parseInt(n[1]),a.height=parseInt(n[2])},h.format=()=>{},h.filter=()=>{a.minFilter=y_(n[1]),a.magFilter=y_(n[2])},h.repeat=()=>{n[1].indexOf("x")!=-1&&(a.uWrap=Ui.Repeat),n[1].indexOf("y")!=-1&&(a.vWrap=Ui.Repeat)},h.pma=()=>{a.pma=n[1]=="true"};const l={};l.xy=()=>{o.x=parseInt(n[1]),o.y=parseInt(n[2])},l.size=()=>{o.width=parseInt(n[1]),o.height=parseInt(n[2])},l.bounds=()=>{o.x=parseInt(n[1]),o.y=parseInt(n[2]),o.width=parseInt(n[3]),o.height=parseInt(n[4])},l.offset=()=>{o.offsetX=parseInt(n[1]),o.offsetY=parseInt(n[2])},l.orig=()=>{o.originalWidth=parseInt(n[1]),o.originalHeight=parseInt(n[2])},l.offsets=()=>{o.offsetX=parseInt(n[1]),o.offsetY=parseInt(n[2]),o.originalWidth=parseInt(n[3]),o.originalHeight=parseInt(n[4])},l.rotate=()=>{const d=n[1];let f=0;d.toLocaleLowerCase()=="true"?f=6:d.toLocaleLowerCase()=="false"?f=0:f=(720-parseFloat(d))%360/45,o.rotate=f},l.index=()=>{o.index=parseInt(n[1])};let u=r.readLine();for(;u!=null&&u.trim().length==0;)u=r.readLine();for(;!(u==null||u.trim().length==0||r.readEntry(n,u)==0);)u=r.readLine();const c=()=>{for(;;){if(u==null)return s&&s(this);if(u.trim().length==0)a=null,u=r.readLine();else if(a===null){for(a=new x_,a.name=u.trim();r.readEntry(n,u=r.readLine())!=0;){const d=h[n[0]];d&&d()}this.pages.push(a),e(a.name,d=>{if(d===null)return this.pages.splice(this.pages.indexOf(a),1),s&&s(null);a.baseTexture=d,a.pma&&(d.alphaMode=Re.PMA),d.valid||d.setSize(a.width,a.height),a.setFilters(),(!a.width||!a.height)&&(a.width=d.realWidth,a.height=d.realHeight,(!a.width||!a.height)&&console.log(`ERROR spine atlas page ${a.name}: meshes wont work if you dont specify size in atlas (http://www.html5gamedevs.com/topic/18888-pixi-spines-and-meshes/?p=107121)`)),c()});break}else{o=new OS;const d=new v_;d.name=u,d.page=a;let f=null,p=null;for(;;){const v=r.readEntry(n,u=r.readLine());if(v==0)break;const b=l[n[0]];if(b)b();else{f==null&&(f=[],p=[]),f.push(n[0]);const w=[];for(let E=0;E<v;E++)w.push(parseInt(n[E+1]));p.push(w)}}o.originalWidth==0&&o.originalHeight==0&&(o.originalWidth=o.width,o.originalHeight=o.height);const m=a.baseTexture.resolution;o.x/=m,o.y/=m,o.width/=m,o.height/=m,o.originalWidth/=m,o.originalHeight/=m,o.offsetX/=m,o.offsetY/=m;const g=o.rotate%4!==0,_=new rt(o.x,o.y,g?o.height:o.width,g?o.width:o.height),x=new rt(0,0,o.originalWidth,o.originalHeight),y=new rt(o.offsetX,o.originalHeight-o.height-o.offsetY,o.width,o.height);d.texture=new q(d.page.baseTexture,_,x,y,o.rotate),d.index=o.index,d.texture.updateUvs(),this.regions.push(d)}}};c()}findRegion(t){for(let e=0;e<this.regions.length;e++)if(this.regions[e].name==t)return this.regions[e];return null}dispose(){for(let t=0;t<this.pages.length;t++)this.pages[t].baseTexture.dispose()}}class LS{constructor(t){this.index=0,this.lines=t.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(t,e){if(e==null||(e=e.trim(),e.length==0))return 0;const s=e.indexOf(":");if(s==-1)return 0;t[0]=e.substr(0,s).trim();for(let r=1,n=s+1;;r++){const a=e.indexOf(",",n);if(a==-1)return t[r]=e.substr(n).trim(),r;if(t[r]=e.substr(n,a-n).trim(),n=a+1,r==4)return 4}}}class x_{constructor(){this.minFilter=Ye.Nearest,this.magFilter=Ye.Nearest,this.uWrap=Ui.ClampToEdge,this.vWrap=Ui.ClampToEdge}setFilters(){const t=this.baseTexture,e=this.minFilter;e==Ye.Linear?t.scaleMode=je.LINEAR:this.minFilter==Ye.Nearest?t.scaleMode=je.NEAREST:(t.mipmap=vs.POW2,e==Ye.MipMapNearestNearest?t.scaleMode=je.NEAREST:t.scaleMode=je.LINEAR)}}class v_ extends Ou{}class NS{constructor(){this.array=new Array}add(t){const e=this.contains(t);return this.array[t|0]=t|0,!e}contains(t){return this.array[t|0]!=null}remove(t){this.array[t|0]=void 0}clear(){this.array.length=0}}class VS{constructor(){this.entries={},this.size=0}add(t){const e=this.entries[t];return this.entries[t]=!0,e?!1:(this.size++,!0)}addAll(t){const e=this.size;for(let s=0,r=t.length;s<r;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}}const Gi=class{constructor(i=0,t=0,e=0,s=0){this.r=i,this.g=t,this.b=e,this.a=s}set(i,t,e,s){return this.r=i,this.g=t,this.b=e,this.a=s,this.clamp()}setFromColor(i){return this.r=i.r,this.g=i.g,this.b=i.b,this.a=i.a,this}setFromString(i){return i=i.charAt(0)=="#"?i.substr(1):i,this.r=parseInt(i.substr(0,2),16)/255,this.g=parseInt(i.substr(2,2),16)/255,this.b=parseInt(i.substr(4,2),16)/255,this.a=i.length!=8?1:parseInt(i.substr(6,2),16)/255,this}add(i,t,e,s){return this.r+=i,this.g+=t,this.b+=e,this.a+=s,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(i,t){i.r=((t&4278190080)>>>24)/255,i.g=((t&16711680)>>>16)/255,i.b=((t&65280)>>>8)/255,i.a=(t&255)/255}static rgb888ToColor(i,t){i.r=((t&16711680)>>>16)/255,i.g=((t&65280)>>>8)/255,i.b=(t&255)/255}static fromString(i){return new Gi().setFromString(i)}};let X=Gi;X.WHITE=new Gi(1,1,1,1),X.RED=new Gi(1,0,0,1),X.GREEN=new Gi(0,1,0,1),X.BLUE=new Gi(0,0,1,1),X.MAGENTA=new Gi(1,0,1,1);const Sr=class{static clamp(i,t,e){return i<t?t:i>e?e:i}static cosDeg(i){return Math.cos(i*Sr.degRad)}static sinDeg(i){return Math.sin(i*Sr.degRad)}static signum(i){return Math.sign(i)}static toInt(i){return i>0?Math.floor(i):Math.ceil(i)}static cbrt(i){const t=Math.pow(Math.abs(i),.3333333333333333);return i<0?-t:t}static randomTriangular(i,t){return Sr.randomTriangularWith(i,t,(i+t)*.5)}static randomTriangularWith(i,t,e){const s=Math.random(),r=t-i;return s<=(e-i)/r?i+Math.sqrt(s*r*(e-i)):t-Math.sqrt((1-s)*r*(t-e))}static isPowerOfTwo(i){return i&&(i&i-1)===0}};let D=Sr;D.PI=3.1415927,D.PI2=Sr.PI*2,D.radiansToDegrees=180/Sr.PI,D.radDeg=Sr.radiansToDegrees,D.degreesToRadians=Sr.PI/180,D.degRad=Sr.degreesToRadians;class US{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class GS extends US{constructor(t){super(),this.power=2,this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2==0?-2:2)+1}}class b_ extends GS{applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}const Pn=class{static arrayCopy(i,t,e,s,r){for(let n=t,a=s;n<t+r;n++,a++)e[a]=i[n]}static arrayFill(i,t,e,s){for(let r=t;r<e;r++)i[r]=s}static setArraySize(i,t,e=0){const s=i.length;if(s==t)return i;if(i.length=t,s<t)for(let r=s;r<t;r++)i[r]=e;return i}static ensureArrayCapacity(i,t,e=0){return i.length>=t?i:Pn.setArraySize(i,t,e)}static newArray(i,t){const e=new Array(i);for(let s=0;s<i;s++)e[s]=t;return e}static newFloatArray(i){if(Pn.SUPPORTS_TYPED_ARRAYS)return new Float32Array(i);const t=new Array(i);for(let e=0;e<t.length;e++)t[e]=0;return t}static newShortArray(i){if(Pn.SUPPORTS_TYPED_ARRAYS)return new Int16Array(i);const t=new Array(i);for(let e=0;e<t.length;e++)t[e]=0;return t}static toFloatArray(i){return Pn.SUPPORTS_TYPED_ARRAYS?new Float32Array(i):i}static toSinglePrecision(i){return Pn.SUPPORTS_TYPED_ARRAYS?Math.fround(i):i}static webkit602BugfixHelper(i,t){}static contains(i,t,e=!0){for(let s=0;s<i.length;s++)if(i[s]==t)return!0;return!1}static enumValue(i,t){return i[t[0].toUpperCase()+t.slice(1)]}};let B=Pn;B.SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";class XS{constructor(t){this.items=new Array,this.instantiator=t}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(t){t.reset&&t.reset(),this.items.push(t)}freeAll(t){for(let e=0;e<t.length;e++)this.free(t[e])}clear(){this.items.length=0}}class $S{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}length(){const t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}normalize(){const t=this.length();return t!=0&&(this.x/=t,this.y/=t),this}}const YS={yDown:!0,FAIL_ON_NON_EXISTING_SKIN:!1,GLOBAL_AUTO_UPDATE:!0,GLOBAL_DELAY_LIMIT:0},ti=[0,0,0];class HS extends qe{constructor(){super(...arguments),this.region=null,this.attachment=null}}class WS extends FT{constructor(t,e,s,r,n){super(t,e,s,r,n),this.region=null,this.attachment=null}}const w_=class extends Bt{constructor(i){if(super(),!i)throw new Error("The spineData param is required.");if(typeof i=="string")throw new Error('spineData param cant be string. Please use spine.Spine.fromAtlas("YOUR_RESOURCE_NAME") from now on.');this.spineData=i,this.createSkeleton(i),this.slotContainers=[],this.tempClipContainers=[];for(let t=0,e=this.skeleton.slots.length;t<e;t++){const s=this.skeleton.slots[t],r=s.getAttachment(),n=this.newContainer();if(this.slotContainers.push(n),this.addChild(n),this.tempClipContainers.push(null),!!r)if(r.type===at.Region){const a=r.name,h=this.createSprite(s,r,a);s.currentSprite=h,s.currentSpriteName=a,n.addChild(h)}else if(r.type===at.Mesh){const a=this.createMesh(s,r);s.currentMesh=a,s.currentMeshId=r.id,s.currentMeshName=r.name,n.addChild(a)}else r.type===at.Clipping&&(this.createGraphics(s,r),n.addChild(s.clippingContainer),n.addChild(s.currentGraphics))}this.tintRgb=new Float32Array([1,1,1]),this.autoUpdate=!0,this.visible=!0}get debug(){return this._debug}set debug(i){var t;i!=this._debug&&((t=this._debug)==null||t.unregisterSpine(this),i==null||i.registerSpine(this),this._debug=i)}get autoUpdate(){return this._autoUpdate}set autoUpdate(i){i!==this._autoUpdate&&(this._autoUpdate=i,this.updateTransform=i?w_.prototype.autoUpdateTransform:Bt.prototype.updateTransform)}get tint(){return eo(this.tintRgb)}set tint(i){this.tintRgb=Kf(i,this.tintRgb)}get delayLimit(){return(typeof this.localDelayLimit<"u"?this.localDelayLimit:YS.GLOBAL_DELAY_LIMIT)||Number.MAX_VALUE}update(i){var l;const t=this.delayLimit;if(i>t&&(i=t),this.state.update(i),this.state.apply(this.skeleton),!this.skeleton)return;this.skeleton.updateWorldTransform();const e=this.skeleton.slots,s=this.color;let r=null,n=null;s?(r=s.light,n=s.dark):r=this.tintRgb;for(let u=0,c=e.length;u<c;u++){const d=e[u],f=d.getAttachment(),p=this.slotContainers[u];if(!f){p.visible=!1;continue}let m=null;f.sequence&&f.sequence.apply(d,f);let g=f.region;const _=f.color;switch(f!=null&&f.type){case at.Region:if(p.transform.setFromMatrix(d.bone.matrix),g=f.region,d.currentMesh&&(d.currentMesh.visible=!1,d.currentMesh=null,d.currentMeshId=void 0,d.currentMeshName=void 0),!g){d.currentSprite&&(d.currentSprite.renderable=!1);break}if(!d.currentSpriteName||d.currentSpriteName!==f.name){const v=f.name;if(d.currentSprite&&(d.currentSprite.visible=!1),d.sprites=d.sprites||{},d.sprites[v]!==void 0)d.sprites[v].visible=!0;else{const b=this.createSprite(d,f,v);p.addChild(b)}d.currentSprite=d.sprites[v],d.currentSpriteName=v}d.currentSprite.renderable=!0,d.hackRegion||this.setSpriteRegion(f,d.currentSprite,g),d.currentSprite.color?m=d.currentSprite.color:(ti[0]=r[0]*d.color.r*_.r,ti[1]=r[1]*d.color.g*_.g,ti[2]=r[2]*d.color.b*_.b,d.currentSprite.tint=eo(ti)),d.currentSprite.blendMode=d.blendMode;break;case at.Mesh:if(d.currentSprite){d.currentSprite.visible=!1,d.currentSprite=null,d.currentSpriteName=void 0;const v=new ma;v._parentID=-1,v._worldID=p.transform._worldID,p.transform=v}if(!g){d.currentMesh&&(d.currentMesh.renderable=!1);break}const y=f.id;if(d.currentMeshId===void 0||d.currentMeshId!==y){const v=y;if(d.currentMesh&&(d.currentMesh.visible=!1),d.meshes=d.meshes||{},d.meshes[v]!==void 0)d.meshes[v].visible=!0;else{const b=this.createMesh(d,f);p.addChild(b)}d.currentMesh=d.meshes[v],d.currentMeshName=f.name,d.currentMeshId=v}d.currentMesh.renderable=!0,f.computeWorldVerticesOld(d,d.currentMesh.vertices),d.currentMesh.color?m=d.currentMesh.color:(ti[0]=r[0]*d.color.r*_.r,ti[1]=r[1]*d.color.g*_.g,ti[2]=r[2]*d.color.b*_.b,d.currentMesh.tint=eo(ti)),d.currentMesh.blendMode=d.blendMode,d.hackRegion||this.setMeshRegion(f,d.currentMesh,g);break;case at.Clipping:d.currentGraphics||(this.createGraphics(d,f),p.addChild(d.clippingContainer),p.addChild(d.currentGraphics)),this.updateGraphics(d,f),p.alpha=1,p.visible=!0;continue;default:p.visible=!1;continue}if(p.visible=!0,m){let x=d.color.r*_.r,y=d.color.g*_.g,v=d.color.b*_.b;m.setLight(r[0]*x+n[0]*(1-x),r[1]*y+n[1]*(1-y),r[2]*v+n[2]*(1-v)),d.darkColor?(x=d.darkColor.r,y=d.darkColor.g,v=d.darkColor.b):(x=0,y=0,v=0),m.setDark(r[0]*x+n[0]*(1-x),r[1]*y+n[1]*(1-y),r[2]*v+n[2]*(1-v))}p.alpha=d.color.a}const a=this.skeleton.drawOrder;let h=null,o=null;for(let u=0,c=a.length;u<c;u++){const d=e[a[u].data.index],f=this.slotContainers[a[u].data.index];if(o||f.parent!==null&&f.parent!==this&&(f.parent.removeChild(f),f.parent=this),d.currentGraphics&&d.getAttachment())o=d.clippingContainer,h=d.getAttachment(),o.children.length=0,this.children[u]=f,h.endSlot===d.data&&(h.endSlot=null);else if(o){let p=this.tempClipContainers[u];p||(p=this.tempClipContainers[u]=this.newContainer(),p.visible=!1),this.children[u]=p,f.parent=null,o.addChild(f),h.endSlot==d.data&&(o.renderable=!0,o=null,h=null)}else this.children[u]=f}(l=this._debug)==null||l.renderDebug(this)}setSpriteRegion(i,t,e){t.attachment===i&&t.region===e||(t.region=e,t.attachment=i,t.texture=e.texture,t.rotation=i.rotation*D.degRad,t.position.x=i.x,t.position.y=i.y,t.alpha=i.color.a,e.size?(t.scale.x=e.size.width/e.originalWidth,t.scale.y=-e.size.height/e.originalHeight):(t.scale.x=i.scaleX*i.width/e.originalWidth,t.scale.y=-i.scaleY*i.height/e.originalHeight))}setMeshRegion(i,t,e){t.attachment===i&&t.region===e||(t.region=e,t.attachment=i,t.texture=e.texture,e.texture.updateUvs(),t.uvBuffer.update(i.regionUVs))}autoUpdateTransform(){{this.lastTime=this.lastTime||Date.now();const i=(Date.now()-this.lastTime)*.001;this.lastTime=Date.now(),this.update(i)}Bt.prototype.updateTransform.call(this)}createSprite(i,t,e){let s=t.region;i.hackAttachment===t&&(s=i.hackRegion);const r=s?s.texture:null,n=this.newSprite(r);return n.anchor.set(.5),s&&this.setSpriteRegion(t,n,t.region),i.sprites=i.sprites||{},i.sprites[e]=n,n}createMesh(i,t){let e=t.region;i.hackAttachment===t&&(e=i.hackRegion,i.hackAttachment=null,i.hackRegion=null);const s=this.newMesh(e?e.texture:null,new Float32Array(t.regionUVs.length),t.regionUVs,new Uint16Array(t.triangles),xs.TRIANGLES);return typeof s._canvasPadding<"u"&&(s._canvasPadding=1.5),s.alpha=t.color.a,s.region=t.region,e&&this.setMeshRegion(t,s,e),i.meshes=i.meshes||{},i.meshes[t.id]=s,s}createGraphics(i,t){const e=this.newGraphics(),s=new Nr([]);return e.clear(),e.beginFill(16777215,1),e.drawPolygon(s),e.renderable=!1,i.currentGraphics=e,i.clippingContainer=this.newContainer(),i.clippingContainer.mask=i.currentGraphics,e}updateGraphics(i,t){const e=i.currentGraphics.geometry,s=e.graphicsData[0].shape.points,r=t.worldVerticesLength;s.length=r,t.computeWorldVertices(i,0,r,s,0,2),e.invalidate()}hackTextureBySlotIndex(i,t=null,e=null){const s=this.skeleton.slots[i];if(!s)return!1;const r=s.getAttachment();let n=r.region;return t?(n=new Ou,n.texture=t,n.size=e,s.hackRegion=n,s.hackAttachment=r):(s.hackRegion=null,s.hackAttachment=null),s.currentSprite?this.setSpriteRegion(r,s.currentSprite,n):s.currentMesh&&this.setMeshRegion(r,s.currentMesh,n),!0}hackTextureBySlotName(i,t=null,e=null){const s=this.skeleton.findSlotIndex(i);return s==-1?!1:this.hackTextureBySlotIndex(s,t,e)}hackTextureAttachment(i,t,e,s=null){const r=this.skeleton.findSlotIndex(i),n=this.skeleton.getAttachmentByName(i,t);n.region.texture=e;const a=this.skeleton.slots[r];if(!a)return!1;const h=a.getAttachment();if(t===h.name){let o=n.region;return e?(o=new Ou,o.texture=e,o.size=s,a.hackRegion=o,a.hackAttachment=h):(a.hackRegion=null,a.hackAttachment=null),a.currentSprite&&a.currentSprite.region!=o?(this.setSpriteRegion(h,a.currentSprite,o),a.currentSprite.region=o):a.currentMesh&&a.currentMesh.region!=o&&this.setMeshRegion(h,a.currentMesh,o),!0}return!1}newContainer(){return new Bt}newSprite(i){return new HS(i)}newGraphics(){return new hs}newMesh(i,t,e,s,r){return new WS(i,t,e,s,r)}transformHack(){return 1}hackAttachmentGroups(i,t,e){if(!i)return;const s=[],r=[];for(let n=0,a=this.skeleton.slots.length;n<a;n++){const h=this.skeleton.slots[n],o=h.currentSpriteName||h.currentMeshName||"",l=h.currentSprite||h.currentMesh;o.endsWith(i)?(l.parentGroup=t,r.push(l)):e&&l&&(l.parentGroup=e,s.push(l))}return[s,r]}destroy(i){this.debug=null;for(let t=0,e=this.skeleton.slots.length;t<e;t++){const s=this.skeleton.slots[t];for(const r in s.meshes)s.meshes[r].destroy(i);s.meshes=null;for(const r in s.sprites)s.sprites[r].destroy(i);s.sprites=null}for(let t=0,e=this.slotContainers.length;t<e;t++)this.slotContainers[t].destroy(i);this.spineData=null,this.skeleton=null,this.slotContainers=null,this.stateData=null,this.state=null,this.tempClipContainers=null,super.destroy(i)}};let Nu=w_;Nu.clippingPolygon=[],Object.defineProperty(Nu.prototype,"visible",{get(){return this._visible},set(i){i!==this._visible&&(this._visible=i,i&&(this.lastTime=0))}});let E_=class{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}};const T_=class extends E_{constructor(t){super(t),this.id=(T_.nextID++&65535)<<11,this.worldVerticesLength=0,this.deformAttachment=this}computeWorldVerticesOld(t,e){this.computeWorldVertices(t,0,this.worldVerticesLength,e,0,2)}computeWorldVertices(t,e,s,r,n,a){s=n+(s>>1)*a;const h=t.bone.skeleton,o=t.deform;let l=this.vertices;const u=this.bones;if(u==null){o.length>0&&(l=o);const p=t.bone.matrix,m=p.tx,g=p.ty,_=p.a,x=p.c,y=p.b,v=p.d;for(let b=e,w=n;w<s;b+=2,w+=a){const E=l[b],T=l[b+1];r[w]=E*_+T*x+m,r[w+1]=E*y+T*v+g}return}let c=0,d=0;for(let p=0;p<e;p+=2){const m=u[c];c+=m+1,d+=m}const f=h.bones;if(o.length==0)for(let p=n,m=d*3;p<s;p+=a){let g=0,_=0,x=u[c++];for(x+=c;c<x;c++,m+=3){const y=f[u[c]].matrix,v=l[m],b=l[m+1],w=l[m+2];g+=(v*y.a+b*y.c+y.tx)*w,_+=(v*y.b+b*y.d+y.ty)*w}r[p]=g,r[p+1]=_}else{const p=o;for(let m=n,g=d*3,_=d<<1;m<s;m+=a){let x=0,y=0,v=u[c++];for(v+=c;c<v;c++,g+=3,_+=2){const b=f[u[c]].matrix,w=l[g]+p[_],E=l[g+1]+p[_+1],T=l[g+2];x+=(w*b.a+E*b.c+b.tx)*T,y+=(w*b.b+E*b.d+b.ty)*T}r[m]=x,r[m+1]=y}}}copyTo(t){this.bones!=null?(t.bones=new Array(this.bones.length),B.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices!=null?(t.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)):t.vertices=null,t.worldVerticesLength=this.worldVerticesLength,t.deformAttachment=this.deformAttachment}};let Xi=T_;Xi.nextID=0;let zS=class sy extends Xi{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}copy(){const t=new sy(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},jS=class ry extends Xi{constructor(t){super(t),this.type=at.Clipping,this.color=new X(.2275,.2275,.8078,1)}copy(){const t=new ry(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},Vu=class xd extends Xi{constructor(t){super(t),this.type=at.Mesh,this.color=new X(1,1,1,1),this.tempColor=new X(0,0,0,0)}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t!=null&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh!=null)return this.newLinkedMesh();const t=new xd(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Float32Array(this.regionUVs.length),B.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=new Array(this.triangles.length),B.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges!=null&&(t.edges=new Array(this.edges.length),B.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}newLinkedMesh(){const t=new xd(this.name);return t.region=this.region,t.path=this.path,t.color.setFromColor(this.color),t.deformAttachment=this.deformAttachment,t.setParentMesh(this.parentMesh!=null?this.parentMesh:this),t}},_l=class iy extends Xi{constructor(t){super(t),this.type=at.Path,this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}copy(){const t=new iy(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),B.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},qS=class ny extends Xi{constructor(t){super(t),this.type=at.Point,this.color=new X(.38,.94,0,1)}computeWorldPosition(t,e){const s=t.matrix;return e.x=this.x*s.a+this.y*s.c+t.worldX,e.y=this.x*s.b+this.y*s.d+t.worldY,e}computeWorldRotation(t){const e=t.matrix,s=D.cosDeg(this.rotation),r=D.sinDeg(this.rotation),n=s*e.a+r*e.c,a=s*e.b+r*e.d;return Math.atan2(a,n)*D.radDeg}copy(){const t=new ny(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},A_=class{constructor(t,e){if(this.deform=new Array,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new X,this.darkColor=t.darkColor==null?null:new X,this.setToSetupPose(),this.blendMode=this.data.blendMode}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.deform.length=0)}setAttachmentTime(t){this.attachmentTime=this.bone.skeleton.time-t}getAttachmentTime(){return this.bone.skeleton.time-this.attachmentTime}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor!=null&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName==null?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))}};const _e=class extends E_{constructor(t){super(t),this.type=at.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new X(1,1,1,1),this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new X(1,1,1,1)}updateOffset(){const t=this.width/this.region.originalWidth*this.scaleX,e=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*t,r=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=r+this.region.height*e,h=this.rotation*Math.PI/180,o=Math.cos(h),l=Math.sin(h),u=s*o+this.x,c=s*l,d=r*o+this.y,f=r*l,p=n*o+this.x,m=n*l,g=a*o+this.y,_=a*l,x=this.offset;x[_e.OX1]=u-f,x[_e.OY1]=d+c,x[_e.OX2]=u-_,x[_e.OY2]=g+c,x[_e.OX3]=p-_,x[_e.OY3]=g+m,x[_e.OX4]=p-f,x[_e.OY4]=d+m}setRegion(t){this.region=t;const e=this.uvs;t.rotate?(e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v,e[0]=t.u2,e[1]=t.v2):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,r){const n=this.offset,a=t instanceof A_?t.bone.matrix:t.matrix,h=a.tx,o=a.ty,l=a.a,u=a.c,c=a.b,d=a.d;let f=0,p=0;f=n[_e.OX1],p=n[_e.OY1],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[_e.OX2],p=n[_e.OY2],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[_e.OX3],p=n[_e.OY3],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[_e.OX4],p=n[_e.OY4],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o}copy(){const t=new _e(this.name);return t.region=this.region,t.rendererObject=this.rendererObject,t.path=this.path,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,B.arrayCopy(this.uvs,0,t.uvs,0,8),B.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t}};let it=_e;it.OX1=0,it.OY1=1,it.OX2=2,it.OY2=3,it.OX3=4,it.OY3=5,it.OX4=6,it.OY4=7,it.X1=0,it.Y1=1,it.C1R=2,it.C1G=3,it.C1B=4,it.C1A=5,it.U1=6,it.V1=7,it.X2=8,it.Y2=9,it.C2R=10,it.C2G=11,it.C2B=12,it.C2A=13,it.U2=14,it.V2=15,it.X3=16,it.Y3=17,it.C3R=18,it.C3G=19,it.C3B=20,it.C3A=21,it.U3=22,it.V3=23,it.X4=24,it.Y4=25,it.C4R=26,it.C4G=27,it.C4B=28,it.C4A=29,it.U4=30,it.V4=31,new b_(2);let oe=class{constructor(t,e,s){if(t==null)throw new Error("name cannot be null.");if(e==null)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.timelineIds=[];for(let r=0;r<e.length;r++)this.timelineIds[e[r].getPropertyId()]=!0;this.duration=s}hasTimeline(t){return this.timelineIds[t]==!0}apply(t,e,s,r,n,a,h,o){if(t==null)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let u=0,c=l.length;u<c;u++)l[u].apply(t,e,s,n,a,h,o)}static binarySearch(t,e,s=1){let r=0,n=t.length/s-2;if(n==0)return s;let a=n>>>1;for(;;){if(t[(a+1)*s]<=e?r=a+1:n=a,r==n)return(r+1)*s;a=r+n>>>1}}static linearSearch(t,e,s){for(let r=0,n=t.length-s;r<=n;r+=s)if(t[r]>e)return r;return-1}};const ee=class{constructor(t){if(t<=0)throw new Error(`frameCount must be > 0: ${t}`);this.curves=B.newFloatArray((t-1)*ee.BEZIER_SIZE)}getFrameCount(){return this.curves.length/ee.BEZIER_SIZE+1}setLinear(t){this.curves[t*ee.BEZIER_SIZE]=ee.LINEAR}setStepped(t){this.curves[t*ee.BEZIER_SIZE]=ee.STEPPED}getCurveType(t){const e=t*ee.BEZIER_SIZE;if(e==this.curves.length)return ee.LINEAR;const s=this.curves[e];return s==ee.LINEAR?ee.LINEAR:s==ee.STEPPED?ee.STEPPED:ee.BEZIER}setCurve(t,e,s,r,n){const a=(-e*2+r)*.03,h=(-s*2+n)*.03,o=((e-r)*3+1)*.006,l=((s-n)*3+1)*.006;let u=a*2+o,c=h*2+l,d=e*.3+a+o*.16666667,f=s*.3+h+l*.16666667,p=t*ee.BEZIER_SIZE;const m=this.curves;m[p++]=ee.BEZIER;let g=d,_=f;for(let x=p+ee.BEZIER_SIZE-1;p<x;p+=2)m[p]=g,m[p+1]=_,d+=u,f+=c,u+=o,c+=l,g+=d,_+=f}getCurvePercent(t,e){e=D.clamp(e,0,1);const s=this.curves;let r=t*ee.BEZIER_SIZE;const n=s[r];if(n==ee.LINEAR)return e;if(n==ee.STEPPED)return 0;r++;let a=0;for(let o=r,l=r+ee.BEZIER_SIZE-1;r<l;r+=2)if(a=s[r],a>=e){let u,c;return r==o?(u=0,c=0):(u=s[r-2],c=s[r-1]),c+(s[r+1]-c)*(e-u)/(a-u)}const h=s[r-1];return h+(1-h)*(e-a)/(1-a)}};let es=ee;es.LINEAR=0,es.STEPPED=1,es.BEZIER=2,es.BEZIER_SIZE=10*2-1;const ei=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+ei.ROTATION]=s}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.rotation=l.data.rotation;return;case S.first:const m=l.data.rotation-l.rotation;l.rotation+=(m-(16384-(16384.499999999996-m/360|0))*360)*n}return}if(s>=o[o.length-ei.ENTRIES]){let m=o[o.length+ei.PREV_ROTATION];switch(a){case S.setup:l.rotation=l.data.rotation+m*n;break;case S.first:case S.replace:m+=l.data.rotation-l.rotation,m-=(16384-(16384.499999999996-m/360|0))*360;case S.add:l.rotation+=m*n}return}const u=oe.binarySearch(o,s,ei.ENTRIES),c=o[u+ei.PREV_ROTATION],d=o[u],f=this.getCurvePercent((u>>1)-1,1-(s-d)/(o[u+ei.PREV_TIME]-d));let p=o[u+ei.ROTATION]-c;switch(p=c+(p-(16384-(16384.499999999996-p/360|0))*360)*f,a){case S.setup:l.rotation=l.data.rotation+(p-(16384-(16384.499999999996-p/360|0))*360)*n;break;case S.first:case S.replace:p+=l.data.rotation-l.rotation;case S.add:l.rotation+=(p-(16384-(16384.499999999996-p/360|0))*360)*n}}};let Ie=ei;Ie.ENTRIES=2,Ie.PREV_TIME=-2,Ie.PREV_ROTATION=-1,Ie.ROTATION=1;const ke=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*ke.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(t,e,s,r){t*=ke.ENTRIES,this.frames[t]=e,this.frames[t+ke.X]=s,this.frames[t+ke.Y]=r}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.x=l.data.x,l.y=l.data.y;return;case S.first:l.x+=(l.data.x-l.x)*n,l.y+=(l.data.y-l.y)*n}return}let u=0,c=0;if(s>=o[o.length-ke.ENTRIES])u=o[o.length+ke.PREV_X],c=o[o.length+ke.PREV_Y];else{const d=oe.binarySearch(o,s,ke.ENTRIES);u=o[d+ke.PREV_X],c=o[d+ke.PREV_Y];const f=o[d],p=this.getCurvePercent(d/ke.ENTRIES-1,1-(s-f)/(o[d+ke.PREV_TIME]-f));u+=(o[d+ke.X]-u)*p,c+=(o[d+ke.Y]-c)*p}switch(a){case S.setup:l.x=l.data.x+u*n,l.y=l.data.y+c*n;break;case S.first:case S.replace:l.x+=(l.data.x+u-l.x)*n,l.y+=(l.data.y+c-l.y)*n;break;case S.add:l.x+=u*n,l.y+=c*n}}};let ps=ke;ps.ENTRIES=3,ps.PREV_TIME=-3,ps.PREV_X=-2,ps.PREV_Y=-1,ps.X=1,ps.Y=2;let S_=class Bs extends ps{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.scaleX=l.data.scaleX,l.scaleY=l.data.scaleY;return;case S.first:l.scaleX+=(l.data.scaleX-l.scaleX)*n,l.scaleY+=(l.data.scaleY-l.scaleY)*n}return}let u=0,c=0;if(s>=o[o.length-Bs.ENTRIES])u=o[o.length+Bs.PREV_X]*l.data.scaleX,c=o[o.length+Bs.PREV_Y]*l.data.scaleY;else{const d=oe.binarySearch(o,s,Bs.ENTRIES);u=o[d+Bs.PREV_X],c=o[d+Bs.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Bs.ENTRIES-1,1-(s-f)/(o[d+Bs.PREV_TIME]-f));u=(u+(o[d+Bs.X]-u)*p)*l.data.scaleX,c=(c+(o[d+Bs.Y]-c)*p)*l.data.scaleY}if(n==1)a==S.add?(l.scaleX+=u-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=u,l.scaleY=c);else{let d=0,f=0;if(h==At.mixOut)switch(a){case S.setup:d=l.data.scaleX,f=l.data.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.first:case S.replace:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.add:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-l.data.scaleX)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-l.data.scaleY)*n}else switch(a){case S.setup:d=Math.abs(l.data.scaleX)*D.signum(u),f=Math.abs(l.data.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.first:case S.replace:d=Math.abs(l.scaleX)*D.signum(u),f=Math.abs(l.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.add:d=D.signum(u),f=D.signum(c),l.scaleX=Math.abs(l.scaleX)*d+(u-Math.abs(l.data.scaleX)*d)*n,l.scaleY=Math.abs(l.scaleY)*f+(c-Math.abs(l.data.scaleY)*f)*n}}}},C_=class Ds extends ps{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.shearX=l.data.shearX,l.shearY=l.data.shearY;return;case S.first:l.shearX+=(l.data.shearX-l.shearX)*n,l.shearY+=(l.data.shearY-l.shearY)*n}return}let u=0,c=0;if(s>=o[o.length-Ds.ENTRIES])u=o[o.length+Ds.PREV_X],c=o[o.length+Ds.PREV_Y];else{const d=oe.binarySearch(o,s,Ds.ENTRIES);u=o[d+Ds.PREV_X],c=o[d+Ds.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Ds.ENTRIES-1,1-(s-f)/(o[d+Ds.PREV_TIME]-f));u=u+(o[d+Ds.X]-u)*p,c=c+(o[d+Ds.Y]-c)*p}switch(a){case S.setup:l.shearX=l.data.shearX+u*n,l.shearY=l.data.shearY+c*n;break;case S.first:case S.replace:l.shearX+=(l.data.shearX+u-l.shearX)*n,l.shearY+=(l.data.shearY+c-l.shearY)*n;break;case S.add:l.shearX+=u*n,l.shearY+=c*n}}};const Xt=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Xt.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(t,e,s,r,n,a){t*=Xt.ENTRIES,this.frames[t]=e,this.frames[t+Xt.R]=s,this.frames[t+Xt.G]=r,this.frames[t+Xt.B]=n,this.frames[t+Xt.A]=a}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.color.setFromColor(o.data.color);return;case S.first:const p=o.color,m=o.data.color;p.add((m.r-p.r)*n,(m.g-p.g)*n,(m.b-p.b)*n,(m.a-p.a)*n)}return}let u=0,c=0,d=0,f=0;if(s>=l[l.length-Xt.ENTRIES]){const p=l.length;u=l[p+Xt.PREV_R],c=l[p+Xt.PREV_G],d=l[p+Xt.PREV_B],f=l[p+Xt.PREV_A]}else{const p=oe.binarySearch(l,s,Xt.ENTRIES);u=l[p+Xt.PREV_R],c=l[p+Xt.PREV_G],d=l[p+Xt.PREV_B],f=l[p+Xt.PREV_A];const m=l[p],g=this.getCurvePercent(p/Xt.ENTRIES-1,1-(s-m)/(l[p+Xt.PREV_TIME]-m));u+=(l[p+Xt.R]-u)*g,c+=(l[p+Xt.G]-c)*g,d+=(l[p+Xt.B]-d)*g,f+=(l[p+Xt.A]-f)*g}if(n==1)o.color.set(u,c,d,f);else{const p=o.color;a==S.setup&&p.setFromColor(o.data.color),p.add((u-p.r)*n,(c-p.g)*n,(d-p.b)*n,(f-p.a)*n)}}};let He=Xt;He.ENTRIES=5,He.PREV_TIME=-5,He.PREV_R=-4,He.PREV_G=-3,He.PREV_B=-2,He.PREV_A=-1,He.R=1,He.G=2,He.B=3,He.A=4;const dt=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*dt.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(t,e,s,r,n,a,h,o,l){t*=dt.ENTRIES,this.frames[t]=e,this.frames[t+dt.R]=s,this.frames[t+dt.G]=r,this.frames[t+dt.B]=n,this.frames[t+dt.A]=a,this.frames[t+dt.R2]=h,this.frames[t+dt.G2]=o,this.frames[t+dt.B2]=l}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.color.setFromColor(o.data.color),o.darkColor.setFromColor(o.data.darkColor);return;case S.first:const _=o.color,x=o.darkColor,y=o.data.color,v=o.data.darkColor;_.add((y.r-_.r)*n,(y.g-_.g)*n,(y.b-_.b)*n,(y.a-_.a)*n),x.add((v.r-x.r)*n,(v.g-x.g)*n,(v.b-x.b)*n,0)}return}let u=0,c=0,d=0,f=0,p=0,m=0,g=0;if(s>=l[l.length-dt.ENTRIES]){const _=l.length;u=l[_+dt.PREV_R],c=l[_+dt.PREV_G],d=l[_+dt.PREV_B],f=l[_+dt.PREV_A],p=l[_+dt.PREV_R2],m=l[_+dt.PREV_G2],g=l[_+dt.PREV_B2]}else{const _=oe.binarySearch(l,s,dt.ENTRIES);u=l[_+dt.PREV_R],c=l[_+dt.PREV_G],d=l[_+dt.PREV_B],f=l[_+dt.PREV_A],p=l[_+dt.PREV_R2],m=l[_+dt.PREV_G2],g=l[_+dt.PREV_B2];const x=l[_],y=this.getCurvePercent(_/dt.ENTRIES-1,1-(s-x)/(l[_+dt.PREV_TIME]-x));u+=(l[_+dt.R]-u)*y,c+=(l[_+dt.G]-c)*y,d+=(l[_+dt.B]-d)*y,f+=(l[_+dt.A]-f)*y,p+=(l[_+dt.R2]-p)*y,m+=(l[_+dt.G2]-m)*y,g+=(l[_+dt.B2]-g)*y}if(n==1)o.color.set(u,c,d,f),o.darkColor.set(p,m,g,1);else{const _=o.color,x=o.darkColor;a==S.setup&&(_.setFromColor(o.data.color),x.setFromColor(o.data.darkColor)),_.add((u-_.r)*n,(c-_.g)*n,(d-_.b)*n,(f-_.a)*n),x.add((p-x.r)*n,(m-x.g)*n,(g-x.b)*n,0)}}};let ae=dt;ae.ENTRIES=8,ae.PREV_TIME=-8,ae.PREV_R=-7,ae.PREV_G=-6,ae.PREV_B=-5,ae.PREV_A=-4,ae.PREV_R2=-3,ae.PREV_G2=-2,ae.PREV_B2=-1,ae.R=1,ae.G=2,ae.B=3,ae.A=4,ae.R2=5,ae.G2=6,ae.B2=7;let Rn=class{constructor(t){this.frames=B.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;if(h==At.mixOut){a==S.setup&&this.setAttachment(t,o,o.data.attachmentName);return}const l=this.frames;if(s<l[0]){(a==S.setup||a==S.first)&&this.setAttachment(t,o,o.data.attachmentName);return}let u=0;s>=l[l.length-1]?u=l.length-1:u=oe.binarySearch(l,s,1)-1;const c=this.attachmentNames[u];t.slots[this.slotIndex].setAttachment(c==null?null:t.getAttachment(this.slotIndex,c))}setAttachment(t,e,s){e.setAttachment(s==null?null:t.getAttachment(this.slotIndex,s))}},I_=null,P_=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t),this.frameVertices=new Array(t),I_==null&&(I_=B.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(t,e,s){this.frames[t]=e,this.frameVertices[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.getAttachment();if(!(l instanceof Xi)||l.deformAttachment!=this.attachment)return;const u=o.deform;u.length==0&&(a=S.setup);const c=this.frameVertices,d=c[0].length,f=this.frames;if(s<f[0]){const v=l;switch(a){case S.setup:u.length=0;return;case S.first:if(n==1){u.length=0;break}const b=B.setArraySize(u,d);if(v.bones==null){const w=v.vertices;for(let E=0;E<d;E++)b[E]+=(w[E]-b[E])*n}else{n=1-n;for(let w=0;w<d;w++)b[w]*=n}}return}const p=B.setArraySize(u,d);if(s>=f[f.length-1]){const v=c[f.length-1];if(n==1)if(a==S.add){const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=v[E]-w[E]}else for(let w=0;w<d;w++)p[w]+=v[w]}else B.arrayCopy(v,0,p,0,d);else switch(a){case S.setup:{const w=l;if(w.bones==null){const E=w.vertices;for(let T=0;T<d;T++){const A=E[T];p[T]=A+(v[T]-A)*n}}else for(let E=0;E<d;E++)p[E]=v[E]*n;break}case S.first:case S.replace:for(let w=0;w<d;w++)p[w]+=(v[w]-p[w])*n;break;case S.add:const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=(v[E]-w[E])*n}else for(let w=0;w<d;w++)p[w]+=v[w]*n}return}const m=oe.binarySearch(f,s),g=c[m-1],_=c[m],x=f[m],y=this.getCurvePercent(m-1,1-(s-x)/(f[m-1]-x));if(n==1)if(a==S.add){const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=E+(_[w]-E)*y-b[w]}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=w+(_[b]-w)*y}}else for(let v=0;v<d;v++){const b=g[v];p[v]=b+(_[v]-b)*y}else switch(a){case S.setup:{const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++){const T=g[E],A=w[E];p[E]=A+(T+(_[E]-T)*y-A)*n}}else for(let w=0;w<d;w++){const E=g[w];p[w]=(E+(_[w]-E)*y)*n}break}case S.first:case S.replace:for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y-p[b])*n}break;case S.add:const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=(E+(_[w]-E)*y-b[w])*n}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y)*n}}}},Uu=class{constructor(t){this.frames=B.newFloatArray(t),this.events=new Array(t)}getPropertyId(){return 7<<24}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,r,n,a,h){if(r==null)return;const o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,r,n,a,h),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let u=0;if(e<o[0])u=0;else{u=oe.binarySearch(o,e);const c=o[u];for(;u>0&&o[u-1]==c;)u--}for(;u<l&&s>=o[u];u++)r.push(this.events[u])}},Io=class{constructor(t){this.frames=B.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,r,n,a,h){const o=t.drawOrder,l=t.slots;if(h==At.mixOut&&a==S.setup){B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const u=this.frames;if(s<u[0]){(a==S.setup||a==S.first)&&B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let c=0;s>=u[u.length-1]?c=u.length-1:c=oe.binarySearch(u,s)-1;const d=this.drawOrders[c];if(d==null)B.arrayCopy(l,0,o,0,l.length);else for(let f=0,p=d.length;f<p;f++)o[f]=l[d[f]]}};const mt=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*mt.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(t,e,s,r,n,a,h){t*=mt.ENTRIES,this.frames[t]=e,this.frames[t+mt.MIX]=s,this.frames[t+mt.SOFTNESS]=r,this.frames[t+mt.BEND_DIRECTION]=n,this.frames[t+mt.COMPRESS]=a?1:0,this.frames[t+mt.STRETCH]=h?1:0}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.ikConstraints[this.ikConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.mix=l.data.mix,l.softness=l.data.softness,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch;return;case S.first:l.mix+=(l.data.mix-l.mix)*n,l.softness+=(l.data.softness-l.softness)*n,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch}return}if(s>=o[o.length-mt.ENTRIES]){a==S.setup?(l.mix=l.data.mix+(o[o.length+mt.PREV_MIX]-l.data.mix)*n,l.softness=l.data.softness+(o[o.length+mt.PREV_SOFTNESS]-l.data.softness)*n,h==At.mixOut?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=o[o.length+mt.PREV_BEND_DIRECTION],l.compress=o[o.length+mt.PREV_COMPRESS]!=0,l.stretch=o[o.length+mt.PREV_STRETCH]!=0)):(l.mix+=(o[o.length+mt.PREV_MIX]-l.mix)*n,l.softness+=(o[o.length+mt.PREV_SOFTNESS]-l.softness)*n,h==At.mixIn&&(l.bendDirection=o[o.length+mt.PREV_BEND_DIRECTION],l.compress=o[o.length+mt.PREV_COMPRESS]!=0,l.stretch=o[o.length+mt.PREV_STRETCH]!=0));return}const u=oe.binarySearch(o,s,mt.ENTRIES),c=o[u+mt.PREV_MIX],d=o[u+mt.PREV_SOFTNESS],f=o[u],p=this.getCurvePercent(u/mt.ENTRIES-1,1-(s-f)/(o[u+mt.PREV_TIME]-f));a==S.setup?(l.mix=l.data.mix+(c+(o[u+mt.MIX]-c)*p-l.data.mix)*n,l.softness=l.data.softness+(d+(o[u+mt.SOFTNESS]-d)*p-l.data.softness)*n,h==At.mixOut?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=o[u+mt.PREV_BEND_DIRECTION],l.compress=o[u+mt.PREV_COMPRESS]!=0,l.stretch=o[u+mt.PREV_STRETCH]!=0)):(l.mix+=(c+(o[u+mt.MIX]-c)*p-l.mix)*n,l.softness+=(d+(o[u+mt.SOFTNESS]-d)*p-l.softness)*n,h==At.mixIn&&(l.bendDirection=o[u+mt.PREV_BEND_DIRECTION],l.compress=o[u+mt.PREV_COMPRESS]!=0,l.stretch=o[u+mt.PREV_STRETCH]!=0))}};let Pe=mt;Pe.ENTRIES=6,Pe.PREV_TIME=-6,Pe.PREV_MIX=-5,Pe.PREV_SOFTNESS=-4,Pe.PREV_BEND_DIRECTION=-3,Pe.PREV_COMPRESS=-2,Pe.PREV_STRETCH=-1,Pe.MIX=1,Pe.SOFTNESS=2,Pe.BEND_DIRECTION=3,Pe.COMPRESS=4,Pe.STRETCH=5;const $t=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*$t.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(t,e,s,r,n,a){t*=$t.ENTRIES,this.frames[t]=e,this.frames[t+$t.ROTATE]=s,this.frames[t+$t.TRANSLATE]=r,this.frames[t+$t.SCALE]=n,this.frames[t+$t.SHEAR]=a}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.transformConstraints[this.transformConstraintIndex];if(!l.active)return;if(s<o[0]){const p=l.data;switch(a){case S.setup:l.rotateMix=p.rotateMix,l.translateMix=p.translateMix,l.scaleMix=p.scaleMix,l.shearMix=p.shearMix;return;case S.first:l.rotateMix+=(p.rotateMix-l.rotateMix)*n,l.translateMix+=(p.translateMix-l.translateMix)*n,l.scaleMix+=(p.scaleMix-l.scaleMix)*n,l.shearMix+=(p.shearMix-l.shearMix)*n}return}let u=0,c=0,d=0,f=0;if(s>=o[o.length-$t.ENTRIES]){const p=o.length;u=o[p+$t.PREV_ROTATE],c=o[p+$t.PREV_TRANSLATE],d=o[p+$t.PREV_SCALE],f=o[p+$t.PREV_SHEAR]}else{const p=oe.binarySearch(o,s,$t.ENTRIES);u=o[p+$t.PREV_ROTATE],c=o[p+$t.PREV_TRANSLATE],d=o[p+$t.PREV_SCALE],f=o[p+$t.PREV_SHEAR];const m=o[p],g=this.getCurvePercent(p/$t.ENTRIES-1,1-(s-m)/(o[p+$t.PREV_TIME]-m));u+=(o[p+$t.ROTATE]-u)*g,c+=(o[p+$t.TRANSLATE]-c)*g,d+=(o[p+$t.SCALE]-d)*g,f+=(o[p+$t.SHEAR]-f)*g}if(a==S.setup){const p=l.data;l.rotateMix=p.rotateMix+(u-p.rotateMix)*n,l.translateMix=p.translateMix+(c-p.translateMix)*n,l.scaleMix=p.scaleMix+(d-p.scaleMix)*n,l.shearMix=p.shearMix+(f-p.shearMix)*n}else l.rotateMix+=(u-l.rotateMix)*n,l.translateMix+=(c-l.translateMix)*n,l.scaleMix+=(d-l.scaleMix)*n,l.shearMix+=(f-l.shearMix)*n}};let We=$t;We.ENTRIES=5,We.PREV_TIME=-5,We.PREV_ROTATE=-4,We.PREV_TRANSLATE=-3,We.PREV_SCALE=-2,We.PREV_SHEAR=-1,We.ROTATE=1,We.TRANSLATE=2,We.SCALE=3,We.SHEAR=4;const Is=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Is.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(t,e,s){t*=Is.ENTRIES,this.frames[t]=e,this.frames[t+Is.VALUE]=s}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.position=l.data.position;return;case S.first:l.position+=(l.data.position-l.position)*n}return}let u=0;if(s>=o[o.length-Is.ENTRIES])u=o[o.length+Is.PREV_VALUE];else{const c=oe.binarySearch(o,s,Is.ENTRIES);u=o[c+Is.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/Is.ENTRIES-1,1-(s-d)/(o[c+Is.PREV_TIME]-d));u+=(o[c+Is.VALUE]-u)*f}a==S.setup?l.position=l.data.position+(u-l.data.position)*n:l.position+=(u-l.position)*n}};let Cr=Is;Cr.ENTRIES=2,Cr.PREV_TIME=-2,Cr.PREV_VALUE=-1,Cr.VALUE=1;let R_=class ci extends Cr{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.spacing=l.data.spacing;return;case S.first:l.spacing+=(l.data.spacing-l.spacing)*n}return}let u=0;if(s>=o[o.length-ci.ENTRIES])u=o[o.length+ci.PREV_VALUE];else{const c=oe.binarySearch(o,s,ci.ENTRIES);u=o[c+ci.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/ci.ENTRIES-1,1-(s-d)/(o[c+ci.PREV_TIME]-d));u+=(o[c+ci.VALUE]-u)*f}a==S.setup?l.spacing=l.data.spacing+(u-l.data.spacing)*n:l.spacing+=(u-l.spacing)*n}};const Be=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Be.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(t,e,s,r){t*=Be.ENTRIES,this.frames[t]=e,this.frames[t+Be.ROTATE]=s,this.frames[t+Be.TRANSLATE]=r}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<o[0]){switch(a){case S.setup:l.rotateMix=l.data.rotateMix,l.translateMix=l.data.translateMix;return;case S.first:l.rotateMix+=(l.data.rotateMix-l.rotateMix)*n,l.translateMix+=(l.data.translateMix-l.translateMix)*n}return}let u=0,c=0;if(s>=o[o.length-Be.ENTRIES])u=o[o.length+Be.PREV_ROTATE],c=o[o.length+Be.PREV_TRANSLATE];else{const d=oe.binarySearch(o,s,Be.ENTRIES);u=o[d+Be.PREV_ROTATE],c=o[d+Be.PREV_TRANSLATE];const f=o[d],p=this.getCurvePercent(d/Be.ENTRIES-1,1-(s-f)/(o[d+Be.PREV_TIME]-f));u+=(o[d+Be.ROTATE]-u)*p,c+=(o[d+Be.TRANSLATE]-c)*p}a==S.setup?(l.rotateMix=l.data.rotateMix+(u-l.data.rotateMix)*n,l.translateMix=l.data.translateMix+(c-l.data.translateMix)*n):(l.rotateMix+=(u-l.rotateMix)*n,l.translateMix+=(c-l.translateMix)*n)}};let or=Be;or.ENTRIES=3,or.PREV_TIME=-3,or.PREV_ROTATE=-2,or.PREV_TRANSLATE=-1,or.ROTATE=1,or.TRANSLATE=2;const Yt=class{constructor(i){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new M_(this),this.propertyIDs=new NS,this.animationsChanged=!1,this.trackEntryPool=new XS(()=>new Gu),this.data=i}update(i){i*=this.timeScale;const t=this.tracks;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r==null)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let n=i*r.timeScale;if(r.delay>0){if(r.delay-=n,r.delay>0)continue;n=-r.delay,r.delay=0}let a=r.next;if(a!=null){const h=r.trackLast-a.delay;if(h>=0){for(a.delay=0,a.trackTime+=r.timeScale==0?0:(h/r.timeScale+i)*a.timeScale,r.trackTime+=n,this.setCurrent(e,a,!0);a.mixingFrom!=null;)a.mixTime+=i,a=a.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&r.mixingFrom==null){t[e]=null,this.queue.end(r),this.disposeNext(r);continue}if(r.mixingFrom!=null&&this.updateMixingFrom(r,i)){let h=r.mixingFrom;for(r.mixingFrom=null,h!=null&&(h.mixingTo=null);h!=null;)this.queue.end(h),h=h.mixingFrom}r.trackTime+=n}this.queue.drain()}updateMixingFrom(i,t){const e=i.mixingFrom;if(e==null)return!0;const s=this.updateMixingFrom(e,t);return e.animationLast=e.nextAnimationLast,e.trackLast=e.nextTrackLast,i.mixTime>0&&i.mixTime>=i.mixDuration?((e.totalAlpha==0||i.mixDuration==0)&&(i.mixingFrom=e.mixingFrom,e.mixingFrom!=null&&(e.mixingFrom.mixingTo=i),i.interruptAlpha=e.interruptAlpha,this.queue.end(e)),s):(e.trackTime+=t*e.timeScale,i.mixTime+=t,!1)}apply(i){if(i==null)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const t=this.events,e=this.tracks;let s=!1;for(let a=0,h=e.length;a<h;a++){const o=e[a];if(o==null||o.delay>0)continue;s=!0;const l=a==0?S.first:o.mixBlend;let u=o.alpha;o.mixingFrom!=null?u*=this.applyMixingFrom(o,i,l):o.trackTime>=o.trackEnd&&o.next==null&&(u=0);const c=o.animationLast,d=o.getAnimationTime(),f=o.animation.timelines.length,p=o.animation.timelines;if(a==0&&u==1||l==S.add)for(let m=0;m<f;m++){const g=p[m];g instanceof Rn?this.applyAttachmentTimeline(g,i,d,l,!0):g.apply(i,c,d,t,u,l,At.mixIn)}else{const m=o.timelineMode,g=o.timelinesRotation.length==0;g&&B.setArraySize(o.timelinesRotation,f<<1,null);const _=o.timelinesRotation;for(let x=0;x<f;x++){const y=p[x],v=m[x]==Yt.SUBSEQUENT?l:S.setup;y instanceof Ie?this.applyRotateTimeline(y,i,d,u,v,_,x<<1,g):y instanceof Rn?this.applyAttachmentTimeline(y,i,d,l,!0):y.apply(i,c,d,t,u,v,At.mixIn)}}this.queueEvents(o,d),t.length=0,o.nextAnimationLast=d,o.nextTrackLast=o.trackTime}const r=this.unkeyedState+Yt.SETUP,n=i.slots;for(let a=0,h=i.slots.length;a<h;a++){const o=n[a];if(o.attachmentState==r){const l=o.data.attachmentName;o.setAttachment(l==null?null:i.getAttachment(o.data.index,l))}}return this.unkeyedState+=2,this.queue.drain(),s}applyMixingFrom(i,t,e){const s=i.mixingFrom;s.mixingFrom!=null&&this.applyMixingFrom(s,t,e);let r=0;i.mixDuration==0?(r=1,e==S.first&&(e=S.setup)):(r=i.mixTime/i.mixDuration,r>1&&(r=1),e!=S.first&&(e=s.mixBlend));const n=r<s.eventThreshold?this.events:null,a=r<s.attachmentThreshold,h=r<s.drawOrderThreshold,o=s.animationLast,l=s.getAnimationTime(),u=s.animation.timelines.length,c=s.animation.timelines,d=s.alpha*i.interruptAlpha,f=d*(1-r);if(e==S.add)for(let p=0;p<u;p++)c[p].apply(t,o,l,n,f,e,At.mixOut);else{const p=s.timelineMode,m=s.timelineHoldMix,g=s.timelinesRotation.length==0;g&&B.setArraySize(s.timelinesRotation,u<<1,null);const _=s.timelinesRotation;s.totalAlpha=0;for(let x=0;x<u;x++){const y=c[x];let v=At.mixOut,b,w=0;switch(p[x]){case Yt.SUBSEQUENT:if(!h&&y instanceof Io)continue;b=e,w=f;break;case Yt.FIRST:b=S.setup,w=f;break;case Yt.HOLD_SUBSEQUENT:b=e,w=d;break;case Yt.HOLD_FIRST:b=S.setup,w=d;break;default:b=S.setup;const E=m[x];w=d*Math.max(0,1-E.mixTime/E.mixDuration);break}s.totalAlpha+=w,y instanceof Ie?this.applyRotateTimeline(y,t,l,w,b,_,x<<1,g):y instanceof Rn?this.applyAttachmentTimeline(y,t,l,b,a):(h&&y instanceof Io&&b==S.setup&&(v=At.mixIn),y.apply(t,o,l,n,w,b,v))}}return i.mixDuration>0&&this.queueEvents(s,l),this.events.length=0,s.nextAnimationLast=l,s.nextTrackLast=s.trackTime,r}applyAttachmentTimeline(i,t,e,s,r){const n=t.slots[i.slotIndex];if(!n.bone.active)return;const a=i.frames;if(e<a[0])(s==S.setup||s==S.first)&&this.setAttachment(t,n,n.data.attachmentName,r);else{let h;e>=a[a.length-1]?h=a.length-1:h=oe.binarySearch(a,e)-1,this.setAttachment(t,n,i.attachmentNames[h],r)}n.attachmentState<=this.unkeyedState&&(n.attachmentState=this.unkeyedState+Yt.SETUP)}setAttachment(i,t,e,s){t.setAttachment(e==null?null:i.getAttachment(t.data.index,e)),s&&(t.attachmentState=this.unkeyedState+Yt.CURRENT)}applyRotateTimeline(i,t,e,s,r,n,a,h){if(h&&(n[a]=0),s==1){i.apply(t,0,e,null,1,r,At.mixIn);return}const o=i,l=o.frames,u=t.bones[o.boneIndex];if(!u.active)return;let c=0,d=0;if(e<l[0])switch(r){case S.setup:u.rotation=u.data.rotation;default:return;case S.first:c=u.rotation,d=u.data.rotation}else if(c=r==S.setup?u.data.rotation:u.rotation,e>=l[l.length-Ie.ENTRIES])d=u.data.rotation+l[l.length+Ie.PREV_ROTATION];else{const m=oe.binarySearch(l,e,Ie.ENTRIES),g=l[m+Ie.PREV_ROTATION],_=l[m],x=o.getCurvePercent((m>>1)-1,1-(e-_)/(l[m+Ie.PREV_TIME]-_));d=l[m+Ie.ROTATION]-g,d-=(16384-(16384.499999999996-d/360|0))*360,d=g+d*x+u.data.rotation,d-=(16384-(16384.499999999996-d/360|0))*360}let f=0,p=d-c;if(p-=(16384-(16384.499999999996-p/360|0))*360,p==0)f=n[a];else{let m=0,g=0;h?(m=0,g=p):(m=n[a],g=n[a+1]);const _=p>0;let x=m>=0;D.signum(g)!=D.signum(p)&&Math.abs(g)<=90&&(Math.abs(m)>180&&(m+=360*D.signum(m)),x=_),f=p+m-m%360,x!=_&&(f+=360*D.signum(m)),n[a]=f}n[a+1]=p,c+=f*s,u.rotation=c-(16384-(16384.499999999996-c/360|0))*360}queueEvents(i,t){const e=i.animationStart,s=i.animationEnd,r=s-e,n=i.trackLast%r,a=this.events;let h=0;const o=a.length;for(;h<o;h++){const u=a[h];if(u.time<n)break;u.time>s||this.queue.event(i,u)}let l=!1;for(i.loop?l=r==0||n>i.trackTime%r:l=t>=s&&i.animationLast<s,l&&this.queue.complete(i);h<o;h++)a[h].time<e||this.queue.event(i,a[h])}clearTracks(){const i=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,e=this.tracks.length;t<e;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=i,this.queue.drain()}clearTrack(i){if(i>=this.tracks.length)return;const t=this.tracks[i];if(t==null)return;this.queue.end(t),this.disposeNext(t);let e=t;for(;;){const s=e.mixingFrom;if(s==null)break;this.queue.end(s),e.mixingFrom=null,e.mixingTo=null,e=s}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(i,t,e){const s=this.expandToIndex(i);this.tracks[i]=t,s!=null&&(e&&this.queue.interrupt(s),t.mixingFrom=s,s.mixingTo=t,t.mixTime=0,s.mixingFrom!=null&&s.mixDuration>0&&(t.interruptAlpha*=Math.min(1,s.mixTime/s.mixDuration)),s.timelinesRotation.length=0),this.queue.start(t)}setAnimation(i,t,e){const s=this.data.skeletonData.findAnimation(t);if(s==null)throw new Error(`Animation not found: ${t}`);return this.setAnimationWith(i,s,e)}setAnimationWith(i,t,e){if(t==null)throw new Error("animation cannot be null.");let s=!0,r=this.expandToIndex(i);r!=null&&(r.nextTrackLast==-1?(this.tracks[i]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.disposeNext(r),r=r.mixingFrom,s=!1):this.disposeNext(r));const n=this.trackEntry(i,t,e,r);return this.setCurrent(i,n,s),this.queue.drain(),n}addAnimation(i,t,e,s){const r=this.data.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);return this.addAnimationWith(i,r,e,s)}addAnimationWith(i,t,e,s){if(t==null)throw new Error("animation cannot be null.");let r=this.expandToIndex(i);if(r!=null)for(;r.next!=null;)r=r.next;const n=this.trackEntry(i,t,e,r);if(r==null)this.setCurrent(i,n,!0),this.queue.drain();else if(r.next=n,s<=0){const a=r.animationEnd-r.animationStart;a!=0?(r.loop?s+=a*(1+(r.trackTime/a|0)):s+=Math.max(a,r.trackTime),s-=this.data.getMix(r.animation,t)):s=r.trackTime}return n.delay=s,n}setEmptyAnimation(i,t){const e=this.setAnimationWith(i,Yt.emptyAnimation,!1);return e.mixDuration=t,e.trackEnd=t,e}addEmptyAnimation(i,t,e){e<=0&&(e-=t);const s=this.addAnimationWith(i,Yt.emptyAnimation,!1,e);return s.mixDuration=t,s.trackEnd=t,s}setEmptyAnimations(i){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++){const r=this.tracks[e];r!=null&&this.setEmptyAnimation(r.trackIndex,i)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(i){return i<this.tracks.length?this.tracks[i]:(B.ensureArrayCapacity(this.tracks,i+1,null),this.tracks.length=i+1,null)}trackEntry(i,t,e,s){const r=this.trackEntryPool.obtain();return r.trackIndex=i,r.animation=t,r.loop=e,r.holdPrevious=!1,r.eventThreshold=0,r.attachmentThreshold=0,r.drawOrderThreshold=0,r.animationStart=0,r.animationEnd=t.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.interruptAlpha=1,r.mixTime=0,r.mixDuration=s==null?0:this.data.getMix(s.animation,t),r.mixBlend=S.replace,r}disposeNext(i){let t=i.next;for(;t!=null;)this.queue.dispose(t),t=t.next;i.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();for(let i=0,t=this.tracks.length;i<t;i++){let e=this.tracks[i];if(e!=null){for(;e.mixingFrom!=null;)e=e.mixingFrom;do(e.mixingFrom==null||e.mixBlend!=S.add)&&this.computeHold(e),e=e.mixingTo;while(e!=null)}}}computeHold(i){const t=i.mixingTo,e=i.animation.timelines,s=i.animation.timelines.length,r=B.setArraySize(i.timelineMode,s);i.timelineHoldMix.length=0;const n=B.setArraySize(i.timelineHoldMix,s),a=this.propertyIDs;if(t!=null&&t.holdPrevious){for(let h=0;h<s;h++)r[h]=a.add(e[h].getPropertyId())?Yt.HOLD_FIRST:Yt.HOLD_SUBSEQUENT;return}t:for(let h=0;h<s;h++){const o=e[h],l=o.getPropertyId();if(!a.add(l))r[h]=Yt.SUBSEQUENT;else if(t==null||o instanceof Rn||o instanceof Io||o instanceof Uu||!t.animation.hasTimeline(l))r[h]=Yt.FIRST;else{for(let u=t.mixingTo;u!=null;u=u.mixingTo)if(!u.animation.hasTimeline(l)){if(i.mixDuration>0){r[h]=Yt.HOLD_MIX,n[h]=u;continue t}break}r[h]=Yt.HOLD_FIRST}}}getCurrent(i){return i>=this.tracks.length?null:this.tracks[i]}addListener(i){if(i==null)throw new Error("listener cannot be null.");this.listeners.push(i)}removeListener(i){const t=this.listeners.indexOf(i);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(i,t,e){Yt.deprecatedWarning1||(Yt.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(i,t,e)}addAnimationByName(i,t,e,s){Yt.deprecatedWarning2||(Yt.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(i,t,e,s)}hasAnimation(i){return this.data.skeletonData.findAnimation(i)!==null}hasAnimationByName(i){return Yt.deprecatedWarning3||(Yt.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(i)}};let ms=Yt;ms.emptyAnimation=new oe("<empty>",[],0),ms.SUBSEQUENT=0,ms.FIRST=1,ms.HOLD_SUBSEQUENT=2,ms.HOLD_FIRST=3,ms.HOLD_MIX=4,ms.SETUP=1,ms.CURRENT=2,ms.deprecatedWarning1=!1,ms.deprecatedWarning2=!1,ms.deprecatedWarning3=!1;const Ir=class{constructor(){this.mixBlend=S.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}reset(){this.next=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){const i=this.animationEnd-this.animationStart;return i==0?this.animationStart:this.trackTime%i+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(i){this.animationLast=i,this.nextAnimationLast=i}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}get time(){return Ir.deprecatedWarning1||(Ir.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(i){Ir.deprecatedWarning1||(Ir.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=i}get endTime(){return Ir.deprecatedWarning2||(Ir.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(i){Ir.deprecatedWarning2||(Ir.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=i}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};let Gu=Ir;Gu.deprecatedWarning1=!1,Gu.deprecatedWarning2=!1;const Xu=class{constructor(i){this.objects=[],this.drainDisabled=!1,this.animState=i}start(i){this.objects.push(ss.start),this.objects.push(i),this.animState.animationsChanged=!0}interrupt(i){this.objects.push(ss.interrupt),this.objects.push(i)}end(i){this.objects.push(ss.end),this.objects.push(i),this.animState.animationsChanged=!0}dispose(i){this.objects.push(ss.dispose),this.objects.push(i)}complete(i){this.objects.push(ss.complete),this.objects.push(i)}event(i,t){this.objects.push(ss.event),this.objects.push(i),this.objects.push(t)}deprecateStuff(){return Xu.deprecatedWarning1||(Xu.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: onComplete, onStart, onEnd, onEvent art deprecated, please use listeners from now on. 'state.addListener({ complete: function(track, event) { } })'")),!0}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;const i=this.objects,t=this.animState.listeners;for(let e=0;e<i.length;e+=2){const s=i[e],r=i[e+1];switch(s){case ss.start:r.listener!=null&&r.listener.start&&r.listener.start(r);for(let h=0;h<t.length;h++)t[h].start&&t[h].start(r);r.onStart&&this.deprecateStuff()&&r.onStart(r.trackIndex),this.animState.onStart&&this.deprecateStuff()&&this.deprecateStuff&&this.animState.onStart(r.trackIndex);break;case ss.interrupt:r.listener!=null&&r.listener.interrupt&&r.listener.interrupt(r);for(let h=0;h<t.length;h++)t[h].interrupt&&t[h].interrupt(r);break;case ss.end:r.listener!=null&&r.listener.end&&r.listener.end(r);for(let h=0;h<t.length;h++)t[h].end&&t[h].end(r);r.onEnd&&this.deprecateStuff()&&r.onEnd(r.trackIndex),this.animState.onEnd&&this.deprecateStuff()&&this.animState.onEnd(r.trackIndex);case ss.dispose:r.listener!=null&&r.listener.dispose&&r.listener.dispose(r);for(let h=0;h<t.length;h++)t[h].dispose&&t[h].dispose(r);this.animState.trackEntryPool.free(r);break;case ss.complete:r.listener!=null&&r.listener.complete&&r.listener.complete(r);for(let h=0;h<t.length;h++)t[h].complete&&t[h].complete(r);const n=D.toInt(r.loopsCount());r.onComplete&&this.deprecateStuff()&&r.onComplete(r.trackIndex,n),this.animState.onComplete&&this.deprecateStuff()&&this.animState.onComplete(r.trackIndex,n);break;case ss.event:const a=i[e+++2];r.listener!=null&&r.listener.event&&r.listener.event(r,a);for(let h=0;h<t.length;h++)t[h].event&&t[h].event(r,a);r.onEvent&&this.deprecateStuff()&&r.onEvent(r.trackIndex,a),this.animState.onEvent&&this.deprecateStuff()&&this.animState.onEvent(r.trackIndex,a);break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}};let M_=Xu;M_.deprecatedWarning1=!1;var ss=(i=>(i[i.start=0]="start",i[i.interrupt=1]="interrupt",i[i.end=2]="end",i[i.dispose=3]="dispose",i[i.complete=4]="complete",i[i.event=5]="event",i))(ss||{});const $u=class{constructor(i){if(this.animationToMixTime={},this.defaultMix=0,i==null)throw new Error("skeletonData cannot be null.");this.skeletonData=i}setMix(i,t,e){const s=this.skeletonData.findAnimation(i);if(s==null)throw new Error(`Animation not found: ${i}`);const r=this.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);this.setMixWith(s,r,e)}setMixByName(i,t,e){$u.deprecatedWarning1||($u.deprecatedWarning1=!0,console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.")),this.setMix(i,t,e)}setMixWith(i,t,e){if(i==null)throw new Error("from cannot be null.");if(t==null)throw new Error("to cannot be null.");const s=`${i.name}.${t.name}`;this.animationToMixTime[s]=e}getMix(i,t){const e=`${i.name}.${t.name}`,s=this.animationToMixTime[e];return s===void 0?this.defaultMix:s}};let F_=$u;F_.deprecatedWarning1=!1;let k_=class{constructor(t){this.atlas=t}newRegionAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);const n=new it(e);return n.region=r,n}newMeshAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);const n=new Vu(e);return n.region=r,n}newBoundingBoxAttachment(t,e){return new zS(e)}newPathAttachment(t,e){return new _l(e)}newPointAttachment(t,e){return new qS(e)}newClippingAttachment(t,e){return new jS(e)}};class B_{constructor(t,e,s){if(this.matrix=new Rt,this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.appliedValid=!1,this.sorted=!1,this.active=!1,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=s,this.setToSetupPose()}get worldX(){return this.matrix.tx}get worldY(){return this.matrix.ty}isActive(){return this.active}update(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(t,e,s,r,n,a,h){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=r,this.ascaleY=n,this.ashearX=a,this.ashearY=h,this.appliedValid=!0;const o=this.parent,l=this.matrix,u=this.skeleton.scaleX,c=-this.skeleton.scaleY;if(o==null){const g=this.skeleton,_=s+90+h;l.a=D.cosDeg(s+a)*r*u,l.c=D.cosDeg(_)*n*u,l.b=D.sinDeg(s+a)*r*c,l.d=D.sinDeg(_)*n*c,l.tx=t*u+g.x,l.ty=e*c+g.y;return}let d=o.matrix.a,f=o.matrix.c,p=o.matrix.b,m=o.matrix.d;switch(l.tx=d*t+f*e+o.matrix.tx,l.ty=p*t+m*e+o.matrix.ty,this.data.transformMode){case vt.Normal:{const g=s+90+h,_=D.cosDeg(s+a)*r,x=D.cosDeg(g)*n,y=D.sinDeg(s+a)*r,v=D.sinDeg(g)*n;l.a=d*_+f*y,l.c=d*x+f*v,l.b=p*_+m*y,l.d=p*x+m*v;return}case vt.OnlyTranslation:{const g=s+90+h;l.a=D.cosDeg(s+a)*r,l.c=D.cosDeg(g)*n,l.b=D.sinDeg(s+a)*r,l.d=D.sinDeg(g)*n;break}case vt.NoRotationOrReflection:{let g=d*d+p*p,_=0;g>1e-4?(g=Math.abs(d*m-f*p)/g,d/=this.skeleton.scaleX,p/=this.skeleton.scaleY,f=p*g,m=d*g,_=Math.atan2(p,d)*D.radDeg):(d=0,p=0,_=90-Math.atan2(m,f)*D.radDeg);const x=s+a-_,y=s+h-_+90,v=D.cosDeg(x)*r,b=D.cosDeg(y)*n,w=D.sinDeg(x)*r,E=D.sinDeg(y)*n;l.a=d*v-f*w,l.c=d*b-f*E,l.b=p*v+m*w,l.d=p*b+m*E;break}case vt.NoScale:case vt.NoScaleOrReflection:{const g=D.cosDeg(s),_=D.sinDeg(s);let x=(d*g+f*_)/u,y=(p*g+m*_)/c,v=Math.sqrt(x*x+y*y);v>1e-5&&(v=1/v),x*=v,y*=v,v=Math.sqrt(x*x+y*y),this.data.transformMode==vt.NoScale&&d*m-f*p<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY>0)&&(v=-v);const b=Math.PI/2+Math.atan2(y,x),w=Math.cos(b)*v,E=Math.sin(b)*v,T=D.cosDeg(a)*r,A=D.cosDeg(90+h)*n,I=D.sinDeg(a)*r,M=D.sinDeg(90+h)*n;l.a=x*T+w*I,l.c=x*A+w*M,l.b=y*T+E*I,l.d=y*A+E*M;break}}l.a*=u,l.c*=u,l.b*=c,l.d*=c}setToSetupPose(){const t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY}getWorldRotationX(){return Math.atan2(this.matrix.b,this.matrix.a)*D.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*D.radDeg}getWorldScaleX(){const t=this.matrix;return Math.sqrt(t.a*t.a+t.c*t.c)}getWorldScaleY(){const t=this.matrix;return Math.sqrt(t.b*t.b+t.d*t.d)}updateAppliedTransform(){this.appliedValid=!0;const t=this.parent,e=this.matrix;if(t==null){this.ax=e.tx,this.ay=e.ty,this.arotation=Math.atan2(e.b,e.a)*D.radDeg,this.ascaleX=Math.sqrt(e.a*e.a+e.b*e.b),this.ascaleY=Math.sqrt(e.c*e.c+e.d*e.d),this.ashearX=0,this.ashearY=Math.atan2(e.a*e.c+e.b*e.d,e.a*e.d-e.b*e.c)*D.radDeg;return}const s=t.matrix,r=1/(s.a*s.d-s.b*s.c),n=e.tx-s.tx,a=e.ty-s.ty;this.ax=n*s.d*r-a*s.c*r,this.ay=a*s.a*r-n*s.b*r;const h=r*s.d,o=r*s.a,l=r*s.c,u=r*s.b,c=h*e.a-l*e.b,d=h*e.c-l*e.d,f=o*e.b-u*e.a,p=o*e.d-u*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(c*c+f*f),this.ascaleX>1e-4){const m=c*p-d*f;this.ascaleY=m/this.ascaleX,this.ashearY=Math.atan2(c*d+f*p,m)*D.radDeg,this.arotation=Math.atan2(f,c)*D.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,d)*D.radDeg}worldToLocal(t){const e=this.matrix,s=e.a,r=e.c,n=e.b,a=e.d,h=1/(s*a-r*n),o=t.x-e.tx,l=t.y-e.ty;return t.x=o*a*h-l*r*h,t.y=l*s*h-o*n*h,t}localToWorld(t){const e=this.matrix,s=t.x,r=t.y;return t.x=s*e.a+r*e.c+e.tx,t.y=s*e.b+r*e.d+e.ty,t}worldToLocalRotation(t){const e=D.sinDeg(t),s=D.cosDeg(t),r=this.matrix;return Math.atan2(r.a*e-r.b*s,r.d*s-r.c*e)*D.radDeg}localToWorldRotation(t){const e=D.sinDeg(t),s=D.cosDeg(t),r=this.matrix;return Math.atan2(s*r.b+e*r.d,s*r.a+e*r.c)*D.radDeg}rotateWorld(t){const e=this.matrix,s=e.a,r=e.c,n=e.b,a=e.d,h=D.cosDeg(t),o=D.sinDeg(t);e.a=h*s-o*n,e.c=h*r-o*a,e.b=o*s+h*n,e.d=o*r+h*a,this.appliedValid=!1}}let D_=class{constructor(t,e,s){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=vt.Normal,this.skinRequired=!1,this.color=new X,t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},Yu=class{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}},O_=class{constructor(t,e){if(e==null)throw new Error("data cannot be null.");this.time=t,this.data=e}},L_=class{constructor(t){this.name=t}};class ZS{constructor(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(let s=0;s<t.bones.length;s++)this.bones.push(e.findBone(t.bones[s].name));this.target=e.findBone(t.target.name)}isActive(){return this.active}apply(){this.update()}update(){const t=this.target,e=this.bones;switch(e.length){case 1:this.apply1(e[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.softness,this.mix);break}}apply1(t,e,s,r,n,a,h){t.appliedValid||t.updateAppliedTransform();const o=t.parent.matrix,l=o.a;let u=o.c;const c=o.b;let d=o.d,f=-t.ashearX-t.arotation,p=0,m=0;switch(t.data.transformMode){case vt.OnlyTranslation:p=e-t.worldX,m=s-t.worldY;break;case vt.NoRotationOrReflection:const x=Math.abs(l*d-u*c)/(l*l+c*c),y=l/t.skeleton.scaleX,v=c/t.skeleton.scaleY;u=-v*x*t.skeleton.scaleX,d=y*x*t.skeleton.scaleY,f+=Math.atan2(v,y)*D.radDeg;default:const b=e-o.tx,w=s-o.ty,E=l*d-u*c;p=(b*d-w*u)/E-t.ax,m=(w*l-b*c)/E-t.ay}f+=Math.atan2(m,p)*D.radDeg,t.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let g=t.ascaleX,_=t.ascaleY;if(r||n){switch(t.data.transformMode){case vt.NoScale:case vt.NoScaleOrReflection:p=e-t.worldX,m=s-t.worldY}const x=t.data.length*g,y=Math.sqrt(p*p+m*m);if(r&&y<x||n&&y>x&&x>1e-4){const v=(y/x-1)*h+1;g*=v,a&&(_*=v)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*h,g,_,t.ashearX,t.ashearY)}apply2(t,e,s,r,n,a,h,o){if(o==0){e.updateWorldTransform();return}t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();const l=t.ax,u=t.ay;let c=t.ascaleX,d=c,f=t.ascaleY,p=e.ascaleX;const m=t.matrix;let g=0,_=0,x=0;c<0?(c=-c,g=180,x=-1):(g=0,x=1),f<0&&(f=-f,x=-x),p<0?(p=-p,_=180):_=0;const y=e.ax;let v=0,b=0,w=0,E=m.a,T=m.c,A=m.b,I=m.d;const M=Math.abs(c-f)<=1e-4;M?(v=e.ay,b=E*y+T*v+m.tx,w=A*y+I*v+m.ty):(v=0,b=E*y+m.tx,w=A*y+m.ty);const R=t.parent.matrix;E=R.a,T=R.c,A=R.b,I=R.d;const C=1/(E*I-T*A);let P=b-R.tx,k=w-R.ty;const U=(P*I-k*T)*C-l,V=(k*E-P*A)*C-u,L=Math.sqrt(U*U+V*V);let $=e.data.length*p,O,N;if(L<1e-4){this.apply1(t,s,r,!1,a,!1,o),e.updateWorldTransformWith(y,v,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}P=s-R.tx,k=r-R.ty;let Z=(P*I-k*T)*C-l,Q=(k*E-P*A)*C-u,H=Z*Z+Q*Q;if(h!=0){h*=c*(p+1)/2;const _t=Math.sqrt(H),kt=_t-L-$*c+h;if(kt>0){let zt=Math.min(1,kt/(h*2))-1;zt=(kt-h*(1-zt*zt))/_t,Z-=zt*Z,Q-=zt*Q,H=Z*Z+Q*Q}}t:if(M){$*=c;let _t=(H-L*L-$*$)/(2*L*$);_t<-1?_t=-1:_t>1&&(_t=1,a&&(d*=(Math.sqrt(H)/(L+$)-1)*o+1)),N=Math.acos(_t)*n,E=L+$*_t,T=$*Math.sin(N),O=Math.atan2(Q*E-Z*T,Z*E+Q*T)}else{E=c*$,T=f*$;const _t=E*E,kt=T*T,zt=Math.atan2(Q,Z);A=kt*L*L+_t*H-_t*kt;const Qt=-2*kt*L,Pt=kt-_t;if(I=Qt*Qt-4*Pt*A,I>=0){let Bn=Math.sqrt(I);Qt<0&&(Bn=-Bn),Bn=-(Qt+Bn)/2;const Z0=Bn/Pt,K0=A/Bn,Dn=Math.abs(Z0)<Math.abs(K0)?Z0:K0;if(Dn*Dn<=H){k=Math.sqrt(H-Dn*Dn)*n,O=zt-Math.atan2(k,Dn),N=Math.atan2(k/f,(Dn-L)/c);break t}}let jt=D.PI,Ot=L-E,ze=Ot*Ot,is=0,li=0,kn=L+E,hi=kn*kn,q0=0;A=-E*L/(_t-kt),A>=-1&&A<=1&&(A=Math.acos(A),P=E*Math.cos(A)+L,k=T*Math.sin(A),I=P*P+k*k,I<ze&&(jt=A,ze=I,Ot=P,is=k),I>hi&&(li=A,hi=I,kn=P,q0=k)),H<=(ze+hi)/2?(O=zt-Math.atan2(is*n,Ot),N=jt*n):(O=zt-Math.atan2(q0*n,kn),N=li*n)}const lt=Math.atan2(v,y)*x;let Tt=t.arotation;O=(O-lt)*D.radDeg+g-Tt,O>180?O-=360:O<-180&&(O+=360),t.updateWorldTransformWith(l,u,Tt+O*o,d,t.ascaleY,0,0),Tt=e.arotation,N=((N+lt)*D.radDeg-e.ashearX)*x+_-Tt,N>180?N-=360:N<-180&&(N+=360),e.updateWorldTransformWith(y,v,Tt+N*o,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}let N_=class extends Yu{constructor(t){super(t,0,!1),this.bones=new Array,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}},V_=class extends Yu{constructor(t){super(t,0,!1),this.bones=new Array}};var be=(i=>(i[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",i))(be||{});const $i=class{constructor(i,t){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,i==null)throw new Error("data cannot be null.");if(t==null)throw new Error("skeleton cannot be null.");this.data=i,this.bones=new Array;for(let e=0,s=i.bones.length;e<s;e++)this.bones.push(t.findBone(i.bones[e].name));this.target=t.findSlot(i.target.name),this.position=i.position,this.spacing=i.spacing,this.rotateMix=i.rotateMix,this.translateMix=i.translateMix}isActive(){return this.active}apply(){this.update()}update(){const i=this.target.getAttachment();if(!(i instanceof _l))return;const t=this.rotateMix,e=this.translateMix,s=e>0,r=t>0;if(!s&&!r)return;const n=this.data,a=n.spacingMode,h=a==be.Length,o=n.rotateMode,l=o==Fe.Tangent,u=o==Fe.ChainScale,c=this.bones.length,d=l?c:c+1,f=this.bones,p=B.setArraySize(this.spaces,d);let m=null;const g=this.spacing;if(u||h){u&&(m=B.setArraySize(this.lengths,c));for(let w=0,E=d-1;w<E;){const T=f[w],A=T.data.length;if(A<$i.epsilon)u&&(m[w]=0),p[++w]=0;else{const I=A*T.matrix.a,M=A*T.matrix.b,R=Math.sqrt(I*I+M*M);u&&(m[w]=R),p[++w]=(h?A+g:g)*R/A}}}else for(let w=1;w<d;w++)p[w]=g;const _=this.computeWorldPositions(i,d,l,n.positionMode==ne.Percent,a==be.Percent);let x=_[0],y=_[1],v=n.offsetRotation,b=!1;if(v==0)b=o==Fe.Chain;else{b=!1;const w=this.target.bone.matrix;v*=w.a*w.d-w.b*w.c>0?D.degRad:-D.degRad}for(let w=0,E=3;w<c;w++,E+=3){const T=f[w],A=T.matrix;A.tx+=(x-A.tx)*e,A.ty+=(y-A.ty)*e;const I=_[E],M=_[E+1],R=I-x,C=M-y;if(u){const P=m[w];if(P!=0){const k=(Math.sqrt(R*R+C*C)/P-1)*t+1;A.a*=k,A.b*=k}}if(x=I,y=M,r){const P=A.a,k=A.c,U=A.b,V=A.d;let L=0,$=0,O=0;if(l&&(l?L=_[E-1]:p[w+1]==0?L=_[E+2]:L=Math.atan2(C,R)),L-=Math.atan2(U,P),b){$=Math.cos(L),O=Math.sin(L);const N=T.data.length;x+=(N*($*P-O*U)-R)*t,y+=(N*(O*P+$*U)-C)*t}else L+=v;L>D.PI?L-=D.PI2:L<-D.PI&&(L+=D.PI2),L*=t,$=Math.cos(L),O=Math.sin(L),A.a=$*P-O*U,A.c=$*k-O*V,A.b=O*P+$*U,A.d=O*k+$*V}T.appliedValid=!1}}computeWorldPositions(i,t,e,s,r){const n=this.target;let a=this.position;const h=this.spaces,o=B.setArraySize(this.positions,t*3+2);let l=null;const u=i.closed;let c=i.worldVerticesLength,d=c/6,f=$i.NONE;if(!i.constantSpeed){const L=i.lengths;d-=u?1:2;const $=L[d];if(s&&(a*=$),r)for(let O=0;O<t;O++)h[O]*=$;l=B.setArraySize(this.world,8);for(let O=0,N=0,Z=0;O<t;O++,N+=3){const Q=h[O];a+=Q;let H=a;if(u)H%=$,H<0&&(H+=$),Z=0;else if(H<0){f!=$i.BEFORE&&(f=$i.BEFORE,i.computeWorldVertices(n,2,4,l,0,2)),this.addBeforePosition(H,l,0,o,N);continue}else if(H>$){f!=$i.AFTER&&(f=$i.AFTER,i.computeWorldVertices(n,c-6,4,l,0,2)),this.addAfterPosition(H-$,l,0,o,N);continue}for(;;Z++){const lt=L[Z];if(!(H>lt)){if(Z==0)H/=lt;else{const Tt=L[Z-1];H=(H-Tt)/(lt-Tt)}break}}Z!=f&&(f=Z,u&&Z==d?(i.computeWorldVertices(n,c-4,4,l,0,2),i.computeWorldVertices(n,0,4,l,4,2)):i.computeWorldVertices(n,Z*6+2,8,l,0,2)),this.addCurvePosition(H,l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],o,N,e||O>0&&Q==0)}return o}u?(c+=2,l=B.setArraySize(this.world,c),i.computeWorldVertices(n,2,c-4,l,0,2),i.computeWorldVertices(n,0,2,l,c-4,2),l[c-2]=l[0],l[c-1]=l[1]):(d--,c-=4,l=B.setArraySize(this.world,c),i.computeWorldVertices(n,2,c,l,0,2));const p=B.setArraySize(this.curves,d);let m=0,g=l[0],_=l[1],x=0,y=0,v=0,b=0,w=0,E=0,T=0,A=0,I=0,M=0,R=0,C=0,P=0,k=0;for(let L=0,$=2;L<d;L++,$+=6)x=l[$],y=l[$+1],v=l[$+2],b=l[$+3],w=l[$+4],E=l[$+5],T=(g-x*2+v)*.1875,A=(_-y*2+b)*.1875,I=((x-v)*3-g+w)*.09375,M=((y-b)*3-_+E)*.09375,R=T*2+I,C=A*2+M,P=(x-g)*.75+T+I*.16666667,k=(y-_)*.75+A+M*.16666667,m+=Math.sqrt(P*P+k*k),P+=R,k+=C,R+=I,C+=M,m+=Math.sqrt(P*P+k*k),P+=R,k+=C,m+=Math.sqrt(P*P+k*k),P+=R+I,k+=C+M,m+=Math.sqrt(P*P+k*k),p[L]=m,g=w,_=E;if(s&&(a*=m),r)for(let L=0;L<t;L++)h[L]*=m;const U=this.segments;let V=0;for(let L=0,$=0,O=0,N=0;L<t;L++,$+=3){const Z=h[L];a+=Z;let Q=a;if(u)Q%=m,Q<0&&(Q+=m),O=0;else if(Q<0){this.addBeforePosition(Q,l,0,o,$);continue}else if(Q>m){this.addAfterPosition(Q-m,l,c-4,o,$);continue}for(;;O++){const H=p[O];if(!(Q>H)){if(O==0)Q/=H;else{const lt=p[O-1];Q=(Q-lt)/(H-lt)}break}}if(O!=f){f=O;let H=O*6;for(g=l[H],_=l[H+1],x=l[H+2],y=l[H+3],v=l[H+4],b=l[H+5],w=l[H+6],E=l[H+7],T=(g-x*2+v)*.03,A=(_-y*2+b)*.03,I=((x-v)*3-g+w)*.006,M=((y-b)*3-_+E)*.006,R=T*2+I,C=A*2+M,P=(x-g)*.3+T+I*.16666667,k=(y-_)*.3+A+M*.16666667,V=Math.sqrt(P*P+k*k),U[0]=V,H=1;H<8;H++)P+=R,k+=C,R+=I,C+=M,V+=Math.sqrt(P*P+k*k),U[H]=V;P+=R,k+=C,V+=Math.sqrt(P*P+k*k),U[8]=V,P+=R+I,k+=C+M,V+=Math.sqrt(P*P+k*k),U[9]=V,N=0}for(Q*=V;;N++){const H=U[N];if(!(Q>H)){if(N==0)Q/=H;else{const lt=U[N-1];Q=N+(Q-lt)/(H-lt)}break}}this.addCurvePosition(Q*.1,g,_,x,y,v,b,w,E,o,$,e||L>0&&Z==0)}return o}addBeforePosition(i,t,e,s,r){const n=t[e],a=t[e+1],h=t[e+2]-n,o=t[e+3]-a,l=Math.atan2(o,h);s[r]=n+i*Math.cos(l),s[r+1]=a+i*Math.sin(l),s[r+2]=l}addAfterPosition(i,t,e,s,r){const n=t[e+2],a=t[e+3],h=n-t[e],o=a-t[e+1],l=Math.atan2(o,h);s[r]=n+i*Math.cos(l),s[r+1]=a+i*Math.sin(l),s[r+2]=l}addCurvePosition(i,t,e,s,r,n,a,h,o,l,u,c){(i==0||isNaN(i))&&(i=1e-4);const d=i*i,f=d*i,p=1-i,m=p*p,g=m*p,_=p*i,x=_*3,y=p*x,v=x*i,b=t*g+s*y+n*v+h*f,w=e*g+r*y+a*v+o*f;l[u]=b,l[u+1]=w,c&&(l[u+2]=Math.atan2(w-(e*m+r*_*2+a*d),b-(t*m+s*_*2+n*d)))}};let Po=$i;Po.NONE=-1,Po.BEFORE=-2,Po.AFTER=-3,Po.epsilon=1e-5;class KS{constructor(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new $S,this.active=!1,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("skeleton cannot be null.");this.data=t,this.rotateMix=t.rotateMix,this.translateMix=t.translateMix,this.scaleMix=t.scaleMix,this.shearMix=t.shearMix,this.bones=new Array;for(let s=0;s<t.bones.length;s++)this.bones.push(e.findBone(t.bones[s].name));this.target=e.findBone(t.target.name)}isActive(){return this.active}apply(){this.update()}update(){this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld()}applyAbsoluteWorld(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target,a=n.matrix,h=a.a,o=a.c,l=a.b,u=a.d,c=h*u-o*l>0?D.degRad:-D.degRad,d=this.data.offsetRotation*c,f=this.data.offsetShearY*c,p=this.bones;for(let m=0,g=p.length;m<g;m++){const _=p[m];let x=!1;const y=_.matrix;if(t!=0){const v=y.a,b=y.c,w=y.b,E=y.d;let T=Math.atan2(l,h)-Math.atan2(w,v)+d;T>D.PI?T-=D.PI2:T<-D.PI&&(T+=D.PI2),T*=t;const A=Math.cos(T),I=Math.sin(T);y.a=A*v-I*w,y.c=A*b-I*E,y.b=I*v+A*w,y.d=I*b+A*E,x=!0}if(e!=0){const v=this.temp;n.localToWorld(v.set(this.data.offsetX,this.data.offsetY)),y.tx+=(v.x-y.tx)*e,y.ty+=(v.y-y.ty)*e,x=!0}if(s>0){let v=Math.sqrt(y.a*y.a+y.b*y.b),b=Math.sqrt(h*h+l*l);v>1e-5&&(v=(v+(b-v+this.data.offsetScaleX)*s)/v),y.a*=v,y.b*=v,v=Math.sqrt(y.c*y.c+y.d*y.d),b=Math.sqrt(o*o+u*u),v>1e-5&&(v=(v+(b-v+this.data.offsetScaleY)*s)/v),y.c*=v,y.d*=v,x=!0}if(r>0){const v=y.c,b=y.d,w=Math.atan2(b,v);let E=Math.atan2(u,o)-Math.atan2(l,h)-(w-Math.atan2(y.b,y.a));E>D.PI?E-=D.PI2:E<-D.PI&&(E+=D.PI2),E=w+(E+f)*r;const T=Math.sqrt(v*v+b*b);y.c=Math.cos(E)*T,y.d=Math.sin(E)*T,x=!0}x&&(_.appliedValid=!1)}}applyRelativeWorld(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target,a=n.matrix,h=a.a,o=a.c,l=a.b,u=a.d,c=h*u-o*l>0?D.degRad:-D.degRad,d=this.data.offsetRotation*c,f=this.data.offsetShearY*c,p=this.bones;for(let m=0,g=p.length;m<g;m++){const _=p[m];let x=!1;const y=_.matrix;if(t!=0){const v=y.a,b=y.c,w=y.b,E=y.d;let T=Math.atan2(l,h)+d;T>D.PI?T-=D.PI2:T<-D.PI&&(T+=D.PI2),T*=t;const A=Math.cos(T),I=Math.sin(T);y.a=A*v-I*w,y.c=A*b-I*E,y.b=I*v+A*w,y.d=I*b+A*E,x=!0}if(e!=0){const v=this.temp;n.localToWorld(v.set(this.data.offsetX,this.data.offsetY)),y.tx+=v.x*e,y.ty+=v.y*e,x=!0}if(s>0){let v=(Math.sqrt(h*h+l*l)-1+this.data.offsetScaleX)*s+1;y.a*=v,y.b*=v,v=(Math.sqrt(o*o+u*u)-1+this.data.offsetScaleY)*s+1,y.c*=v,y.d*=v,x=!0}if(r>0){let v=Math.atan2(u,o)-Math.atan2(l,h);v>D.PI?v-=D.PI2:v<-D.PI&&(v+=D.PI2);const b=y.c,w=y.d;v=Math.atan2(w,b)+(v-D.PI/2+f)*r;const E=Math.sqrt(b*b+w*w);y.c=Math.cos(v)*E,y.d=Math.sin(v)*E,x=!0}x&&(_.appliedValid=!1)}}applyAbsoluteLocal(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const a=this.bones;for(let h=0,o=a.length;h<o;h++){const l=a[h];l.appliedValid||l.updateAppliedTransform();let u=l.arotation;if(t!=0){let g=n.arotation-u+this.data.offsetRotation;g-=(16384-(16384.499999999996-g/360|0))*360,u+=g*t}let c=l.ax,d=l.ay;e!=0&&(c+=(n.ax-c+this.data.offsetX)*e,d+=(n.ay-d+this.data.offsetY)*e);let f=l.ascaleX,p=l.ascaleY;s>0&&(f>1e-5&&(f=(f+(n.ascaleX-f+this.data.offsetScaleX)*s)/f),p>1e-5&&(p=(p+(n.ascaleY-p+this.data.offsetScaleY)*s)/p));const m=l.ashearY;if(r>0){let g=n.ashearY-m+this.data.offsetShearY;g-=(16384-(16384.499999999996-g/360|0))*360,l.shearY+=g*r}l.updateWorldTransformWith(c,d,u,f,p,l.ashearX,m)}}applyRelativeLocal(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,r=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const a=this.bones;for(let h=0,o=a.length;h<o;h++){const l=a[h];l.appliedValid||l.updateAppliedTransform();let u=l.arotation;t!=0&&(u+=(n.arotation+this.data.offsetRotation)*t);let c=l.ax,d=l.ay;e!=0&&(c+=(n.ax+this.data.offsetX)*e,d+=(n.ay+this.data.offsetY)*e);let f=l.ascaleX,p=l.ascaleY;s>0&&(f>1e-5&&(f*=(n.ascaleX-1+this.data.offsetScaleX)*s+1),p>1e-5&&(p*=(n.ascaleY-1+this.data.offsetScaleY)*s+1));let m=l.ashearY;r>0&&(m+=(n.ashearY+this.data.offsetShearY)*r),l.updateWorldTransformWith(c,d,u,f,p,l.ashearX,m)}}}const Ro=class{constructor(i){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,i==null)throw new Error("data cannot be null.");this.data=i,this.bones=new Array;for(let t=0;t<i.bones.length;t++){const e=i.bones[t];let s;if(e.parent==null)s=new B_(e,this,null);else{const r=this.bones[e.parent.index];s=new B_(e,this,r),r.children.push(s)}this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<i.slots.length;t++){const e=i.slots[t],s=this.bones[e.boneData.index],r=new A_(e,s);this.slots.push(r),this.drawOrder.push(r)}this.ikConstraints=new Array;for(let t=0;t<i.ikConstraints.length;t++){const e=i.ikConstraints[t];this.ikConstraints.push(new ZS(e,this))}this.transformConstraints=new Array;for(let t=0;t<i.transformConstraints.length;t++){const e=i.transformConstraints[t];this.transformConstraints.push(new KS(e,this))}this.pathConstraints=new Array;for(let t=0;t<i.pathConstraints.length;t++){const e=i.pathConstraints[t];this.pathConstraints.push(new Po(e,this))}this.color=new X(1,1,1,1),this.updateCache()}updateCache(){const i=this._updateCache;i.length=0,this.updateCacheReset.length=0;const t=this.bones;for(let l=0,u=t.length;l<u;l++){const c=t[l];c.sorted=c.data.skinRequired,c.active=!c.sorted}if(this.skin!=null){const l=this.skin.bones;for(let u=0,c=this.skin.bones.length;u<c;u++){let d=this.bones[l[u].index];do d.sorted=!1,d.active=!0,d=d.parent;while(d!=null)}}const e=this.ikConstraints,s=this.transformConstraints,r=this.pathConstraints,n=e.length,a=s.length,h=r.length,o=n+a+h;t:for(let l=0;l<o;l++){for(let u=0;u<n;u++){const c=e[u];if(c.data.order==l){this.sortIkConstraint(c);continue t}}for(let u=0;u<a;u++){const c=s[u];if(c.data.order==l){this.sortTransformConstraint(c);continue t}}for(let u=0;u<h;u++){const c=r[u];if(c.data.order==l){this.sortPathConstraint(c);continue t}}}for(let l=0,u=t.length;l<u;l++)this.sortBone(t[l])}sortIkConstraint(i){if(i.active=i.target.isActive()&&(!i.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,i.data,!0)),!i.active)return;const t=i.target;this.sortBone(t);const e=i.bones,s=e[0];if(this.sortBone(s),e.length>1){const r=e[e.length-1];this._updateCache.indexOf(r)>-1||this.updateCacheReset.push(r)}this._updateCache.push(i),this.sortReset(s.children),e[e.length-1].sorted=!0}sortPathConstraint(i){if(i.active=i.target.bone.isActive()&&(!i.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,i.data,!0)),!i.active)return;const t=i.target,e=t.data.index,s=t.bone;this.skin!=null&&this.sortPathConstraintAttachment(this.skin,e,s),this.data.defaultSkin!=null&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,e,s);for(let h=0,o=this.data.skins.length;h<o;h++)this.sortPathConstraintAttachment(this.data.skins[h],e,s);const r=t.getAttachment();r instanceof _l&&this.sortPathConstraintAttachmentWith(r,s);const n=i.bones,a=n.length;for(let h=0;h<a;h++)this.sortBone(n[h]);this._updateCache.push(i);for(let h=0;h<a;h++)this.sortReset(n[h].children);for(let h=0;h<a;h++)n[h].sorted=!0}sortTransformConstraint(i){if(i.active=i.target.isActive()&&(!i.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,i.data,!0)),!i.active)return;this.sortBone(i.target);const t=i.bones,e=t.length;if(i.data.local)for(let s=0;s<e;s++){const r=t[s];this.sortBone(r.parent),this._updateCache.indexOf(r)>-1||this.updateCacheReset.push(r)}else for(let s=0;s<e;s++)this.sortBone(t[s]);this._updateCache.push(i);for(let s=0;s<e;s++)this.sortReset(t[s].children);for(let s=0;s<e;s++)t[s].sorted=!0}sortPathConstraintAttachment(i,t,e){const s=i.attachments[t];if(s)for(const r in s)this.sortPathConstraintAttachmentWith(s[r],e)}sortPathConstraintAttachmentWith(i,t){if(!(i instanceof _l))return;const e=i.bones;if(e==null)this.sortBone(t);else{const s=this.bones;let r=0;for(;r<e.length;){const n=e[r++];for(let a=r+n;r<a;r++){const h=e[r];this.sortBone(s[h])}}}}sortBone(i){if(i.sorted)return;const t=i.parent;t!=null&&this.sortBone(t),i.sorted=!0,this._updateCache.push(i)}sortReset(i){for(let t=0,e=i.length;t<e;t++){const s=i[t];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(){const i=this.updateCacheReset;for(let e=0,s=i.length;e<s;e++){const r=i[e];r.ax=r.x,r.ay=r.y,r.arotation=r.rotation,r.ascaleX=r.scaleX,r.ascaleY=r.scaleY,r.ashearX=r.shearX,r.ashearY=r.shearY,r.appliedValid=!0}const t=this._updateCache;for(let e=0,s=t.length;e<s;e++)t[e].update()}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){const i=this.bones;for(let r=0,n=i.length;r<n;r++)i[r].setToSetupPose();const t=this.ikConstraints;for(let r=0,n=t.length;r<n;r++){const a=t[r];a.mix=a.data.mix,a.softness=a.data.softness,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch}const e=this.transformConstraints;for(let r=0,n=e.length;r<n;r++){const a=e[r],h=a.data;a.rotateMix=h.rotateMix,a.translateMix=h.translateMix,a.scaleMix=h.scaleMix,a.shearMix=h.shearMix}const s=this.pathConstraints;for(let r=0,n=s.length;r<n;r++){const a=s[r],h=a.data;a.position=h.position,a.spacing=h.spacing,a.rotateMix=h.rotateMix,a.translateMix=h.translateMix}}setSlotsToSetupPose(){const i=this.slots;B.arrayCopy(i,0,this.drawOrder,0,i.length);for(let t=0,e=i.length;t<e;t++)i[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(i){if(i==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findBoneIndex(i){if(i==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,s=t.length;e<s;e++)if(t[e].data.name==i)return e;return-1}findSlot(i){if(i==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findSlotIndex(i){if(i==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,s=t.length;e<s;e++)if(t[e].data.name==i)return e;return-1}setSkinByName(i){const t=this.data.findSkin(i);if(t==null)throw new Error(`Skin not found: ${i}`);this.setSkin(t)}setSkin(i){if(i!=this.skin){if(i!=null)if(this.skin!=null)i.attachAll(this,this.skin);else{const t=this.slots;for(let e=0,s=t.length;e<s;e++){const r=t[e],n=r.data.attachmentName;if(n!=null){const a=i.getAttachment(e,n);a!=null&&r.setAttachment(a)}}}this.skin=i,this.updateCache()}}getAttachmentByName(i,t){return this.getAttachment(this.data.findSlotIndex(i),t)}getAttachment(i,t){if(t==null)throw new Error("attachmentName cannot be null.");if(this.skin!=null){const e=this.skin.getAttachment(i,t);if(e!=null)return e}return this.data.defaultSkin!=null?this.data.defaultSkin.getAttachment(i,t):null}setAttachment(i,t){if(i==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.data.name==i){let a=null;if(t!=null&&(a=this.getAttachment(s,t),a==null))throw new Error(`Attachment not found: ${t}, for slot: ${i}`);n.setAttachment(a);return}}throw new Error(`Slot not found: ${i}`)}findIkConstraint(i){if(i==null)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findTransformConstraint(i){if(i==null)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}findPathConstraint(i){if(i==null)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let e=0,s=t.length;e<s;e++){const r=t[e];if(r.data.name==i)return r}return null}getBounds(i,t,e=new Array(2)){if(i==null)throw new Error("offset cannot be null.");if(t==null)throw new Error("size cannot be null.");const s=this.drawOrder;let r=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let o=0,l=s.length;o<l;o++){const u=s[o];if(!u.bone.active)continue;let c=0,d=null;const f=u.getAttachment();if(f instanceof it)c=8,d=B.setArraySize(e,c,0),f.computeWorldVertices(u.bone,d,0,2);else if(f instanceof Vu){const p=f;c=p.worldVerticesLength,d=B.setArraySize(e,c,0),p.computeWorldVertices(u,0,c,d,0,2)}if(d!=null)for(let p=0,m=d.length;p<m;p+=2){const g=d[p],_=d[p+1];r=Math.min(r,g),n=Math.min(n,_),a=Math.max(a,g),h=Math.max(h,_)}}i.set(r,n),t.set(a-r,h-n)}update(i){this.time+=i}get flipX(){return this.scaleX==-1}set flipX(i){Ro.deprecatedWarning1||(Ro.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleX=i?1:-1}get flipY(){return this.scaleY==-1}set flipY(i){Ro.deprecatedWarning1||(Ro.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleY=i?1:-1}};let U_=Ro;U_.deprecatedWarning1=!1;let G_=class{constructor(){this.bones=new Array,this.slots=new Array,this.skins=new Array,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.fps=0}findBone(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findBoneIndex(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSlot(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findSlotIndex(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSkin(t){if(t==null)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findEvent(t){if(t==null)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(t==null)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}},X_=class{constructor(t,e,s){if(this.color=new X(1,1,1,1),t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");if(s==null)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},$_=class extends Yu{constructor(t){super(t,0,!1),this.bones=new Array,this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}},Y_=class{constructor(t,e,s){this.slotIndex=t,this.name=e,this.attachment=s}},Hu=class{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,t==null)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(s==null)throw new Error("attachment cannot be null.");const r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];this.setAttachment(r.slotIndex,r.name,r.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];r.attachment!=null&&(r.attachment instanceof Vu?(r.attachment=r.attachment.newLinkedMesh(),this.setAttachment(r.slotIndex,r.name,r.attachment)):(r.attachment=r.attachment.copy(),this.setAttachment(r.slotIndex,r.name,r.attachment)))}}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){const s=this.attachments[t];s&&(s[e]=null)}getAttachments(){const t=new Array;for(let e=0;e<this.attachments.length;e++){const s=this.attachments[e];if(s)for(const r in s){const n=s[r];n&&t.push(new Y_(e,r,n))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const r in s){const n=s[r];n&&e.push(new Y_(t,r,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){const n=t.slots[r],a=n.getAttachment();if(a&&s<e.attachments.length){const h=e.attachments[s];for(const o in h){const l=h[o];if(a==l){const u=this.getAttachment(s,o);u!=null&&n.setAttachment(u);break}}}s++}}};const Kt=class{constructor(i){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=i}readSkeletonData(i){const t=this.scale,e=new G_;e.name="";const s=new gl(i);e.hash=s.readString(),e.version=s.readString(),e.version==="3.8.75"&&console.error("Unsupported skeleton data, 3.8.75 is deprecated, please export with a newer version of Spine."),e.x=s.readFloat(),e.y=s.readFloat(),e.width=s.readFloat(),e.height=s.readFloat();const r=s.readBoolean();r&&(e.fps=s.readFloat(),e.imagesPath=s.readString(),e.audioPath=s.readString());let n=0;n=s.readInt(!0);for(let h=0;h<n;h++)s.strings.push(s.readString());n=s.readInt(!0);for(let h=0;h<n;h++){const o=s.readString(),l=h==0?null:e.bones[s.readInt(!0)],u=new D_(h,o,l);u.rotation=s.readFloat(),u.x=s.readFloat()*t,u.y=s.readFloat()*t,u.scaleX=s.readFloat(),u.scaleY=s.readFloat(),u.shearX=s.readFloat(),u.shearY=s.readFloat(),u.length=s.readFloat()*t,u.transformMode=Kt.TransformModeValues[s.readInt(!0)],u.skinRequired=s.readBoolean(),r&&X.rgba8888ToColor(u.color,s.readInt32()),e.bones.push(u)}n=s.readInt(!0);for(let h=0;h<n;h++){const o=s.readString(),l=e.bones[s.readInt(!0)],u=new X_(h,o,l);X.rgba8888ToColor(u.color,s.readInt32());const c=s.readInt32();c!=-1&&X.rgb888ToColor(u.darkColor=new X,c),u.attachmentName=s.readStringRef(),u.blendMode=Kt.BlendModeValues[s.readInt(!0)],e.slots.push(u)}n=s.readInt(!0);for(let h=0,o;h<n;h++){const l=new N_(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),o=s.readInt(!0);for(let u=0;u<o;u++)l.bones.push(e.bones[s.readInt(!0)]);l.target=e.bones[s.readInt(!0)],l.mix=s.readFloat(),l.softness=s.readFloat()*t,l.bendDirection=s.readByte(),l.compress=s.readBoolean(),l.stretch=s.readBoolean(),l.uniform=s.readBoolean(),e.ikConstraints.push(l)}n=s.readInt(!0);for(let h=0,o;h<n;h++){const l=new $_(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),o=s.readInt(!0);for(let u=0;u<o;u++)l.bones.push(e.bones[s.readInt(!0)]);l.target=e.bones[s.readInt(!0)],l.local=s.readBoolean(),l.relative=s.readBoolean(),l.offsetRotation=s.readFloat(),l.offsetX=s.readFloat()*t,l.offsetY=s.readFloat()*t,l.offsetScaleX=s.readFloat(),l.offsetScaleY=s.readFloat(),l.offsetShearY=s.readFloat(),l.rotateMix=s.readFloat(),l.translateMix=s.readFloat(),l.scaleMix=s.readFloat(),l.shearMix=s.readFloat(),e.transformConstraints.push(l)}n=s.readInt(!0);for(let h=0,o;h<n;h++){const l=new V_(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),o=s.readInt(!0);for(let u=0;u<o;u++)l.bones.push(e.bones[s.readInt(!0)]);l.target=e.slots[s.readInt(!0)],l.positionMode=Kt.PositionModeValues[s.readInt(!0)],l.spacingMode=Kt.SpacingModeValues[s.readInt(!0)],l.rotateMode=Kt.RotateModeValues[s.readInt(!0)],l.offsetRotation=s.readFloat(),l.position=s.readFloat(),l.positionMode==ne.Fixed&&(l.position*=t),l.spacing=s.readFloat(),(l.spacingMode==be.Length||l.spacingMode==be.Fixed)&&(l.spacing*=t),l.rotateMix=s.readFloat(),l.translateMix=s.readFloat(),e.pathConstraints.push(l)}const a=this.readSkin(s,e,!0,r);a!=null&&(e.defaultSkin=a,e.skins.push(a));{let h=e.skins.length;for(B.setArraySize(e.skins,n=h+s.readInt(!0));h<n;h++)e.skins[h]=this.readSkin(s,e,!1,r)}n=this.linkedMeshes.length;for(let h=0;h<n;h++){const o=this.linkedMeshes[h],l=o.skin==null?e.defaultSkin:e.findSkin(o.skin);if(l==null)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(u==null)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.deformAttachment=o.inheritDeform?u:o.mesh,o.mesh.setParentMesh(u)}this.linkedMeshes.length=0,n=s.readInt(!0);for(let h=0;h<n;h++){const o=new L_(s.readStringRef());o.intValue=s.readInt(!1),o.floatValue=s.readFloat(),o.stringValue=s.readString(),o.audioPath=s.readString(),o.audioPath!=null&&(o.volume=s.readFloat(),o.balance=s.readFloat()),e.events.push(o)}n=s.readInt(!0);for(let h=0;h<n;h++)e.animations.push(this.readAnimation(s,s.readString(),e));return e}readSkin(i,t,e,s){let r=null,n=0;if(e){if(n=i.readInt(!0),n==0)return null;r=new Hu("default")}else{r=new Hu(i.readStringRef()),r.bones.length=i.readInt(!0);for(let a=0,h=r.bones.length;a<h;a++)r.bones[a]=t.bones[i.readInt(!0)];for(let a=0,h=i.readInt(!0);a<h;a++)r.constraints.push(t.ikConstraints[i.readInt(!0)]);for(let a=0,h=i.readInt(!0);a<h;a++)r.constraints.push(t.transformConstraints[i.readInt(!0)]);for(let a=0,h=i.readInt(!0);a<h;a++)r.constraints.push(t.pathConstraints[i.readInt(!0)]);n=i.readInt(!0)}for(let a=0;a<n;a++){const h=i.readInt(!0);for(let o=0,l=i.readInt(!0);o<l;o++){const u=i.readStringRef(),c=this.readAttachment(i,t,r,h,u,s);c!=null&&r.setAttachment(h,u,c)}}return r}readAttachment(i,t,e,s,r,n){const a=this.scale;let h=i.readStringRef();h==null&&(h=r);const o=i.readByte();switch(Kt.AttachmentTypeValues[o]){case at.Region:{let u=i.readStringRef();const c=i.readFloat(),d=i.readFloat(),f=i.readFloat(),p=i.readFloat(),m=i.readFloat(),g=i.readFloat(),_=i.readFloat(),x=i.readInt32();u==null&&(u=h);const y=this.attachmentLoader.newRegionAttachment(e,h,u);return y==null?null:(y.path=u,y.x=d*a,y.y=f*a,y.scaleX=p,y.scaleY=m,y.rotation=c,y.width=g*a,y.height=_*a,X.rgba8888ToColor(y.color,x),y)}case at.BoundingBox:{const u=i.readInt(!0),c=this.readVertices(i,u),d=n?i.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(e,h);return f==null?null:(f.worldVerticesLength=u<<1,f.vertices=c.vertices,f.bones=c.bones,n&&X.rgba8888ToColor(f.color,d),f)}case at.Mesh:{let u=i.readStringRef();const c=i.readInt32(),d=i.readInt(!0),f=this.readFloatArray(i,d<<1,1),p=this.readShortArray(i),m=this.readVertices(i,d),g=i.readInt(!0);let _=null,x=0,y=0;n&&(_=this.readShortArray(i),x=i.readFloat(),y=i.readFloat()),u==null&&(u=h);const v=this.attachmentLoader.newMeshAttachment(e,h,u);return v==null?null:(v.path=u,X.rgba8888ToColor(v.color,c),v.bones=m.bones,v.vertices=m.vertices,v.worldVerticesLength=d<<1,v.triangles=p,v.regionUVs=new Float32Array(f),v.hullLength=g<<1,n&&(v.edges=_,v.width=x*a,v.height=y*a),v)}case at.LinkedMesh:{let u=i.readStringRef();const c=i.readInt32(),d=i.readStringRef(),f=i.readStringRef(),p=i.readBoolean();let m=0,g=0;n&&(m=i.readFloat(),g=i.readFloat()),u==null&&(u=h);const _=this.attachmentLoader.newMeshAttachment(e,h,u);return _==null?null:(_.path=u,X.rgba8888ToColor(_.color,c),n&&(_.width=m*a,_.height=g*a),this.linkedMeshes.push(new QS(_,d,s,f,p)),_)}case at.Path:{const u=i.readBoolean(),c=i.readBoolean(),d=i.readInt(!0),f=this.readVertices(i,d),p=B.newArray(d/3,0);for(let _=0,x=p.length;_<x;_++)p[_]=i.readFloat()*a;const m=n?i.readInt32():0,g=this.attachmentLoader.newPathAttachment(e,h);return g==null?null:(g.closed=u,g.constantSpeed=c,g.worldVerticesLength=d<<1,g.vertices=f.vertices,g.bones=f.bones,g.lengths=p,n&&X.rgba8888ToColor(g.color,m),g)}case at.Point:{const u=i.readFloat(),c=i.readFloat(),d=i.readFloat(),f=n?i.readInt32():0,p=this.attachmentLoader.newPointAttachment(e,h);return p==null?null:(p.x=c*a,p.y=d*a,p.rotation=u,n&&X.rgba8888ToColor(p.color,f),p)}case at.Clipping:{const u=i.readInt(!0),c=i.readInt(!0),d=this.readVertices(i,c),f=n?i.readInt32():0,p=this.attachmentLoader.newClippingAttachment(e,h);return p==null?null:(p.endSlot=t.slots[u],p.worldVerticesLength=c<<1,p.vertices=d.vertices,p.bones=d.bones,n&&X.rgba8888ToColor(p.color,f),p)}}return null}readVertices(i,t){const e=t<<1,s=new JS,r=this.scale;if(!i.readBoolean())return s.vertices=this.readFloatArray(i,e,r),s;const n=new Array,a=new Array;for(let h=0;h<t;h++){const o=i.readInt(!0);a.push(o);for(let l=0;l<o;l++)a.push(i.readInt(!0)),n.push(i.readFloat()*r),n.push(i.readFloat()*r),n.push(i.readFloat())}return s.vertices=B.toFloatArray(n),s.bones=a,s}readFloatArray(i,t,e){const s=new Array(t);if(e==1)for(let r=0;r<t;r++)s[r]=i.readFloat();else for(let r=0;r<t;r++)s[r]=i.readFloat()*e;return s}readShortArray(i){const t=i.readInt(!0),e=new Array(t);for(let s=0;s<t;s++)e[s]=i.readShort();return e}readAnimation(i,t,e){const s=new Array,r=this.scale;let n=0;const a=new X,h=new X;for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0);for(let f=0,p=i.readInt(!0);f<p;f++){const m=i.readByte(),g=i.readInt(!0);switch(m){case Kt.SLOT_ATTACHMENT:{const _=new Rn(g);_.slotIndex=d;for(let x=0;x<g;x++)_.setFrame(x,i.readFloat(),i.readStringRef());s.push(_),n=Math.max(n,_.frames[g-1]);break}case Kt.SLOT_COLOR:{const _=new He(g);_.slotIndex=d;for(let x=0;x<g;x++){const y=i.readFloat();X.rgba8888ToColor(a,i.readInt32()),_.setFrame(x,y,a.r,a.g,a.b,a.a),x<g-1&&this.readCurve(i,x,_)}s.push(_),n=Math.max(n,_.frames[(g-1)*He.ENTRIES]);break}case Kt.SLOT_TWO_COLOR:{const _=new ae(g);_.slotIndex=d;for(let x=0;x<g;x++){const y=i.readFloat();X.rgba8888ToColor(a,i.readInt32()),X.rgb888ToColor(h,i.readInt32()),_.setFrame(x,y,a.r,a.g,a.b,a.a,h.r,h.g,h.b),x<g-1&&this.readCurve(i,x,_)}s.push(_),n=Math.max(n,_.frames[(g-1)*ae.ENTRIES]);break}}}}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0);for(let f=0,p=i.readInt(!0);f<p;f++){const m=i.readByte(),g=i.readInt(!0);switch(m){case Kt.BONE_ROTATE:{const _=new Ie(g);_.boneIndex=d;for(let x=0;x<g;x++)_.setFrame(x,i.readFloat(),i.readFloat()),x<g-1&&this.readCurve(i,x,_);s.push(_),n=Math.max(n,_.frames[(g-1)*Ie.ENTRIES]);break}case Kt.BONE_TRANSLATE:case Kt.BONE_SCALE:case Kt.BONE_SHEAR:{let _,x=1;m==Kt.BONE_SCALE?_=new S_(g):m==Kt.BONE_SHEAR?_=new C_(g):(_=new ps(g),x=r),_.boneIndex=d;for(let y=0;y<g;y++)_.setFrame(y,i.readFloat(),i.readFloat()*x,i.readFloat()*x),y<g-1&&this.readCurve(i,y,_);s.push(_),n=Math.max(n,_.frames[(g-1)*ps.ENTRIES]);break}}}}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0),f=i.readInt(!0),p=new Pe(f);p.ikConstraintIndex=d;for(let m=0;m<f;m++)p.setFrame(m,i.readFloat(),i.readFloat(),i.readFloat()*r,i.readByte(),i.readBoolean(),i.readBoolean()),m<f-1&&this.readCurve(i,m,p);s.push(p),n=Math.max(n,p.frames[(f-1)*Pe.ENTRIES])}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0),f=i.readInt(!0),p=new We(f);p.transformConstraintIndex=d;for(let m=0;m<f;m++)p.setFrame(m,i.readFloat(),i.readFloat(),i.readFloat(),i.readFloat(),i.readFloat()),m<f-1&&this.readCurve(i,m,p);s.push(p),n=Math.max(n,p.frames[(f-1)*We.ENTRIES])}for(let u=0,c=i.readInt(!0);u<c;u++){const d=i.readInt(!0),f=e.pathConstraints[d];for(let p=0,m=i.readInt(!0);p<m;p++){const g=i.readByte(),_=i.readInt(!0);switch(g){case Kt.PATH_POSITION:case Kt.PATH_SPACING:{let x,y=1;g==Kt.PATH_SPACING?(x=new R_(_),(f.spacingMode==be.Length||f.spacingMode==be.Fixed)&&(y=r)):(x=new Cr(_),f.positionMode==ne.Fixed&&(y=r)),x.pathConstraintIndex=d;for(let v=0;v<_;v++)x.setFrame(v,i.readFloat(),i.readFloat()*y),v<_-1&&this.readCurve(i,v,x);s.push(x),n=Math.max(n,x.frames[(_-1)*Cr.ENTRIES]);break}case Kt.PATH_MIX:{const x=new or(_);x.pathConstraintIndex=d;for(let y=0;y<_;y++)x.setFrame(y,i.readFloat(),i.readFloat(),i.readFloat()),y<_-1&&this.readCurve(i,y,x);s.push(x),n=Math.max(n,x.frames[(_-1)*or.ENTRIES]);break}}}}for(let u=0,c=i.readInt(!0);u<c;u++){const d=e.skins[i.readInt(!0)];for(let f=0,p=i.readInt(!0);f<p;f++){const m=i.readInt(!0);for(let g=0,_=i.readInt(!0);g<_;g++){const x=d.getAttachment(m,i.readStringRef()),y=x.bones!=null,v=x.vertices,b=y?v.length/3*2:v.length,w=i.readInt(!0),E=new P_(w);E.slotIndex=m,E.attachment=x;for(let T=0;T<w;T++){const A=i.readFloat();let I,M=i.readInt(!0);if(M==0)I=y?B.newFloatArray(b):v;else{I=B.newFloatArray(b);const R=i.readInt(!0);if(M+=R,r==1)for(let C=R;C<M;C++)I[C]=i.readFloat();else for(let C=R;C<M;C++)I[C]=i.readFloat()*r;if(!y)for(let C=0,P=I.length;C<P;C++)I[C]+=v[C]}E.setFrame(T,A,I),T<w-1&&this.readCurve(i,T,E)}s.push(E),n=Math.max(n,E.frames[w-1])}}}const o=i.readInt(!0);if(o>0){const u=new Io(o),c=e.slots.length;for(let d=0;d<o;d++){const f=i.readFloat(),p=i.readInt(!0),m=B.newArray(c,0);for(let y=c-1;y>=0;y--)m[y]=-1;const g=B.newArray(c-p,0);let _=0,x=0;for(let y=0;y<p;y++){const v=i.readInt(!0);for(;_!=v;)g[x++]=_++;m[_+i.readInt(!0)]=_++}for(;_<c;)g[x++]=_++;for(let y=c-1;y>=0;y--)m[y]==-1&&(m[y]=g[--x]);u.setFrame(d,f,m)}s.push(u),n=Math.max(n,u.frames[o-1])}const l=i.readInt(!0);if(l>0){const u=new Uu(l);for(let c=0;c<l;c++){const d=i.readFloat(),f=e.events[i.readInt(!0)],p=new O_(d,f);p.intValue=i.readInt(!1),p.floatValue=i.readFloat(),p.stringValue=i.readBoolean()?i.readString():f.stringValue,p.data.audioPath!=null&&(p.volume=i.readFloat(),p.balance=i.readFloat()),u.setFrame(c,p)}s.push(u),n=Math.max(n,u.frames[l-1])}return new oe(t,s,n)}readCurve(i,t,e){switch(i.readByte()){case Kt.CURVE_STEPPED:e.setStepped(t);break;case Kt.CURVE_BEZIER:this.setCurve(e,t,i.readFloat(),i.readFloat(),i.readFloat(),i.readFloat());break}}setCurve(i,t,e,s,r,n){i.setCurve(t,e,s,r,n)}};let le=Kt;le.AttachmentTypeValues=[0,1,2,3,4,5,6],le.TransformModeValues=[vt.Normal,vt.OnlyTranslation,vt.NoRotationOrReflection,vt.NoScale,vt.NoScaleOrReflection],le.PositionModeValues=[ne.Fixed,ne.Percent],le.SpacingModeValues=[be.Length,be.Fixed,be.Percent],le.RotateModeValues=[Fe.Tangent,Fe.Chain,Fe.ChainScale],le.BlendModeValues=[W.NORMAL,W.ADD,W.MULTIPLY,W.SCREEN],le.BONE_ROTATE=0,le.BONE_TRANSLATE=1,le.BONE_SCALE=2,le.BONE_SHEAR=3,le.SLOT_ATTACHMENT=0,le.SLOT_COLOR=1,le.SLOT_TWO_COLOR=2,le.PATH_POSITION=0,le.PATH_SPACING=1,le.PATH_MIX=2,le.CURVE_LINEAR=0,le.CURVE_STEPPED=1,le.CURVE_BEZIER=2;let QS=class{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritDeform=n}},JS=class{constructor(t=null,e=null){this.bones=t,this.vertices=e}},tC=class Un{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new G_,r=typeof t=="string"?JSON.parse(t):t,n=r.skeleton;if(n!=null){if(s.hash=n.hash,s.version=n.spine,s.version.substr(0,3)!=="3.8"){const a=`Spine 3.8 loader cant load version ${n.spine}. Please configure your pixi-spine bundle`;console.error(a)}s.version==="3.8.75"&&console.error("Unsupported skeleton data, 3.8.75 is deprecated, please export with a newer version of Spine."),s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.fps=n.fps,s.imagesPath=n.images}if(r.bones)for(let a=0;a<r.bones.length;a++){const h=r.bones[a];let o=null;const l=this.getValue(h,"parent",null);if(l!=null&&(o=s.findBone(l),o==null))throw new Error(`Parent bone not found: ${l}`);const u=new D_(s.bones.length,h.name,o);u.length=this.getValue(h,"length",0)*e,u.x=this.getValue(h,"x",0)*e,u.y=this.getValue(h,"y",0)*e,u.rotation=this.getValue(h,"rotation",0),u.scaleX=this.getValue(h,"scaleX",1),u.scaleY=this.getValue(h,"scaleY",1),u.shearX=this.getValue(h,"shearX",0),u.shearY=this.getValue(h,"shearY",0),u.transformMode=Un.transformModeFromString(this.getValue(h,"transform","normal")),u.skinRequired=this.getValue(h,"skin",!1),s.bones.push(u)}if(r.slots)for(let a=0;a<r.slots.length;a++){const h=r.slots[a],o=h.name,l=h.bone,u=s.findBone(l);if(u==null)throw new Error(`Slot bone not found: ${l}`);const c=new X_(s.slots.length,o,u),d=this.getValue(h,"color",null);d!=null&&c.color.setFromString(d);const f=this.getValue(h,"dark",null);f!=null&&(c.darkColor=new X(1,1,1,1),c.darkColor.setFromString(f)),c.attachmentName=this.getValue(h,"attachment",null),c.blendMode=Un.blendModeFromString(this.getValue(h,"blend","normal")),s.slots.push(c)}if(r.ik)for(let a=0;a<r.ik.length;a++){const h=r.ik[a],o=new N_(h.name);o.order=this.getValue(h,"order",0),o.skinRequired=this.getValue(h,"skin",!1);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`IK bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`IK target bone not found: ${l}`);o.mix=this.getValue(h,"mix",1),o.softness=this.getValue(h,"softness",0)*e,o.bendDirection=this.getValue(h,"bendPositive",!0)?1:-1,o.compress=this.getValue(h,"compress",!1),o.stretch=this.getValue(h,"stretch",!1),o.uniform=this.getValue(h,"uniform",!1),s.ikConstraints.push(o)}if(r.transform)for(let a=0;a<r.transform.length;a++){const h=r.transform[a],o=new $_(h.name);o.order=this.getValue(h,"order",0),o.skinRequired=this.getValue(h,"skin",!1);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`Transform constraint target bone not found: ${l}`);o.local=this.getValue(h,"local",!1),o.relative=this.getValue(h,"relative",!1),o.offsetRotation=this.getValue(h,"rotation",0),o.offsetX=this.getValue(h,"x",0)*e,o.offsetY=this.getValue(h,"y",0)*e,o.offsetScaleX=this.getValue(h,"scaleX",0),o.offsetScaleY=this.getValue(h,"scaleY",0),o.offsetShearY=this.getValue(h,"shearY",0),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),o.scaleMix=this.getValue(h,"scaleMix",1),o.shearMix=this.getValue(h,"shearMix",1),s.transformConstraints.push(o)}if(r.path)for(let a=0;a<r.path.length;a++){const h=r.path[a],o=new V_(h.name);o.order=this.getValue(h,"order",0),o.skinRequired=this.getValue(h,"skin",!1);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findSlot(l),o.target==null)throw new Error(`Path target slot not found: ${l}`);o.positionMode=Un.positionModeFromString(this.getValue(h,"positionMode","percent")),o.spacingMode=Un.spacingModeFromString(this.getValue(h,"spacingMode","length")),o.rotateMode=Un.rotateModeFromString(this.getValue(h,"rotateMode","tangent")),o.offsetRotation=this.getValue(h,"rotation",0),o.position=this.getValue(h,"position",0),o.positionMode==ne.Fixed&&(o.position*=e),o.spacing=this.getValue(h,"spacing",0),(o.spacingMode==be.Length||o.spacingMode==be.Fixed)&&(o.spacing*=e),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),s.pathConstraints.push(o)}if(r.skins)for(let a=0;a<r.skins.length;a++){const h=r.skins[a],o=new Hu(h.name);if(h.bones)for(let l=0;l<h.bones.length;l++){const u=s.findBone(h.bones[l]);if(u==null)throw new Error(`Skin bone not found: ${h.bones[a]}`);o.bones.push(u)}if(h.ik)for(let l=0;l<h.ik.length;l++){const u=s.findIkConstraint(h.ik[l]);if(u==null)throw new Error(`Skin IK constraint not found: ${h.ik[a]}`);o.constraints.push(u)}if(h.transform)for(let l=0;l<h.transform.length;l++){const u=s.findTransformConstraint(h.transform[l]);if(u==null)throw new Error(`Skin transform constraint not found: ${h.transform[a]}`);o.constraints.push(u)}if(h.path)for(let l=0;l<h.path.length;l++){const u=s.findPathConstraint(h.path[l]);if(u==null)throw new Error(`Skin path constraint not found: ${h.path[a]}`);o.constraints.push(u)}for(const l in h.attachments){const u=s.findSlot(l);if(u==null)throw new Error(`Slot not found: ${l}`);const c=h.attachments[l];for(const d in c){const f=this.readAttachment(c[d],o,u.index,d,s);f!=null&&o.setAttachment(u.index,d,f)}}s.skins.push(o),o.name=="default"&&(s.defaultSkin=o)}for(let a=0,h=this.linkedMeshes.length;a<h;a++){const o=this.linkedMeshes[a],l=o.skin==null?s.defaultSkin:s.findSkin(o.skin);if(l==null)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(u==null)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.deformAttachment=o.inheritDeform?u:o.mesh,o.mesh.setParentMesh(u)}if(this.linkedMeshes.length=0,r.events)for(const a in r.events){const h=r.events[a],o=new L_(a);o.intValue=this.getValue(h,"int",0),o.floatValue=this.getValue(h,"float",0),o.stringValue=this.getValue(h,"string",""),o.audioPath=this.getValue(h,"audio",null),o.audioPath!=null&&(o.volume=this.getValue(h,"volume",1),o.balance=this.getValue(h,"balance",0)),s.events.push(o)}if(r.animations)for(const a in r.animations){const h=r.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,r,n){const a=this.scale;switch(r=this.getValue(t,"name",r),this.getValue(t,"type","region")){case"region":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newRegionAttachment(e,r,o);if(l==null)return null;l.path=o,l.x=this.getValue(t,"x",0)*a,l.y=this.getValue(t,"y",0)*a,l.scaleX=this.getValue(t,"scaleX",1),l.scaleY=this.getValue(t,"scaleY",1),l.rotation=this.getValue(t,"rotation",0),l.width=t.width*a,l.height=t.height*a;const u=this.getValue(t,"color",null);return u!=null&&l.color.setFromString(u),l}case"boundingbox":{const o=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(o==null)return null;this.readVertices(t,o,t.vertexCount<<1);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"mesh":case"linkedmesh":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newMeshAttachment(e,r,o);if(l==null)return null;l.path=o;const u=this.getValue(t,"color",null);u!=null&&l.color.setFromString(u),l.width=this.getValue(t,"width",0)*a,l.height=this.getValue(t,"height",0)*a;const c=this.getValue(t,"parent",null);if(c!=null)return this.linkedMeshes.push(new eC(l,this.getValue(t,"skin",null),s,c,this.getValue(t,"deform",!0))),l;const d=t.uvs;return this.readVertices(t,l,d.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(d),l.edges=this.getValue(t,"edges",null),l.hullLength=this.getValue(t,"hull",0)*2,l}case"path":{const o=this.attachmentLoader.newPathAttachment(e,r);if(o==null)return null;o.closed=this.getValue(t,"closed",!1),o.constantSpeed=this.getValue(t,"constantSpeed",!0);const l=t.vertexCount;this.readVertices(t,o,l<<1);const u=B.newArray(l/3,0);for(let d=0;d<t.lengths.length;d++)u[d]=t.lengths[d]*a;o.lengths=u;const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}case"point":{const o=this.attachmentLoader.newPointAttachment(e,r);if(o==null)return null;o.x=this.getValue(t,"x",0)*a,o.y=this.getValue(t,"y",0)*a,o.rotation=this.getValue(t,"rotation",0);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"clipping":{const o=this.attachmentLoader.newClippingAttachment(e,r);if(o==null)return null;const l=this.getValue(t,"end",null);if(l!=null){const d=n.findSlot(l);if(d==null)throw new Error(`Clipping end slot not found: ${l}`);o.endSlot=d}const u=t.vertexCount;this.readVertices(t,o,u<<1);const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}}return null}readVertices(t,e,s){const r=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(r!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=r;e.vertices=o;return}const a=new Array,h=new Array;for(let o=0,l=n.length;o<l;){const u=n[o++];h.push(u);for(let c=o+u*4;o<c;o+=4)h.push(n[o]),a.push(n[o+1]*r),a.push(n[o+2]*r),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const r=this.scale,n=new Array;let a=0;if(t.slots)for(const o in t.slots){const l=t.slots[o],u=s.findSlotIndex(o);if(u==-1)throw new Error(`Slot not found: ${o}`);for(const c in l){const d=l[c];if(c=="attachment"){const f=new Rn(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p++,this.getValue(g,"time",0),g.name)}n.push(f),a=Math.max(a,f.frames[f.getFrameCount()-1])}else if(c=="color"){const f=new He(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X;_.setFromString(g.color||"ffffffff"),f.setFrame(p,this.getValue(g,"time",0),_.r,_.g,_.b,_.a),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*He.ENTRIES])}else if(c=="twoColor"){const f=new ae(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X,x=new X;_.setFromString(g.light),x.setFromString(g.dark),f.setFrame(p,this.getValue(g,"time",0),_.r,_.g,_.b,_.a,x.r,x.g,x.b),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ae.ENTRIES])}else throw new Error(`Invalid timeline type for a slot: ${c} (${o})`)}}if(t.bones)for(const o in t.bones){const l=t.bones[o],u=s.findBoneIndex(o);if(u==-1)throw new Error(`Bone not found: ${o}`);for(const c in l){const d=l[c];if(c==="rotate"){const f=new Ie(d.length);f.boneIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p,this.getValue(g,"time",0),this.getValue(g,"angle",0)),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*Ie.ENTRIES])}else if(c==="translate"||c==="scale"||c==="shear"){let f=null,p=1,m=0;c==="scale"?(f=new S_(d.length),m=1):c==="shear"?f=new C_(d.length):(f=new ps(d.length),p=r),f.boneIndex=u;let g=0;for(let _=0;_<d.length;_++){const x=d[_],y=this.getValue(x,"x",m),v=this.getValue(x,"y",m);f.setFrame(g,this.getValue(x,"time",0),y*p,v*p),this.readCurve(x,f,g),g++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ps.ENTRIES])}else throw new Error(`Invalid timeline type for a bone: ${c} (${o})`)}}if(t.ik)for(const o in t.ik){const l=t.ik[o],u=s.findIkConstraint(o),c=new Pe(l.length);c.ikConstraintIndex=s.ikConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,this.getValue(p,"time",0),this.getValue(p,"mix",1),this.getValue(p,"softness",0)*r,this.getValue(p,"bendPositive",!0)?1:-1,this.getValue(p,"compress",!1),this.getValue(p,"stretch",!1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*Pe.ENTRIES])}if(t.transform)for(const o in t.transform){const l=t.transform[o],u=s.findTransformConstraint(o),c=new We(l.length);c.transformConstraintIndex=s.transformConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,this.getValue(p,"time",0),this.getValue(p,"rotateMix",1),this.getValue(p,"translateMix",1),this.getValue(p,"scaleMix",1),this.getValue(p,"shearMix",1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*We.ENTRIES])}if(t.path)for(const o in t.path){const l=t.path[o],u=s.findPathConstraintIndex(o);if(u==-1)throw new Error(`Path constraint not found: ${o}`);const c=s.pathConstraints[u];for(const d in l){const f=l[d];if(d==="position"||d==="spacing"){let p=null,m=1;d==="spacing"?(p=new R_(f.length),(c.spacingMode==be.Length||c.spacingMode==be.Fixed)&&(m=r)):(p=new Cr(f.length),c.positionMode==ne.Fixed&&(m=r)),p.pathConstraintIndex=u;let g=0;for(let _=0;_<f.length;_++){const x=f[_];p.setFrame(g,this.getValue(x,"time",0),this.getValue(x,d,0)*m),this.readCurve(x,p,g),g++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*Cr.ENTRIES])}else if(d==="mix"){const p=new or(f.length);p.pathConstraintIndex=u;let m=0;for(let g=0;g<f.length;g++){const _=f[g];p.setFrame(m,this.getValue(_,"time",0),this.getValue(_,"rotateMix",1),this.getValue(_,"translateMix",1)),this.readCurve(_,p,m),m++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*or.ENTRIES])}}}if(t.deform)for(const o in t.deform){const l=t.deform[o],u=s.findSkin(o);if(u!=null)for(const c in l){const d=l[c],f=s.findSlotIndex(c);if(f==-1)throw new Error(`Slot not found: ${d.name}`);for(const p in d){const m=d[p],g=u.getAttachment(f,p);if(g==null)throw new Error(`Deform attachment not found: ${m.name}`);const _=g.bones!=null,x=g.vertices,y=_?x.length/3*2:x.length,v=new P_(m.length);v.slotIndex=f,v.attachment=g;let b=0;for(let w=0;w<m.length;w++){const E=m[w];let T;const A=this.getValue(E,"vertices",null);if(A==null)T=_?B.newFloatArray(y):x;else{T=B.newFloatArray(y);const I=this.getValue(E,"offset",0);if(B.arrayCopy(A,0,T,I,A.length),r!=1)for(let M=I,R=M+A.length;M<R;M++)T[M]*=r;if(!_)for(let M=0;M<y;M++)T[M]+=x[M]}v.setFrame(b,this.getValue(E,"time",0),T),this.readCurve(E,v,b),b++}n.push(v),a=Math.max(a,v.frames[v.getFrameCount()-1])}}}let h=t.drawOrder;if(h==null&&(h=t.draworder),h!=null){const o=new Io(h.length),l=s.slots.length;let u=0;for(let c=0;c<h.length;c++){const d=h[c];let f=null;const p=this.getValue(d,"offsets",null);if(p!=null){f=B.newArray(l,-1);const m=B.newArray(l-p.length,0);let g=0,_=0;for(let x=0;x<p.length;x++){const y=p[x],v=s.findSlotIndex(y.slot);if(v==-1)throw new Error(`Slot not found: ${y.slot}`);for(;g!=v;)m[_++]=g++;f[g+y.offset]=g++}for(;g<l;)m[_++]=g++;for(let x=l-1;x>=0;x--)f[x]==-1&&(f[x]=m[--_])}o.setFrame(u++,this.getValue(d,"time",0),f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(t.events){const o=new Uu(t.events.length);let l=0;for(let u=0;u<t.events.length;u++){const c=t.events[u],d=s.findEvent(c.name);if(d==null)throw new Error(`Event not found: ${c.name}`);const f=new O_(B.toSinglePrecision(this.getValue(c,"time",0)),d);f.intValue=this.getValue(c,"int",d.intValue),f.floatValue=this.getValue(c,"float",d.floatValue),f.stringValue=this.getValue(c,"string",d.stringValue),f.data.audioPath!=null&&(f.volume=this.getValue(c,"volume",1),f.balance=this.getValue(c,"balance",0)),o.setFrame(l++,f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(isNaN(a))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new oe(e,n,a))}readCurve(t,e,s){if(t.hasOwnProperty("curve"))if(t.curve==="stepped")e.setStepped(s);else{const r=t.curve;e.setCurve(s,r,this.getValue(t,"c2",0),this.getValue(t,"c3",1),this.getValue(t,"c4",1))}}getValue(t,e,s){return t[e]!==void 0?t[e]:s}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return W.NORMAL;if(t=="additive")return W.ADD;if(t=="multiply")return W.MULTIPLY;if(t=="screen")return W.SCREEN;throw new Error(`Unknown blend mode: ${t}`)}static positionModeFromString(t){if(t=t.toLowerCase(),t=="fixed")return ne.Fixed;if(t=="percent")return ne.Percent;throw new Error(`Unknown position mode: ${t}`)}static spacingModeFromString(t){if(t=t.toLowerCase(),t=="length")return be.Length;if(t=="fixed")return be.Fixed;if(t=="percent")return be.Percent;throw new Error(`Unknown position mode: ${t}`)}static rotateModeFromString(t){if(t=t.toLowerCase(),t=="tangent")return Fe.Tangent;if(t=="chain")return Fe.Chain;if(t=="chainscale")return Fe.ChainScale;throw new Error(`Unknown rotate mode: ${t}`)}static transformModeFromString(t){if(t=t.toLowerCase(),t=="normal")return vt.Normal;if(t=="onlytranslation")return vt.OnlyTranslation;if(t=="norotationorreflection")return vt.NoRotationOrReflection;if(t=="noscale")return vt.NoScale;if(t=="noscaleorreflection")return vt.NoScaleOrReflection;throw new Error(`Unknown transform mode: ${t}`)}},eC=class{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritDeform=n}};class sC extends Nu{createSkeleton(t){this.skeleton=new U_(t),this.skeleton.updateWorldTransform(),this.stateData=new F_(t),this.state=new ms(this.stateData)}}const rC={extension:Y.Asset,loader:{extension:{type:Y.LoadParser,priority:Ne.Normal},test(i){return Le(i,".atlas")},async load(i){return await(await z.ADAPTER.fetch(i)).text()},testParse(i,t){const e=Le(t.src,".atlas"),s=typeof i=="string";return Promise.resolve(e&&s)},async parse(i,t,e){const s=t.data;let r=bt.dirname(t.src);r&&r.lastIndexOf("/")!==r.length-1&&(r+="/");let n=null,a=null;const h=new Promise((u,c)=>{n=u,a=c});let o;const l=u=>{u||a(`Something went terribly wrong loading a spine .atlas file
1170
+ Most likely your texture failed to load.`),n(o)};if(s.image||s.images){const u=Object.assign(s.image?{default:s.image}:{},s.images);o=new Lu(i,(c,d)=>{const f=u[c]||u.default;f&&f.baseTexture?d(f.baseTexture):d(f)},l)}else o=new Lu(i,H_(e,r,s.imageMetadata),l);return await h},unload(i){i.dispose()}}},H_=(i,t,e)=>async(s,r)=>{const n=bt.normalize([...t.split(bt.sep),s].join(bt.sep)),a=await i.load({src:n,data:e});r(a.baseTexture)};K.add(rC);function W_(i){return i.hasOwnProperty("bones")}function iC(i){return i instanceof ArrayBuffer}class nC{constructor(){}installLoader(){const t=this,e={extension:Y.Asset,loader:{extension:{type:Y.LoadParser,priority:Ne.Normal},test(s){return Le(s,".skel")},async load(s){return await(await z.ADAPTER.fetch(s)).arrayBuffer()},testParse(s,r){var o;const n=Le(r.src,".json")&&W_(s),a=Le(r.src,".skel")&&iC(s),h=((o=r.data)==null?void 0:o.spineAtlas)===!1;return Promise.resolve(n&&!h||a)},async parse(s,r,n){const a=bt.extname(r.src).toLowerCase(),h=bt.basename(r.src,a);let o=bt.dirname(r.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");const l=Le(r.src,".json")&&W_(s);let u=null,c=s;l?u=t.createJsonParser():(u=t.createBinaryParser(),c=new Uint8Array(s));const d=r.data||{},f=(d==null?void 0:d.spineSkeletonScale)??null;f&&(u.scale=f);const p=d.spineAtlas;if(p&&p.pages)return t.parseData(u,p,c);const m=d.atlasRawData;if(m){let x=null,y=null;const v=new Promise((E,T)=>{x=E,y=T}),b=new Lu(m,H_(n,o,d.imageMetadata),E=>{E||y(`Something went terribly wrong loading a spine .atlas file
1171
+ Most likely your texture failed to load.`),x(b)}),w=await v;return t.parseData(u,w,c)}let g=d.spineAtlasFile;g||(g=`${o+h}.atlas`);const _=await n.load({src:g,data:d,alias:d.spineAtlasAlias});return t.parseData(u,_,c)}}};return K.add(e),e}}let z_=class{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}};const j_=class extends z_{constructor(t){super(t),this.id=(j_.nextID++&65535)<<11,this.worldVerticesLength=0}computeWorldVerticesOld(t,e){this.computeWorldVertices(t,0,this.worldVerticesLength,e,0,2)}computeWorldVertices(t,e,s,r,n,a){s=n+(s>>1)*a;const h=t.bone.skeleton,o=t.attachmentVertices;let l=this.vertices;const u=this.bones;if(u==null){o.length>0&&(l=o);const p=t.bone.matrix,m=p.tx,g=p.ty,_=p.a,x=p.c,y=p.b,v=p.d;for(let b=e,w=n;w<s;b+=2,w+=a){const E=l[b],T=l[b+1];r[w]=E*_+T*x+m,r[w+1]=E*y+T*v+g}return}let c=0,d=0;for(let p=0;p<e;p+=2){const m=u[c];c+=m+1,d+=m}const f=h.bones;if(o.length==0)for(let p=n,m=d*3;p<s;p+=a){let g=0,_=0,x=u[c++];for(x+=c;c<x;c++,m+=3){const y=f[u[c]].matrix,v=l[m],b=l[m+1],w=l[m+2];g+=(v*y.a+b*y.c+y.tx)*w,_+=(v*y.b+b*y.d+y.ty)*w}r[p]=g,r[p+1]=_}else{const p=o;for(let m=n,g=d*3,_=d<<1;m<s;m+=a){let x=0,y=0,v=u[c++];for(v+=c;c<v;c++,g+=3,_+=2){const b=f[u[c]].matrix,w=l[g]+p[_],E=l[g+1]+p[_+1],T=l[g+2];x+=(w*b.a+E*b.c+b.tx)*T,y+=(w*b.b+E*b.d+b.ty)*T}r[m]=x,r[m+1]=y}}}applyDeform(t){return this==t}};let Yi=j_;Yi.nextID=0;let oC=class extends Yi{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}},aC=class extends Yi{constructor(t){super(t),this.type=at.Clipping,this.color=new X(.2275,.2275,.8078,1)}},lC=class extends Yi{constructor(t){super(t),this.type=at.Mesh,this.color=new X(1,1,1,1),this.inheritDeform=!1,this.tempColor=new X(0,0,0,0)}applyDeform(t){return this==t||this.inheritDeform&&this.parentMesh==t}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t!=null&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}},hC=class extends Yi{constructor(t){super(t),this.type=at.Path,this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}},cC=class extends Yi{constructor(t){super(t),this.type=at.Point,this.color=new X(.38,.94,0,1)}computeWorldPosition(t,e){const s=t.matrix;return e.x=this.x*s.a+this.y*s.c+t.worldX,e.y=this.x*s.b+this.y*s.d+t.worldY,e}computeWorldRotation(t){const e=t.matrix,s=D.cosDeg(this.rotation),r=D.sinDeg(this.rotation),n=s*e.a+r*e.c,a=s*e.b+r*e.d;return Math.atan2(a,n)*D.radDeg}};class uC{constructor(t,e){if(this.attachmentVertices=new Array,t==null)throw new Error("data cannot be null.");if(e==null)throw new Error("bone cannot be null.");this.data=t,this.bone=e,this.color=new X,this.darkColor=t.darkColor==null?null:new X,this.setToSetupPose(),this.blendMode=this.data.blendMode}getAttachment(){return this.attachment}setAttachment(t){this.attachment!=t&&(this.attachment=t,this.attachmentTime=this.bone.skeleton.time,this.attachmentVertices.length=0)}setAttachmentTime(t){this.attachmentTime=this.bone.skeleton.time-t}getAttachmentTime(){return this.bone.skeleton.time-this.attachmentTime}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor!=null&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName==null?this.attachment=null:(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName)))}}const we=class extends z_{constructor(t){super(t),this.type=at.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new X(1,1,1,1),this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new X(1,1,1,1)}updateOffset(){const t=this.width/this.region.originalWidth*this.scaleX,e=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*t,r=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=r+this.region.height*e,h=this.rotation*Math.PI/180,o=Math.cos(h),l=Math.sin(h),u=s*o+this.x,c=s*l,d=r*o+this.y,f=r*l,p=n*o+this.x,m=n*l,g=a*o+this.y,_=a*l,x=this.offset;x[we.OX1]=u-f,x[we.OY1]=d+c,x[we.OX2]=u-_,x[we.OY2]=g+c,x[we.OX3]=p-_,x[we.OY3]=g+m,x[we.OX4]=p-f,x[we.OY4]=d+m}setRegion(t){this.region=t;const e=this.uvs;t.rotate?(e[2]=t.u,e[3]=t.v2,e[4]=t.u,e[5]=t.v,e[6]=t.u2,e[7]=t.v,e[0]=t.u2,e[1]=t.v2):(e[0]=t.u,e[1]=t.v2,e[2]=t.u,e[3]=t.v,e[4]=t.u2,e[5]=t.v,e[6]=t.u2,e[7]=t.v2)}computeWorldVertices(t,e,s,r){const n=this.offset,a=t instanceof uC?t.bone.matrix:t.matrix,h=a.tx,o=a.ty,l=a.a,u=a.c,c=a.b,d=a.d;let f=0,p=0;f=n[we.OX1],p=n[we.OY1],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[we.OX2],p=n[we.OY2],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[we.OX3],p=n[we.OY3],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o,s+=r,f=n[we.OX4],p=n[we.OY4],e[s]=f*l+p*u+h,e[s+1]=f*c+p*d+o}};let nt=we;nt.OX1=0,nt.OY1=1,nt.OX2=2,nt.OY2=3,nt.OX3=4,nt.OY3=5,nt.OX4=6,nt.OY4=7,nt.X1=0,nt.Y1=1,nt.C1R=2,nt.C1G=3,nt.C1B=4,nt.C1A=5,nt.U1=6,nt.V1=7,nt.X2=8,nt.Y2=9,nt.C2R=10,nt.C2G=11,nt.C2B=12,nt.C2A=13,nt.U2=14,nt.V2=15,nt.X3=16,nt.Y3=17,nt.C3R=18,nt.C3G=19,nt.C3B=20,nt.C3A=21,nt.U3=22,nt.V3=23,nt.X4=24,nt.Y4=25,nt.C4R=26,nt.C4G=27,nt.C4B=28,nt.C4A=29,nt.U4=30,nt.V4=31,new b_(2);let Ee=class{constructor(t,e,s){if(t==null)throw new Error("name cannot be null.");if(e==null)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.duration=s}apply(t,e,s,r,n,a,h,o){if(t==null)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let u=0,c=l.length;u<c;u++)l[u].apply(t,e,s,n,a,h,o)}static binarySearch(t,e,s=1){let r=0,n=t.length/s-2;if(n==0)return s;let a=n>>>1;for(;;){if(t[(a+1)*s]<=e?r=a+1:n=a,r==n)return(r+1)*s;a=r+n>>>1}}static linearSearch(t,e,s){for(let r=0,n=t.length-s;r<=n;r+=s)if(t[r]>e)return r;return-1}};const se=class{constructor(i){if(i<=0)throw new Error(`frameCount must be > 0: ${i}`);this.curves=B.newFloatArray((i-1)*se.BEZIER_SIZE)}getFrameCount(){return this.curves.length/se.BEZIER_SIZE+1}setLinear(i){this.curves[i*se.BEZIER_SIZE]=se.LINEAR}setStepped(i){this.curves[i*se.BEZIER_SIZE]=se.STEPPED}getCurveType(i){const t=i*se.BEZIER_SIZE;if(t==this.curves.length)return se.LINEAR;const e=this.curves[t];return e==se.LINEAR?se.LINEAR:e==se.STEPPED?se.STEPPED:se.BEZIER}setCurve(i,t,e,s,r){const n=(-t*2+s)*.03,a=(-e*2+r)*.03,h=((t-s)*3+1)*.006,o=((e-r)*3+1)*.006;let l=n*2+h,u=a*2+o,c=t*.3+n+h*.16666667,d=e*.3+a+o*.16666667,f=i*se.BEZIER_SIZE;const p=this.curves;p[f++]=se.BEZIER;let m=c,g=d;for(let _=f+se.BEZIER_SIZE-1;f<_;f+=2)p[f]=m,p[f+1]=g,c+=l,d+=u,l+=h,u+=o,m+=c,g+=d}getCurvePercent(i,t){t=D.clamp(t,0,1);const e=this.curves;let s=i*se.BEZIER_SIZE;const r=e[s];if(r==se.LINEAR)return t;if(r==se.STEPPED)return 0;s++;let n=0;for(let h=s,o=s+se.BEZIER_SIZE-1;s<o;s+=2)if(n=e[s],n>=t){let l,u;return s==h?(l=0,u=0):(l=e[s-2],u=e[s-1]),u+(e[s+1]-u)*(t-l)/(n-l)}const a=e[s-1];return a+(1-a)*(t-n)/(1-n)}};let rs=se;rs.LINEAR=0,rs.STEPPED=1,rs.BEZIER=2,rs.BEZIER_SIZE=10*2-1;const si=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(i,t,e){i<<=1,this.frames[i]=t,this.frames[i+si.ROTATION]=e}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.bones[this.boneIndex];if(e<h[0]){switch(n){case S.setup:o.rotation=o.data.rotation;return;case S.first:const p=o.data.rotation-o.rotation;o.rotation+=(p-(16384-(16384.499999999996-p/360|0))*360)*r}return}if(e>=h[h.length-si.ENTRIES]){let p=h[h.length+si.PREV_ROTATION];switch(n){case S.setup:o.rotation=o.data.rotation+p*r;break;case S.first:case S.replace:p+=o.data.rotation-o.rotation,p-=(16384-(16384.499999999996-p/360|0))*360;case S.add:o.rotation+=p*r}return}const l=Ee.binarySearch(h,e,si.ENTRIES),u=h[l+si.PREV_ROTATION],c=h[l],d=this.getCurvePercent((l>>1)-1,1-(e-c)/(h[l+si.PREV_TIME]-c));let f=h[l+si.ROTATION]-u;switch(f=u+(f-(16384-(16384.499999999996-f/360|0))*360)*d,n){case S.setup:o.rotation=o.data.rotation+(f-(16384-(16384.499999999996-f/360|0))*360)*r;break;case S.first:case S.replace:f+=o.data.rotation-o.rotation;case S.add:o.rotation+=(f-(16384-(16384.499999999996-f/360|0))*360)*r}}};let Mn=si;Mn.ENTRIES=2,Mn.PREV_TIME=-2,Mn.PREV_ROTATION=-1,Mn.ROTATION=1;const De=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*De.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(i,t,e,s){i*=De.ENTRIES,this.frames[i]=t,this.frames[i+De.X]=e,this.frames[i+De.Y]=s}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.bones[this.boneIndex];if(e<h[0]){switch(n){case S.setup:o.x=o.data.x,o.y=o.data.y;return;case S.first:o.x+=(o.data.x-o.x)*r,o.y+=(o.data.y-o.y)*r}return}let l=0,u=0;if(e>=h[h.length-De.ENTRIES])l=h[h.length+De.PREV_X],u=h[h.length+De.PREV_Y];else{const c=Ee.binarySearch(h,e,De.ENTRIES);l=h[c+De.PREV_X],u=h[c+De.PREV_Y];const d=h[c],f=this.getCurvePercent(c/De.ENTRIES-1,1-(e-d)/(h[c+De.PREV_TIME]-d));l+=(h[c+De.X]-l)*f,u+=(h[c+De.Y]-u)*f}switch(n){case S.setup:o.x=o.data.x+l*r,o.y=o.data.y+u*r;break;case S.first:case S.replace:o.x+=(o.data.x+l-o.x)*r,o.y+=(o.data.y+u-o.y)*r;break;case S.add:o.x+=l*r,o.y+=u*r}}};let ar=De;ar.ENTRIES=3,ar.PREV_TIME=-3,ar.PREV_X=-2,ar.PREV_Y=-1,ar.X=1,ar.Y=2;let dC=class Os extends ar{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(s<o[0]){switch(a){case S.setup:l.scaleX=l.data.scaleX,l.scaleY=l.data.scaleY;return;case S.first:l.scaleX+=(l.data.scaleX-l.scaleX)*n,l.scaleY+=(l.data.scaleY-l.scaleY)*n}return}let u=0,c=0;if(s>=o[o.length-Os.ENTRIES])u=o[o.length+Os.PREV_X]*l.data.scaleX,c=o[o.length+Os.PREV_Y]*l.data.scaleY;else{const d=Ee.binarySearch(o,s,Os.ENTRIES);u=o[d+Os.PREV_X],c=o[d+Os.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Os.ENTRIES-1,1-(s-f)/(o[d+Os.PREV_TIME]-f));u=(u+(o[d+Os.X]-u)*p)*l.data.scaleX,c=(c+(o[d+Os.Y]-c)*p)*l.data.scaleY}if(n==1)a==S.add?(l.scaleX+=u-l.data.scaleX,l.scaleY+=c-l.data.scaleY):(l.scaleX=u,l.scaleY=c);else{let d=0,f=0;if(h==At.mixOut)switch(a){case S.setup:d=l.data.scaleX,f=l.data.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.first:case S.replace:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-d)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-f)*n;break;case S.add:d=l.scaleX,f=l.scaleY,l.scaleX=d+(Math.abs(u)*D.signum(d)-l.data.scaleX)*n,l.scaleY=f+(Math.abs(c)*D.signum(f)-l.data.scaleY)*n}else switch(a){case S.setup:d=Math.abs(l.data.scaleX)*D.signum(u),f=Math.abs(l.data.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.first:case S.replace:d=Math.abs(l.scaleX)*D.signum(u),f=Math.abs(l.scaleY)*D.signum(c),l.scaleX=d+(u-d)*n,l.scaleY=f+(c-f)*n;break;case S.add:d=D.signum(u),f=D.signum(c),l.scaleX=Math.abs(l.scaleX)*d+(u-Math.abs(l.data.scaleX)*d)*n,l.scaleY=Math.abs(l.scaleY)*f+(c-Math.abs(l.data.scaleY)*f)*n}}}},fC=class Ls extends ar{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.bones[this.boneIndex];if(s<o[0]){switch(a){case S.setup:l.shearX=l.data.shearX,l.shearY=l.data.shearY;return;case S.first:l.shearX+=(l.data.shearX-l.shearX)*n,l.shearY+=(l.data.shearY-l.shearY)*n}return}let u=0,c=0;if(s>=o[o.length-Ls.ENTRIES])u=o[o.length+Ls.PREV_X],c=o[o.length+Ls.PREV_Y];else{const d=Ee.binarySearch(o,s,Ls.ENTRIES);u=o[d+Ls.PREV_X],c=o[d+Ls.PREV_Y];const f=o[d],p=this.getCurvePercent(d/Ls.ENTRIES-1,1-(s-f)/(o[d+Ls.PREV_TIME]-f));u=u+(o[d+Ls.X]-u)*p,c=c+(o[d+Ls.Y]-c)*p}switch(a){case S.setup:l.shearX=l.data.shearX+u*n,l.shearY=l.data.shearY+c*n;break;case S.first:case S.replace:l.shearX+=(l.data.shearX+u-l.shearX)*n,l.shearY+=(l.data.shearY+c-l.shearY)*n;break;case S.add:l.shearX+=u*n,l.shearY+=c*n}}};const Ht=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Ht.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(i,t,e,s,r,n){i*=Ht.ENTRIES,this.frames[i]=t,this.frames[i+Ht.R]=e,this.frames[i+Ht.G]=s,this.frames[i+Ht.B]=r,this.frames[i+Ht.A]=n}apply(i,t,e,s,r,n,a){const h=i.slots[this.slotIndex],o=this.frames;if(e<o[0]){switch(n){case S.setup:h.color.setFromColor(h.data.color);return;case S.first:const f=h.color,p=h.data.color;f.add((p.r-f.r)*r,(p.g-f.g)*r,(p.b-f.b)*r,(p.a-f.a)*r)}return}let l=0,u=0,c=0,d=0;if(e>=o[o.length-Ht.ENTRIES]){const f=o.length;l=o[f+Ht.PREV_R],u=o[f+Ht.PREV_G],c=o[f+Ht.PREV_B],d=o[f+Ht.PREV_A]}else{const f=Ee.binarySearch(o,e,Ht.ENTRIES);l=o[f+Ht.PREV_R],u=o[f+Ht.PREV_G],c=o[f+Ht.PREV_B],d=o[f+Ht.PREV_A];const p=o[f],m=this.getCurvePercent(f/Ht.ENTRIES-1,1-(e-p)/(o[f+Ht.PREV_TIME]-p));l+=(o[f+Ht.R]-l)*m,u+=(o[f+Ht.G]-u)*m,c+=(o[f+Ht.B]-c)*m,d+=(o[f+Ht.A]-d)*m}if(r==1)h.color.set(l,u,c,d);else{const f=h.color;n==S.setup&&f.setFromColor(h.data.color),f.add((l-f.r)*r,(u-f.g)*r,(c-f.b)*r,(d-f.a)*r)}}};let gs=Ht;gs.ENTRIES=5,gs.PREV_TIME=-5,gs.PREV_R=-4,gs.PREV_G=-3,gs.PREV_B=-2,gs.PREV_A=-1,gs.R=1,gs.G=2,gs.B=3,gs.A=4;const ft=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*ft.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(i,t,e,s,r,n,a,h,o){i*=ft.ENTRIES,this.frames[i]=t,this.frames[i+ft.R]=e,this.frames[i+ft.G]=s,this.frames[i+ft.B]=r,this.frames[i+ft.A]=n,this.frames[i+ft.R2]=a,this.frames[i+ft.G2]=h,this.frames[i+ft.B2]=o}apply(i,t,e,s,r,n,a){const h=i.slots[this.slotIndex],o=this.frames;if(e<o[0]){switch(n){case S.setup:h.color.setFromColor(h.data.color),h.darkColor.setFromColor(h.data.darkColor);return;case S.first:const g=h.color,_=h.darkColor,x=h.data.color,y=h.data.darkColor;g.add((x.r-g.r)*r,(x.g-g.g)*r,(x.b-g.b)*r,(x.a-g.a)*r),_.add((y.r-_.r)*r,(y.g-_.g)*r,(y.b-_.b)*r,0)}return}let l=0,u=0,c=0,d=0,f=0,p=0,m=0;if(e>=o[o.length-ft.ENTRIES]){const g=o.length;l=o[g+ft.PREV_R],u=o[g+ft.PREV_G],c=o[g+ft.PREV_B],d=o[g+ft.PREV_A],f=o[g+ft.PREV_R2],p=o[g+ft.PREV_G2],m=o[g+ft.PREV_B2]}else{const g=Ee.binarySearch(o,e,ft.ENTRIES);l=o[g+ft.PREV_R],u=o[g+ft.PREV_G],c=o[g+ft.PREV_B],d=o[g+ft.PREV_A],f=o[g+ft.PREV_R2],p=o[g+ft.PREV_G2],m=o[g+ft.PREV_B2];const _=o[g],x=this.getCurvePercent(g/ft.ENTRIES-1,1-(e-_)/(o[g+ft.PREV_TIME]-_));l+=(o[g+ft.R]-l)*x,u+=(o[g+ft.G]-u)*x,c+=(o[g+ft.B]-c)*x,d+=(o[g+ft.A]-d)*x,f+=(o[g+ft.R2]-f)*x,p+=(o[g+ft.G2]-p)*x,m+=(o[g+ft.B2]-m)*x}if(r==1)h.color.set(l,u,c,d),h.darkColor.set(f,p,m,1);else{const g=h.color,_=h.darkColor;n==S.setup&&(g.setFromColor(h.data.color),_.setFromColor(h.data.darkColor)),g.add((l-g.r)*r,(u-g.g)*r,(c-g.b)*r,(d-g.a)*r),_.add((f-_.r)*r,(p-_.g)*r,(m-_.b)*r,0)}}};let ye=ft;ye.ENTRIES=8,ye.PREV_TIME=-8,ye.PREV_R=-7,ye.PREV_G=-6,ye.PREV_B=-5,ye.PREV_A=-4,ye.PREV_R2=-3,ye.PREV_G2=-2,ye.PREV_B2=-1,ye.R=1,ye.G=2,ye.B=3,ye.A=4,ye.R2=5,ye.G2=6,ye.B2=7;let pC=class{constructor(t){this.frames=B.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(h==At.mixOut&&a==S.setup){const d=o.data.attachmentName;o.setAttachment(d==null?null:t.getAttachment(this.slotIndex,d));return}const l=this.frames;if(s<l[0]){if(a==S.setup||a==S.first){const d=o.data.attachmentName;o.setAttachment(d==null?null:t.getAttachment(this.slotIndex,d))}return}let u=0;s>=l[l.length-1]?u=l.length-1:u=Ee.binarySearch(l,s,1)-1;const c=this.attachmentNames[u];t.slots[this.slotIndex].setAttachment(c==null?null:t.getAttachment(this.slotIndex,c))}},q_=null,mC=class extends rs{constructor(t){super(t),this.frames=B.newFloatArray(t),this.frameVertices=new Array(t),q_==null&&(q_=B.newFloatArray(64))}getPropertyId(){return(6<<27)+Number(this.attachment.id)+this.slotIndex}setFrame(t,e,s){this.frames[t]=e,this.frameVertices[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex],l=o.getAttachment();if(!(l instanceof Yi)||!l.applyDeform(this.attachment))return;const u=o.attachmentVertices;u.length==0&&(a=S.setup);const c=this.frameVertices,d=c[0].length,f=this.frames;if(s<f[0]){const v=l;switch(a){case S.setup:u.length=0;return;case S.first:if(n==1){u.length=0;break}const b=B.setArraySize(u,d);if(v.bones==null){const w=v.vertices;for(let E=0;E<d;E++)b[E]+=(w[E]-b[E])*n}else{n=1-n;for(let w=0;w<d;w++)b[w]*=n}}return}const p=B.setArraySize(u,d);if(s>=f[f.length-1]){const v=c[f.length-1];if(n==1)if(a==S.add){const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=v[E]-w[E]}else for(let w=0;w<d;w++)p[w]+=v[w]}else B.arrayCopy(v,0,p,0,d);else switch(a){case S.setup:{const w=l;if(w.bones==null){const E=w.vertices;for(let T=0;T<d;T++){const A=E[T];p[T]=A+(v[T]-A)*n}}else for(let E=0;E<d;E++)p[E]=v[E]*n;break}case S.first:case S.replace:for(let w=0;w<d;w++)p[w]+=(v[w]-p[w])*n;case S.add:const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++)p[E]+=(v[E]-w[E])*n}else for(let w=0;w<d;w++)p[w]+=v[w]*n}return}const m=Ee.binarySearch(f,s),g=c[m-1],_=c[m],x=f[m],y=this.getCurvePercent(m-1,1-(s-x)/(f[m-1]-x));if(n==1)if(a==S.add){const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=E+(_[w]-E)*y-b[w]}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=w+(_[b]-w)*y}}else for(let v=0;v<d;v++){const b=g[v];p[v]=b+(_[v]-b)*y}else switch(a){case S.setup:{const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<d;E++){const T=g[E],A=w[E];p[E]=A+(T+(_[E]-T)*y-A)*n}}else for(let w=0;w<d;w++){const E=g[w];p[w]=(E+(_[w]-E)*y)*n}break}case S.first:case S.replace:for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y-p[b])*n}break;case S.add:const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<d;w++){const E=g[w];p[w]+=(E+(_[w]-E)*y-b[w])*n}}else for(let b=0;b<d;b++){const w=g[b];p[b]+=(w+(_[b]-w)*y)*n}}}},gC=class{constructor(t){this.frames=B.newFloatArray(t),this.events=new Array(t)}getPropertyId(){return 7<<24}getFrameCount(){return this.frames.length}setFrame(t,e){this.frames[t]=e.time,this.events[t]=e}apply(t,e,s,r,n,a,h){if(r==null)return;const o=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,r,n,a,h),e=-1;else if(e>=o[l-1])return;if(s<o[0])return;let u=0;if(e<o[0])u=0;else{u=Ee.binarySearch(o,e);const c=o[u];for(;u>0&&o[u-1]==c;)u--}for(;u<l&&s>=o[u];u++)r.push(this.events[u])}},_C=class{constructor(t){this.frames=B.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.drawOrders[t]=s}apply(t,e,s,r,n,a,h){const o=t.drawOrder,l=t.slots;if(h==At.mixOut&&a==S.setup){B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const u=this.frames;if(s<u[0]){(a==S.setup||a==S.first)&&B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let c=0;s>=u[u.length-1]?c=u.length-1:c=Ee.binarySearch(u,s)-1;const d=this.drawOrders[c];if(d==null)B.arrayCopy(l,0,o,0,l.length);else for(let f=0,p=d.length;f<p;f++)o[f]=l[d[f]]}};const St=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*St.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(i,t,e,s,r,n){i*=St.ENTRIES,this.frames[i]=t,this.frames[i+St.MIX]=e,this.frames[i+St.BEND_DIRECTION]=s,this.frames[i+St.COMPRESS]=r?1:0,this.frames[i+St.STRETCH]=n?1:0}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.ikConstraints[this.ikConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.mix=o.data.mix,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch;return;case S.first:o.mix+=(o.data.mix-o.mix)*r,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}if(e>=h[h.length-St.ENTRIES]){n==S.setup?(o.mix=o.data.mix+(h[h.length+St.PREV_MIX]-o.data.mix)*r,a==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=h[h.length+St.PREV_BEND_DIRECTION],o.compress=h[h.length+St.PREV_COMPRESS]!=0,o.stretch=h[h.length+St.PREV_STRETCH]!=0)):(o.mix+=(h[h.length+St.PREV_MIX]-o.mix)*r,a==At.mixIn&&(o.bendDirection=h[h.length+St.PREV_BEND_DIRECTION],o.compress=h[h.length+St.PREV_COMPRESS]!=0,o.stretch=h[h.length+St.PREV_STRETCH]!=0));return}const l=Ee.binarySearch(h,e,St.ENTRIES),u=h[l+St.PREV_MIX],c=h[l],d=this.getCurvePercent(l/St.ENTRIES-1,1-(e-c)/(h[l+St.PREV_TIME]-c));n==S.setup?(o.mix=o.data.mix+(u+(h[l+St.MIX]-u)*d-o.data.mix)*r,a==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=h[l+St.PREV_BEND_DIRECTION],o.compress=h[l+St.PREV_COMPRESS]!=0,o.stretch=h[l+St.PREV_STRETCH]!=0)):(o.mix+=(u+(h[l+St.MIX]-u)*d-o.mix)*r,a==At.mixIn&&(o.bendDirection=h[l+St.PREV_BEND_DIRECTION],o.compress=h[l+St.PREV_COMPRESS]!=0,o.stretch=h[l+St.PREV_STRETCH]!=0))}};let _s=St;_s.ENTRIES=5,_s.PREV_TIME=-5,_s.PREV_MIX=-4,_s.PREV_BEND_DIRECTION=-3,_s.PREV_COMPRESS=-2,_s.PREV_STRETCH=-1,_s.MIX=1,_s.BEND_DIRECTION=2,_s.COMPRESS=3,_s.STRETCH=4;const Wt=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Wt.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(i,t,e,s,r,n){i*=Wt.ENTRIES,this.frames[i]=t,this.frames[i+Wt.ROTATE]=e,this.frames[i+Wt.TRANSLATE]=s,this.frames[i+Wt.SCALE]=r,this.frames[i+Wt.SHEAR]=n}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.transformConstraints[this.transformConstraintIndex];if(e<h[0]){const f=o.data;switch(n){case S.setup:o.rotateMix=f.rotateMix,o.translateMix=f.translateMix,o.scaleMix=f.scaleMix,o.shearMix=f.shearMix;return;case S.first:o.rotateMix+=(f.rotateMix-o.rotateMix)*r,o.translateMix+=(f.translateMix-o.translateMix)*r,o.scaleMix+=(f.scaleMix-o.scaleMix)*r,o.shearMix+=(f.shearMix-o.shearMix)*r}return}let l=0,u=0,c=0,d=0;if(e>=h[h.length-Wt.ENTRIES]){const f=h.length;l=h[f+Wt.PREV_ROTATE],u=h[f+Wt.PREV_TRANSLATE],c=h[f+Wt.PREV_SCALE],d=h[f+Wt.PREV_SHEAR]}else{const f=Ee.binarySearch(h,e,Wt.ENTRIES);l=h[f+Wt.PREV_ROTATE],u=h[f+Wt.PREV_TRANSLATE],c=h[f+Wt.PREV_SCALE],d=h[f+Wt.PREV_SHEAR];const p=h[f],m=this.getCurvePercent(f/Wt.ENTRIES-1,1-(e-p)/(h[f+Wt.PREV_TIME]-p));l+=(h[f+Wt.ROTATE]-l)*m,u+=(h[f+Wt.TRANSLATE]-u)*m,c+=(h[f+Wt.SCALE]-c)*m,d+=(h[f+Wt.SHEAR]-d)*m}if(n==S.setup){const f=o.data;o.rotateMix=f.rotateMix+(l-f.rotateMix)*r,o.translateMix=f.translateMix+(u-f.translateMix)*r,o.scaleMix=f.scaleMix+(c-f.scaleMix)*r,o.shearMix=f.shearMix+(d-f.shearMix)*r}else o.rotateMix+=(l-o.rotateMix)*r,o.translateMix+=(u-o.translateMix)*r,o.scaleMix+=(c-o.scaleMix)*r,o.shearMix+=(d-o.shearMix)*r}};let ys=Wt;ys.ENTRIES=5,ys.PREV_TIME=-5,ys.PREV_ROTATE=-4,ys.PREV_TRANSLATE=-3,ys.PREV_SCALE=-2,ys.PREV_SHEAR=-1,ys.ROTATE=1,ys.TRANSLATE=2,ys.SCALE=3,ys.SHEAR=4;const Ps=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Ps.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(i,t,e){i*=Ps.ENTRIES,this.frames[i]=t,this.frames[i+Ps.VALUE]=e}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.pathConstraints[this.pathConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.position=o.data.position;return;case S.first:o.position+=(o.data.position-o.position)*r}return}let l=0;if(e>=h[h.length-Ps.ENTRIES])l=h[h.length+Ps.PREV_VALUE];else{const u=Ee.binarySearch(h,e,Ps.ENTRIES);l=h[u+Ps.PREV_VALUE];const c=h[u],d=this.getCurvePercent(u/Ps.ENTRIES-1,1-(e-c)/(h[u+Ps.PREV_TIME]-c));l+=(h[u+Ps.VALUE]-l)*d}n==S.setup?o.position=o.data.position+(l-o.data.position)*r:o.position+=(l-o.position)*r}};let Hi=Ps;Hi.ENTRIES=2,Hi.PREV_TIME=-2,Hi.PREV_VALUE=-1,Hi.VALUE=1;let yC=class ui extends Hi{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,r,n,a,h){const o=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(s<o[0]){switch(a){case S.setup:l.spacing=l.data.spacing;return;case S.first:l.spacing+=(l.data.spacing-l.spacing)*n}return}let u=0;if(s>=o[o.length-ui.ENTRIES])u=o[o.length+ui.PREV_VALUE];else{const c=Ee.binarySearch(o,s,ui.ENTRIES);u=o[c+ui.PREV_VALUE];const d=o[c],f=this.getCurvePercent(c/ui.ENTRIES-1,1-(s-d)/(o[c+ui.PREV_TIME]-d));u+=(o[c+ui.VALUE]-u)*f}a==S.setup?l.spacing=l.data.spacing+(u-l.data.spacing)*n:l.spacing+=(u-l.spacing)*n}};const Oe=class extends rs{constructor(i){super(i),this.frames=B.newFloatArray(i*Oe.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(i,t,e,s){i*=Oe.ENTRIES,this.frames[i]=t,this.frames[i+Oe.ROTATE]=e,this.frames[i+Oe.TRANSLATE]=s}apply(i,t,e,s,r,n,a){const h=this.frames,o=i.pathConstraints[this.pathConstraintIndex];if(e<h[0]){switch(n){case S.setup:o.rotateMix=o.data.rotateMix,o.translateMix=o.data.translateMix;return;case S.first:o.rotateMix+=(o.data.rotateMix-o.rotateMix)*r,o.translateMix+=(o.data.translateMix-o.translateMix)*r}return}let l=0,u=0;if(e>=h[h.length-Oe.ENTRIES])l=h[h.length+Oe.PREV_ROTATE],u=h[h.length+Oe.PREV_TRANSLATE];else{const c=Ee.binarySearch(h,e,Oe.ENTRIES);l=h[c+Oe.PREV_ROTATE],u=h[c+Oe.PREV_TRANSLATE];const d=h[c],f=this.getCurvePercent(c/Oe.ENTRIES-1,1-(e-d)/(h[c+Oe.PREV_TIME]-d));l+=(h[c+Oe.ROTATE]-l)*f,u+=(h[c+Oe.TRANSLATE]-u)*f}n==S.setup?(o.rotateMix=o.data.rotateMix+(l-o.data.rotateMix)*r,o.translateMix=o.data.translateMix+(u-o.data.translateMix)*r):(o.rotateMix+=(l-o.rotateMix)*r,o.translateMix+=(u-o.translateMix)*r)}};let ri=Oe;ri.ENTRIES=3,ri.PREV_TIME=-3,ri.PREV_ROTATE=-2,ri.PREV_TRANSLATE=-1,ri.ROTATE=1,ri.TRANSLATE=2,new Ee("<empty>",[],0);let xC=class{constructor(t){this.atlas=t}newRegionAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);const n=new nt(e);return n.region=r,n}newMeshAttachment(t,e,s){const r=this.atlas.findRegion(s);if(r==null)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);const n=new lC(e);return n.region=r,n}newBoundingBoxAttachment(t,e){return new oC(e)}newPathAttachment(t,e){return new hC(e)}newPointAttachment(t,e){return new cC(e)}newClippingAttachment(t,e){return new aC(e)}},vC=class{constructor(t,e,s){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=vt.Normal,t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}},bC=class{constructor(t,e){if(e==null)throw new Error("data cannot be null.");this.time=t,this.data=e}},wC=class{constructor(t){this.name=t}},EC=class{constructor(t){this.order=0,this.bones=new Array,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.name=t}},TC=class{constructor(t){this.order=0,this.bones=new Array,this.name=t}};var ii=(i=>(i[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",i))(ii||{});let AC=class{constructor(){this.bones=new Array,this.slots=new Array,this.skins=new Array,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.fps=0}findBone(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findBoneIndex(t){if(t==null)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSlot(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findSlotIndex(t){if(t==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSkin(t){if(t==null)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findEvent(t){if(t==null)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(t==null)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(t==null)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}},SC=class{constructor(t,e,s){if(this.color=new X(1,1,1,1),t<0)throw new Error("index must be >= 0.");if(e==null)throw new Error("name cannot be null.");if(s==null)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}},CC=class{constructor(t){if(this.order=0,this.bones=new Array,this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1,t==null)throw new Error("name cannot be null.");this.name=t}},IC=class{constructor(t){if(this.attachments=new Array,t==null)throw new Error("name cannot be null.");this.name=t}addAttachment(t,e,s){if(s==null)throw new Error("attachment cannot be null.");const r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){const n=t.slots[r],a=n.getAttachment();if(a&&s<e.attachments.length){const h=e.attachments[s];for(const o in h){const l=h[o];if(a==l){const u=this.getAttachment(s,o);u!=null&&n.setAttachment(u);break}}}s++}}},PC=class Gn{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new AC,r=typeof t=="string"?JSON.parse(t):t,n=r.skeleton;if(n!=null&&(s.hash=n.hash,s.version=n.spine,s.width=n.width,s.height=n.height,s.fps=n.fps,s.imagesPath=n.images),r.bones)for(let a=0;a<r.bones.length;a++){const h=r.bones[a];let o=null;const l=this.getValue(h,"parent",null);if(l!=null&&(o=s.findBone(l),o==null))throw new Error(`Parent bone not found: ${l}`);const u=new vC(s.bones.length,h.name,o);u.length=this.getValue(h,"length",0)*e,u.x=this.getValue(h,"x",0)*e,u.y=this.getValue(h,"y",0)*e,u.rotation=this.getValue(h,"rotation",0),u.scaleX=this.getValue(h,"scaleX",1),u.scaleY=this.getValue(h,"scaleY",1),u.shearX=this.getValue(h,"shearX",0),u.shearY=this.getValue(h,"shearY",0),u.transformMode=Gn.transformModeFromString(this.getValue(h,"transform","normal")),s.bones.push(u)}if(r.slots)for(let a=0;a<r.slots.length;a++){const h=r.slots[a],o=h.name,l=h.bone,u=s.findBone(l);if(u==null)throw new Error(`Slot bone not found: ${l}`);const c=new SC(s.slots.length,o,u),d=this.getValue(h,"color",null);d!=null&&c.color.setFromString(d);const f=this.getValue(h,"dark",null);f!=null&&(c.darkColor=new X(1,1,1,1),c.darkColor.setFromString(f)),c.attachmentName=this.getValue(h,"attachment",null),c.blendMode=Gn.blendModeFromString(this.getValue(h,"blend","normal")),s.slots.push(c)}if(r.ik)for(let a=0;a<r.ik.length;a++){const h=r.ik[a],o=new EC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`IK bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`IK target bone not found: ${l}`);o.bendDirection=this.getValue(h,"bendPositive",!0)?1:-1,o.mix=this.getValue(h,"mix",1),s.ikConstraints.push(o)}if(r.transform)for(let a=0;a<r.transform.length;a++){const h=r.transform[a],o=new CC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findBone(l),o.target==null)throw new Error(`Transform constraint target bone not found: ${l}`);o.local=this.getValue(h,"local",!1),o.relative=this.getValue(h,"relative",!1),o.offsetRotation=this.getValue(h,"rotation",0),o.offsetX=this.getValue(h,"x",0)*e,o.offsetY=this.getValue(h,"y",0)*e,o.offsetScaleX=this.getValue(h,"scaleX",0),o.offsetScaleY=this.getValue(h,"scaleY",0),o.offsetShearY=this.getValue(h,"shearY",0),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),o.scaleMix=this.getValue(h,"scaleMix",1),o.shearMix=this.getValue(h,"shearMix",1),s.transformConstraints.push(o)}if(r.path)for(let a=0;a<r.path.length;a++){const h=r.path[a],o=new TC(h.name);o.order=this.getValue(h,"order",0);for(let u=0;u<h.bones.length;u++){const c=h.bones[u],d=s.findBone(c);if(d==null)throw new Error(`Transform constraint bone not found: ${c}`);o.bones.push(d)}const l=h.target;if(o.target=s.findSlot(l),o.target==null)throw new Error(`Path target slot not found: ${l}`);o.positionMode=Gn.positionModeFromString(this.getValue(h,"positionMode","percent")),o.spacingMode=Gn.spacingModeFromString(this.getValue(h,"spacingMode","length")),o.rotateMode=Gn.rotateModeFromString(this.getValue(h,"rotateMode","tangent")),o.offsetRotation=this.getValue(h,"rotation",0),o.position=this.getValue(h,"position",0),o.positionMode==ne.Fixed&&(o.position*=e),o.spacing=this.getValue(h,"spacing",0),(o.spacingMode==ii.Length||o.spacingMode==ii.Fixed)&&(o.spacing*=e),o.rotateMix=this.getValue(h,"rotateMix",1),o.translateMix=this.getValue(h,"translateMix",1),s.pathConstraints.push(o)}if(r.skins)for(const a in r.skins){const h=r.skins[a],o=new IC(a);for(const l in h){const u=s.findSlotIndex(l);if(u==-1)throw new Error(`Slot not found: ${l}`);const c=h[l];for(const d in c){const f=this.readAttachment(c[d],o,u,d,s);f!=null&&o.addAttachment(u,d,f)}}s.skins.push(o),o.name=="default"&&(s.defaultSkin=o)}for(let a=0,h=this.linkedMeshes.length;a<h;a++){const o=this.linkedMeshes[a],l=o.skin==null?s.defaultSkin:s.findSkin(o.skin);if(l==null)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(u==null)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.setParentMesh(u)}if(this.linkedMeshes.length=0,r.events)for(const a in r.events){const h=r.events[a],o=new wC(a);o.intValue=this.getValue(h,"int",0),o.floatValue=this.getValue(h,"float",0),o.stringValue=this.getValue(h,"string",""),o.audioPath=this.getValue(h,"audio",null),o.audioPath!=null&&(o.volume=this.getValue(h,"volume",1),o.balance=this.getValue(h,"balance",0)),s.events.push(o)}if(r.animations)for(const a in r.animations){const h=r.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,r,n){const a=this.scale;switch(r=this.getValue(t,"name",r),this.getValue(t,"type","region")){case"region":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newRegionAttachment(e,r,o);if(l==null)return null;l.path=o,l.x=this.getValue(t,"x",0)*a,l.y=this.getValue(t,"y",0)*a,l.scaleX=this.getValue(t,"scaleX",1),l.scaleY=this.getValue(t,"scaleY",1),l.rotation=this.getValue(t,"rotation",0),l.width=t.width*a,l.height=t.height*a;const u=this.getValue(t,"color",null);return u!=null&&l.color.setFromString(u),l}case"boundingbox":{const o=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(o==null)return null;this.readVertices(t,o,t.vertexCount<<1);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"mesh":case"linkedmesh":{const o=this.getValue(t,"path",r),l=this.attachmentLoader.newMeshAttachment(e,r,o);if(l==null)return null;l.path=o;const u=this.getValue(t,"color",null);u!=null&&l.color.setFromString(u);const c=this.getValue(t,"parent",null);if(c!=null)return l.inheritDeform=this.getValue(t,"deform",!0),this.linkedMeshes.push(new RC(l,this.getValue(t,"skin",null),s,c)),l;const d=t.uvs;return this.readVertices(t,l,d.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(d),l.hullLength=this.getValue(t,"hull",0)*2,l}case"path":{const o=this.attachmentLoader.newPathAttachment(e,r);if(o==null)return null;o.closed=this.getValue(t,"closed",!1),o.constantSpeed=this.getValue(t,"constantSpeed",!0);const l=t.vertexCount;this.readVertices(t,o,l<<1);const u=B.newArray(l/3,0);for(let d=0;d<t.lengths.length;d++)u[d]=t.lengths[d]*a;o.lengths=u;const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}case"point":{const o=this.attachmentLoader.newPointAttachment(e,r);if(o==null)return null;o.x=this.getValue(t,"x",0)*a,o.y=this.getValue(t,"y",0)*a,o.rotation=this.getValue(t,"rotation",0);const l=this.getValue(t,"color",null);return l!=null&&o.color.setFromString(l),o}case"clipping":{const o=this.attachmentLoader.newClippingAttachment(e,r);if(o==null)return null;const l=this.getValue(t,"end",null);if(l!=null){const d=n.findSlot(l);if(d==null)throw new Error(`Clipping end slot not found: ${l}`);o.endSlot=d}const u=t.vertexCount;this.readVertices(t,o,u<<1);const c=this.getValue(t,"color",null);return c!=null&&o.color.setFromString(c),o}}return null}readVertices(t,e,s){const r=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(r!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=r;e.vertices=o;return}const a=new Array,h=new Array;for(let o=0,l=n.length;o<l;){const u=n[o++];h.push(u);for(let c=o+u*4;o<c;o+=4)h.push(n[o]),a.push(n[o+1]*r),a.push(n[o+2]*r),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const r=this.scale,n=new Array;let a=0;if(t.slots)for(const o in t.slots){const l=t.slots[o],u=s.findSlotIndex(o);if(u==-1)throw new Error(`Slot not found: ${o}`);for(const c in l){const d=l[c];if(c=="attachment"){const f=new pC(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p++,g.time,g.name)}n.push(f),a=Math.max(a,f.frames[f.getFrameCount()-1])}else if(c=="color"){const f=new gs(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X;_.setFromString(g.color||"ffffffff"),f.setFrame(p,g.time,_.r,_.g,_.b,_.a),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*gs.ENTRIES])}else if(c=="twoColor"){const f=new ye(d.length);f.slotIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m],_=new X,x=new X;_.setFromString(g.light),x.setFromString(g.dark),f.setFrame(p,g.time,_.r,_.g,_.b,_.a,x.r,x.g,x.b),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ye.ENTRIES])}else throw new Error(`Invalid timeline type for a slot: ${c} (${o})`)}}if(t.bones)for(const o in t.bones){const l=t.bones[o],u=s.findBoneIndex(o);if(u==-1)throw new Error(`Bone not found: ${o}`);for(const c in l){const d=l[c];if(c==="rotate"){const f=new Mn(d.length);f.boneIndex=u;let p=0;for(let m=0;m<d.length;m++){const g=d[m];f.setFrame(p,g.time,g.angle),this.readCurve(g,f,p),p++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*Mn.ENTRIES])}else if(c==="translate"||c==="scale"||c==="shear"){let f=null,p=1;c==="scale"?f=new dC(d.length):c==="shear"?f=new fC(d.length):(f=new ar(d.length),p=r),f.boneIndex=u;let m=0;for(let g=0;g<d.length;g++){const _=d[g],x=this.getValue(_,"x",0),y=this.getValue(_,"y",0);f.setFrame(m,_.time,x*p,y*p),this.readCurve(_,f,m),m++}n.push(f),a=Math.max(a,f.frames[(f.getFrameCount()-1)*ar.ENTRIES])}else throw new Error(`Invalid timeline type for a bone: ${c} (${o})`)}}if(t.ik)for(const o in t.ik){const l=t.ik[o],u=s.findIkConstraint(o),c=new _s(l.length);c.ikConstraintIndex=s.ikConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,p.time,this.getValue(p,"mix",1),this.getValue(p,"bendPositive",!0)?1:-1,this.getValue(p,"compress",!1),this.getValue(p,"stretch",!1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*_s.ENTRIES])}if(t.transform)for(const o in t.transform){const l=t.transform[o],u=s.findTransformConstraint(o),c=new ys(l.length);c.transformConstraintIndex=s.transformConstraints.indexOf(u);let d=0;for(let f=0;f<l.length;f++){const p=l[f];c.setFrame(d,p.time,this.getValue(p,"rotateMix",1),this.getValue(p,"translateMix",1),this.getValue(p,"scaleMix",1),this.getValue(p,"shearMix",1)),this.readCurve(p,c,d),d++}n.push(c),a=Math.max(a,c.frames[(c.getFrameCount()-1)*ys.ENTRIES])}if(t.paths)for(const o in t.paths){const l=t.paths[o],u=s.findPathConstraintIndex(o);if(u==-1)throw new Error(`Path constraint not found: ${o}`);const c=s.pathConstraints[u];for(const d in l){const f=l[d];if(d==="position"||d==="spacing"){let p=null,m=1;d==="spacing"?(p=new yC(f.length),(c.spacingMode==ii.Length||c.spacingMode==ii.Fixed)&&(m=r)):(p=new Hi(f.length),c.positionMode==ne.Fixed&&(m=r)),p.pathConstraintIndex=u;let g=0;for(let _=0;_<f.length;_++){const x=f[_];p.setFrame(g,x.time,this.getValue(x,d,0)*m),this.readCurve(x,p,g),g++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*Hi.ENTRIES])}else if(d==="mix"){const p=new ri(f.length);p.pathConstraintIndex=u;let m=0;for(let g=0;g<f.length;g++){const _=f[g];p.setFrame(m,_.time,this.getValue(_,"rotateMix",1),this.getValue(_,"translateMix",1)),this.readCurve(_,p,m),m++}n.push(p),a=Math.max(a,p.frames[(p.getFrameCount()-1)*ri.ENTRIES])}}}if(t.deform)for(const o in t.deform){const l=t.deform[o],u=s.findSkin(o);if(u!=null)for(const c in l){const d=l[c],f=s.findSlotIndex(c);if(f==-1)throw new Error(`Slot not found: ${d.name}`);for(const p in d){const m=d[p],g=u.getAttachment(f,p);if(g==null)throw new Error(`Deform attachment not found: ${m.name}`);const _=g.bones!=null,x=g.vertices,y=_?x.length/3*2:x.length,v=new mC(m.length);v.slotIndex=f,v.attachment=g;let b=0;for(let w=0;w<m.length;w++){const E=m[w];let T;const A=this.getValue(E,"vertices",null);if(A==null)T=_?B.newFloatArray(y):x;else{T=B.newFloatArray(y);const I=this.getValue(E,"offset",0);if(B.arrayCopy(A,0,T,I,A.length),r!=1)for(let M=I,R=M+A.length;M<R;M++)T[M]*=r;if(!_)for(let M=0;M<y;M++)T[M]+=x[M]}v.setFrame(b,E.time,T),this.readCurve(E,v,b),b++}n.push(v),a=Math.max(a,v.frames[v.getFrameCount()-1])}}}let h=t.drawOrder;if(h==null&&(h=t.draworder),h!=null){const o=new _C(h.length),l=s.slots.length;let u=0;for(let c=0;c<h.length;c++){const d=h[c];let f=null;const p=this.getValue(d,"offsets",null);if(p!=null){f=B.newArray(l,-1);const m=B.newArray(l-p.length,0);let g=0,_=0;for(let x=0;x<p.length;x++){const y=p[x],v=s.findSlotIndex(y.slot);if(v==-1)throw new Error(`Slot not found: ${y.slot}`);for(;g!=v;)m[_++]=g++;f[g+y.offset]=g++}for(;g<l;)m[_++]=g++;for(let x=l-1;x>=0;x--)f[x]==-1&&(f[x]=m[--_])}o.setFrame(u++,d.time,f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(t.events){const o=new gC(t.events.length);let l=0;for(let u=0;u<t.events.length;u++){const c=t.events[u],d=s.findEvent(c.name);if(d==null)throw new Error(`Event not found: ${c.name}`);const f=new bC(B.toSinglePrecision(c.time),d);f.intValue=this.getValue(c,"int",d.intValue),f.floatValue=this.getValue(c,"float",d.floatValue),f.stringValue=this.getValue(c,"string",d.stringValue),f.data.audioPath!=null&&(f.volume=this.getValue(c,"volume",1),f.balance=this.getValue(c,"balance",0)),o.setFrame(l++,f)}n.push(o),a=Math.max(a,o.frames[o.getFrameCount()-1])}if(isNaN(a))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new Ee(e,n,a))}readCurve(t,e,s){if(t.curve){if(t.curve==="stepped")e.setStepped(s);else if(Object.prototype.toString.call(t.curve)==="[object Array]"){const r=t.curve;e.setCurve(s,r[0],r[1],r[2],r[3])}}}getValue(t,e,s){return t[e]!==void 0?t[e]:s}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return W.NORMAL;if(t=="additive")return W.ADD;if(t=="multiply")return W.MULTIPLY;if(t=="screen")return W.SCREEN;throw new Error(`Unknown blend mode: ${t}`)}static positionModeFromString(t){if(t=t.toLowerCase(),t=="fixed")return ne.Fixed;if(t=="percent")return ne.Percent;throw new Error(`Unknown position mode: ${t}`)}static spacingModeFromString(t){if(t=t.toLowerCase(),t=="length")return ii.Length;if(t=="fixed")return ii.Fixed;if(t=="percent")return ii.Percent;throw new Error(`Unknown position mode: ${t}`)}static rotateModeFromString(t){if(t=t.toLowerCase(),t=="tangent")return Fe.Tangent;if(t=="chain")return Fe.Chain;if(t=="chainscale")return Fe.ChainScale;throw new Error(`Unknown rotate mode: ${t}`)}static transformModeFromString(t){if(t=t.toLowerCase(),t=="normal")return vt.Normal;if(t=="onlytranslation")return vt.OnlyTranslation;if(t=="norotationorreflection")return vt.NoRotationOrReflection;if(t=="noscale")return vt.NoScale;if(t=="noscaleorreflection")return vt.NoScaleOrReflection;throw new Error(`Unknown transform mode: ${t}`)}},RC=class{constructor(t,e,s,r){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r}};class Z_{constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}}const K_=class extends Z_{constructor(i){super(i),this.id=K_.nextID++,this.bones=null,this.vertices=[],this.worldVerticesLength=0,this.timelineAttachment=this}computeWorldVerticesOld(i,t){this.computeWorldVertices(i,0,this.worldVerticesLength,t,0,2)}computeWorldVertices(i,t,e,s,r,n){e=r+(e>>1)*n;const a=i.bone.skeleton,h=i.deform;let o=this.vertices;const l=this.bones;if(!l){h.length>0&&(o=h);const f=i.bone.matrix,p=f.tx,m=f.ty,g=f.a,_=f.c,x=f.b,y=f.d;for(let v=t,b=r;b<e;v+=2,b+=n){const w=o[v],E=o[v+1];s[b]=w*g+E*_+p,s[b+1]=w*x+E*y+m}return}let u=0,c=0;for(let f=0;f<t;f+=2){const p=l[u];u+=p+1,c+=p}const d=a.bones;if(h.length==0)for(let f=r,p=c*3;f<e;f+=n){let m=0,g=0,_=l[u++];for(_+=u;u<_;u++,p+=3){const x=d[l[u]].matrix,y=o[p],v=o[p+1],b=o[p+2];m+=(y*x.a+v*x.c+x.tx)*b,g+=(y*x.b+v*x.d+x.ty)*b}s[f]=m,s[f+1]=g}else{const f=h;for(let p=r,m=c*3,g=c<<1;p<e;p+=n){let _=0,x=0,y=l[u++];for(y+=u;u<y;u++,m+=3,g+=2){const v=d[l[u]].matrix,b=o[m]+f[g],w=o[m+1]+f[g+1],E=o[m+2];_+=(b*v.a+w*v.c+v.tx)*E,x+=(b*v.b+w*v.d+v.ty)*E}s[p]=_,s[p+1]=x}}}copyTo(i){this.bones?(i.bones=new Array(this.bones.length),B.arrayCopy(this.bones,0,i.bones,0,this.bones.length)):i.bones=null,this.vertices&&(i.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,i.vertices,0,this.vertices.length)),i.worldVerticesLength=this.worldVerticesLength,i.timelineAttachment=this.timelineAttachment}};let ni=K_;ni.nextID=0;class Wu extends ni{constructor(t){super(t),this.type=at.BoundingBox,this.color=new X(1,1,1,1)}copy(){const t=new Wu(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class zu extends ni{constructor(t){super(t),this.type=at.Clipping,this.endSlot=null,this.color=new X(.2275,.2275,.8078,1)}copy(){const t=new zu(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class Mo extends ni{constructor(t,e){super(t),this.type=at.Mesh,this.region=null,this.triangles=[],this.color=new X(1,1,1,1),this.width=0,this.height=0,this.hullLength=0,this.edges=[],this.parentMesh=null,this.sequence=null,this.tempColor=new X(0,0,0,0),this.path=e}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();const t=new Mo(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Float32Array(this.regionUVs.length),B.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=new Array(this.triangles.length),B.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),B.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,e,s,r,n,a){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,r,n,a)}newLinkedMesh(){const t=new Mo(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),t}}class ju extends ni{constructor(t){super(t),this.type=at.Path,this.lengths=[],this.closed=!1,this.constantSpeed=!1,this.color=new X(1,1,1,1)}copy(){const t=new ju(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),B.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class qu extends ni{constructor(t){super(t),this.type=at.Point,this.x=0,this.y=0,this.rotation=0,this.color=new X(.38,.94,0,1)}computeWorldPosition(t,e){const s=t.matrix;return e.x=this.x*s.a+this.y*s.c+t.worldX,e.y=this.x*s.b+this.y*s.d+t.worldY,e}computeWorldRotation(t){const e=t.matrix,s=D.cosDeg(this.rotation),r=D.sinDeg(this.rotation),n=s*e.a+r*e.c,a=s*e.b+r*e.d;return Math.atan2(a,n)*D.radDeg}copy(){const t=new qu(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}const Q_=class extends Z_{constructor(i,t){super(i),this.type=at.Region,this.x=0,this.y=0,this.scaleX=1,this.scaleY=1,this.rotation=0,this.width=0,this.height=0,this.color=new X(1,1,1,1),this.rendererObject=null,this.region=null,this.sequence=null,this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new X(1,1,1,1),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");const i=this.region,t=this.width/this.region.originalWidth*this.scaleX,e=this.height/this.region.originalHeight*this.scaleY,s=-this.width/2*this.scaleX+this.region.offsetX*t,r=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,a=r+this.region.height*e,h=this.rotation*Math.PI/180,o=Math.cos(h),l=Math.sin(h),u=this.x,c=this.y,d=s*o+u,f=s*l,p=r*o+c,m=r*l,g=n*o+u,_=n*l,x=a*o+c,y=a*l,v=this.offset;v[0]=d-m,v[1]=p+f,v[2]=d-y,v[3]=x+f,v[4]=g-y,v[5]=x+_,v[6]=g-m,v[7]=p+_;const b=this.uvs;i.degrees==90?(b[2]=i.u,b[3]=i.v2,b[4]=i.u,b[5]=i.v,b[6]=i.u2,b[7]=i.v,b[0]=i.u2,b[1]=i.v2):(b[0]=i.u,b[1]=i.v2,b[2]=i.u,b[3]=i.v,b[4]=i.u2,b[5]=i.v,b[6]=i.u2,b[7]=i.v2)}computeWorldVertices(i,t,e,s){this.sequence!=null&&this.sequence.apply(i,this);const r=i.bone,n=this.offset,a=r.matrix,h=a.tx,o=a.ty,l=a.a,u=a.c,c=a.b,d=a.d;let f=0,p=0;f=n[0],p=n[1],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[2],p=n[3],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[4],p=n[5],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o,e+=s,f=n[6],p=n[7],t[e]=f*l+p*u+h,t[e+1]=f*c+p*d+o}copy(){const i=new Q_(this.name,this.path);return i.region=this.region,i.rendererObject=this.rendererObject,i.x=this.x,i.y=this.y,i.scaleX=this.scaleX,i.scaleY=this.scaleY,i.rotation=this.rotation,i.width=this.width,i.height=this.height,B.arrayCopy(this.uvs,0,i.uvs,0,8),B.arrayCopy(this.offset,0,i.offset,0,8),i.color.setFromColor(this.color),i.sequence=this.sequence!=null?this.sequence.copy():null,i}};let gt=Q_;gt.X1=0,gt.Y1=1,gt.C1R=2,gt.C1G=3,gt.C1B=4,gt.C1A=5,gt.U1=6,gt.V1=7,gt.X2=8,gt.Y2=9,gt.C2R=10,gt.C2G=11,gt.C2B=12,gt.C2A=13,gt.U2=14,gt.V2=15,gt.X3=16,gt.Y3=17,gt.C3R=18,gt.C3G=19,gt.C3B=20,gt.C3A=21,gt.U3=22,gt.V3=23,gt.X4=24,gt.Y4=25,gt.C4R=26,gt.C4G=27,gt.C4B=28,gt.C4A=29,gt.U4=30,gt.V4=31;const yl=class{constructor(i){this.id=yl.nextID(),this.start=0,this.digits=0,this.setupIndex=0,this.regions=new Array(i)}copy(){const i=new yl(this.regions.length);return B.arrayCopy(this.regions,0,i.regions,0,this.regions.length),i.start=this.start,i.digits=this.digits,i.setupIndex=this.setupIndex,i}apply(i,t){let e=i.sequenceIndex;e==-1&&(e=this.setupIndex),e>=this.regions.length&&(e=this.regions.length-1);const s=this.regions[e];t.region!=s&&(t.region=s)}getPath(i,t){let e=i;const s=(this.start+t).toString();for(let r=this.digits-s.length;r>0;r--)e+="0";return e+=s,e}static nextID(){return yl._nextID++}};let Zu=yl;Zu._nextID=0;var Pr=(i=>(i[i.hold=0]="hold",i[i.once=1]="once",i[i.loop=2]="loop",i[i.pingpong=3]="pingpong",i[i.onceReverse=4]="onceReverse",i[i.loopReverse=5]="loopReverse",i[i.pingpongReverse=6]="pingpongReverse",i))(Pr||{});const J_=[0,1,2,3,4,5,6];class Ku{constructor(t,e,s){if(this.timelines=[],this.timelineIds=new VS,!t)throw new Error("name cannot be null.");this.name=t,this.setTimelines(e),this.duration=s}setTimelines(t){if(!t)throw new Error("timelines cannot be null.");this.timelines=t,this.timelineIds.clear();for(let e=0;e<t.length;e++)this.timelineIds.addAll(t[e].getPropertyIds())}hasTimeline(t){for(let e=0;e<t.length;e++)if(this.timelineIds.contains(t[e]))return!0;return!1}apply(t,e,s,r,n,a,h,o){if(!t)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let u=0,c=l.length;u<c;u++)l[u].apply(t,e,s,n,a,h,o)}}const yt={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,rgb:7,alpha:8,rgb2:9,attachment:10,deform:11,event:12,drawOrder:13,ikConstraint:14,transformConstraint:15,pathConstraintPosition:16,pathConstraintSpacing:17,pathConstraintMix:18,sequence:19};class he{constructor(t,e){this.propertyIds=e,this.frames=B.newFloatArray(t*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(t,e){const s=t.length;for(let r=1;r<s;r++)if(t[r]>e)return r-1;return s-1}static search(t,e,s){const r=t.length;for(let n=s;n<r;n+=s)if(t[n]>e)return n-s;return r-s}}class lr extends he{constructor(t,e,s){super(t,s),this.curves=B.newFloatArray(t+e*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){const e=this.getFrameCount()+t*18;if(this.curves.length>e){const s=B.newFloatArray(e);B.arrayCopy(this.curves,0,s,0,e),this.curves=s}}setBezier(t,e,s,r,n,a,h,o,l,u,c){const d=this.curves;let f=this.getFrameCount()+t*18;s==0&&(d[e]=2+f);const p=(r-a*2+o)*.03,m=(n-h*2+l)*.03,g=((a-o)*3-r+u)*.006,_=((h-l)*3-n+c)*.006;let x=p*2+g,y=m*2+_,v=(a-r)*.3+p+g*.16666667,b=(h-n)*.3+m+_*.16666667,w=r+v,E=n+b;for(let T=f+18;f<T;f+=2)d[f]=w,d[f+1]=E,v+=x,b+=y,x+=g,y+=_,w+=v,E+=b}getBezierValue(t,e,s,r){const n=this.curves;if(n[r]>t){const l=this.frames[e],u=this.frames[e+s];return u+(t-l)/(n[r]-l)*(n[r+1]-u)}const a=r+18;for(r+=2;r<a;r+=2)if(n[r]>=t){const l=n[r-2],u=n[r-1];return u+(t-l)/(n[r]-l)*(n[r+1]-u)}e+=this.getFrameEntries();const h=n[a-2],o=n[a-1];return o+(t-h)/(this.frames[e]-h)*(this.frames[e+s]-o)}}class hr extends lr{constructor(t,e,s){super(t,e,[s])}getFrameEntries(){return 2}setFrame(t,e,s){t<<=1,this.frames[t]=e,this.frames[t+1]=s}getCurveValue(t){const e=this.frames;let s=e.length-2;for(let n=2;n<=s;n+=2)if(e[n]>t){s=n-2;break}const r=this.curves[s>>1];switch(r){case 0:const n=e[s],a=e[s+1];return a+(t-n)/(e[s+2]-n)*(e[s+2+1]-a);case 1:return e[s+1]}return this.getBezierValue(t,s,1,r-2)}}class Qu extends lr{constructor(t,e,s,r){super(t,e,[s,r])}getFrameEntries(){return 3}setFrame(t,e,s,r){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r}}class t0 extends hr{constructor(t,e,s){super(t,e,`${yt.rotate}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.rotation=o.data.rotation;return;case S.first:o.rotation+=(o.data.rotation-o.rotation)*n}return}let u=this.getCurveValue(s);switch(a){case S.setup:o.rotation=o.data.rotation+u*n;break;case S.first:case S.replace:u+=o.data.rotation-o.rotation;case S.add:o.rotation+=u*n}}}class e0 extends Qu{constructor(t,e,s){super(t,e,`${yt.x}|${s}`,`${yt.y}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.x=o.data.x,o.y=o.data.y;return;case S.first:o.x+=(o.data.x-o.x)*n,o.y+=(o.data.y-o.y)*n}return}let u=0,c=0;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(a){case S.setup:o.x=o.data.x+u*n,o.y=o.data.y+c*n;break;case S.first:case S.replace:o.x+=(o.data.x+u-o.x)*n,o.y+=(o.data.y+c-o.y)*n;break;case S.add:o.x+=u*n,o.y+=c*n}}}class s0 extends hr{constructor(t,e,s){super(t,e,`${yt.x}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.x=o.data.x;return;case S.first:o.x+=(o.data.x-o.x)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.x=o.data.x+u*n;break;case S.first:case S.replace:o.x+=(o.data.x+u-o.x)*n;break;case S.add:o.x+=u*n}}}class r0 extends hr{constructor(t,e,s){super(t,e,`${yt.y}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.y=o.data.y;return;case S.first:o.y+=(o.data.y-o.y)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.y=o.data.y+u*n;break;case S.first:case S.replace:o.y+=(o.data.y+u-o.y)*n;break;case S.add:o.y+=u*n}}}class i0 extends Qu{constructor(t,e,s){super(t,e,`${yt.scaleX}|${s}`,`${yt.scaleY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleX=o.data.scaleX,o.scaleY=o.data.scaleY;return;case S.first:o.scaleX+=(o.data.scaleX-o.scaleX)*n,o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}let u,c;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}if(u*=o.data.scaleX,c*=o.data.scaleY,n==1)a==S.add?(o.scaleX+=u-o.data.scaleX,o.scaleY+=c-o.data.scaleY):(o.scaleX=u,o.scaleY=c);else{let p=0,m=0;if(h==At.mixOut)switch(a){case S.setup:p=o.data.scaleX,m=o.data.scaleY,o.scaleX=p+(Math.abs(u)*D.signum(p)-p)*n,o.scaleY=m+(Math.abs(c)*D.signum(m)-m)*n;break;case S.first:case S.replace:p=o.scaleX,m=o.scaleY,o.scaleX=p+(Math.abs(u)*D.signum(p)-p)*n,o.scaleY=m+(Math.abs(c)*D.signum(m)-m)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n,o.scaleY+=(c-o.data.scaleY)*n}else switch(a){case S.setup:p=Math.abs(o.data.scaleX)*D.signum(u),m=Math.abs(o.data.scaleY)*D.signum(c),o.scaleX=p+(u-p)*n,o.scaleY=m+(c-m)*n;break;case S.first:case S.replace:p=Math.abs(o.scaleX)*D.signum(u),m=Math.abs(o.scaleY)*D.signum(c),o.scaleX=p+(u-p)*n,o.scaleY=m+(c-m)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n,o.scaleY+=(c-o.data.scaleY)*n}}}}class n0 extends hr{constructor(t,e,s){super(t,e,`${yt.scaleX}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleX=o.data.scaleX;return;case S.first:o.scaleX+=(o.data.scaleX-o.scaleX)*n}return}const u=this.getCurveValue(s)*o.data.scaleX;if(n==1)a==S.add?o.scaleX+=u-o.data.scaleX:o.scaleX=u;else{let c=0;if(h==At.mixOut)switch(a){case S.setup:c=o.data.scaleX,o.scaleX=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.first:case S.replace:c=o.scaleX,o.scaleX=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n}else switch(a){case S.setup:c=Math.abs(o.data.scaleX)*D.signum(u),o.scaleX=c+(u-c)*n;break;case S.first:case S.replace:c=Math.abs(o.scaleX)*D.signum(u),o.scaleX=c+(u-c)*n;break;case S.add:o.scaleX+=(u-o.data.scaleX)*n}}}}class o0 extends hr{constructor(t,e,s){super(t,e,`${yt.scaleY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.scaleY=o.data.scaleY;return;case S.first:o.scaleY+=(o.data.scaleY-o.scaleY)*n}return}const u=this.getCurveValue(s)*o.data.scaleY;if(n==1)a==S.add?o.scaleY+=u-o.data.scaleY:o.scaleY=u;else{let c=0;if(h==At.mixOut)switch(a){case S.setup:c=o.data.scaleY,o.scaleY=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.first:case S.replace:c=o.scaleY,o.scaleY=c+(Math.abs(u)*D.signum(c)-c)*n;break;case S.add:o.scaleY+=(u-o.data.scaleY)*n}else switch(a){case S.setup:c=Math.abs(o.data.scaleY)*D.signum(u),o.scaleY=c+(u-c)*n;break;case S.first:case S.replace:c=Math.abs(o.scaleY)*D.signum(u),o.scaleY=c+(u-c)*n;break;case S.add:o.scaleY+=(u-o.data.scaleY)*n}}}}class a0 extends Qu{constructor(t,e,s){super(t,e,`${yt.shearX}|${s}`,`${yt.shearY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearX=o.data.shearX,o.shearY=o.data.shearY;return;case S.first:o.shearX+=(o.data.shearX-o.shearX)*n,o.shearY+=(o.data.shearY-o.shearY)*n}return}let u=0,c=0;const d=he.search(l,s,3),f=this.curves[d/3];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+3]-p);u+=(l[d+3+1]-u)*m,c+=(l[d+3+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}switch(a){case S.setup:o.shearX=o.data.shearX+u*n,o.shearY=o.data.shearY+c*n;break;case S.first:case S.replace:o.shearX+=(o.data.shearX+u-o.shearX)*n,o.shearY+=(o.data.shearY+c-o.shearY)*n;break;case S.add:o.shearX+=u*n,o.shearY+=c*n}}}class l0 extends hr{constructor(t,e,s){super(t,e,`${yt.shearX}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearX=o.data.shearX;return;case S.first:o.shearX+=(o.data.shearX-o.shearX)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.shearX=o.data.shearX+u*n;break;case S.first:case S.replace:o.shearX+=(o.data.shearX+u-o.shearX)*n;break;case S.add:o.shearX+=u*n}}}class h0 extends hr{constructor(t,e,s){super(t,e,`${yt.shearY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,r,n,a,h){const o=t.bones[this.boneIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.shearY=o.data.shearY;return;case S.first:o.shearY+=(o.data.shearY-o.shearY)*n}return}const u=this.getCurveValue(s);switch(a){case S.setup:o.shearY=o.data.shearY+u*n;break;case S.first:case S.replace:o.shearY+=(o.data.shearY+u-o.shearY)*n;break;case S.add:o.shearY+=u*n}}}class c0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.alpha}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,r,n,a){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color;if(s<l[0]){const _=o.data.color;switch(a){case S.setup:u.setFromColor(_);return;case S.first:u.add((_.r-u.r)*n,(_.g-u.g)*n,(_.b-u.b)*n,(_.a-u.a)*n)}return}let c=0,d=0,f=0,p=0;const m=he.search(l,s,5),g=this.curves[m/5];switch(g){case 0:const _=l[m];c=l[m+1],d=l[m+2],f=l[m+3],p=l[m+4];const x=(s-_)/(l[m+5]-_);c+=(l[m+5+1]-c)*x,d+=(l[m+5+2]-d)*x,f+=(l[m+5+3]-f)*x,p+=(l[m+5+4]-p)*x;break;case 1:c=l[m+1],d=l[m+2],f=l[m+3],p=l[m+4];break;default:c=this.getBezierValue(s,m,1,g-2),d=this.getBezierValue(s,m,2,g+18-2),f=this.getBezierValue(s,m,3,g+18*2-2),p=this.getBezierValue(s,m,4,g+18*3-2)}n==1?u.set(c,d,f,p):(a==S.setup&&u.setFromColor(o.data.color),u.add((c-u.r)*n,(d-u.g)*n,(f-u.b)*n,(p-u.a)*n))}}class u0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,n){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color;if(s<l[0]){const g=o.data.color;switch(a){case S.setup:u.r=g.r,u.g=g.g,u.b=g.b;return;case S.first:u.r+=(g.r-u.r)*n,u.g+=(g.g-u.g)*n,u.b+=(g.b-u.b)*n}return}let c=0,d=0,f=0;const p=he.search(l,s,4),m=this.curves[p>>2];switch(m){case 0:const g=l[p];c=l[p+1],d=l[p+2],f=l[p+3];const _=(s-g)/(l[p+4]-g);c+=(l[p+4+1]-c)*_,d+=(l[p+4+2]-d)*_,f+=(l[p+4+3]-f)*_;break;case 1:c=l[p+1],d=l[p+2],f=l[p+3];break;default:c=this.getBezierValue(s,p,1,m-2),d=this.getBezierValue(s,p,2,m+18-2),f=this.getBezierValue(s,p,3,m+18*2-2)}if(n==1)u.r=c,u.g=d,u.b=f;else{if(a==S.setup){const g=o.data.color;u.r=g.r,u.g=g.g,u.b=g.b}u.r+=(c-u.r)*n,u.g+=(d-u.g)*n,u.b+=(f-u.b)*n}}}class d0 extends hr{constructor(t,e,s){super(t,e,`${yt.alpha}|${s}`),this.slotIndex=0,this.slotIndex=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.color;if(s<this.frames[0]){const c=o.data.color;switch(a){case S.setup:l.a=c.a;return;case S.first:l.a+=(c.a-l.a)*n}return}const u=this.getCurveValue(s);n==1?l.a=u:(a==S.setup&&(l.a=o.data.color.a),l.a+=(u-l.a)*n)}}class f0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.alpha}|${s}`,`${yt.rgb2}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,r,n,a,h,o,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a,this.frames[t+5]=h,this.frames[t+6]=o,this.frames[t+7]=l}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color,c=o.darkColor;if(s<l[0]){const b=o.data.color,w=o.data.darkColor;switch(a){case S.setup:u.setFromColor(b),c.r=w.r,c.g=w.g,c.b=w.b;return;case S.first:u.add((b.r-u.r)*n,(b.g-u.g)*n,(b.b-u.b)*n,(b.a-u.a)*n),c.r+=(w.r-c.r)*n,c.g+=(w.g-c.g)*n,c.b+=(w.b-c.b)*n}return}let d=0,f=0,p=0,m=0,g=0,_=0,x=0;const y=he.search(l,s,8),v=this.curves[y>>3];switch(v){case 0:const b=l[y];d=l[y+1],f=l[y+2],p=l[y+3],m=l[y+4],g=l[y+5],_=l[y+6],x=l[y+7];const w=(s-b)/(l[y+8]-b);d+=(l[y+8+1]-d)*w,f+=(l[y+8+2]-f)*w,p+=(l[y+8+3]-p)*w,m+=(l[y+8+4]-m)*w,g+=(l[y+8+5]-g)*w,_+=(l[y+8+6]-_)*w,x+=(l[y+8+7]-x)*w;break;case 1:d=l[y+1],f=l[y+2],p=l[y+3],m=l[y+4],g=l[y+5],_=l[y+6],x=l[y+7];break;default:d=this.getBezierValue(s,y,1,v-2),f=this.getBezierValue(s,y,2,v+18-2),p=this.getBezierValue(s,y,3,v+18*2-2),m=this.getBezierValue(s,y,4,v+18*3-2),g=this.getBezierValue(s,y,5,v+18*4-2),_=this.getBezierValue(s,y,6,v+18*5-2),x=this.getBezierValue(s,y,7,v+18*6-2)}if(n==1)u.set(d,f,p,m),c.r=g,c.g=_,c.b=x;else{if(a==S.setup){u.setFromColor(o.data.color);const b=o.data.darkColor;c.r=b.r,c.g=b.g,c.b=b.b}u.add((d-u.r)*n,(f-u.g)*n,(p-u.b)*n,(m-u.a)*n),c.r+=(g-c.r)*n,c.g+=(_-c.g)*n,c.b+=(x-c.b)*n}}}class p0 extends lr{constructor(t,e,s){super(t,e,[`${yt.rgb}|${s}`,`${yt.rgb2}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,n,a,h,o){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a,this.frames[t+5]=h,this.frames[t+6]=o}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=this.frames,u=o.color,c=o.darkColor;if(s<l[0]){const v=o.data.color,b=o.data.darkColor;switch(a){case S.setup:u.r=v.r,u.g=v.g,u.b=v.b,c.r=b.r,c.g=b.g,c.b=b.b;return;case S.first:u.r+=(v.r-u.r)*n,u.g+=(v.g-u.g)*n,u.b+=(v.b-u.b)*n,c.r+=(b.r-c.r)*n,c.g+=(b.g-c.g)*n,c.b+=(b.b-c.b)*n}return}let d=0,f=0,p=0,m=0,g=0,_=0;const x=he.search(l,s,7),y=this.curves[x/7];switch(y){case 0:const v=l[x];d=l[x+1],f=l[x+2],p=l[x+3],m=l[x+4],g=l[x+5],_=l[x+6];const b=(s-v)/(l[x+7]-v);d+=(l[x+7+1]-d)*b,f+=(l[x+7+2]-f)*b,p+=(l[x+7+3]-p)*b,m+=(l[x+7+4]-m)*b,g+=(l[x+7+5]-g)*b,_+=(l[x+7+6]-_)*b;break;case 1:d=l[x+1],f=l[x+2],p=l[x+3],m=l[x+4],g=l[x+5],_=l[x+6];break;default:d=this.getBezierValue(s,x,1,y-2),f=this.getBezierValue(s,x,2,y+18-2),p=this.getBezierValue(s,x,3,y+18*2-2),m=this.getBezierValue(s,x,4,y+18*3-2),g=this.getBezierValue(s,x,5,y+18*4-2),_=this.getBezierValue(s,x,6,y+18*5-2)}if(n==1)u.r=d,u.g=f,u.b=p,c.r=m,c.g=g,c.b=_;else{if(a==S.setup){const v=o.data.color,b=o.data.darkColor;u.r=v.r,u.g=v.g,u.b=v.b,c.r=b.r,c.g=b.g,c.b=b.b}u.r+=(d-u.r)*n,u.g+=(f-u.g)*n,u.b+=(p-u.b)*n,c.r+=(m-c.r)*n,c.g+=(g-c.g)*n,c.b+=(_-c.b)*n}}}class m0 extends he{constructor(t,e){super(t,[`${yt.attachment}|${e}`]),this.slotIndex=0,this.slotIndex=e,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.attachmentNames[t]=s}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(o.bone.active){if(h==At.mixOut){a==S.setup&&this.setAttachment(t,o,o.data.attachmentName);return}if(s<this.frames[0]){(a==S.setup||a==S.first)&&this.setAttachment(t,o,o.data.attachmentName);return}this.setAttachment(t,o,this.attachmentNames[he.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class g0 extends lr{constructor(t,e,s,r){super(t,e,[`${yt.deform}|${s}|${r.id}`]),this.slotIndex=0,this.slotIndex=s,this.attachment=r,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,e,s){this.frames[t]=e,this.vertices[t]=s}setBezier(t,e,s,r,n,a,h,o,l,u,c){const d=this.curves;let f=this.getFrameCount()+t*18;s==0&&(d[e]=2+f);const p=(r-a*2+o)*.03,m=l*.03-h*.06,g=((a-o)*3-r+u)*.006,_=(h-l+.33333333)*.018;let x=p*2+g,y=m*2+_,v=(a-r)*.3+p+g*.16666667,b=h*.3+m+_*.16666667,w=r+v,E=b;for(let T=f+18;f<T;f+=2)d[f]=w,d[f+1]=E,v+=x,b+=y,x+=g,y+=_,w+=v,E+=b}getCurvePercent(t,e){const s=this.curves;let r=s[e];switch(r){case 0:const o=this.frames[e];return(t-o)/(this.frames[e+this.getFrameEntries()]-o);case 1:return 0}if(r-=2,s[r]>t){const o=this.frames[e];return s[r+1]*(t-o)/(s[r]-o)}const n=r+18;for(r+=2;r<n;r+=2)if(s[r]>=t){const o=s[r-2],l=s[r-1];return l+(t-o)/(s[r]-o)*(s[r+1]-l)}const a=s[n-2],h=s[n-1];return h+(1-h)*(t-a)/(this.frames[e+this.getFrameEntries()]-a)}apply(t,e,s,r,n,a,h){const o=t.slots[this.slotIndex];if(!o.bone.active)return;const l=o.getAttachment();if(!l||!(l instanceof ni)||l.timelineAttachment!=this.attachment)return;const u=o.deform;u.length==0&&(a=S.setup);const c=this.vertices,d=c[0].length,f=this.frames;if(s<f[0]){switch(a){case S.setup:u.length=0;return;case S.first:if(n==1){u.length=0;return}u.length=d;const x=l;if(x.bones){n=1-n;for(let y=0;y<d;y++)u[y]*=n}else{const y=x.vertices;for(let v=0;v<d;v++)u[v]+=(y[v]-u[v])*n}}return}if(u.length=d,s>=f[f.length-1]){const x=c[f.length-1];if(n==1)if(a==S.add){const y=l;if(y.bones)for(let v=0;v<d;v++)u[v]+=x[v];else{const v=y.vertices;for(let b=0;b<d;b++)u[b]+=x[b]-v[b]}}else B.arrayCopy(x,0,u,0,d);else switch(a){case S.setup:{const v=l;if(v.bones)for(let b=0;b<d;b++)u[b]=x[b]*n;else{const b=v.vertices;for(let w=0;w<d;w++){const E=b[w];u[w]=E+(x[w]-E)*n}}break}case S.first:case S.replace:for(let v=0;v<d;v++)u[v]+=(x[v]-u[v])*n;break;case S.add:const y=l;if(y.bones)for(let v=0;v<d;v++)u[v]+=x[v]*n;else{const v=y.vertices;for(let b=0;b<d;b++)u[b]+=(x[b]-v[b])*n}}return}const p=he.search1(f,s),m=this.getCurvePercent(s,p),g=c[p],_=c[p+1];if(n==1)if(a==S.add){const x=l;if(x.bones)for(let y=0;y<d;y++){const v=g[y];u[y]+=v+(_[y]-v)*m}else{const y=x.vertices;for(let v=0;v<d;v++){const b=g[v];u[v]+=b+(_[v]-b)*m-y[v]}}}else for(let x=0;x<d;x++){const y=g[x];u[x]=y+(_[x]-y)*m}else switch(a){case S.setup:{const y=l;if(y.bones)for(let v=0;v<d;v++){const b=g[v];u[v]=(b+(_[v]-b)*m)*n}else{const v=y.vertices;for(let b=0;b<d;b++){const w=g[b],E=v[b];u[b]=E+(w+(_[b]-w)*m-E)*n}}break}case S.first:case S.replace:for(let y=0;y<d;y++){const v=g[y];u[y]+=(v+(_[y]-v)*m-u[y])*n}break;case S.add:const x=l;if(x.bones)for(let y=0;y<d;y++){const v=g[y];u[y]+=(v+(_[y]-v)*m)*n}else{const y=x.vertices;for(let v=0;v<d;v++){const b=g[v];u[v]+=(b+(_[v]-b)*m-y[v])*n}}}}}const _0=class extends he{constructor(i){super(i,_0.propertyIds),this.events=new Array(i)}getFrameCount(){return this.frames.length}setFrame(i,t){this.frames[i]=t.time,this.events[i]=t}apply(i,t,e,s,r,n,a){if(!s)return;const h=this.frames,o=this.frames.length;if(t>e)this.apply(i,t,Number.MAX_VALUE,s,r,n,a),t=-1;else if(t>=h[o-1])return;if(e<h[0])return;let l=0;if(t<h[0])l=0;else{l=he.search1(h,t)+1;const u=h[l];for(;l>0&&h[l-1]==u;)l--}for(;l<o&&e>=h[l];l++)s.push(this.events[l])}};let Ju=_0;Ju.propertyIds=[`${yt.event}`];const y0=class extends he{constructor(i){super(i,y0.propertyIds),this.drawOrders=new Array(i)}getFrameCount(){return this.frames.length}setFrame(i,t,e){this.frames[i]=t,this.drawOrders[i]=e}apply(i,t,e,s,r,n,a){if(a==At.mixOut){n==S.setup&&B.arrayCopy(i.slots,0,i.drawOrder,0,i.slots.length);return}if(e<this.frames[0]){(n==S.setup||n==S.first)&&B.arrayCopy(i.slots,0,i.drawOrder,0,i.slots.length);return}const h=he.search1(this.frames,e),o=this.drawOrders[h];if(!o)B.arrayCopy(i.slots,0,i.drawOrder,0,i.slots.length);else{const l=i.drawOrder,u=i.slots;for(let c=0,d=o.length;c<d;c++)l[c]=u[o[c]]}}};let td=y0;td.propertyIds=[`${yt.drawOrder}`];class x0 extends lr{constructor(t,e,s){super(t,e,[`${yt.ikConstraint}|${s}`]),this.ikConstraintIndex=0,this.ikConstraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,r,n,a,h){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=a?1:0,this.frames[t+5]=h?1:0}apply(t,e,s,r,n,a,h){const o=t.ikConstraints[this.ikConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.mix=o.data.mix,o.softness=o.data.softness,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch;return;case S.first:o.mix+=(o.data.mix-o.mix)*n,o.softness+=(o.data.softness-o.softness)*n,o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch}return}let u=0,c=0;const d=he.search(l,s,6),f=this.curves[d/6];switch(f){case 0:const p=l[d];u=l[d+1],c=l[d+2];const m=(s-p)/(l[d+6]-p);u+=(l[d+6+1]-u)*m,c+=(l[d+6+2]-c)*m;break;case 1:u=l[d+1],c=l[d+2];break;default:u=this.getBezierValue(s,d,1,f-2),c=this.getBezierValue(s,d,2,f+18-2)}a==S.setup?(o.mix=o.data.mix+(u-o.data.mix)*n,o.softness=o.data.softness+(c-o.data.softness)*n,h==At.mixOut?(o.bendDirection=o.data.bendDirection,o.compress=o.data.compress,o.stretch=o.data.stretch):(o.bendDirection=l[d+3],o.compress=l[d+4]!=0,o.stretch=l[d+5]!=0)):(o.mix+=(u-o.mix)*n,o.softness+=(c-o.softness)*n,h==At.mixIn&&(o.bendDirection=l[d+3],o.compress=l[d+4]!=0,o.stretch=l[d+5]!=0))}}class v0 extends lr{constructor(t,e,s){super(t,e,[`${yt.transformConstraint}|${s}`]),this.transformConstraintIndex=0,this.transformConstraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,r,n,a,h,o){const l=this.frames;t*=7,l[t]=e,l[t+1]=s,l[t+2]=r,l[t+3]=n,l[t+4]=a,l[t+5]=h,l[t+6]=o}apply(t,e,s,r,n,a,h){const o=t.transformConstraints[this.transformConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){const x=o.data;switch(a){case S.setup:o.mixRotate=x.mixRotate,o.mixX=x.mixX,o.mixY=x.mixY,o.mixScaleX=x.mixScaleX,o.mixScaleY=x.mixScaleY,o.mixShearY=x.mixShearY;return;case S.first:o.mixRotate+=(x.mixRotate-o.mixRotate)*n,o.mixX+=(x.mixX-o.mixX)*n,o.mixY+=(x.mixY-o.mixY)*n,o.mixScaleX+=(x.mixScaleX-o.mixScaleX)*n,o.mixScaleY+=(x.mixScaleY-o.mixScaleY)*n,o.mixShearY+=(x.mixShearY-o.mixShearY)*n}return}let u,c,d,f,p,m;const g=he.search(l,s,7),_=this.curves[g/7];switch(_){case 0:const x=l[g];u=l[g+1],c=l[g+2],d=l[g+3],f=l[g+4],p=l[g+5],m=l[g+6];const y=(s-x)/(l[g+7]-x);u+=(l[g+7+1]-u)*y,c+=(l[g+7+2]-c)*y,d+=(l[g+7+3]-d)*y,f+=(l[g+7+4]-f)*y,p+=(l[g+7+5]-p)*y,m+=(l[g+7+6]-m)*y;break;case 1:u=l[g+1],c=l[g+2],d=l[g+3],f=l[g+4],p=l[g+5],m=l[g+6];break;default:u=this.getBezierValue(s,g,1,_-2),c=this.getBezierValue(s,g,2,_+18-2),d=this.getBezierValue(s,g,3,_+18*2-2),f=this.getBezierValue(s,g,4,_+18*3-2),p=this.getBezierValue(s,g,5,_+18*4-2),m=this.getBezierValue(s,g,6,_+18*5-2)}if(a==S.setup){const x=o.data;o.mixRotate=x.mixRotate+(u-x.mixRotate)*n,o.mixX=x.mixX+(c-x.mixX)*n,o.mixY=x.mixY+(d-x.mixY)*n,o.mixScaleX=x.mixScaleX+(f-x.mixScaleX)*n,o.mixScaleY=x.mixScaleY+(p-x.mixScaleY)*n,o.mixShearY=x.mixShearY+(m-x.mixShearY)*n}else o.mixRotate+=(u-o.mixRotate)*n,o.mixX+=(c-o.mixX)*n,o.mixY+=(d-o.mixY)*n,o.mixScaleX+=(f-o.mixScaleX)*n,o.mixScaleY+=(p-o.mixScaleY)*n,o.mixShearY+=(m-o.mixShearY)*n}}class b0 extends hr{constructor(t,e,s){super(t,e,`${yt.pathConstraintPosition}|${s}`),this.pathConstraintIndex=0,this.pathConstraintIndex=s}apply(t,e,s,r,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.position=o.data.position;return;case S.first:o.position+=(o.data.position-o.position)*n}return}const u=this.getCurveValue(s);a==S.setup?o.position=o.data.position+(u-o.data.position)*n:o.position+=(u-o.position)*n}}class w0 extends hr{constructor(t,e,s){super(t,e,`${yt.pathConstraintSpacing}|${s}`),this.pathConstraintIndex=0,this.pathConstraintIndex=s}apply(t,e,s,r,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.spacing=o.data.spacing;return;case S.first:o.spacing+=(o.data.spacing-o.spacing)*n}return}const u=this.getCurveValue(s);a==S.setup?o.spacing=o.data.spacing+(u-o.data.spacing)*n:o.spacing+=(u-o.spacing)*n}}class E0 extends lr{constructor(t,e,s){super(t,e,[`${yt.pathConstraintMix}|${s}`]),this.pathConstraintIndex=0,this.pathConstraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,r,n){const a=this.frames;t<<=2,a[t]=e,a[t+1]=s,a[t+2]=r,a[t+3]=n}apply(t,e,s,r,n,a,h){const o=t.pathConstraints[this.pathConstraintIndex];if(!o.active)return;const l=this.frames;if(s<l[0]){switch(a){case S.setup:o.mixRotate=o.data.mixRotate,o.mixX=o.data.mixX,o.mixY=o.data.mixY;return;case S.first:o.mixRotate+=(o.data.mixRotate-o.mixRotate)*n,o.mixX+=(o.data.mixX-o.mixX)*n,o.mixY+=(o.data.mixY-o.mixY)*n}return}let u,c,d;const f=he.search(l,s,4),p=this.curves[f>>2];switch(p){case 0:const m=l[f];u=l[f+1],c=l[f+2],d=l[f+3];const g=(s-m)/(l[f+4]-m);u+=(l[f+4+1]-u)*g,c+=(l[f+4+2]-c)*g,d+=(l[f+4+3]-d)*g;break;case 1:u=l[f+1],c=l[f+2],d=l[f+3];break;default:u=this.getBezierValue(s,f,1,p-2),c=this.getBezierValue(s,f,2,p+18-2),d=this.getBezierValue(s,f,3,p+18*2-2)}if(a==S.setup){const m=o.data;o.mixRotate=m.mixRotate+(u-m.mixRotate)*n,o.mixX=m.mixX+(c-m.mixX)*n,o.mixY=m.mixY+(d-m.mixY)*n}else o.mixRotate+=(u-o.mixRotate)*n,o.mixX+=(c-o.mixX)*n,o.mixY+=(d-o.mixY)*n}}const oi=class extends he{constructor(i,t,e){super(i,[`${yt.sequence}|${t}|${e.sequence.id}`]),this.slotIndex=t,this.attachment=e}getFrameEntries(){return oi.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(i,t,e,s,r){const n=this.frames;i*=oi.ENTRIES,n[i]=t,n[i+oi.MODE]=e|s<<4,n[i+oi.DELAY]=r}apply(i,t,e,s,r,n,a){const h=i.slots[this.slotIndex];if(!h.bone.active)return;const o=h.attachment,l=this.attachment;if(o!=l&&(!(o instanceof ni)||o.timelineAttachment!=l))return;const u=this.frames;if(e<u[0]){(n==S.setup||n==S.first)&&(h.sequenceIndex=-1);return}const c=he.search(u,e,oi.ENTRIES),d=u[c],f=u[c+oi.MODE],p=u[c+oi.DELAY];if(!this.attachment.sequence)return;let m=f>>4;const g=this.attachment.sequence.regions.length,_=J_[f&15];if(_!=Pr.hold)switch(m+=(e-d)/p+1e-5|0,_){case Pr.once:m=Math.min(g-1,m);break;case Pr.loop:m%=g;break;case Pr.pingpong:{const x=(g<<1)-2;m=x==0?0:m%x,m>=g&&(m=x-m);break}case Pr.onceReverse:m=Math.max(g-1-m,0);break;case Pr.loopReverse:m=g-1-m%g;break;case Pr.pingpongReverse:{const x=(g<<1)-2;m=x==0?0:(m+g-1)%x,m>=g&&(m=x-m)}}h.sequenceIndex=m}};let Fo=oi;Fo.ENTRIES=3,Fo.MODE=1,Fo.DELAY=2,new Ku("<empty>",[],0);class T0{constructor(t){this.atlas=t}loadSequence(t,e,s){const r=s.regions;for(let n=0,a=r.length;n<a;n++){const h=s.getPath(e,n),o=this.atlas.findRegion(h);if(o==null)throw new Error(`Region not found in atlas: ${h} (sequence: ${t})`);r[n]=o,r[n].renderObject=r[n]}}newRegionAttachment(t,e,s,r){const n=new gt(e,s);if(r!=null)this.loadSequence(e,s,r);else{const a=this.atlas.findRegion(s);if(!a)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);a.renderObject=a,n.region=a}return n}newMeshAttachment(t,e,s,r){const n=new Mo(e,s);if(r!=null)this.loadSequence(e,s,r);else{const a=this.atlas.findRegion(s);if(!a)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);a.renderObject=a,n.region=a}return n}newBoundingBoxAttachment(t,e){return new Wu(e)}newPathAttachment(t,e){return new ju(e)}newPointAttachment(t,e){return new qu(e)}newClippingAttachment(t,e){return new zu(e)}}class A0{constructor(t,e,s){if(this.index=0,this.parent=null,this.length=0,this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=vt.Normal,this.skinRequired=!1,this.color=new X,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");this.index=t,this.name=e,this.parent=s}}class ed{constructor(t,e,s){this.name=t,this.order=e,this.skinRequired=s}}let S0=class{constructor(t,e){if(this.intValue=0,this.floatValue=0,this.stringValue=null,this.time=0,this.volume=0,this.balance=0,!e)throw new Error("data cannot be null.");this.time=t,this.data=e}};class C0{constructor(t){this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=t}}class I0 extends ed{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.bendDirection=1,this.compress=!1,this.stretch=!1,this.uniform=!1,this.mix=1,this.softness=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class P0 extends ed{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.positionMode=ne.Fixed,this.spacingMode=Rs.Fixed,this.rotateMode=Fe.Chain,this.offsetRotation=0,this.position=0,this.spacing=0,this.mixRotate=0,this.mixX=0,this.mixY=0}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}}var Rs=(i=>(i[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",i[i.Proportional=3]="Proportional",i))(Rs||{});class R0{constructor(){this.name=null,this.bones=new Array,this.slots=new Array,this.skins=new Array,this.defaultSkin=null,this.events=new Array,this.animations=new Array,this.ikConstraints=new Array,this.transformConstraints=new Array,this.pathConstraints=new Array,this.x=0,this.y=0,this.width=0,this.height=0,this.version=null,this.hash=null,this.fps=0,this.imagesPath=null,this.audioPath=null}findBone(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findBoneIndex(t){if(!t)throw new Error("boneName cannot be null.");const e=this.bones;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSlot(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findSlotIndex(t){if(!t)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}findSkin(t){if(!t)throw new Error("skinName cannot be null.");const e=this.skins;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findEvent(t){if(!t)throw new Error("eventDataName cannot be null.");const e=this.events;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findAnimation(t){if(!t)throw new Error("animationName cannot be null.");const e=this.animations;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findIkConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.ikConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findTransformConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.transformConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraint(t){if(!t)throw new Error("constraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++){const n=e[s];if(n.name==t)return n}return null}findPathConstraintIndex(t){if(t==null)throw new Error("pathConstraintName cannot be null.");const e=this.pathConstraints;for(let s=0,r=e.length;s<r;s++)if(e[s].name==t)return s;return-1}}class M0{constructor(t,e,s){if(this.index=0,this.color=new X(1,1,1,1),this.darkColor=null,this.attachmentName=null,this.blendMode=W.NORMAL,t<0)throw new Error("index must be >= 0.");if(!e)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.name=e,this.boneData=s}}class F0 extends ed{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.mixRotate=0,this.mixX=0,this.mixY=0,this.mixScaleX=0,this.mixScaleY=0,this.mixShearY=0,this.offsetRotation=0,this.offsetX=0,this.offsetY=0,this.offsetScaleX=0,this.offsetScaleY=0,this.offsetShearY=0,this.relative=!1,this.local=!1}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class k0{constructor(t,e,s){this.slotIndex=t,this.name=e,this.attachment=s}}class sd{constructor(t){if(this.attachments=new Array,this.bones=Array(),this.constraints=new Array,!t)throw new Error("name cannot be null.");this.name=t}setAttachment(t,e,s){if(!s)throw new Error("attachment cannot be null.");const r=this.attachments;t>=r.length&&(r.length=t+1),r[t]||(r[t]={}),r[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];this.setAttachment(r.slotIndex,r.name,r.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const r=t.bones[s];let n=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){n=!0;break}n||this.bones.push(r)}for(let s=0;s<t.constraints.length;s++){const r=t.constraints[s];let n=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){n=!0;break}n||this.constraints.push(r)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const r=e[s];r.attachment&&(r.attachment instanceof Mo?(r.attachment=r.attachment.newLinkedMesh(),this.setAttachment(r.slotIndex,r.name,r.attachment)):(r.attachment=r.attachment.copy(),this.setAttachment(r.slotIndex,r.name,r.attachment)))}}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}removeAttachment(t,e){const s=this.attachments[t];s&&delete s[e]}getAttachments(){const t=new Array;for(let e=0;e<this.attachments.length;e++){const s=this.attachments[e];if(s)for(const r in s){const n=s[r];n&&t.push(new k0(e,r,n))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const r in s){const n=s[r];n&&e.push(new k0(t,r,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let r=0;r<t.slots.length;r++){const n=t.slots[r],a=n.getAttachment();if(a&&s<e.attachments.length){const h=e.attachments[s];for(const o in h){const l=h[o];if(a==l){const u=this.getAttachment(s,o);u&&n.setAttachment(u);break}}}s++}}}class B0{constructor(t){this.ver40=!1,this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new R0;s.name="";const r=new gl(t),n=r.readInt32(),a=r.readInt32();s.hash=a==0&&n==0?null:a.toString(16)+n.toString(16),s.version=r.readString();const h=s.version.substr(0,3);if(h!=="4.0"&&h!=="4.1"){const c=`Spine 4.1 loader cant load version ${s.version}. Please configure your pixi-spine bundle`;console.error(c)}this.ver40=h==="4.0",s.x=r.readFloat(),s.y=r.readFloat(),s.width=r.readFloat(),s.height=r.readFloat();const o=r.readBoolean();o&&(s.fps=r.readFloat(),s.imagesPath=r.readString(),s.audioPath=r.readString());let l=0;l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("String in string table must not be null.");r.strings.push(d)}l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("Bone name must not be null.");const f=c==0?null:s.bones[r.readInt(!0)],p=new A0(c,d,f);p.rotation=r.readFloat(),p.x=r.readFloat()*e,p.y=r.readFloat()*e,p.scaleX=r.readFloat(),p.scaleY=r.readFloat(),p.shearX=r.readFloat(),p.shearY=r.readFloat(),p.length=r.readFloat()*e,p.transformMode=r.readInt(!0),p.skinRequired=r.readBoolean(),o&&X.rgba8888ToColor(p.color,r.readInt32()),s.bones.push(p)}l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("Slot name must not be null.");const f=s.bones[r.readInt(!0)],p=new M0(c,d,f);X.rgba8888ToColor(p.color,r.readInt32());const m=r.readInt32();m!=-1&&X.rgb888ToColor(p.darkColor=new X,m),p.attachmentName=r.readStringRef(),p.blendMode=r.readInt(!0),s.slots.push(p)}l=r.readInt(!0);for(let c=0,d;c<l;c++){const f=r.readString();if(!f)throw new Error("IK constraint data name must not be null.");const p=new I0(f);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[r.readInt(!0)]);p.target=s.bones[r.readInt(!0)],p.mix=r.readFloat(),p.softness=r.readFloat()*e,p.bendDirection=r.readByte(),p.compress=r.readBoolean(),p.stretch=r.readBoolean(),p.uniform=r.readBoolean(),s.ikConstraints.push(p)}l=r.readInt(!0);for(let c=0,d;c<l;c++){const f=r.readString();if(!f)throw new Error("Transform constraint data name must not be null.");const p=new F0(f);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[r.readInt(!0)]);p.target=s.bones[r.readInt(!0)],p.local=r.readBoolean(),p.relative=r.readBoolean(),p.offsetRotation=r.readFloat(),p.offsetX=r.readFloat()*e,p.offsetY=r.readFloat()*e,p.offsetScaleX=r.readFloat(),p.offsetScaleY=r.readFloat(),p.offsetShearY=r.readFloat(),p.mixRotate=r.readFloat(),p.mixX=r.readFloat(),p.mixY=r.readFloat(),p.mixScaleX=r.readFloat(),p.mixScaleY=r.readFloat(),p.mixShearY=r.readFloat(),s.transformConstraints.push(p)}l=r.readInt(!0);for(let c=0,d;c<l;c++){const f=r.readString();if(!f)throw new Error("Path constraint data name must not be null.");const p=new P0(f);p.order=r.readInt(!0),p.skinRequired=r.readBoolean(),d=r.readInt(!0);for(let m=0;m<d;m++)p.bones.push(s.bones[r.readInt(!0)]);p.target=s.slots[r.readInt(!0)],p.positionMode=r.readInt(!0),p.spacingMode=r.readInt(!0),p.rotateMode=r.readInt(!0),p.offsetRotation=r.readFloat(),p.position=r.readFloat(),p.positionMode==ne.Fixed&&(p.position*=e),p.spacing=r.readFloat(),(p.spacingMode==Rs.Length||p.spacingMode==Rs.Fixed)&&(p.spacing*=e),p.mixRotate=r.readFloat(),p.mixX=r.readFloat(),p.mixY=r.readFloat(),s.pathConstraints.push(p)}const u=this.readSkin(r,s,!0,o);u&&(s.defaultSkin=u,s.skins.push(u));{let c=s.skins.length;for(B.setArraySize(s.skins,l=c+r.readInt(!0));c<l;c++){const d=this.readSkin(r,s,!1,o);if(!d)throw new Error("readSkin() should not have returned null.");s.skins[c]=d}}l=this.linkedMeshes.length;for(let c=0;c<l;c++){const d=this.linkedMeshes[c],f=d.skin?s.findSkin(d.skin):s.defaultSkin;if(!f)throw new Error("Not skin found for linked mesh.");if(!d.parent)throw new Error("Linked mesh parent must not be null");const p=f.getAttachment(d.slotIndex,d.parent);if(!p)throw new Error(`Parent mesh not found: ${d.parent}`);d.mesh.timelineAttachment=d.inheritTimeline?p:d.mesh,d.mesh.setParentMesh(p)}this.linkedMeshes.length=0,l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readStringRef();if(!d)throw new Error;const f=new C0(d);f.intValue=r.readInt(!1),f.floatValue=r.readFloat(),f.stringValue=r.readString(),f.audioPath=r.readString(),f.audioPath&&(f.volume=r.readFloat(),f.balance=r.readFloat()),s.events.push(f)}l=r.readInt(!0);for(let c=0;c<l;c++){const d=r.readString();if(!d)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(r,d,s))}return s}readSkin(t,e,s,r){let n=null,a=0;if(s){if(a=t.readInt(!0),a==0)return null;n=new sd("default")}else{const h=t.readStringRef();if(!h)throw new Error("Skin name must not be null.");n=new sd(h),n.bones.length=t.readInt(!0);for(let o=0,l=n.bones.length;o<l;o++)n.bones[o]=e.bones[t.readInt(!0)];for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let o=0,l=t.readInt(!0);o<l;o++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);a=t.readInt(!0)}for(let h=0;h<a;h++){const o=t.readInt(!0);for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readStringRef();if(!c)throw new Error("Attachment name must not be null");const d=this.readAttachment(t,e,n,o,c,r);d&&n.setAttachment(o,c,d)}}return n}readAttachment(t,e,s,r,n,a){const h=this.scale;let o=t.readStringRef();switch(o||(o=n),t.readByte()){case at.Region:{let l=t.readStringRef();const u=t.readFloat(),c=t.readFloat(),d=t.readFloat(),f=t.readFloat(),p=t.readFloat(),m=t.readFloat(),g=t.readFloat(),_=t.readInt32(),x=this.readSequence(t);l||(l=o);const y=this.attachmentLoader.newRegionAttachment(s,o,l,x);return y?(y.path=l,y.x=c*h,y.y=d*h,y.scaleX=f,y.scaleY=p,y.rotation=u,y.width=m*h,y.height=g*h,X.rgba8888ToColor(y.color,_),y.sequence=x,x==null&&y.updateRegion(),y):null}case at.BoundingBox:{const l=t.readInt(!0),u=this.readVertices(t,l),c=a?t.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(s,o);return d?(d.worldVerticesLength=l<<1,d.vertices=u.vertices,d.bones=u.bones,a&&X.rgba8888ToColor(d.color,c),d):null}case at.Mesh:{let l=t.readStringRef();const u=t.readInt32(),c=t.readInt(!0),d=this.readFloatArray(t,c<<1,1),f=this.readShortArray(t),p=this.readVertices(t,c),m=t.readInt(!0),g=this.readSequence(t);let _=[],x=0,y=0;a&&(_=this.readShortArray(t),x=t.readFloat(),y=t.readFloat()),l||(l=o);const v=this.attachmentLoader.newMeshAttachment(s,o,l,g);return v?(v.path=l,X.rgba8888ToColor(v.color,u),v.bones=p.bones,v.vertices=p.vertices,v.worldVerticesLength=c<<1,v.triangles=f,v.regionUVs=new Float32Array(d),v.hullLength=m<<1,v.sequence=g,a&&(v.edges=_,v.width=x*h,v.height=y*h),v):null}case at.LinkedMesh:{let l=t.readStringRef();const u=t.readInt32(),c=t.readStringRef(),d=t.readStringRef(),f=t.readBoolean(),p=this.readSequence(t);let m=0,g=0;a&&(m=t.readFloat(),g=t.readFloat()),l||(l=o);const _=this.attachmentLoader.newMeshAttachment(s,o,l,p);return _?(_.path=l,X.rgba8888ToColor(_.color,u),_.sequence=p,a&&(_.width=m*h,_.height=g*h),this.linkedMeshes.push(new MC(_,c,r,d,f)),_):null}case at.Path:{const l=t.readBoolean(),u=t.readBoolean(),c=t.readInt(!0),d=this.readVertices(t,c),f=B.newArray(c/3,0);for(let g=0,_=f.length;g<_;g++)f[g]=t.readFloat()*h;const p=a?t.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,o);return m?(m.closed=l,m.constantSpeed=u,m.worldVerticesLength=c<<1,m.vertices=d.vertices,m.bones=d.bones,m.lengths=f,a&&X.rgba8888ToColor(m.color,p),m):null}case at.Point:{const l=t.readFloat(),u=t.readFloat(),c=t.readFloat(),d=a?t.readInt32():0,f=this.attachmentLoader.newPointAttachment(s,o);return f?(f.x=u*h,f.y=c*h,f.rotation=l,a&&X.rgba8888ToColor(f.color,d),f):null}case at.Clipping:{const l=t.readInt(!0),u=t.readInt(!0),c=this.readVertices(t,u),d=a?t.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,o);return f?(f.endSlot=e.slots[l],f.worldVerticesLength=u<<1,f.vertices=c.vertices,f.bones=c.bones,a&&X.rgba8888ToColor(f.color,d),f):null}}return null}readSequence(t){if(this.ver40||!t.readBoolean())return null;const e=new Zu(t.readInt(!0));return e.start=t.readInt(!0),e.digits=t.readInt(!0),e.setupIndex=t.readInt(!0),e}readDeformTimelineType(t){return this.ver40?D0:t.readByte()}readVertices(t,e){const s=this.scale,r=e<<1,n=new FC;if(!t.readBoolean())return n.vertices=this.readFloatArray(t,r,s),n;const a=new Array,h=new Array;for(let o=0;o<e;o++){const l=t.readInt(!0);h.push(l);for(let u=0;u<l;u++)h.push(t.readInt(!0)),a.push(t.readFloat()*s),a.push(t.readFloat()*s),a.push(t.readFloat())}return n.vertices=B.toFloatArray(a),n.bones=h,n}readFloatArray(t,e,s){const r=new Array(e);if(s==1)for(let n=0;n<e;n++)r[n]=t.readFloat();else for(let n=0;n<e;n++)r[n]=t.readFloat()*s;return r}readShortArray(t){const e=t.readInt(!0),s=new Array(e);for(let r=0;r<e;r++)s[r]=t.readShort();return s}readAnimation(t,e,s){t.readInt(!0);const r=new Array,n=this.scale;for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0);for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readByte(),m=t.readInt(!0),g=m-1;switch(p){case $C:{const _=new m0(m,c);for(let x=0;x<m;x++)_.setFrame(x,t.readFloat(),t.readStringRef());r.push(_);break}case YC:{const _=t.readInt(!0),x=new c0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255;for(let T=0,A=0;x.setFrame(T,y,v,b,w,E),T!=g;T++){const I=t.readFloat(),M=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255,C=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:x.setStepped(T);break;case Fs:ct(t,x,A++,T,0,y,I,v,M,1),ct(t,x,A++,T,1,y,I,b,R,1),ct(t,x,A++,T,2,y,I,w,C,1),ct(t,x,A++,T,3,y,I,E,P,1)}y=I,v=M,b=R,w=C,E=P}r.push(x);break}case HC:{const _=t.readInt(!0),x=new u0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255;for(let E=0,T=0;x.setFrame(E,y,v,b,w),E!=g;E++){const A=t.readFloat(),I=t.readUnsignedByte()/255,M=t.readUnsignedByte()/255,R=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:x.setStepped(E);break;case Fs:ct(t,x,T++,E,0,y,A,v,I,1),ct(t,x,T++,E,1,y,A,b,M,1),ct(t,x,T++,E,2,y,A,w,R,1)}y=A,v=I,b=M,w=R}r.push(x);break}case WC:{const _=t.readInt(!0),x=new f0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255,I=t.readUnsignedByte()/255;for(let M=0,R=0;x.setFrame(M,y,v,b,w,E,T,A,I),M!=g;M++){const C=t.readFloat(),P=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,$=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:x.setStepped(M);break;case Fs:ct(t,x,R++,M,0,y,C,v,P,1),ct(t,x,R++,M,1,y,C,b,k,1),ct(t,x,R++,M,2,y,C,w,U,1),ct(t,x,R++,M,3,y,C,E,V,1),ct(t,x,R++,M,4,y,C,T,L,1),ct(t,x,R++,M,5,y,C,A,$,1),ct(t,x,R++,M,6,y,C,I,O,1)}y=C,v=P,b=k,w=U,E=V,T=L,A=$,I=O}r.push(x);break}case zC:{const _=t.readInt(!0),x=new p0(m,_,c);let y=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255,E=t.readUnsignedByte()/255,T=t.readUnsignedByte()/255,A=t.readUnsignedByte()/255;for(let I=0,M=0;x.setFrame(I,y,v,b,w,E,T,A),I!=g;I++){const R=t.readFloat(),C=t.readUnsignedByte()/255,P=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:x.setStepped(I);break;case Fs:ct(t,x,M++,I,0,y,R,v,C,1),ct(t,x,M++,I,1,y,R,b,P,1),ct(t,x,M++,I,2,y,R,w,k,1),ct(t,x,M++,I,3,y,R,E,U,1),ct(t,x,M++,I,4,y,R,T,V,1),ct(t,x,M++,I,5,y,R,A,L,1)}y=R,v=C,b=P,w=k,E=U,T=V,A=L}r.push(x);break}case jC:{const _=new d0(m,t.readInt(!0),c);let x=t.readFloat(),y=t.readUnsignedByte()/255;for(let v=0,b=0;_.setFrame(v,x,y),v!=g;v++){const w=t.readFloat(),E=t.readUnsignedByte()/255;switch(t.readByte()){case Ms:_.setStepped(v);break;case Fs:ct(t,_,b++,v,0,x,w,y,E,1)}x=w,y=E}r.push(_)}}}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0);for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readByte(),m=t.readInt(!0),g=t.readInt(!0);switch(p){case kC:r.push(Rr(t,new t0(m,g,c),1));break;case BC:r.push(rd(t,new e0(m,g,c),n));break;case DC:r.push(Rr(t,new s0(m,g,c),n));break;case OC:r.push(Rr(t,new r0(m,g,c),n));break;case LC:r.push(rd(t,new i0(m,g,c),1));break;case NC:r.push(Rr(t,new n0(m,g,c),1));break;case VC:r.push(Rr(t,new o0(m,g,c),1));break;case UC:r.push(rd(t,new a0(m,g,c),1));break;case GC:r.push(Rr(t,new l0(m,g,c),1));break;case XC:r.push(Rr(t,new h0(m,g,c),1))}}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=t.readInt(!0),f=d-1,p=new x0(d,t.readInt(!0),c);let m=t.readFloat(),g=t.readFloat(),_=t.readFloat()*n;for(let x=0,y=0;p.setFrame(x,m,g,_,t.readByte(),t.readBoolean(),t.readBoolean()),x!=f;x++){const v=t.readFloat(),b=t.readFloat(),w=t.readFloat()*n;switch(t.readByte()){case Ms:p.setStepped(x);break;case Fs:ct(t,p,y++,x,0,m,v,g,b,1),ct(t,p,y++,x,1,m,v,_,w,n)}m=v,g=b,_=w}r.push(p)}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=t.readInt(!0),f=d-1,p=new v0(d,t.readInt(!0),c);let m=t.readFloat(),g=t.readFloat(),_=t.readFloat(),x=t.readFloat(),y=t.readFloat(),v=t.readFloat(),b=t.readFloat();for(let w=0,E=0;p.setFrame(w,m,g,_,x,y,v,b),w!=f;w++){const T=t.readFloat(),A=t.readFloat(),I=t.readFloat(),M=t.readFloat(),R=t.readFloat(),C=t.readFloat(),P=t.readFloat();switch(t.readByte()){case Ms:p.setStepped(w);break;case Fs:ct(t,p,E++,w,0,m,T,g,A,1),ct(t,p,E++,w,1,m,T,_,I,1),ct(t,p,E++,w,2,m,T,x,M,1),ct(t,p,E++,w,3,m,T,y,R,1),ct(t,p,E++,w,4,m,T,v,C,1),ct(t,p,E++,w,5,m,T,b,P,1)}m=T,g=A,_=I,x=M,y=R,v=C,b=P}r.push(p)}for(let l=0,u=t.readInt(!0);l<u;l++){const c=t.readInt(!0),d=s.pathConstraints[c];for(let f=0,p=t.readInt(!0);f<p;f++)switch(t.readByte()){case ZC:r.push(Rr(t,new b0(t.readInt(!0),t.readInt(!0),c),d.positionMode==ne.Fixed?n:1));break;case KC:r.push(Rr(t,new w0(t.readInt(!0),t.readInt(!0),c),d.spacingMode==Rs.Length||d.spacingMode==Rs.Fixed?n:1));break;case QC:const m=new E0(t.readInt(!0),t.readInt(!0),c);let g=t.readFloat(),_=t.readFloat(),x=t.readFloat(),y=t.readFloat();for(let v=0,b=0,w=m.getFrameCount()-1;m.setFrame(v,g,_,x,y),v!=w;v++){const E=t.readFloat(),T=t.readFloat(),A=t.readFloat(),I=t.readFloat();switch(t.readByte()){case Ms:m.setStepped(v);break;case Fs:ct(t,m,b++,v,0,g,E,_,T,1),ct(t,m,b++,v,1,g,E,x,A,1),ct(t,m,b++,v,2,g,E,y,I,1)}g=E,_=T,x=A,y=I}r.push(m)}}for(let l=0,u=t.readInt(!0);l<u;l++){const c=s.skins[t.readInt(!0)];for(let d=0,f=t.readInt(!0);d<f;d++){const p=t.readInt(!0);for(let m=0,g=t.readInt(!0);m<g;m++){const _=t.readStringRef();if(!_)throw new Error("attachmentName must not be null.");const x=c.getAttachment(p,_),y=this.readDeformTimelineType(t),v=t.readInt(!0),b=v-1;switch(y){case D0:{const w=x,E=w.bones,T=w.vertices,A=E?T.length/3*2:T.length,I=t.readInt(!0),M=new g0(v,I,p,w);let R=t.readFloat();for(let C=0,P=0;;C++){let k,U=t.readInt(!0);if(U==0)k=E?B.newFloatArray(A):T;else{k=B.newFloatArray(A);const L=t.readInt(!0);if(U+=L,n==1)for(let $=L;$<U;$++)k[$]=t.readFloat();else for(let $=L;$<U;$++)k[$]=t.readFloat()*n;if(!E)for(let $=0,O=k.length;$<O;$++)k[$]+=T[$]}if(M.setFrame(C,R,k),C==b)break;const V=t.readFloat();switch(t.readByte()){case Ms:M.setStepped(C);break;case Fs:ct(t,M,P++,C,0,R,V,0,1,1)}R=V}r.push(M);break}case qC:{const w=new Fo(v,p,x);for(let E=0;E<v;E++){const T=t.readFloat(),A=t.readInt32();w.setFrame(E,T,J_[A&15],A>>4,t.readFloat())}r.push(w);break}}}}}const a=t.readInt(!0);if(a>0){const l=new td(a),u=s.slots.length;for(let c=0;c<a;c++){const d=t.readFloat(),f=t.readInt(!0),p=B.newArray(u,0);for(let x=u-1;x>=0;x--)p[x]=-1;const m=B.newArray(u-f,0);let g=0,_=0;for(let x=0;x<f;x++){const y=t.readInt(!0);for(;g!=y;)m[_++]=g++;p[g+t.readInt(!0)]=g++}for(;g<u;)m[_++]=g++;for(let x=u-1;x>=0;x--)p[x]==-1&&(p[x]=m[--_]);l.setFrame(c,d,p)}r.push(l)}const h=t.readInt(!0);if(h>0){const l=new Ju(h);for(let u=0;u<h;u++){const c=t.readFloat(),d=s.events[t.readInt(!0)],f=new S0(c,d);f.intValue=t.readInt(!1),f.floatValue=t.readFloat(),f.stringValue=t.readBoolean()?t.readString():d.stringValue,f.data.audioPath&&(f.volume=t.readFloat(),f.balance=t.readFloat()),l.setFrame(u,f)}r.push(l)}let o=0;for(let l=0,u=r.length;l<u;l++)o=Math.max(o,r[l].getDuration());return new Ku(e,r,o)}}B0.BlendModeValues=[W.NORMAL,W.ADD,W.MULTIPLY,W.SCREEN];let MC=class{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=n}};class FC{constructor(t=null,e=null){this.bones=t,this.vertices=e}}function Rr(i,t,e){let s=i.readFloat(),r=i.readFloat()*e;for(let n=0,a=0,h=t.getFrameCount()-1;t.setFrame(n,s,r),n!=h;n++){const o=i.readFloat(),l=i.readFloat()*e;switch(i.readByte()){case Ms:t.setStepped(n);break;case Fs:ct(i,t,a++,n,0,s,o,r,l,e)}s=o,r=l}return t}function rd(i,t,e){let s=i.readFloat(),r=i.readFloat()*e,n=i.readFloat()*e;for(let a=0,h=0,o=t.getFrameCount()-1;t.setFrame(a,s,r,n),a!=o;a++){const l=i.readFloat(),u=i.readFloat()*e,c=i.readFloat()*e;switch(i.readByte()){case Ms:t.setStepped(a);break;case Fs:ct(i,t,h++,a,0,s,l,r,u,e),ct(i,t,h++,a,1,s,l,n,c,e)}s=l,r=u,n=c}return t}function ct(i,t,e,s,r,n,a,h,o,l){t.setBezier(e,s,r,n,h,i.readFloat(),i.readFloat()*l,i.readFloat(),i.readFloat()*l,a,o)}const kC=0,BC=1,DC=2,OC=3,LC=4,NC=5,VC=6,UC=7,GC=8,XC=9,$C=0,YC=1,HC=2,WC=3,zC=4,jC=5,D0=0,qC=1,ZC=0,KC=1,QC=2,Ms=1,Fs=2;class id{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new R0,r=typeof t=="string"?JSON.parse(t):t,n=r.skeleton;if(n){s.hash=n.hash,s.version=n.spine;const a=s.version.substr(0,3);if(a!=="4.0"&&a!=="4.1"){const h=`Spine 4.1 loader cant load version ${n.spine}. Please configure your pixi-spine bundle`;console.error(h)}s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height,s.fps=n.fps,s.imagesPath=n.images}if(r.bones)for(let a=0;a<r.bones.length;a++){const h=r.bones[a];let o=null;const l=F(h,"parent",null);if(l!=null&&(o=s.findBone(l),o==null))throw new Error(`Parent bone not found: ${l}`);const u=new A0(s.bones.length,h.name,o);u.length=F(h,"length",0)*e,u.x=F(h,"x",0)*e,u.y=F(h,"y",0)*e,u.rotation=F(h,"rotation",0),u.scaleX=F(h,"scaleX",1),u.scaleY=F(h,"scaleY",1),u.shearX=F(h,"shearX",0),u.shearY=F(h,"shearY",0),u.transformMode=B.enumValue(vt,F(h,"transform","Normal")),u.skinRequired=F(h,"skin",!1);const c=F(h,"color",null);c&&u.color.setFromString(c),s.bones.push(u)}if(r.slots)for(let a=0;a<r.slots.length;a++){const h=r.slots[a],o=s.findBone(h.bone);if(!o)throw new Error(`Couldn't find bone ${h.bone} for slot ${h.name}`);const l=new M0(s.slots.length,h.name,o),u=F(h,"color",null);u&&l.color.setFromString(u);const c=F(h,"dark",null);c&&(l.darkColor=X.fromString(c)),l.attachmentName=F(h,"attachment",null),l.blendMode=id.blendModeFromString(F(h,"blend","normal")),s.slots.push(l)}if(r.ik)for(let a=0;a<r.ik.length;a++){const h=r.ik[a],o=new I0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let l=0;l<h.bones.length;l++){const u=h.bones[l],c=s.findBone(u);if(c==null)throw new Error(`IK bone not found: ${u}`);o.bones.push(c)}o.target=s.findBone(h.target),o.mix=F(h,"mix",1),o.softness=F(h,"softness",0)*e,o.bendDirection=F(h,"bendPositive",!0)?1:-1,o.compress=F(h,"compress",!1),o.stretch=F(h,"stretch",!1),o.uniform=F(h,"uniform",!1),s.ikConstraints.push(o)}if(r.transform)for(let a=0;a<r.transform.length;a++){const h=r.transform[a],o=new F0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let c=0;c<h.bones.length;c++){const d=h.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for transform constraint ${h.name}.`);o.bones.push(f)}const l=h.target,u=s.findBone(l);if(!u)throw new Error(`Couldn't find target bone ${l} for transform constraint ${h.name}.`);o.target=u,o.local=F(h,"local",!1),o.relative=F(h,"relative",!1),o.offsetRotation=F(h,"rotation",0),o.offsetX=F(h,"x",0)*e,o.offsetY=F(h,"y",0)*e,o.offsetScaleX=F(h,"scaleX",0),o.offsetScaleY=F(h,"scaleY",0),o.offsetShearY=F(h,"shearY",0),o.mixRotate=F(h,"mixRotate",1),o.mixX=F(h,"mixX",1),o.mixY=F(h,"mixY",o.mixX),o.mixScaleX=F(h,"mixScaleX",1),o.mixScaleY=F(h,"mixScaleY",o.mixScaleX),o.mixShearY=F(h,"mixShearY",1),s.transformConstraints.push(o)}if(r.path)for(let a=0;a<r.path.length;a++){const h=r.path[a],o=new P0(h.name);o.order=F(h,"order",0),o.skinRequired=F(h,"skin",!1);for(let c=0;c<h.bones.length;c++){const d=h.bones[c],f=s.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for path constraint ${h.name}.`);o.bones.push(f)}const l=h.target,u=s.findSlot(l);if(!u)throw new Error(`Couldn't find target slot ${l} for path constraint ${h.name}.`);o.target=u,o.positionMode=B.enumValue(ne,F(h,"positionMode","Percent")),o.spacingMode=B.enumValue(Rs,F(h,"spacingMode","Length")),o.rotateMode=B.enumValue(Fe,F(h,"rotateMode","Tangent")),o.offsetRotation=F(h,"rotation",0),o.position=F(h,"position",0),o.positionMode==ne.Fixed&&(o.position*=e),o.spacing=F(h,"spacing",0),(o.spacingMode==Rs.Length||o.spacingMode==Rs.Fixed)&&(o.spacing*=e),o.mixRotate=F(h,"mixRotate",1),o.mixX=F(h,"mixX",1),o.mixY=F(h,"mixY",o.mixX),s.pathConstraints.push(o)}if(r.skins)for(let a=0;a<r.skins.length;a++){const h=r.skins[a],o=new sd(h.name);if(h.bones)for(let l=0;l<h.bones.length;l++){const u=h.bones[l],c=s.findBone(u);if(!c)throw new Error(`Couldn't find bone ${u} for skin ${h.name}.`);o.bones.push(c)}if(h.ik)for(let l=0;l<h.ik.length;l++){const u=h.ik[l],c=s.findIkConstraint(u);if(!c)throw new Error(`Couldn't find IK constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}if(h.transform)for(let l=0;l<h.transform.length;l++){const u=h.transform[l],c=s.findTransformConstraint(u);if(!c)throw new Error(`Couldn't find transform constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}if(h.path)for(let l=0;l<h.path.length;l++){const u=h.path[l],c=s.findPathConstraint(u);if(!c)throw new Error(`Couldn't find path constraint ${u} for skin ${h.name}.`);o.constraints.push(c)}for(const l in h.attachments){const u=s.findSlot(l);if(!u)throw new Error(`Couldn't find slot ${l} for skin ${h.name}.`);const c=h.attachments[l];for(const d in c){const f=this.readAttachment(c[d],o,u.index,d,s);f&&o.setAttachment(u.index,d,f)}}s.skins.push(o),o.name=="default"&&(s.defaultSkin=o)}for(let a=0,h=this.linkedMeshes.length;a<h;a++){const o=this.linkedMeshes[a],l=o.skin?s.findSkin(o.skin):s.defaultSkin;if(!l)throw new Error(`Skin not found: ${o.skin}`);const u=l.getAttachment(o.slotIndex,o.parent);if(!u)throw new Error(`Parent mesh not found: ${o.parent}`);o.mesh.timelineAttachment=o.inheritTimeline?u:o.mesh,o.mesh.setParentMesh(u)}if(this.linkedMeshes.length=0,r.events)for(const a in r.events){const h=r.events[a],o=new C0(a);o.intValue=F(h,"int",0),o.floatValue=F(h,"float",0),o.stringValue=F(h,"string",""),o.audioPath=F(h,"audio",null),o.audioPath&&(o.volume=F(h,"volume",1),o.balance=F(h,"balance",0)),s.events.push(o)}if(r.animations)for(const a in r.animations){const h=r.animations[a];this.readAnimation(h,a,s)}return s}readAttachment(t,e,s,r,n){const a=this.scale;switch(r=F(t,"name",r),F(t,"type","region")){case"region":{const h=F(t,"path",r),o=this.readSequence(F(t,"sequence",null)),l=this.attachmentLoader.newRegionAttachment(e,r,h,o);if(!l)return null;l.path=h,l.x=F(t,"x",0)*a,l.y=F(t,"y",0)*a,l.scaleX=F(t,"scaleX",1),l.scaleY=F(t,"scaleY",1),l.rotation=F(t,"rotation",0),l.width=t.width*a,l.height=t.height*a,l.sequence=o;const u=F(t,"color",null);return u&&l.color.setFromString(u),l}case"boundingbox":{const h=this.attachmentLoader.newBoundingBoxAttachment(e,r);if(!h)return null;this.readVertices(t,h,t.vertexCount<<1);const o=F(t,"color",null);return o&&h.color.setFromString(o),h}case"mesh":case"linkedmesh":{const h=F(t,"path",r),o=this.readSequence(F(t,"sequence",null)),l=this.attachmentLoader.newMeshAttachment(e,r,h,o);if(!l)return null;l.path=h;const u=F(t,"color",null);u&&l.color.setFromString(u),l.width=F(t,"width",0)*a,l.height=F(t,"height",0)*a,l.sequence=o;const c=F(t,"parent",null);if(c)return this.linkedMeshes.push(new JC(l,F(t,"skin",null),s,c,F(t,"timelines",!0))),l;const d=t.uvs;return this.readVertices(t,l,d.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(d),l.edges=F(t,"edges",null),l.hullLength=F(t,"hull",0)*2,l}case"path":{const h=this.attachmentLoader.newPathAttachment(e,r);if(!h)return null;h.closed=F(t,"closed",!1),h.constantSpeed=F(t,"constantSpeed",!0);const o=t.vertexCount;this.readVertices(t,h,o<<1);const l=B.newArray(o/3,0);for(let c=0;c<t.lengths.length;c++)l[c]=t.lengths[c]*a;h.lengths=l;const u=F(t,"color",null);return u&&h.color.setFromString(u),h}case"point":{const h=this.attachmentLoader.newPointAttachment(e,r);if(!h)return null;h.x=F(t,"x",0)*a,h.y=F(t,"y",0)*a,h.rotation=F(t,"rotation",0);const o=F(t,"color",null);return o&&h.color.setFromString(o),h}case"clipping":{const h=this.attachmentLoader.newClippingAttachment(e,r);if(!h)return null;const o=F(t,"end",null);if(o!=null){const c=n.findSlot(o);if(c==null)throw new Error(`Clipping end slot not found: ${o}`);h.endSlot=c}const l=t.vertexCount;this.readVertices(t,h,l<<1);const u=F(t,"color",null);return u&&h.color.setFromString(u),h}}return null}readSequence(t){if(t==null)return null;const e=new Zu(F(t,"count",0));return e.start=F(t,"start",1),e.digits=F(t,"digits",0),e.setupIndex=F(t,"setup",0),e}readVertices(t,e,s){const r=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const o=B.toFloatArray(n);if(r!=1)for(let l=0,u=n.length;l<u;l++)o[l]*=r;e.vertices=o;return}const a=new Array,h=new Array;for(let o=0,l=n.length;o<l;){const u=n[o++];h.push(u);for(let c=o+u*4;o<c;o+=4)h.push(n[o]),a.push(n[o+1]*r),a.push(n[o+2]*r),a.push(n[o+3])}e.bones=h,e.vertices=B.toFloatArray(a)}readAnimation(t,e,s){const r=this.scale,n=new Array;if(t.slots)for(const h in t.slots){const o=t.slots[h],l=s.findSlot(h);if(!l)throw new Error(`Slot not found: ${h}`);const u=l.index;for(const c in o){const d=o[c];if(!d)continue;const f=d.length;if(c=="attachment"){const p=new m0(f,u);for(let m=0;m<f;m++){const g=d[m];p.setFrame(m,F(g,"time",0),F(g,"name",null))}n.push(p)}else if(c=="rgba"){const p=new c0(f,f<<2,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.color);for(let x=0,y=0;;x++){p.setFrame(x,g,_.r,_.g,_.b,_.a);const v=d[x+1];if(!v){p.shrink(y);break}const b=F(v,"time",0),w=X.fromString(v.color),E=m.curve;E&&(y=pt(E,p,y,x,0,g,b,_.r,w.r,1),y=pt(E,p,y,x,1,g,b,_.g,w.g,1),y=pt(E,p,y,x,2,g,b,_.b,w.b,1),y=pt(E,p,y,x,3,g,b,_.a,w.a,1)),g=b,_=w,m=v}n.push(p)}else if(c=="rgb"){const p=new u0(f,f*3,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.color);for(let x=0,y=0;;x++){p.setFrame(x,g,_.r,_.g,_.b);const v=d[x+1];if(!v){p.shrink(y);break}const b=F(v,"time",0),w=X.fromString(v.color),E=m.curve;E&&(y=pt(E,p,y,x,0,g,b,_.r,w.r,1),y=pt(E,p,y,x,1,g,b,_.g,w.g,1),y=pt(E,p,y,x,2,g,b,_.b,w.b,1)),g=b,_=w,m=v}n.push(p)}else if(c=="alpha")n.push(cr(d,new d0(f,f,u),0,1));else if(c=="rgba2"){const p=new f0(f,f*7,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.light),x=X.fromString(m.dark);for(let y=0,v=0;;y++){p.setFrame(y,g,_.r,_.g,_.b,_.a,x.r,x.g,x.b);const b=d[y+1];if(!b){p.shrink(v);break}const w=F(b,"time",0),E=X.fromString(b.light),T=X.fromString(b.dark),A=m.curve;A&&(v=pt(A,p,v,y,0,g,w,_.r,E.r,1),v=pt(A,p,v,y,1,g,w,_.g,E.g,1),v=pt(A,p,v,y,2,g,w,_.b,E.b,1),v=pt(A,p,v,y,3,g,w,_.a,E.a,1),v=pt(A,p,v,y,4,g,w,x.r,T.r,1),v=pt(A,p,v,y,5,g,w,x.g,T.g,1),v=pt(A,p,v,y,6,g,w,x.b,T.b,1)),g=w,_=E,x=T,m=b}n.push(p)}else if(c=="rgb2"){const p=new p0(f,f*6,u);let m=d[0],g=F(m,"time",0),_=X.fromString(m.light),x=X.fromString(m.dark);for(let y=0,v=0;;y++){p.setFrame(y,g,_.r,_.g,_.b,x.r,x.g,x.b);const b=d[y+1];if(!b){p.shrink(v);break}const w=F(b,"time",0),E=X.fromString(b.light),T=X.fromString(b.dark),A=m.curve;A&&(v=pt(A,p,v,y,0,g,w,_.r,E.r,1),v=pt(A,p,v,y,1,g,w,_.g,E.g,1),v=pt(A,p,v,y,2,g,w,_.b,E.b,1),v=pt(A,p,v,y,3,g,w,x.r,T.r,1),v=pt(A,p,v,y,4,g,w,x.g,T.g,1),v=pt(A,p,v,y,5,g,w,x.b,T.b,1)),g=w,_=E,x=T,m=b}n.push(p)}}}if(t.bones)for(const h in t.bones){const o=t.bones[h],l=s.findBone(h);if(!l)throw new Error(`Bone not found: ${h}`);const u=l.index;for(const c in o){const d=o[c],f=d.length;if(f!=0){if(c==="rotate")n.push(cr(d,new t0(f,f,u),0,1));else if(c==="translate"){const p=new e0(f,f<<1,u);n.push(nd(d,p,"x","y",0,r))}else if(c==="translatex"){const p=new s0(f,f,u);n.push(cr(d,p,0,r))}else if(c==="translatey"){const p=new r0(f,f,u);n.push(cr(d,p,0,r))}else if(c==="scale"){const p=new i0(f,f<<1,u);n.push(nd(d,p,"x","y",1,1))}else if(c==="scalex"){const p=new n0(f,f,u);n.push(cr(d,p,1,1))}else if(c==="scaley"){const p=new o0(f,f,u);n.push(cr(d,p,1,1))}else if(c==="shear"){const p=new a0(f,f<<1,u);n.push(nd(d,p,"x","y",0,1))}else if(c==="shearx"){const p=new l0(f,f,u);n.push(cr(d,p,0,1))}else if(c==="sheary"){const p=new h0(f,f,u);n.push(cr(d,p,0,1))}}}}if(t.ik)for(const h in t.ik){const o=t.ik[h];let l=o[0];if(!l)continue;const u=s.findIkConstraint(h);if(!u)throw new Error(`IK Constraint not found: ${h}`);const c=s.ikConstraints.indexOf(u),d=new x0(o.length,o.length<<1,c);let f=F(l,"time",0),p=F(l,"mix",1),m=F(l,"softness",0)*r;for(let g=0,_=0;;g++){d.setFrame(g,f,p,m,F(l,"bendPositive",!0)?1:-1,F(l,"compress",!1),F(l,"stretch",!1));const x=o[g+1];if(!x){d.shrink(_);break}const y=F(x,"time",0),v=F(x,"mix",1),b=F(x,"softness",0)*r,w=l.curve;w&&(_=pt(w,d,_,g,0,f,y,p,v,1),_=pt(w,d,_,g,1,f,y,m,b,r)),f=y,p=v,m=b,l=x}n.push(d)}if(t.transform)for(const h in t.transform){const o=t.transform[h];let l=o[0];if(!l)continue;const u=s.findTransformConstraint(h);if(!u)throw new Error(`Transform constraint not found: ${h}`);const c=s.transformConstraints.indexOf(u),d=new v0(o.length,o.length*6,c);let f=F(l,"time",0),p=F(l,"mixRotate",1),m=F(l,"mixX",1),g=F(l,"mixY",m),_=F(l,"mixScaleX",1),x=F(l,"mixScaleY",_);const y=F(l,"mixShearY",1);for(let v=0,b=0;;v++){d.setFrame(v,f,p,m,g,_,x,y);const w=o[v+1];if(!w){d.shrink(b);break}const E=F(w,"time",0),T=F(w,"mixRotate",1),A=F(w,"mixX",1),I=F(w,"mixY",A),M=F(w,"mixScaleX",1),R=F(w,"mixScaleY",M),C=F(w,"mixShearY",1),P=l.curve;P&&(b=pt(P,d,b,v,0,f,E,p,T,1),b=pt(P,d,b,v,1,f,E,m,A,1),b=pt(P,d,b,v,2,f,E,g,I,1),b=pt(P,d,b,v,3,f,E,_,M,1),b=pt(P,d,b,v,4,f,E,x,R,1),b=pt(P,d,b,v,5,f,E,y,C,1)),f=E,p=T,m=A,g=I,_=M,x=R,_=M,l=w}n.push(d)}if(t.path)for(const h in t.path){const o=t.path[h],l=s.findPathConstraint(h);if(!l)throw new Error(`Path constraint not found: ${h}`);const u=s.pathConstraints.indexOf(l);for(const c in o){const d=o[c];let f=d[0];if(!f)continue;const p=d.length;if(c==="position"){const m=new b0(p,p,u);n.push(cr(d,m,0,l.positionMode==ne.Fixed?r:1))}else if(c==="spacing"){const m=new w0(p,p,u);n.push(cr(d,m,0,l.spacingMode==Rs.Length||l.spacingMode==Rs.Fixed?r:1))}else if(c==="mix"){const m=new E0(p,p*3,u);let g=F(f,"time",0),_=F(f,"mixRotate",1),x=F(f,"mixX",1),y=F(f,"mixY",x);for(let v=0,b=0;;v++){m.setFrame(v,g,_,x,y);const w=d[v+1];if(!w){m.shrink(b);break}const E=F(w,"time",0),T=F(w,"mixRotate",1),A=F(w,"mixX",1),I=F(w,"mixY",A),M=f.curve;M&&(b=pt(M,m,b,v,0,g,E,_,T,1),b=pt(M,m,b,v,1,g,E,x,A,1),b=pt(M,m,b,v,2,g,E,y,I,1)),g=E,_=T,x=A,y=I,f=w}n.push(m)}}}if(t.deform){t.attachments={};for(const h in t.deform){const o=t.deform[h],l=t.attachments[h]={};for(const u in o){const c=o[u],d=l[u]={};for(const f in c)d[f]={deform:c[f]}}}}if(t.attachments)for(const h in t.attachments){const o=t.attachments[h],l=s.findSkin(h);if(l!=null)for(const u in o){const c=o[u],d=s.findSlot(u);if(!d)throw new Error(`Slot not found: ${u}`);const f=d.index;for(const p in c){const m=c[p],g=l.getAttachment(f,p);for(const _ in m){const x=m[_];let y=x[0];if(y){if(_=="deform"){const v=g.bones,b=g.vertices,w=v?b.length/3*2:b.length,E=new g0(x.length,x.length,f,g);let T=F(y,"time",0);for(let A=0,I=0;;A++){let M;const R=F(y,"vertices",null);if(!R)M=v?B.newFloatArray(w):b;else{M=B.newFloatArray(w);const U=F(y,"offset",0);if(B.arrayCopy(R,0,M,U,R.length),r!=1)for(let V=U,L=V+R.length;V<L;V++)M[V]*=r;if(!v)for(let V=0;V<w;V++)M[V]+=b[V]}E.setFrame(A,T,M);const C=x[A+1];if(!C){E.shrink(I);break}const P=F(C,"time",0),k=y.curve;k&&(I=pt(k,E,I,A,0,T,P,0,1,1)),T=P,y=C}n.push(E)}else if(_=="sequence"){const v=new Fo(x.length,f,g);let b=0;for(let w=0;w<x.length;w++){const E=F(y,"delay",b),T=F(y,"time",0),A=Pr[F(y,"mode","hold")],I=F(y,"index",0);v.setFrame(w,T,A,I,E),b=E,y=x[w+1]}n.push(v)}}}}}}if(t.drawOrder){const h=new td(t.drawOrder.length),o=s.slots.length;let l=0;for(let u=0;u<t.drawOrder.length;u++,l++){const c=t.drawOrder[u];let d=null;const f=F(c,"offsets",null);if(f){d=B.newArray(o,-1);const p=B.newArray(o-f.length,0);let m=0,g=0;for(let _=0;_<f.length;_++){const x=f[_],y=s.findSlot(x.slot);if(!y)throw new Error(`Slot not found: ${y}`);const v=y.index;for(;m!=v;)p[g++]=m++;d[m+x.offset]=m++}for(;m<o;)p[g++]=m++;for(let _=o-1;_>=0;_--)d[_]==-1&&(d[_]=p[--g])}h.setFrame(l,F(c,"time",0),d)}n.push(h)}if(t.events){const h=new Ju(t.events.length);let o=0;for(let l=0;l<t.events.length;l++,o++){const u=t.events[l],c=s.findEvent(u.name);if(!c)throw new Error(`Event not found: ${u.name}`);const d=new S0(B.toSinglePrecision(F(u,"time",0)),c);d.intValue=F(u,"int",c.intValue),d.floatValue=F(u,"float",c.floatValue),d.stringValue=F(u,"string",c.stringValue),d.data.audioPath&&(d.volume=F(u,"volume",1),d.balance=F(u,"balance",0)),h.setFrame(o,d)}n.push(h)}let a=0;for(let h=0,o=n.length;h<o;h++)a=Math.max(a,n[h].getDuration());if(isNaN(a))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new Ku(e,n,a))}static blendModeFromString(t){if(t=t.toLowerCase(),t=="normal")return W.NORMAL;if(t=="additive")return W.ADD;if(t=="multiply")return W.MULTIPLY;if(t=="screen")return W.SCREEN;throw new Error(`Unknown blend mode: ${t}`)}}class JC{constructor(t,e,s,r,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=r,this.inheritTimeline=n}}function cr(i,t,e,s){let r=i[0],n=F(r,"time",0),a=F(r,"value",e)*s,h=0;for(let o=0;;o++){t.setFrame(o,n,a);const l=i[o+1];if(!l)return t.shrink(h),t;const u=F(l,"time",0),c=F(l,"value",e)*s;r.curve&&(h=pt(r.curve,t,h,o,0,n,u,a,c,s)),n=u,a=c,r=l}}function nd(i,t,e,s,r,n){let a=i[0],h=F(a,"time",0),o=F(a,e,r)*n,l=F(a,s,r)*n,u=0;for(let c=0;;c++){t.setFrame(c,h,o,l);const d=i[c+1];if(!d)return t.shrink(u),t;const f=F(d,"time",0),p=F(d,e,r)*n,m=F(d,s,r)*n,g=a.curve;g&&(u=pt(g,t,u,c,0,h,f,o,p,n),u=pt(g,t,u,c,1,h,f,l,m,n)),h=f,o=p,l=m,a=d}}function pt(i,t,e,s,r,n,a,h,o,l){if(i=="stepped")return t.setStepped(s),e;const u=r<<2,c=i[u],d=i[u+1]*l,f=i[u+2],p=i[u+3]*l;return t.setBezier(e,s,r,n,h,c,d,f,p,a,o),e+1}function F(i,t,e){return i[t]!==void 0?i[t]:e}var ai=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.VER37=37]="VER37",i[i.VER38=38]="VER38",i[i.VER40=40]="VER40",i[i.VER41=41]="VER41",i))(ai||{});function od(i){const t=i.substr(0,3),e=Math.floor(Number(t)*10+.001);return t==="3.7"?37:t==="3.8"?38:t==="4.0"?40:t==="4.1"?41:e<37?37:0}class tI{constructor(){this.scale=1}readSkeletonData(t,e){let s=null,r=this.readVersionOldFormat(e),n=od(r);if(n===ai.VER38&&(s=new le(new k_(t))),r=this.readVersionNewFormat(e),n=od(r),(n===ai.VER40||n===ai.VER41)&&(s=new B0(new T0(t))),!s){const a=`Unsupported version of spine model ${r}, please update pixi-spine`;console.error(a)}return s.scale=this.scale,s.readSkeletonData(e)}readVersionOldFormat(t){const e=new gl(t);let s;try{e.readString(),s=e.readString()}catch{s=""}return s||""}readVersionNewFormat(t){const e=new gl(t);e.readInt32(),e.readInt32();let s;try{s=e.readString()}catch{s=""}return s||""}}class eI{constructor(){this.scale=1}readSkeletonData(t,e){const s=e.skeleton.spine,r=od(s);let n=null;if(r===ai.VER37&&(n=new PC(new xC(t))),r===ai.VER38&&(n=new tC(new k_(t))),(r===ai.VER40||r===ai.VER41)&&(n=new id(new T0(t))),!n){const a=`Unsupported version of spine model ${s}, please update pixi-spine`;console.error(a)}return n.scale=this.scale,n.readSkeletonData(e)}}class sI extends nC{createBinaryParser(){return new tI}createJsonParser(){return new eI}parseData(t,e,s){return{spineData:t.readSkeletonData(e,s),spineAtlas:e}}}new sI().installLoader();class rI extends sC{constructor(t,e){const{followPointList:s,visible:r=!1}=e||{};let n;typeof t=="string"?n=Gr.get(t).spineData:n=t.spineData,super(n),this._followDots=[],this._isStart=!1,this.visible=r,this.autoUpdate=!1,s!=null&&s.length&&(s==null||s.forEach(a=>{a.follow.alpha=0,this._followDots.push({point:this.skeleton.findBone(a.boneName),follow:a.follow,onUpdate:a.onUpdate,angleFollow:a.angleFollow||!1,scaleFollow:a.scaleFollow||!0})})),this._loopFn=this._loop.bind(this),wt.system.add(this._loopFn)}setAnimation(t="animation",e=!1){return new Promise(s=>{this.visible=!0,this.state.setAnimation(0,t,e).listener={complete:()=>{s()}}})}addAnimation(t="animation",e=!1,s=0){return new Promise(r=>{this.visible=!0,this.state.addAnimation(0,t,e,s).listener={complete:()=>{r()}}})}setSkin(t){this.skeleton.setSkinByName(t)}destroyAll(){wt.system.remove(this._loopFn),this.destroy({children:!0})}_loop(){if(this.destroyed){wt.system.remove(this._loopFn);return}this.update(wt.system.deltaMS/1e3),this._updateFollowPoint()}_updateFollowPoint(){this._followDots.length!==0&&(this._followDots.forEach(t=>{const{worldX:e,worldY:s}=t.point,r=t.point.getWorldRotationX()*(Math.PI/180),n=t.point.getWorldScaleX(),a=t.point.getWorldScaleY();t.onUpdate?t.onUpdate({x:e,y:s,rotate:r,scaleX:n,scaleY:a}):(t.angleFollow&&(t.follow.rotation=r),t.scaleFollow&&t.follow.scale.set(n,a),t.follow.position.set(e+1920/2-t.follow.width/2,s+1080/2-t.follow.height/2))}),this._isStart||(this._isStart=!0,this._followDots.forEach(t=>{xt.to(t.follow,{alpha:1,duration:.25,delay:.15})})))}}const Mr=(i,t,e,s=!1)=>{i.cursor="pointer",i.eventMode="static";const r=n=>{n.button!==2&&e(n)};s?i.once(t,r):i.on(t,r)};class iI extends Bt{constructor(t){super(),this.disabled=!1;const{texture:e,hoverTexture:s,tintColor:r,hoverTintColor:n="#fff",disabledColor:a="#999"}=t;this._texture=e,this._hoverTexture=s,this._tintColor=r,this._disabledColor=a,this._btn=new qe(e),this.addChild(this._btn),this._btn.anchor.set(.5),r&&(this._btn.tint=r),Mr(this._btn,"pointerenter",()=>{this.disabled||(this._btn.tint=n,this._hoverTexture&&(this._btn._texture=this._hoverTexture))}),Mr(this._btn,"pointerleave",()=>{this.disabled||(this._btn._texture=this._texture,r&&(this._btn.tint=r))})}toggleTexture(t,e){this._texture=t,this._hoverTexture=e,this._btn._texture=e}setDisabled(t){this.disabled=t,this._btn.tint=t?this._disabledColor:this._tintColor||"#fff",this._btn.texture=this._texture}}class nI extends Ao{constructor(t){const{sprite:e,onClick:s}=t;super(e.width,e.height),this.addChild(e),e.anchor.set(.5),e.x=e.width/2,e.y=e.height/2,Mr(this,"pointerenter",()=>{xt.to(e,{duration:.25,rotation:180*(Math.PI/180)})}),Mr(this,"pointerleave",()=>{e.alpha=1,xt.to(e,{duration:.25,rotation:0})}),Mr(this,"pointerdown",()=>{e.alpha=.5}),Mr(this,"pointerup",()=>{s()})}}class oI extends Bt{constructor(t){super(),this._maskUI=new hu({bgColor:"#000",width:1080,height:1920}),this.addChild(this._maskUI),this._maskUI.alpha=0,this._maskUI.eventMode="static",this._drawerContainer=t,this.addChild(this._drawerContainer),this._drawerContainer.y=this._maskUI.height,xt.to(this._maskUI,{duration:.25,alpha:.5}),xt.to(this._drawerContainer,{duration:.25,ease:"power1.out",y:this._maskUI.height-this._drawerContainer.height})}async close(){xt.to(this._drawerContainer,{duration:.25,y:this._maskUI.height}),await xt.to(this._maskUI,{duration:.25,delay:.125,alpha:0})}}class aI extends Bt{constructor(t){super(),this.COLLECT_TIME=5*1e3,this._nowTime=0,this._lastTime=0,this._drawCount=0,this._maxDrawCount=0,this._tempMaxDrawCount=0,this._lastCollectTime=0,this._paramTxts=[];for(let e=0;e<3;e++){const s=new Du({text:"",fontWeight:"bold",fontSize:36,shadow:["#000",45,3,5],fontColor:"#fff"});this._paramTxts[e]=s,s.x=0,s.y=s.height*e,this.addChild(s),s.alpha=.75}this._renderer=t.renderer,this._drawElements=this._renderer.gl.drawElements,this.init()}init(){this._renderer.gl.drawElements=(...t)=>{this._drawElements.call(this._renderer.gl,...t),this._drawCount++},wt.shared.add(()=>{const t=wt.system.FPS;this._nowTime=performance.now(),this._nowTime-this._lastTime>=100&&(this._setTxtInfo(0,Math.floor(t).toFixed(0)),this._lastTime=this._nowTime),this._nowTime-this._lastCollectTime<this.COLLECT_TIME?this._tempMaxDrawCount<this._drawCount&&(this._tempMaxDrawCount=this._drawCount):(this._maxDrawCount=this._tempMaxDrawCount,this._tempMaxDrawCount=0,this._lastCollectTime=this._nowTime),this._setTxtInfo(1,this._drawCount),this._setTxtInfo(2,this._maxDrawCount),this._drawCount=0},Vr.UTILITY)}_setTxtInfo(t,e){const s=a=>{this._paramTxts[t].style.fill="#fff",a<=30&&(this._paramTxts[t].style.fill="yellow"),a<=20&&(this._paramTxts[t].style.fill="red")},r=a=>{this._paramTxts[t].style.fill="#fff",a>=75&&(this._paramTxts[t].style.fill="yellow"),a>=100&&(this._paramTxts[t].style.fill="red")},n=[()=>(s(e),`Fps:${e}`),()=>(r(e),`Draw Call:${e}`),()=>(r(e),`Max Draw Call:${e}`)];this._paramTxts[t].text=n[t]()}}class lI extends Bt{constructor(t){super();const{bgWidth:e,bgHeight:s,barWidth:r,barHeight:n,bgTexture:a,barTexture:h}=t,o=new qe(a);this.addChild(o),this._progressBar=new qe(h),this.addChild(this._progressBar),this._progressBar.x=(e-r)/2,this._progressBar.y=(s-n)/2;const l=new hs;l.beginFill(16777215),l.drawRect(0,0,0,this._progressBar.height),l.endFill(),this._progressBar.addChild(l),this._progressBar.mask=l,this._maskGraphics=l}setProgress(t){const e=Math.max(0,Math.min(1,t));this._maskGraphics.clear(),this._maskGraphics.beginFill(16777215),this._maskGraphics.drawRect(0,0,this._progressBar.width*e,this._progressBar.height),this._maskGraphics.endFill()}}class hI extends Ao{constructor(t){const{width:e,height:s,scrollContent:r,bottomMargin:n=50}=t;if(super(e,s),this._startY=0,this._velocity=0,this._startTime=0,this._startPosition=0,this._scrollSpeed=200,this._isDragging=!1,this._scrollContent=r,this._content=new Bt,this.addChild(this._content),this._content.addChild(this._scrollContent),n>0){const a=new qe;this._content.addChild(a),a.y=this._content.height+n}this._maskGraphics=new hs,this.addChild(this._maskGraphics),this._maskGraphics.clear(),this._maskGraphics.beginFill(0),this._maskGraphics.drawRect(0,0,e,s),this._maskGraphics.endFill(),this.mask=this._maskGraphics,this.eventMode="static",this.on("pointerdown",this._onDragStart,this),this.on("pointermove",this._onDragMove,this),this.on("pointerup",this._onDragEnd,this),this.on("pointerupoutside",this._onDragEnd,this),this.on("wheel",this._onWheelScroll,this)}setDimensions(t,e){this._maskGraphics.clear(),this._maskGraphics.beginFill(0),this._maskGraphics.drawRect(0,0,t,e),this._maskGraphics.endFill(),this.setSize(t,e)}scrollToTop(){xt.killTweensOf(this._content),this._content.y=0}addContent(t){this._scrollContent.addChild(t)}_onDragStart(t){if(this._content.height<=this._maskGraphics.height)return;const e=t.getLocalPosition(this);this._startY=e.y-this._content.y,this._isDragging=!0,this._velocity=0,this._startTime=Date.now(),this._startPosition=this._content.y,xt.killTweensOf(this._content)}_onDragMove(t){if(this._isDragging){const s=t.getLocalPosition(this).y-this._startY;this._content.y=s}}_onDragEnd(){this._isDragging=!1;const e=Date.now()-this._startTime;e<250?(this._velocity=(this._content.y-this._startPosition)/e,this._applyInertia()):this._velocity=0,this._limitScrollRange()}_onWheelScroll(t){if(this._content.height<=this._maskGraphics.height)return;let e=this._content.y-t.deltaY*(this._scrollSpeed/100);e>0?e=0:Math.abs(e)>=this._content.height-this._maskGraphics.height&&(e=-(this._content.height-this._maskGraphics.height)),xt.to(this._content,{duration:.25,ease:"power1.out",y:e})}_applyInertia(){xt.to(this._content,{y:this._content.y+this._velocity*250,duration:.5,ease:"power1.out",onUpdate:this._limitScrollRange.bind(this)})}_limitScrollRange(){if(this._content.y>0)xt.to(this._content,{duration:.75,y:0,ease:"elastic.out"});else if(Math.abs(this._content.y)>=this._content.height-this._maskGraphics.height)if(this._content.height>this._maskGraphics.height){const t=-(this._content.height-this._maskGraphics.height);xt.to(this._content,{duration:.75,y:t,ease:"elastic.out"})}else xt.to(this._content,{duration:.25,y:0})}}class cI extends Ao{constructor(t){const{width:e,height:s,content:r,slideCallback:n,scrollCallback:a,pageNum:h,pageHeight:o}=t;super(e,s),this._currentIndex=0,this._scrollHeight=0,this._slideHeight=0,this._startY=0,this._offsetY=0,this._pageNum=0,this._startTime=new Date().getTime(),this._isDragging=!1;const l=new hs;l.beginFill(16777215),l.drawRect(0,0,this.width,this.height),l.endFill(),this.addChild(l),this.mask=l,this._scrollHeight=s,this._slideHeight=o,this._slideArea=r,this._slideCallback=n,this._scrollCallback=a,this._pageNum=h-1,this.addChild(this._slideArea),this._slideArea.x=e/2,this._slideArea.y=this._scrollHeight/2,this.eventMode="static",this.cursor="pointer",this.on("pointerdown",this._onDragStart),window.addEventListener("pointermove",this._onDragMove.bind(this)),window.addEventListener("pointerup",this._onDragEnd.bind(this))}updatePosition(t,e){this._slideArea.y=t,this._currentIndex=e}slideTo(t,e=!0){var s;t<0?(xt.to(this._slideArea,{y:this._scrollHeight/2,duration:.25,onUpdate:()=>{var r;(r=this._scrollCallback)==null||r.call(this,this._slideArea.y,this._currentIndex)}}),this._currentIndex=0):t>this._pageNum?(xt.to(this._slideArea,{y:-this._pageNum*this._slideHeight+this._scrollHeight/2,duration:.5,onUpdate:()=>{var r;(r=this._scrollCallback)==null||r.call(this,this._slideArea.y,this._currentIndex)}}),this._currentIndex=this._pageNum):(this._currentIndex=t,xt.to(this._slideArea,{y:-this._currentIndex*this._slideHeight+this._scrollHeight/2,duration:e?.25:.01,onUpdate:()=>{var r;(r=this._scrollCallback)==null||r.call(this,this._slideArea.y,this._currentIndex)}})),(s=this._slideCallback)==null||s.call(this,this._currentIndex)}setDepth(t,e,s=0){const r=e-s,n=Math.floor(Math.abs(r)/70),a=Math.abs(r)%70/70,h=n-1,o=n+1,l=n+2,u=t[n];if(u.alpha=this.lerp(.5,1,1-a),u.scale.y=this.lerp(.85,1,1-a),o<t.length){const c=t[o];c.alpha=this.lerp(.5,1,a),c.scale.y=this.lerp(.85,1,a)}if(l<t.length){const c=t[l];c.alpha=this.lerp(.1,.5,a)}if(h>=0){const c=t[h];c.alpha=this.lerp(.1,.5,1-a)}}_onDragStart(t){this._isDragging=!0,this._startY=t.data.global.y,this._offsetY=this._slideArea.y,xt.killTweensOf(this._slideArea),this._startTime=new Date().getTime()}_onDragMove(t){var a;if(!this._isDragging)return;const e=t.pageY-this._startY;let s=this._offsetY+e;const r=this._scrollHeight/2,n=-this._pageNum*this._slideHeight+this._scrollHeight/2;s>r&&(s=r),s<n&&(s=n),this._slideArea.y=s,(a=this._scrollCallback)==null||a.call(this,this._slideArea.y,this._currentIndex)}_onDragEnd(t){if(!this._isDragging)return;this._isDragging=!1;const e=new Date().getTime()-this._startTime,s=this._startY-t.pageY,r=Math.abs(s)/e,n=.275,a=this._slideHeight/2,h=Math.round(s/this._slideHeight);(Math.abs(s)>a||r>n)&&(this._currentIndex+=h),this._currentIndex<0?this._currentIndex=0:this._currentIndex>this._pageNum&&(this._currentIndex=this._pageNum),this.slideTo(this._currentIndex)}lerp(t,e,s){return t*(1-s)+e*s}}const O0=i=>{const t=new hs;return t.beginFill(16777215),t.drawRect(0,0,i.width,i.height),t.endFill(),i.addChild(t),i.mask=t,t};class uI extends Ao{constructor(t,e,s,r){super(t,e),this._currentIndex=0,this._slideWidth=0,this._startX=0,this._offsetX=0,this._pageNum=0,this._startTime=new Date().getTime(),this._isDragging=!1,O0(this),this._slideWidth=t,this._slideArea=s,this.slideCallback=r,this._pageNum=Math.floor(s.width/this._slideWidth)-1,this.addChild(s),this.eventMode="static",this.cursor="pointer",this.on("pointerdown",this._onDragStart),window.addEventListener("pointermove",this._onDragMove.bind(this)),window.addEventListener("pointerup",this._onDragEnd.bind(this))}prev(){this._slideTo(this._currentIndex-1)}next(){this._slideTo(this._currentIndex+1)}_slideTo(t){t<0?(xt.to(this._slideArea,{x:0,duration:.25}),this._currentIndex=0):t>this._pageNum?(xt.to(this._slideArea,{x:-this._pageNum*this._slideWidth,duration:.5}),this._currentIndex=this._pageNum):(this._currentIndex=t,xt.to(this._slideArea,{x:-this._currentIndex*this._slideWidth,duration:.25})),this.slideCallback(this._currentIndex,this._pageNum)}_onDragStart(t){this._isDragging=!0,this._startX=t.global.x,this._offsetX=this._slideArea.x,xt.killTweensOf(this._slideArea),this._startTime=new Date().getTime()}_onDragMove(t){if(!this._isDragging)return;const e=t.pageX-this._startX;this._slideArea.x=this._offsetX+e}_onDragEnd(t){if(!this._isDragging)return;this._isDragging=!1;const e=new Date().getTime()-this._startTime,s=this._startX-t.pageX,r=Math.abs(s)/e,n=this._slideWidth/2,a=.275;(Math.abs(s)>n||r>a)&&(s>0?this._currentIndex++:this._currentIndex--),this._slideTo(this._currentIndex)}}class dI{constructor(t,e){this._currentIndex=0,this._numsLength=0,this._isDown=!1,this._onChange=e,this._numsLength=t,window.addEventListener("pointerup",()=>{this._isDown&&this._up()})}down(t){this._isDown=!0,this._handleChange(t),this._timerId=setTimeout(()=>{this._isDown&&(this._intervalId=setInterval(()=>{this._handleChange(t)},100))},100)}updateIndex(t){this._currentIndex=t}_up(){this._isDown=!1,clearTimeout(this._timerId),clearInterval(this._intervalId)}_handleChange(t){t==="add"?this._currentIndex<this._numsLength-1&&(this._currentIndex++,this._onChange(this._currentIndex)):t==="sub"&&this._currentIndex>0&&(this._currentIndex--,this._onChange(this._currentIndex))}}class fI{constructor(t){this._betAmountListLength=0;const{initialBetIndex:e,betAmountListLength:s,onAmountIndex:r,onDisabled:n}=t;this._onAmountIndex=r,this._onDisabled=n,this._betAmountListLength=s,this._baseNumSteper=new dI(s,a=>{this._onAmountIndex(a),this.minMaxUpdateIndex(a)}),this.minMaxUpdateIndex(e),this._baseNumSteper.updateIndex(e)}min(){this.minMaxUpdateIndex(0),this._onAmountIndex(0)}max(){const t=this._betAmountListLength-1;this.minMaxUpdateIndex(t),this._onAmountIndex(t)}sub(){this._baseNumSteper.down("sub")}add(){this._baseNumSteper.down("add")}minMaxUpdateIndex(t){t===0?this._onDisabled("min"):t===this._betAmountListLength-1?this._onDisabled("max"):this._onDisabled(),this._baseNumSteper.updateIndex(t)}}const L0=(i,t,e)=>{const s=t/i.width*i.scale.x,r=e?e/i.height*i.scale.y:s,n=Math.min(s,r);i.scale.set(n>1?1:n)};class pI extends Bt{constructor(t){super();const{data:e,cellWidth:s=130,cellHeight:r=100,fontColor:n="#fff",firstColumnFontColor:a="#fff",fontSize:h=30,lineWidth:o=2,lineColor:l="#5b5b5b",outsideBorder:u=!0,fontBold:c=!0}=t;this._data=e,this._rows=e.length,this._cols=e[0].length,this._cellWidth=s,this._cellHeight=r,this._fontColor=n,this._fontSize=h,this._lineWidth=o,this._lineColor=l,this._outsideBorder=u,this._fontBold=c,this._firstColumnFontColor=a,this._drawTable(),this.fillNumbers()}_drawTable(){const t=this._cellWidth*this._cols,e=this._cellHeight*this._rows,s=new hs;s.lineStyle(this._lineWidth,this._lineColor),this._outsideBorder&&s.drawRect(0,0,t,e);for(let r=1;r<this._rows;r++)s.moveTo(0,r*this._cellHeight),s.lineTo(t,r*this._cellHeight);for(let r=1;r<this._cols;r++)s.moveTo(r*this._cellWidth,0),s.lineTo(r*this._cellWidth,e);this.addChild(s)}fillNumbers(){for(let t=0;t<this._rows;t++)for(let e=0;e<this._cols;e++){const s=this._data[t][e];this._createNumberText(s,e,t)}}_createNumberText(t,e,s){const r=new za(t.toString(),{_fontSize:this._fontSize,fill:e===0?this._firstColumnFontColor:this._fontColor,fontWeight:this._fontBold?"bold":"normal"}),n=e*this._cellWidth+this._cellWidth/2,a=s*this._cellHeight+this._cellHeight/2;this.addChild(r),r.anchor.set(.5),r.position.set(n,a),L0(r,this._cellWidth*.9)}}var ad={};/*!
1172
1172
  * howler.js v2.2.4
1173
1173
  * howlerjs.com
1174
1174
  *
@@ -1186,7 +1186,7 @@ Most likely your texture failed to load.`),x(b)}),w=await v;return t.parseData(u
1186
1186
  * goldfirestudios.com
1187
1187
  *
1188
1188
  * MIT License
1189
- */(function(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var s=this;if(!s.ctx||!s.ctx.listener)return s;for(var r=s._howls.length-1;r>=0;r--)s._howls[r].stereo(e);return s},HowlerGlobal.prototype.pos=function(e,s,r){var n=this;if(!n.ctx||!n.ctx.listener)return n;if(s=typeof s!="number"?n._pos[1]:s,r=typeof r!="number"?n._pos[2]:r,typeof e=="number")n._pos=[e,s,r],typeof n.ctx.listener.positionX<"u"?(n.ctx.listener.positionX.setTargetAtTime(n._pos[0],Howler.ctx.currentTime,.1),n.ctx.listener.positionY.setTargetAtTime(n._pos[1],Howler.ctx.currentTime,.1),n.ctx.listener.positionZ.setTargetAtTime(n._pos[2],Howler.ctx.currentTime,.1)):n.ctx.listener.setPosition(n._pos[0],n._pos[1],n._pos[2]);else return n._pos;return n},HowlerGlobal.prototype.orientation=function(e,s,r,n,a,h){var o=this;if(!o.ctx||!o.ctx.listener)return o;var l=o._orientation;if(s=typeof s!="number"?l[1]:s,r=typeof r!="number"?l[2]:r,n=typeof n!="number"?l[3]:n,a=typeof a!="number"?l[4]:a,h=typeof h!="number"?l[5]:h,typeof e=="number")o._orientation=[e,s,r,n,a,h],typeof o.ctx.listener.forwardX<"u"?(o.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),o.ctx.listener.forwardY.setTargetAtTime(s,Howler.ctx.currentTime,.1),o.ctx.listener.forwardZ.setTargetAtTime(r,Howler.ctx.currentTime,.1),o.ctx.listener.upX.setTargetAtTime(n,Howler.ctx.currentTime,.1),o.ctx.listener.upY.setTargetAtTime(a,Howler.ctx.currentTime,.1),o.ctx.listener.upZ.setTargetAtTime(h,Howler.ctx.currentTime,.1)):o.ctx.listener.setOrientation(e,s,r,n,a,h);else return l;return o},Howl.prototype.init=function(e){return function(s){var r=this;return r._orientation=s.orientation||[1,0,0],r._stereo=s.stereo||null,r._pos=s.pos||null,r._pannerAttr={coneInnerAngle:typeof s.coneInnerAngle<"u"?s.coneInnerAngle:360,coneOuterAngle:typeof s.coneOuterAngle<"u"?s.coneOuterAngle:360,coneOuterGain:typeof s.coneOuterGain<"u"?s.coneOuterGain:0,distanceModel:typeof s.distanceModel<"u"?s.distanceModel:"inverse",maxDistance:typeof s.maxDistance<"u"?s.maxDistance:1e4,panningModel:typeof s.panningModel<"u"?s.panningModel:"HRTF",refDistance:typeof s.refDistance<"u"?s.refDistance:1,rolloffFactor:typeof s.rolloffFactor<"u"?s.rolloffFactor:1},r._onstereo=s.onstereo?[{fn:s.onstereo}]:[],r._onpos=s.onpos?[{fn:s.onpos}]:[],r._onorientation=s.onorientation?[{fn:s.onorientation}]:[],e.call(this,s)}}(Howl.prototype.init),Howl.prototype.stereo=function(e,s){var r=this;if(!r._webAudio)return r;if(r._state!=="loaded")return r._queue.push({event:"stereo",action:function(){r.stereo(e,s)}}),r;var n=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof s>"u")if(typeof e=="number")r._stereo=e,r._pos=[e,0,0];else return r._stereo;for(var a=r._getSoundIds(s),h=0;h<a.length;h++){var o=r._soundById(a[h]);if(o)if(typeof e=="number")o._stereo=e,o._pos=[e,0,0],o._node&&(o._pannerAttr.panningModel="equalpower",(!o._panner||!o._panner.pan)&&t(o,n),n==="spatial"?typeof o._panner.positionX<"u"?(o._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),o._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),o._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):o._panner.setPosition(e,0,0):o._panner.pan.setValueAtTime(e,Howler.ctx.currentTime)),r._emit("stereo",o._id);else return o._stereo}return r},Howl.prototype.pos=function(e,s,r,n){var a=this;if(!a._webAudio)return a;if(a._state!=="loaded")return a._queue.push({event:"pos",action:function(){a.pos(e,s,r,n)}}),a;if(s=typeof s!="number"?0:s,r=typeof r!="number"?-.5:r,typeof n>"u")if(typeof e=="number")a._pos=[e,s,r];else return a._pos;for(var h=a._getSoundIds(n),o=0;o<h.length;o++){var l=a._soundById(h[o]);if(l)if(typeof e=="number")l._pos=[e,s,r],l._node&&((!l._panner||l._panner.pan)&&t(l,"spatial"),typeof l._panner.positionX<"u"?(l._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),l._panner.positionY.setValueAtTime(s,Howler.ctx.currentTime),l._panner.positionZ.setValueAtTime(r,Howler.ctx.currentTime)):l._panner.setPosition(e,s,r)),a._emit("pos",l._id);else return l._pos}return a},Howl.prototype.orientation=function(e,s,r,n){var a=this;if(!a._webAudio)return a;if(a._state!=="loaded")return a._queue.push({event:"orientation",action:function(){a.orientation(e,s,r,n)}}),a;if(s=typeof s!="number"?a._orientation[1]:s,r=typeof r!="number"?a._orientation[2]:r,typeof n>"u")if(typeof e=="number")a._orientation=[e,s,r];else return a._orientation;for(var h=a._getSoundIds(n),o=0;o<h.length;o++){var l=a._soundById(h[o]);if(l)if(typeof e=="number")l._orientation=[e,s,r],l._node&&(l._panner||(l._pos||(l._pos=a._pos||[0,0,-.5]),t(l,"spatial")),typeof l._panner.orientationX<"u"?(l._panner.orientationX.setValueAtTime(e,Howler.ctx.currentTime),l._panner.orientationY.setValueAtTime(s,Howler.ctx.currentTime),l._panner.orientationZ.setValueAtTime(r,Howler.ctx.currentTime)):l._panner.setOrientation(e,s,r)),a._emit("orientation",l._id);else return l._orientation}return a},Howl.prototype.pannerAttr=function(){var e=this,s=arguments,r,n,a;if(!e._webAudio)return e;if(s.length===0)return e._pannerAttr;if(s.length===1)if(typeof s[0]=="object")r=s[0],typeof n>"u"&&(r.pannerAttr||(r.pannerAttr={coneInnerAngle:r.coneInnerAngle,coneOuterAngle:r.coneOuterAngle,coneOuterGain:r.coneOuterGain,distanceModel:r.distanceModel,maxDistance:r.maxDistance,refDistance:r.refDistance,rolloffFactor:r.rolloffFactor,panningModel:r.panningModel}),e._pannerAttr={coneInnerAngle:typeof r.pannerAttr.coneInnerAngle<"u"?r.pannerAttr.coneInnerAngle:e._coneInnerAngle,coneOuterAngle:typeof r.pannerAttr.coneOuterAngle<"u"?r.pannerAttr.coneOuterAngle:e._coneOuterAngle,coneOuterGain:typeof r.pannerAttr.coneOuterGain<"u"?r.pannerAttr.coneOuterGain:e._coneOuterGain,distanceModel:typeof r.pannerAttr.distanceModel<"u"?r.pannerAttr.distanceModel:e._distanceModel,maxDistance:typeof r.pannerAttr.maxDistance<"u"?r.pannerAttr.maxDistance:e._maxDistance,refDistance:typeof r.pannerAttr.refDistance<"u"?r.pannerAttr.refDistance:e._refDistance,rolloffFactor:typeof r.pannerAttr.rolloffFactor<"u"?r.pannerAttr.rolloffFactor:e._rolloffFactor,panningModel:typeof r.pannerAttr.panningModel<"u"?r.pannerAttr.panningModel:e._panningModel});else return a=e._soundById(parseInt(s[0],10)),a?a._pannerAttr:e._pannerAttr;else s.length===2&&(r=s[0],n=parseInt(s[1],10));for(var h=e._getSoundIds(n),o=0;o<h.length;o++)if(a=e._soundById(h[o]),a){var l=a._pannerAttr;l={coneInnerAngle:typeof r.coneInnerAngle<"u"?r.coneInnerAngle:l.coneInnerAngle,coneOuterAngle:typeof r.coneOuterAngle<"u"?r.coneOuterAngle:l.coneOuterAngle,coneOuterGain:typeof r.coneOuterGain<"u"?r.coneOuterGain:l.coneOuterGain,distanceModel:typeof r.distanceModel<"u"?r.distanceModel:l.distanceModel,maxDistance:typeof r.maxDistance<"u"?r.maxDistance:l.maxDistance,refDistance:typeof r.refDistance<"u"?r.refDistance:l.refDistance,rolloffFactor:typeof r.rolloffFactor<"u"?r.rolloffFactor:l.rolloffFactor,panningModel:typeof r.panningModel<"u"?r.panningModel:l.panningModel};var u=a._panner;u||(a._pos||(a._pos=e._pos||[0,0,-.5]),t(a,"spatial"),u=a._panner),u.coneInnerAngle=l.coneInnerAngle,u.coneOuterAngle=l.coneOuterAngle,u.coneOuterGain=l.coneOuterGain,u.distanceModel=l.distanceModel,u.maxDistance=l.maxDistance,u.refDistance=l.refDistance,u.rolloffFactor=l.rolloffFactor,u.panningModel=l.panningModel}return e},Sound.prototype.init=function(e){return function(){var s=this,r=s._parent;s._orientation=r._orientation,s._stereo=r._stereo,s._pos=r._pos,s._pannerAttr=r._pannerAttr,e.call(this),s._stereo?r.stereo(s._stereo):s._pos&&r.pos(s._pos[0],s._pos[1],s._pos[2],s._id)}}(Sound.prototype.init),Sound.prototype.reset=function(e){return function(){var s=this,r=s._parent;return s._orientation=r._orientation,s._stereo=r._stereo,s._pos=r._pos,s._pannerAttr=r._pannerAttr,s._stereo?r.stereo(s._stereo):s._pos?r.pos(s._pos[0],s._pos[1],s._pos[2],s._id):s._panner&&(s._panner.disconnect(0),s._panner=void 0,r._refreshBuffer(s)),e.call(this)}}(Sound.prototype.reset);var t=function(e,s){s=s||"spatial",s==="spatial"?(e._panner=Howler.ctx.createPanner(),e._panner.coneInnerAngle=e._pannerAttr.coneInnerAngle,e._panner.coneOuterAngle=e._pannerAttr.coneOuterAngle,e._panner.coneOuterGain=e._pannerAttr.coneOuterGain,e._panner.distanceModel=e._pannerAttr.distanceModel,e._panner.maxDistance=e._pannerAttr.maxDistance,e._panner.refDistance=e._pannerAttr.refDistance,e._panner.rolloffFactor=e._pannerAttr.rolloffFactor,e._panner.panningModel=e._pannerAttr.panningModel,typeof e._panner.positionX<"u"?(e._panner.positionX.setValueAtTime(e._pos[0],Howler.ctx.currentTime),e._panner.positionY.setValueAtTime(e._pos[1],Howler.ctx.currentTime),e._panner.positionZ.setValueAtTime(e._pos[2],Howler.ctx.currentTime)):e._panner.setPosition(e._pos[0],e._pos[1],e._pos[2]),typeof e._panner.orientationX<"u"?(e._panner.orientationX.setValueAtTime(e._orientation[0],Howler.ctx.currentTime),e._panner.orientationY.setValueAtTime(e._orientation[1],Howler.ctx.currentTime),e._panner.orientationZ.setValueAtTime(e._orientation[2],Howler.ctx.currentTime)):e._panner.setOrientation(e._orientation[0],e._orientation[1],e._orientation[2])):(e._panner=Howler.ctx.createStereoPanner(),e._panner.pan.setValueAtTime(e._stereo,Howler.ctx.currentTime)),e._panner.connect(e._node),e._paused||e._parent.pause(e._id,!0).play(e._id,!0)}})()})(cd);let $0;function fI(i){return $0=i,i}function ko(){return $0}let pI=0;const ud=class extends Xs{constructor(i){super(),this.id=pI++,this.init(i)}set(i,t){if(this[i]===void 0)throw new Error(`Property with name ${i} does not exist.`);switch(i){case"speed":this.speed=t;break;case"volume":this.volume=t;break;case"paused":this.paused=t;break;case"loop":this.loop=t;break;case"muted":this.muted=t;break}return this}get progress(){const{currentTime:i}=this._source;return i/this._duration}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused()}_onPlay(){this._playing=!0}_onPause(){this._playing=!1}init(i){this._playing=!1,this._duration=i.source.duration;const t=this._source=i.source.cloneNode(!1);t.src=i.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),i.context.on("refresh",this.refresh,this),i.context.on("refreshPaused",this.refreshPaused,this),this._media=i}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause())}stop(){this._internalStop(),this._source&&this.emit("stop")}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh()}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh()}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh()}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh()}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(i){console.warn("HTML Audio does not support filters")}refresh(){const i=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;const e=i.volume*(i.muted?0:1),s=t.volume*(t.muted?0:1),r=this._volume*(this._muted?0:1);this._source.volume=r*e*s,this._source.playbackRate=this._speed*i.speed*t.speed}refreshPaused(){const i=this._media.context,t=this._media.parent,e=this._paused||t.paused||i.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e))}play(i){const{start:t,end:e,speed:s,loop:r,volume:n,muted:a}=i;e&&console.assert(e>t,"End time is before start time"),this._speed=s,this._volume=n,this._loop=!!r,this._muted=a,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=!1),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-ud.PADDING),this._end=Math.min(this._end+ud.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t,this._duration),wt.shared.add(this._onUpdate,this))},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start")}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete()}_onComplete(){wt.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this)}destroy(){wt.shared.remove(this._onUpdate,this),this.removeAllListeners();const i=this._source;i&&(i.onended=null,i.onplay=null,i.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=!1,this._end=null,this._start=0,this._duration=0,this._playing=!1,this._pausedReal=!1,this._paused=!1,this._muted=!1,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null)}toString(){return`[HTMLAudioInstance id=${this.id}]`}};let Y0=ud;Y0.PADDING=.1;class mI extends Xs{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url)}create(){return new Y0(this)}get isPlayable(){return!!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters")}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null)}get source(){return this._source}load(t){const e=this._source,s=this.parent;if(e.readyState===4){s.isLoaded=!0;const o=s.autoPlayStart();t&&setTimeout(()=>{t(null,s,o)},0);return}if(!s.url){t(new Error("sound.url or sound.source must be set"));return}e.src=s.url;const r=()=>{h(),s.isLoaded=!0;const o=s.autoPlayStart();t&&t(null,s,o)},n=()=>{h(),t&&t(new Error("Sound loading has been aborted"))},a=()=>{h();const o=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(o)):console.error(o)},h=()=>{e.removeEventListener("canplaythrough",r),e.removeEventListener("load",r),e.removeEventListener("abort",n),e.removeEventListener("error",a)};e.addEventListener("canplaythrough",r,!1),e.addEventListener("load",r,!1),e.addEventListener("abort",n,!1),e.addEventListener("error",a,!1),e.load()}}class gI{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time")}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null}}const xl=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],_I=["audio/mpeg","audio/ogg"],vl={};function yI(i){const t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...i||{}},e=document.createElement("audio"),s={},r=/^no$/;xl.forEach(n=>{const a=e.canPlayType(`audio/${n}`).replace(r,""),h=t[n]?e.canPlayType(t[n]).replace(r,""):"";s[n]=!!a||!!h}),Object.assign(vl,s)}yI();class dd{static setParamValue(t,e){if(t.setValueAtTime){const s=ko().context;t.setValueAtTime(e,s.audioContext.currentTime)}else t.value=e;return e}}let xI=0;class vI extends Xs{constructor(t){super(),this.id=xI++,this._media=null,this._paused=!1,this._muted=!1,this._elapsed=0,this.init(t)}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case"speed":this.speed=e;break;case"volume":this.volume=e;break;case"muted":this.muted=e;break;case"loop":this.loop=e;break;case"paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"))}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(!0)}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh()}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh()}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh()}get filters(){return this._filters}set filters(t){var e;this._filters&&((e=this._filters)==null||e.filter(s=>s).forEach(s=>s.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t!=null&&t.length?t.slice(0):null,this.refresh()}refresh(){if(!this._source)return;const t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;const s=t.volume*(t.muted?0:1),r=e.volume*(e.muted?0:1),n=this._volume*(this._muted?0:1);dd.setParamValue(this._gain.gain,n*r*s),dd.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters()}applyFilters(){var t;if((t=this._filters)!=null&&t.length){this._source.disconnect();let e=this._source;this._filters.forEach(s=>{e.connect(s.destination),e=s}),e.connect(this._gain)}}refreshPaused(){const t=this._media.context,e=this._media.parent,s=this._paused||e.paused||t.paused;s!==this._pausedReal&&(this._pausedReal=s,s?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",s))}play(t){const{start:e,end:s,speed:r,loop:n,volume:a,muted:h,filters:o}=t;s&&console.assert(s>e,"End time is before start time"),this._paused=!1;const{source:l,gain:u}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=u,this._speed=r,this._volume=a,this._loop=!!n,this._muted=h,this._filters=o,this.refresh();const c=this._source.buffer.duration;this._duration=c,this._end=s,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=s,this._source.loopStart=e,this._source.start(0,e)):s?this._source.start(0,e,s-e):this._source.start(0,e),this.emit("start"),this._update(!0),this.enableTicker(!0)}enableTicker(t){wt.shared.remove(this._updateListener,this),t&&wt.shared.add(this._updateListener,this)}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused()}destroy(){var t;this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),(t=this._filters)==null||t.forEach(e=>e.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=!1,this._elapsed=0,this._duration=0,this._paused=!1,this._muted=!1,this._pausedReal=!1}toString(){return`[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update()}_update(t=!1){if(this._source){const e=this._now(),s=e-this._lastUpdate;if(s>0||t){const r=this._source.playbackRate.value;this._elapsed+=s*r,this._lastUpdate=e;const n=this._duration;let a;if(this._source.loopStart){const h=this._source.loopEnd-this._source.loopStart;a=(this._source.loopStart+this._elapsed%h)/n}else a=this._elapsed%n/n;this._progress=a,this.emit("progress",this._progress,n)}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this)}_internalStop(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}this._source=null}}_onComplete(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this)}}class H0{constructor(t,e){this._output=e,this._input=t}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect()}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(s=>{e===null?this._input.connect(s.destination):e.connect(s.destination),e=s}),e.connect(this._output)}}destroy(){this.filters=null,this._input=null,this._output=null}}const W0=class extends H0{constructor(i){const t=i.audioContext,e=t.createBufferSource(),s=t.createGain(),r=t.createAnalyser();e.connect(r),r.connect(s),s.connect(i.destination),super(r,s),this.context=i,this.bufferSource=e,this.gain=s,this.analyser=r}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(W0.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null}cloneBufferSource(){const i=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=i.buffer,dd.setParamValue(t.playbackRate,i.playbackRate.value),t.loop=i.loop;const e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}};let z0=W0;z0.BUFFER_SIZE=0;class bI{init(t){this.parent=t,this._nodes=new z0(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}this._source=null,this.source=null}create(){return new vI(this)}get context(){return this.parent.context}get isPlayable(){return!!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set")}async _loadUrl(t){const e=this.parent.url,s=await z.ADAPTER.fetch(e);this._decode(await s.arrayBuffer(),t)}_decode(t,e){const s=(r,n)=>{if(r)e&&e(r);else{this.parent.isLoaded=!0,this.buffer=n;const a=this.parent.autoPlayStart();e&&e(null,this.parent,a)}};t instanceof AudioBuffer?s(null,t):this.parent.context.decode(t,s)}}const Fn=class{static from(i){let t={};typeof i=="string"?t.url=i:i instanceof ArrayBuffer||i instanceof AudioBuffer||i instanceof HTMLAudioElement?t.source=i:Array.isArray(i)?t.url=i:t=i,t={autoPlay:!1,singleInstance:!1,url:null,source:null,preload:!1,volume:1,speed:1,complete:null,loaded:null,loop:!1,...t},Object.freeze(t);const e=ko().useLegacy?new mI:new bI;return new Fn(e,t)}constructor(i,t){this.media=i,this.options=t,this._instances=[],this._sprites={},this.media.init(this);const e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=!1,this._preloadQueue=null,this.isPlaying=!1,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded)}preferUrl(i){const[t]=i.map(e=>({url:e,ext:bt.extname(e).slice(1)})).filter(({ext:e})=>vl[e]).sort((e,s)=>xl.indexOf(e.ext)-xl.indexOf(s.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return ko().context}pause(){return this.isPlaying=!1,this.paused=!0,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=!1,this}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused()}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh()}get filters(){return this.media.filters}set filters(i){this.media.filters=i}addSprites(i,t){if(typeof i=="object"){const s={};for(const r in i)s[r]=this.addSprites(r,i[r]);return s}console.assert(!this._sprites[i],`Alias ${i} is already taken`);const e=new gI(this,t);return this._sprites[i]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null}removeSprites(i){if(i){const t=this._sprites[i];t!==void 0&&(t.destroy(),delete this._sprites[i])}else for(const t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=!1,this._autoPlayOptions=null,this;this.isPlaying=!1;for(let i=this._instances.length-1;i>=0;i--)this._instances[i].stop();return this}play(i,t){let e;if(typeof i=="string"?e={sprite:i,loop:this.loop,complete:t}:typeof i=="function"?(e={},e.complete=i):e=i,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:!1,loop:!1,...e||{}},e.sprite){const r=e.sprite;console.assert(!!this._sprites[r],`Alias ${r} is not available`);const n=this._sprites[r];e.start=n.start+(e.start||0),e.end=n.end,e.speed=n.speed||1,e.loop=n.loop||e.loop,delete e.sprite}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(r=>{this._preloadQueue.push(()=>{r(this.play(e))})}):(this._preloadQueue=[],this.autoPlay=!0,this._autoPlayOptions=e,new Promise((r,n)=>{this._preload((a,h,o)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,a?n(a):(e.loaded&&e.loaded(a,h,o),r(o))})}));(this.singleInstance||e.singleInstance)&&this._removeInstances();const s=this._createInstance();return this._instances.push(s),this.isPlaying=!0,s.once("end",()=>{e.complete&&e.complete(this),this._onComplete(s)}),s.once("stop",()=>{this._onComplete(s)}),s.play(e),s}refresh(){const i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refresh()}refreshPaused(){const i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refreshPaused()}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh()}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh()}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh()}_preload(i){this.media.load(i)}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let i;return this.autoPlay&&(i=this.play(this._autoPlayOptions)),i}_removeInstances(){for(let i=this._instances.length-1;i>=0;i--)this._poolInstance(this._instances[i]);this._instances.length=0}_onComplete(i){if(this._instances){const t=this._instances.indexOf(i);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0}this._poolInstance(i)}_createInstance(){if(Fn._pool.length>0){const i=Fn._pool.pop();return i.init(this.media),i}return this.media.create()}_poolInstance(i){i.destroy(),Fn._pool.indexOf(i)<0&&Fn._pool.push(i)}};let bl=Fn;bl._pool=[];class wI extends Xs{constructor(){super(...arguments),this.speed=1,this.muted=!1,this.volume=1,this.paused=!1}refresh(){this.emit("refresh")}refreshPaused(){this.emit("refreshPaused")}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters")}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners()}}class Bo extends H0{constructor(){const t=window,e=new Bo.AudioContext,s=e.createDynamicsCompressor(),r=e.createAnalyser();r.connect(s),s.connect(e.destination),super(r,s),this.autoPause=!0,this._ctx=e,this._offlineCtx=new Bo.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=s,this.analyser=r,this.events=new Xs,this.volume=1,this.speed=1,this.muted=!1,this.paused=!1,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,!0),document.addEventListener("touchstart",this._unlock,!0),document.addEventListener("touchend",this._unlock,!0)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur)}onFocus(){if(!this.autoPause)return;const t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused())}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=!0,this.refreshPaused()))}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,!0),document.removeEventListener("touchend",this._unlock,!0),document.removeEventListener("touchstart",this._unlock,!0),this._locked=!1))}playEmptySound(){const t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume()}static get AudioContext(){const t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){const t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();const t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t}get paused(){return this._paused}refresh(){this.events.emit("refresh")}refreshPaused(){this.events.emit("refreshPaused")}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){const s=n=>{e(new Error((n==null?void 0:n.message)||"Unable to decode file"))},r=this._offlineCtx.decodeAudioData(t,n=>{e(null,n)},s);r&&r.catch(s)}}class EI{constructor(){this.init()}init(){return this.supported&&(this._webAudioContext=new Bo),this._htmlAudioContext=new wI,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t)}get supported(){return Bo.AudioContext!==null}add(t,e){if(typeof t=="object"){const n={};for(const a in t){const h=this._getOptions(t[a],e);n[a]=this.add(a,h)}return n}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof bl)return this._sounds[t]=e,e;const s=this._getOptions(e),r=bl.from(s);return this._sounds[t]=r,r}_getOptions(t,e){let s;return typeof t=="string"?s={url:t}:Array.isArray(t)?s={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?s={source:t}:s=t,s={...s,...e||{}},s}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext}get disableAutoPause(){return!this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t}remove(t){return this.exists(t,!0),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh()}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh()}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=!0,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=!1,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=!0,this._context.refresh(),this}unmuteAll(){return this._context.muted=!1,this._context.refresh(),this}removeAll(){for(const t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(const t in this._sounds)this._sounds[t].stop();return this}exists(t,e=!1){const s=!!this._sounds[t];return e&&console.assert(s,`No sound matching alias '${t}'.`),s}isPlaying(){for(const t in this._sounds)if(this._sounds[t].isPlaying)return!0;return!1}find(t){return this.exists(t,!0),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){const s=this.find(t);return e!==void 0&&(s.volume=e),s.volume}speed(t,e){const s=this.find(t);return e!==void 0&&(s.speed=e),s.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}}const j0=i=>{var e;const t=i.src;return((e=i==null?void 0:i.alias)==null?void 0:e[0])??bt.basename(t,bt.extname(t))},TI={extension:Y.Asset,detection:{test:async()=>!0,add:async i=>[...i,...xl.filter(t=>vl[t])],remove:async i=>i.filter(t=>i.includes(t))},loader:{extension:{type:[Y.LoadParser],priority:Ne.High},test(i){const t=bt.extname(i).slice(1);return!!vl[t]||_I.some(e=>i.startsWith(`data:${e}`))},async load(i,t){const e=await new Promise((s,r)=>bl.from({...t.data,url:i,preload:!0,loaded(n,a){var h,o;n?r(n):s(a),(o=(h=t.data)==null?void 0:h.loaded)==null||o.call(h,n,a)}}));return ko().add(j0(t),e),e},async unload(i,t){ko().remove(j0(t))}}};K.add(TI),fI(new EI);class AI{constructor(){this.effectEnabled=!0,this.musicEnabled=!0,this._isMusicPaused=!1,this._isBackground=!1,this._playingList=[],this._setPlayStatus=t=>{var e,s;t?!this._isMusicPaused&&((e=this._musicPlayer)==null||e.play()):(s=this._musicPlayer)==null||s.pause(),this._playingList.forEach(r=>{t?r.audio.play():r.audio.pause()})},document.addEventListener("visibilitychange",()=>{this._isBackground=document.hidden,this._setPlayStatus(!document.hidden)})}playEffect(t,e){return new Promise(s=>{const r=Math.random(),n=Gr.get(t).url,a=new cd.Howl({src:n,mute:this._isBackground||!this.effectEnabled});if(a.play(),a.on("end",()=>{this._playingList=this._playingList.filter(h=>h.id!==r),s()}),e){const o=a.duration()-e;a.seek(o)}this._playingList.push({id:r,audio:a,url:n})})}async playMusic(t){const e=Gr.get(t).url;this._musicPlayer&&(xt.killTweensOf(this._musicPlayer),await xt.to(this._musicPlayer,{volume:0,duration:1,ease:"linear"}),this._musicPlayer.stop()),this._musicPlayer=new cd.Howl({src:e,loop:!0,volume:0,mute:this._isBackground||!this.musicEnabled}),this._musicPlayer.play(),this._isMusicPaused=!1,xt.killTweensOf(this._musicPlayer),xt.to(this._musicPlayer,{volume:1,duration:1,ease:"linear"})}pauseMusic(){var t;this._isMusicPaused=!0,(t=this._musicPlayer)==null||t.pause()}resumeMusic(){var t,e;this._isMusicPaused=!1,!((t=this._musicPlayer)!=null&&t.playing())&&((e=this._musicPlayer)==null||e.play())}stopEffect(t){const e=Gr.get(t).url;this._playingList.forEach(s=>{s.url===e&&s.audio.stop()}),this._playingList=this._playingList.filter(s=>s.url!==e)}setEffectEnabled(t){this.effectEnabled=t,this._setEffectMute(!t)}setMusicEnabled(t){this.musicEnabled=t,this._setMusicMute(!t)}_setMusicMute(t){var e;(e=this._musicPlayer)==null||e.mute(t||!this.musicEnabled)}_setEffectMute(t){this._playingList.forEach(e=>{e.audio.mute(t||!this.effectEnabled)})}}const SI=i=>{const{texture:t,dotWidth:e,width:s,height:r}=i;let n=[];Array.isArray(e)?n=e:n=[e,e,e,e];const a=new PT(t,n[0],n[1],n[2],n[3]);return a.width=s,a.height=r,a},CI=(i,t,e)=>{let s=!1;return i.cursor="pointer",i.eventMode="static",i.on(t,r=>{s||r.button!==2&&e(r)}),()=>{s=!0}},II=(i,t,e=0)=>parseFloat((Math.random()*(t-i)+i).toFixed(e)),PI=(i,t)=>{let e=0;const s=new wt,r=n=>{e+=n*s.deltaMS;let a=0;Array.isArray(t)?a=II(t[0],t[1],2):a=t,e>=a&&(i(),e=0)};return s.add(r),s.start(),()=>{s.remove(r),s.stop()}},RI=(i,t,e)=>{const s=r=>{const n=t.getBounds().contains(r.clientX,r.clientY),a=i.getBounds().contains(r.clientX,r.clientY);!n&&!a&&i.visible&&(e(),window.removeEventListener("pointerdown",s))};return window.addEventListener("pointerdown",s),()=>{window.removeEventListener("pointerdown",s)}},MI=(i=1,t)=>new Promise(e=>{let s=0;const r=new wt,n=()=>{s+=r.deltaMS,s>=i&&(t==null||t(),r.destroy(),e())};r.add(n),r.start()}),FI=(i,t)=>{let e;if(i==="brightness")e=new hn,e.brightness(t,!1);else if(i==="blur")e=new um;else if(i==="desaturate")e=new hn,e.desaturate();else if(i==="contrast")e=new hn,e.contrast(t,!1);else throw new Error("未知滤镜名称");return e.resolution=window.devicePixelRatio||1,e};var kI=`attribute vec2 aVertexPosition;
1189
+ */(function(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var s=this;if(!s.ctx||!s.ctx.listener)return s;for(var r=s._howls.length-1;r>=0;r--)s._howls[r].stereo(e);return s},HowlerGlobal.prototype.pos=function(e,s,r){var n=this;if(!n.ctx||!n.ctx.listener)return n;if(s=typeof s!="number"?n._pos[1]:s,r=typeof r!="number"?n._pos[2]:r,typeof e=="number")n._pos=[e,s,r],typeof n.ctx.listener.positionX<"u"?(n.ctx.listener.positionX.setTargetAtTime(n._pos[0],Howler.ctx.currentTime,.1),n.ctx.listener.positionY.setTargetAtTime(n._pos[1],Howler.ctx.currentTime,.1),n.ctx.listener.positionZ.setTargetAtTime(n._pos[2],Howler.ctx.currentTime,.1)):n.ctx.listener.setPosition(n._pos[0],n._pos[1],n._pos[2]);else return n._pos;return n},HowlerGlobal.prototype.orientation=function(e,s,r,n,a,h){var o=this;if(!o.ctx||!o.ctx.listener)return o;var l=o._orientation;if(s=typeof s!="number"?l[1]:s,r=typeof r!="number"?l[2]:r,n=typeof n!="number"?l[3]:n,a=typeof a!="number"?l[4]:a,h=typeof h!="number"?l[5]:h,typeof e=="number")o._orientation=[e,s,r,n,a,h],typeof o.ctx.listener.forwardX<"u"?(o.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),o.ctx.listener.forwardY.setTargetAtTime(s,Howler.ctx.currentTime,.1),o.ctx.listener.forwardZ.setTargetAtTime(r,Howler.ctx.currentTime,.1),o.ctx.listener.upX.setTargetAtTime(n,Howler.ctx.currentTime,.1),o.ctx.listener.upY.setTargetAtTime(a,Howler.ctx.currentTime,.1),o.ctx.listener.upZ.setTargetAtTime(h,Howler.ctx.currentTime,.1)):o.ctx.listener.setOrientation(e,s,r,n,a,h);else return l;return o},Howl.prototype.init=function(e){return function(s){var r=this;return r._orientation=s.orientation||[1,0,0],r._stereo=s.stereo||null,r._pos=s.pos||null,r._pannerAttr={coneInnerAngle:typeof s.coneInnerAngle<"u"?s.coneInnerAngle:360,coneOuterAngle:typeof s.coneOuterAngle<"u"?s.coneOuterAngle:360,coneOuterGain:typeof s.coneOuterGain<"u"?s.coneOuterGain:0,distanceModel:typeof s.distanceModel<"u"?s.distanceModel:"inverse",maxDistance:typeof s.maxDistance<"u"?s.maxDistance:1e4,panningModel:typeof s.panningModel<"u"?s.panningModel:"HRTF",refDistance:typeof s.refDistance<"u"?s.refDistance:1,rolloffFactor:typeof s.rolloffFactor<"u"?s.rolloffFactor:1},r._onstereo=s.onstereo?[{fn:s.onstereo}]:[],r._onpos=s.onpos?[{fn:s.onpos}]:[],r._onorientation=s.onorientation?[{fn:s.onorientation}]:[],e.call(this,s)}}(Howl.prototype.init),Howl.prototype.stereo=function(e,s){var r=this;if(!r._webAudio)return r;if(r._state!=="loaded")return r._queue.push({event:"stereo",action:function(){r.stereo(e,s)}}),r;var n=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof s>"u")if(typeof e=="number")r._stereo=e,r._pos=[e,0,0];else return r._stereo;for(var a=r._getSoundIds(s),h=0;h<a.length;h++){var o=r._soundById(a[h]);if(o)if(typeof e=="number")o._stereo=e,o._pos=[e,0,0],o._node&&(o._pannerAttr.panningModel="equalpower",(!o._panner||!o._panner.pan)&&t(o,n),n==="spatial"?typeof o._panner.positionX<"u"?(o._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),o._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),o._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):o._panner.setPosition(e,0,0):o._panner.pan.setValueAtTime(e,Howler.ctx.currentTime)),r._emit("stereo",o._id);else return o._stereo}return r},Howl.prototype.pos=function(e,s,r,n){var a=this;if(!a._webAudio)return a;if(a._state!=="loaded")return a._queue.push({event:"pos",action:function(){a.pos(e,s,r,n)}}),a;if(s=typeof s!="number"?0:s,r=typeof r!="number"?-.5:r,typeof n>"u")if(typeof e=="number")a._pos=[e,s,r];else return a._pos;for(var h=a._getSoundIds(n),o=0;o<h.length;o++){var l=a._soundById(h[o]);if(l)if(typeof e=="number")l._pos=[e,s,r],l._node&&((!l._panner||l._panner.pan)&&t(l,"spatial"),typeof l._panner.positionX<"u"?(l._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),l._panner.positionY.setValueAtTime(s,Howler.ctx.currentTime),l._panner.positionZ.setValueAtTime(r,Howler.ctx.currentTime)):l._panner.setPosition(e,s,r)),a._emit("pos",l._id);else return l._pos}return a},Howl.prototype.orientation=function(e,s,r,n){var a=this;if(!a._webAudio)return a;if(a._state!=="loaded")return a._queue.push({event:"orientation",action:function(){a.orientation(e,s,r,n)}}),a;if(s=typeof s!="number"?a._orientation[1]:s,r=typeof r!="number"?a._orientation[2]:r,typeof n>"u")if(typeof e=="number")a._orientation=[e,s,r];else return a._orientation;for(var h=a._getSoundIds(n),o=0;o<h.length;o++){var l=a._soundById(h[o]);if(l)if(typeof e=="number")l._orientation=[e,s,r],l._node&&(l._panner||(l._pos||(l._pos=a._pos||[0,0,-.5]),t(l,"spatial")),typeof l._panner.orientationX<"u"?(l._panner.orientationX.setValueAtTime(e,Howler.ctx.currentTime),l._panner.orientationY.setValueAtTime(s,Howler.ctx.currentTime),l._panner.orientationZ.setValueAtTime(r,Howler.ctx.currentTime)):l._panner.setOrientation(e,s,r)),a._emit("orientation",l._id);else return l._orientation}return a},Howl.prototype.pannerAttr=function(){var e=this,s=arguments,r,n,a;if(!e._webAudio)return e;if(s.length===0)return e._pannerAttr;if(s.length===1)if(typeof s[0]=="object")r=s[0],typeof n>"u"&&(r.pannerAttr||(r.pannerAttr={coneInnerAngle:r.coneInnerAngle,coneOuterAngle:r.coneOuterAngle,coneOuterGain:r.coneOuterGain,distanceModel:r.distanceModel,maxDistance:r.maxDistance,refDistance:r.refDistance,rolloffFactor:r.rolloffFactor,panningModel:r.panningModel}),e._pannerAttr={coneInnerAngle:typeof r.pannerAttr.coneInnerAngle<"u"?r.pannerAttr.coneInnerAngle:e._coneInnerAngle,coneOuterAngle:typeof r.pannerAttr.coneOuterAngle<"u"?r.pannerAttr.coneOuterAngle:e._coneOuterAngle,coneOuterGain:typeof r.pannerAttr.coneOuterGain<"u"?r.pannerAttr.coneOuterGain:e._coneOuterGain,distanceModel:typeof r.pannerAttr.distanceModel<"u"?r.pannerAttr.distanceModel:e._distanceModel,maxDistance:typeof r.pannerAttr.maxDistance<"u"?r.pannerAttr.maxDistance:e._maxDistance,refDistance:typeof r.pannerAttr.refDistance<"u"?r.pannerAttr.refDistance:e._refDistance,rolloffFactor:typeof r.pannerAttr.rolloffFactor<"u"?r.pannerAttr.rolloffFactor:e._rolloffFactor,panningModel:typeof r.pannerAttr.panningModel<"u"?r.pannerAttr.panningModel:e._panningModel});else return a=e._soundById(parseInt(s[0],10)),a?a._pannerAttr:e._pannerAttr;else s.length===2&&(r=s[0],n=parseInt(s[1],10));for(var h=e._getSoundIds(n),o=0;o<h.length;o++)if(a=e._soundById(h[o]),a){var l=a._pannerAttr;l={coneInnerAngle:typeof r.coneInnerAngle<"u"?r.coneInnerAngle:l.coneInnerAngle,coneOuterAngle:typeof r.coneOuterAngle<"u"?r.coneOuterAngle:l.coneOuterAngle,coneOuterGain:typeof r.coneOuterGain<"u"?r.coneOuterGain:l.coneOuterGain,distanceModel:typeof r.distanceModel<"u"?r.distanceModel:l.distanceModel,maxDistance:typeof r.maxDistance<"u"?r.maxDistance:l.maxDistance,refDistance:typeof r.refDistance<"u"?r.refDistance:l.refDistance,rolloffFactor:typeof r.rolloffFactor<"u"?r.rolloffFactor:l.rolloffFactor,panningModel:typeof r.panningModel<"u"?r.panningModel:l.panningModel};var u=a._panner;u||(a._pos||(a._pos=e._pos||[0,0,-.5]),t(a,"spatial"),u=a._panner),u.coneInnerAngle=l.coneInnerAngle,u.coneOuterAngle=l.coneOuterAngle,u.coneOuterGain=l.coneOuterGain,u.distanceModel=l.distanceModel,u.maxDistance=l.maxDistance,u.refDistance=l.refDistance,u.rolloffFactor=l.rolloffFactor,u.panningModel=l.panningModel}return e},Sound.prototype.init=function(e){return function(){var s=this,r=s._parent;s._orientation=r._orientation,s._stereo=r._stereo,s._pos=r._pos,s._pannerAttr=r._pannerAttr,e.call(this),s._stereo?r.stereo(s._stereo):s._pos&&r.pos(s._pos[0],s._pos[1],s._pos[2],s._id)}}(Sound.prototype.init),Sound.prototype.reset=function(e){return function(){var s=this,r=s._parent;return s._orientation=r._orientation,s._stereo=r._stereo,s._pos=r._pos,s._pannerAttr=r._pannerAttr,s._stereo?r.stereo(s._stereo):s._pos?r.pos(s._pos[0],s._pos[1],s._pos[2],s._id):s._panner&&(s._panner.disconnect(0),s._panner=void 0,r._refreshBuffer(s)),e.call(this)}}(Sound.prototype.reset);var t=function(e,s){s=s||"spatial",s==="spatial"?(e._panner=Howler.ctx.createPanner(),e._panner.coneInnerAngle=e._pannerAttr.coneInnerAngle,e._panner.coneOuterAngle=e._pannerAttr.coneOuterAngle,e._panner.coneOuterGain=e._pannerAttr.coneOuterGain,e._panner.distanceModel=e._pannerAttr.distanceModel,e._panner.maxDistance=e._pannerAttr.maxDistance,e._panner.refDistance=e._pannerAttr.refDistance,e._panner.rolloffFactor=e._pannerAttr.rolloffFactor,e._panner.panningModel=e._pannerAttr.panningModel,typeof e._panner.positionX<"u"?(e._panner.positionX.setValueAtTime(e._pos[0],Howler.ctx.currentTime),e._panner.positionY.setValueAtTime(e._pos[1],Howler.ctx.currentTime),e._panner.positionZ.setValueAtTime(e._pos[2],Howler.ctx.currentTime)):e._panner.setPosition(e._pos[0],e._pos[1],e._pos[2]),typeof e._panner.orientationX<"u"?(e._panner.orientationX.setValueAtTime(e._orientation[0],Howler.ctx.currentTime),e._panner.orientationY.setValueAtTime(e._orientation[1],Howler.ctx.currentTime),e._panner.orientationZ.setValueAtTime(e._orientation[2],Howler.ctx.currentTime)):e._panner.setOrientation(e._orientation[0],e._orientation[1],e._orientation[2])):(e._panner=Howler.ctx.createStereoPanner(),e._panner.pan.setValueAtTime(e._stereo,Howler.ctx.currentTime)),e._panner.connect(e._node),e._paused||e._parent.pause(e._id,!0).play(e._id,!0)}})()})(ad);let N0;function mI(i){return N0=i,i}function ko(){return N0}let gI=0;const ld=class extends Xs{constructor(i){super(),this.id=gI++,this.init(i)}set(i,t){if(this[i]===void 0)throw new Error(`Property with name ${i} does not exist.`);switch(i){case"speed":this.speed=t;break;case"volume":this.volume=t;break;case"paused":this.paused=t;break;case"loop":this.loop=t;break;case"muted":this.muted=t;break}return this}get progress(){const{currentTime:i}=this._source;return i/this._duration}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused()}_onPlay(){this._playing=!0}_onPause(){this._playing=!1}init(i){this._playing=!1,this._duration=i.source.duration;const t=this._source=i.source.cloneNode(!1);t.src=i.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),i.context.on("refresh",this.refresh,this),i.context.on("refreshPaused",this.refreshPaused,this),this._media=i}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause())}stop(){this._internalStop(),this._source&&this.emit("stop")}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh()}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh()}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh()}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh()}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(i){console.warn("HTML Audio does not support filters")}refresh(){const i=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;const e=i.volume*(i.muted?0:1),s=t.volume*(t.muted?0:1),r=this._volume*(this._muted?0:1);this._source.volume=r*e*s,this._source.playbackRate=this._speed*i.speed*t.speed}refreshPaused(){const i=this._media.context,t=this._media.parent,e=this._paused||t.paused||i.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e))}play(i){const{start:t,end:e,speed:s,loop:r,volume:n,muted:a}=i;e&&console.assert(e>t,"End time is before start time"),this._speed=s,this._volume=n,this._loop=!!r,this._muted=a,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=!1),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-ld.PADDING),this._end=Math.min(this._end+ld.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t,this._duration),wt.shared.add(this._onUpdate,this))},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start")}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete()}_onComplete(){wt.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this)}destroy(){wt.shared.remove(this._onUpdate,this),this.removeAllListeners();const i=this._source;i&&(i.onended=null,i.onplay=null,i.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=!1,this._end=null,this._start=0,this._duration=0,this._playing=!1,this._pausedReal=!1,this._paused=!1,this._muted=!1,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null)}toString(){return`[HTMLAudioInstance id=${this.id}]`}};let V0=ld;V0.PADDING=.1;class _I extends Xs{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url)}create(){return new V0(this)}get isPlayable(){return!!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters")}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null)}get source(){return this._source}load(t){const e=this._source,s=this.parent;if(e.readyState===4){s.isLoaded=!0;const o=s.autoPlayStart();t&&setTimeout(()=>{t(null,s,o)},0);return}if(!s.url){t(new Error("sound.url or sound.source must be set"));return}e.src=s.url;const r=()=>{h(),s.isLoaded=!0;const o=s.autoPlayStart();t&&t(null,s,o)},n=()=>{h(),t&&t(new Error("Sound loading has been aborted"))},a=()=>{h();const o=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(o)):console.error(o)},h=()=>{e.removeEventListener("canplaythrough",r),e.removeEventListener("load",r),e.removeEventListener("abort",n),e.removeEventListener("error",a)};e.addEventListener("canplaythrough",r,!1),e.addEventListener("load",r,!1),e.addEventListener("abort",n,!1),e.addEventListener("error",a,!1),e.load()}}class yI{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time")}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null}}const xl=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],xI=["audio/mpeg","audio/ogg"],vl={};function vI(i){const t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...i||{}},e=document.createElement("audio"),s={},r=/^no$/;xl.forEach(n=>{const a=e.canPlayType(`audio/${n}`).replace(r,""),h=t[n]?e.canPlayType(t[n]).replace(r,""):"";s[n]=!!a||!!h}),Object.assign(vl,s)}vI();class hd{static setParamValue(t,e){if(t.setValueAtTime){const s=ko().context;t.setValueAtTime(e,s.audioContext.currentTime)}else t.value=e;return e}}let bI=0;class wI extends Xs{constructor(t){super(),this.id=bI++,this._media=null,this._paused=!1,this._muted=!1,this._elapsed=0,this.init(t)}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case"speed":this.speed=e;break;case"volume":this.volume=e;break;case"muted":this.muted=e;break;case"loop":this.loop=e;break;case"paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"))}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(!0)}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh()}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh()}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh()}get filters(){return this._filters}set filters(t){var e;this._filters&&((e=this._filters)==null||e.filter(s=>s).forEach(s=>s.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t!=null&&t.length?t.slice(0):null,this.refresh()}refresh(){if(!this._source)return;const t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;const s=t.volume*(t.muted?0:1),r=e.volume*(e.muted?0:1),n=this._volume*(this._muted?0:1);hd.setParamValue(this._gain.gain,n*r*s),hd.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters()}applyFilters(){var t;if((t=this._filters)!=null&&t.length){this._source.disconnect();let e=this._source;this._filters.forEach(s=>{e.connect(s.destination),e=s}),e.connect(this._gain)}}refreshPaused(){const t=this._media.context,e=this._media.parent,s=this._paused||e.paused||t.paused;s!==this._pausedReal&&(this._pausedReal=s,s?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",s))}play(t){const{start:e,end:s,speed:r,loop:n,volume:a,muted:h,filters:o}=t;s&&console.assert(s>e,"End time is before start time"),this._paused=!1;const{source:l,gain:u}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=u,this._speed=r,this._volume=a,this._loop=!!n,this._muted=h,this._filters=o,this.refresh();const c=this._source.buffer.duration;this._duration=c,this._end=s,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=s,this._source.loopStart=e,this._source.start(0,e)):s?this._source.start(0,e,s-e):this._source.start(0,e),this.emit("start"),this._update(!0),this.enableTicker(!0)}enableTicker(t){wt.shared.remove(this._updateListener,this),t&&wt.shared.add(this._updateListener,this)}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused()}destroy(){var t;this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),(t=this._filters)==null||t.forEach(e=>e.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=!1,this._elapsed=0,this._duration=0,this._paused=!1,this._muted=!1,this._pausedReal=!1}toString(){return`[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update()}_update(t=!1){if(this._source){const e=this._now(),s=e-this._lastUpdate;if(s>0||t){const r=this._source.playbackRate.value;this._elapsed+=s*r,this._lastUpdate=e;const n=this._duration;let a;if(this._source.loopStart){const h=this._source.loopEnd-this._source.loopStart;a=(this._source.loopStart+this._elapsed%h)/n}else a=this._elapsed%n/n;this._progress=a,this.emit("progress",this._progress,n)}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this)}_internalStop(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}this._source=null}}_onComplete(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this)}}class U0{constructor(t,e){this._output=e,this._input=t}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect()}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(s=>{e===null?this._input.connect(s.destination):e.connect(s.destination),e=s}),e.connect(this._output)}}destroy(){this.filters=null,this._input=null,this._output=null}}const G0=class extends U0{constructor(i){const t=i.audioContext,e=t.createBufferSource(),s=t.createGain(),r=t.createAnalyser();e.connect(r),r.connect(s),s.connect(i.destination),super(r,s),this.context=i,this.bufferSource=e,this.gain=s,this.analyser=r}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(G0.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null}cloneBufferSource(){const i=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=i.buffer,hd.setParamValue(t.playbackRate,i.playbackRate.value),t.loop=i.loop;const e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}};let X0=G0;X0.BUFFER_SIZE=0;class EI{init(t){this.parent=t,this._nodes=new X0(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}this._source=null,this.source=null}create(){return new wI(this)}get context(){return this.parent.context}get isPlayable(){return!!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set")}async _loadUrl(t){const e=this.parent.url,s=await z.ADAPTER.fetch(e);this._decode(await s.arrayBuffer(),t)}_decode(t,e){const s=(r,n)=>{if(r)e&&e(r);else{this.parent.isLoaded=!0,this.buffer=n;const a=this.parent.autoPlayStart();e&&e(null,this.parent,a)}};t instanceof AudioBuffer?s(null,t):this.parent.context.decode(t,s)}}const Fn=class{static from(i){let t={};typeof i=="string"?t.url=i:i instanceof ArrayBuffer||i instanceof AudioBuffer||i instanceof HTMLAudioElement?t.source=i:Array.isArray(i)?t.url=i:t=i,t={autoPlay:!1,singleInstance:!1,url:null,source:null,preload:!1,volume:1,speed:1,complete:null,loaded:null,loop:!1,...t},Object.freeze(t);const e=ko().useLegacy?new _I:new EI;return new Fn(e,t)}constructor(i,t){this.media=i,this.options=t,this._instances=[],this._sprites={},this.media.init(this);const e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=!1,this._preloadQueue=null,this.isPlaying=!1,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded)}preferUrl(i){const[t]=i.map(e=>({url:e,ext:bt.extname(e).slice(1)})).filter(({ext:e})=>vl[e]).sort((e,s)=>xl.indexOf(e.ext)-xl.indexOf(s.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return ko().context}pause(){return this.isPlaying=!1,this.paused=!0,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=!1,this}get paused(){return this._paused}set paused(i){this._paused=i,this.refreshPaused()}get speed(){return this._speed}set speed(i){this._speed=i,this.refresh()}get filters(){return this.media.filters}set filters(i){this.media.filters=i}addSprites(i,t){if(typeof i=="object"){const s={};for(const r in i)s[r]=this.addSprites(r,i[r]);return s}console.assert(!this._sprites[i],`Alias ${i} is already taken`);const e=new yI(this,t);return this._sprites[i]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null}removeSprites(i){if(i){const t=this._sprites[i];t!==void 0&&(t.destroy(),delete this._sprites[i])}else for(const t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=!1,this._autoPlayOptions=null,this;this.isPlaying=!1;for(let i=this._instances.length-1;i>=0;i--)this._instances[i].stop();return this}play(i,t){let e;if(typeof i=="string"?e={sprite:i,loop:this.loop,complete:t}:typeof i=="function"?(e={},e.complete=i):e=i,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:!1,loop:!1,...e||{}},e.sprite){const r=e.sprite;console.assert(!!this._sprites[r],`Alias ${r} is not available`);const n=this._sprites[r];e.start=n.start+(e.start||0),e.end=n.end,e.speed=n.speed||1,e.loop=n.loop||e.loop,delete e.sprite}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(r=>{this._preloadQueue.push(()=>{r(this.play(e))})}):(this._preloadQueue=[],this.autoPlay=!0,this._autoPlayOptions=e,new Promise((r,n)=>{this._preload((a,h,o)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,a?n(a):(e.loaded&&e.loaded(a,h,o),r(o))})}));(this.singleInstance||e.singleInstance)&&this._removeInstances();const s=this._createInstance();return this._instances.push(s),this.isPlaying=!0,s.once("end",()=>{e.complete&&e.complete(this),this._onComplete(s)}),s.once("stop",()=>{this._onComplete(s)}),s.play(e),s}refresh(){const i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refresh()}refreshPaused(){const i=this._instances.length;for(let t=0;t<i;t++)this._instances[t].refreshPaused()}get volume(){return this._volume}set volume(i){this._volume=i,this.refresh()}get muted(){return this._muted}set muted(i){this._muted=i,this.refresh()}get loop(){return this._loop}set loop(i){this._loop=i,this.refresh()}_preload(i){this.media.load(i)}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let i;return this.autoPlay&&(i=this.play(this._autoPlayOptions)),i}_removeInstances(){for(let i=this._instances.length-1;i>=0;i--)this._poolInstance(this._instances[i]);this._instances.length=0}_onComplete(i){if(this._instances){const t=this._instances.indexOf(i);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0}this._poolInstance(i)}_createInstance(){if(Fn._pool.length>0){const i=Fn._pool.pop();return i.init(this.media),i}return this.media.create()}_poolInstance(i){i.destroy(),Fn._pool.indexOf(i)<0&&Fn._pool.push(i)}};let bl=Fn;bl._pool=[];class TI extends Xs{constructor(){super(...arguments),this.speed=1,this.muted=!1,this.volume=1,this.paused=!1}refresh(){this.emit("refresh")}refreshPaused(){this.emit("refreshPaused")}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters")}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners()}}class Bo extends U0{constructor(){const t=window,e=new Bo.AudioContext,s=e.createDynamicsCompressor(),r=e.createAnalyser();r.connect(s),s.connect(e.destination),super(r,s),this.autoPause=!0,this._ctx=e,this._offlineCtx=new Bo.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=s,this.analyser=r,this.events=new Xs,this.volume=1,this.speed=1,this.muted=!1,this.paused=!1,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,!0),document.addEventListener("touchstart",this._unlock,!0),document.addEventListener("touchend",this._unlock,!0)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur)}onFocus(){if(!this.autoPause)return;const t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused())}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=!0,this.refreshPaused()))}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,!0),document.removeEventListener("touchend",this._unlock,!0),document.removeEventListener("touchstart",this._unlock,!0),this._locked=!1))}playEmptySound(){const t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume()}static get AudioContext(){const t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){const t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();const t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t}get paused(){return this._paused}refresh(){this.events.emit("refresh")}refreshPaused(){this.events.emit("refreshPaused")}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){const s=n=>{e(new Error((n==null?void 0:n.message)||"Unable to decode file"))},r=this._offlineCtx.decodeAudioData(t,n=>{e(null,n)},s);r&&r.catch(s)}}class AI{constructor(){this.init()}init(){return this.supported&&(this._webAudioContext=new Bo),this._htmlAudioContext=new TI,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t)}get supported(){return Bo.AudioContext!==null}add(t,e){if(typeof t=="object"){const n={};for(const a in t){const h=this._getOptions(t[a],e);n[a]=this.add(a,h)}return n}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof bl)return this._sounds[t]=e,e;const s=this._getOptions(e),r=bl.from(s);return this._sounds[t]=r,r}_getOptions(t,e){let s;return typeof t=="string"?s={url:t}:Array.isArray(t)?s={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?s={source:t}:s=t,s={...s,...e||{}},s}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext}get disableAutoPause(){return!this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t}remove(t){return this.exists(t,!0),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh()}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh()}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=!0,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=!1,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=!0,this._context.refresh(),this}unmuteAll(){return this._context.muted=!1,this._context.refresh(),this}removeAll(){for(const t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(const t in this._sounds)this._sounds[t].stop();return this}exists(t,e=!1){const s=!!this._sounds[t];return e&&console.assert(s,`No sound matching alias '${t}'.`),s}isPlaying(){for(const t in this._sounds)if(this._sounds[t].isPlaying)return!0;return!1}find(t){return this.exists(t,!0),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){const s=this.find(t);return e!==void 0&&(s.volume=e),s.volume}speed(t,e){const s=this.find(t);return e!==void 0&&(s.speed=e),s.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}}const $0=i=>{var e;const t=i.src;return((e=i==null?void 0:i.alias)==null?void 0:e[0])??bt.basename(t,bt.extname(t))},SI={extension:Y.Asset,detection:{test:async()=>!0,add:async i=>[...i,...xl.filter(t=>vl[t])],remove:async i=>i.filter(t=>i.includes(t))},loader:{extension:{type:[Y.LoadParser],priority:Ne.High},test(i){const t=bt.extname(i).slice(1);return!!vl[t]||xI.some(e=>i.startsWith(`data:${e}`))},async load(i,t){const e=await new Promise((s,r)=>bl.from({...t.data,url:i,preload:!0,loaded(n,a){var h,o;n?r(n):s(a),(o=(h=t.data)==null?void 0:h.loaded)==null||o.call(h,n,a)}}));return ko().add($0(t),e),e},async unload(i,t){ko().remove($0(t))}}};K.add(SI),mI(new AI);class CI{constructor(){this.effectEnabled=!0,this.musicEnabled=!0,this._isMusicPaused=!1,this._isBackground=!1,this._playingList=[],this._setPlayStatus=t=>{var e,s;t?!this._isMusicPaused&&((e=this._musicPlayer)==null||e.play()):(s=this._musicPlayer)==null||s.pause(),this._playingList.forEach(r=>{t?r.audio.play():r.audio.pause()})},document.addEventListener("visibilitychange",()=>{this._isBackground=document.hidden,this._setPlayStatus(!document.hidden)})}playEffect(t,e){return new Promise(s=>{const r=Math.random(),n=Gr.get(t).url,a=new ad.Howl({src:n,mute:this._isBackground||!this.effectEnabled});if(a.play(),a.on("end",()=>{this._playingList=this._playingList.filter(h=>h.id!==r),s()}),e){const o=a.duration()-e;a.seek(o)}this._playingList.push({id:r,audio:a,url:n})})}async playMusic(t){const e=Gr.get(t).url;this._musicPlayer&&(xt.killTweensOf(this._musicPlayer),await xt.to(this._musicPlayer,{volume:0,duration:1,ease:"linear"}),this._musicPlayer.stop()),this._musicPlayer=new ad.Howl({src:e,loop:!0,volume:0,mute:this._isBackground||!this.musicEnabled}),this._musicPlayer.play(),this._isMusicPaused=!1,xt.killTweensOf(this._musicPlayer),xt.to(this._musicPlayer,{volume:1,duration:1,ease:"linear"})}pauseMusic(){var t;this._isMusicPaused=!0,(t=this._musicPlayer)==null||t.pause()}resumeMusic(){var t,e;this._isMusicPaused=!1,!((t=this._musicPlayer)!=null&&t.playing())&&((e=this._musicPlayer)==null||e.play())}stopEffect(t){const e=Gr.get(t).url;this._playingList.forEach(s=>{s.url===e&&s.audio.stop()}),this._playingList=this._playingList.filter(s=>s.url!==e)}setEffectEnabled(t){this.effectEnabled=t,this._setEffectMute(!t)}setMusicEnabled(t){this.musicEnabled=t,this._setMusicMute(!t)}_setMusicMute(t){var e;(e=this._musicPlayer)==null||e.mute(t||!this.musicEnabled)}_setEffectMute(t){this._playingList.forEach(e=>{e.audio.mute(t||!this.effectEnabled)})}}const II=i=>{const{texture:t,dotWidth:e,width:s,height:r}=i;let n=[];Array.isArray(e)?n=e:n=[e,e,e,e];const a=new MT(t,n[0],n[1],n[2],n[3]);return a.width=s,a.height=r,a},PI=(i,t,e)=>{let s=!1;return i.cursor="pointer",i.eventMode="static",i.on(t,r=>{s||r.button!==2&&e(r)}),()=>{s=!0}},RI=(i,t,e=0)=>parseFloat((Math.random()*(t-i)+i).toFixed(e)),MI=(i,t)=>{let e=0;const s=new wt,r=n=>{e+=n*s.deltaMS;let a=0;Array.isArray(t)?a=RI(t[0],t[1],2):a=t,e>=a&&(i(),e=0)};return s.add(r),s.start(),()=>{s.remove(r),s.stop()}},FI=(i,t,e)=>{const s=r=>{const n=t.getBounds().contains(r.clientX,r.clientY),a=i.getBounds().contains(r.clientX,r.clientY);!n&&!a&&i.visible&&(e(),window.removeEventListener("pointerdown",s))};return window.addEventListener("pointerdown",s),()=>{window.removeEventListener("pointerdown",s)}},kI=(i=1,t)=>new Promise(e=>{let s=0;const r=new wt,n=()=>{s+=r.deltaMS,s>=i&&(t==null||t(),r.destroy(),e())};r.add(n),r.start()}),BI=(i,t)=>{let e;if(i==="brightness")e=new hn,e.brightness(t,!1);else if(i==="blur")e=new om;else if(i==="desaturate")e=new hn,e.desaturate();else if(i==="contrast")e=new hn,e.contrast(t,!1);else throw new Error("未知滤镜名称");return e.resolution=window.devicePixelRatio||1,e};var DI=`attribute vec2 aVertexPosition;
1190
1190
  attribute vec2 aTextureCoord;
1191
1191
 
1192
1192
  uniform mat3 projectionMatrix;
@@ -1197,7 +1197,7 @@ void main(void)
1197
1197
  {
1198
1198
  gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
1199
1199
  vTextureCoord = aTextureCoord;
1200
- }`,BI=`
1200
+ }`,OI=`
1201
1201
  varying vec2 vTextureCoord;
1202
1202
  uniform sampler2D uSampler;
1203
1203
 
@@ -1223,7 +1223,7 @@ void main(void)
1223
1223
  color *= 0.25;
1224
1224
 
1225
1225
  gl_FragColor = color;
1226
- }`,DI=`
1226
+ }`,LI=`
1227
1227
  varying vec2 vTextureCoord;
1228
1228
  uniform sampler2D uSampler;
1229
1229
 
@@ -1251,7 +1251,7 @@ void main(void)
1251
1251
 
1252
1252
  gl_FragColor = color;
1253
1253
  }
1254
- `;let q0=class extends pe{constructor(t=4,e=3,s=!1){super(kI,s?DI:BI),this._kernels=[],this._blur=4,this._quality=3,this.uniforms.uOffset=new Float32Array(2),this._pixelSize=new st,this.pixelSize=1,this._clamp=s,Array.isArray(t)?this.kernels=t:(this._blur=t,this.quality=e)}apply(t,e,s,r){const n=this._pixelSize.x/e._frame.width,a=this._pixelSize.y/e._frame.height;let h;if(this._quality===1||this._blur===0)h=this._kernels[0]+.5,this.uniforms.uOffset[0]=h*n,this.uniforms.uOffset[1]=h*a,t.applyFilter(this,e,s,r);else{const o=t.getFilterTexture();let l=e,u=o,c;const d=this._quality-1;for(let f=0;f<d;f++)h=this._kernels[f]+.5,this.uniforms.uOffset[0]=h*n,this.uniforms.uOffset[1]=h*a,t.applyFilter(this,l,u,1),c=l,l=u,u=c;h=this._kernels[d]+.5,this.uniforms.uOffset[0]=h*n,this.uniforms.uOffset[1]=h*a,t.applyFilter(this,l,s,r),t.returnFilterTexture(o)}}_updatePadding(){this.padding=Math.ceil(this._kernels.reduce((t,e)=>t+e+.5,0))}_generateKernels(){const t=this._blur,e=this._quality,s=[t];if(t>0){let r=t;const n=t/e;for(let a=1;a<e;a++)r-=n,s.push(r)}this._kernels=s,this._updatePadding()}get kernels(){return this._kernels}set kernels(t){Array.isArray(t)&&t.length>0?(this._kernels=t,this._quality=t.length,this._blur=Math.max(...t)):(this._kernels=[0],this._quality=1)}get clamp(){return this._clamp}set pixelSize(t){typeof t=="number"?(this._pixelSize.x=t,this._pixelSize.y=t):Array.isArray(t)?(this._pixelSize.x=t[0],this._pixelSize.y=t[1]):t instanceof st?(this._pixelSize.x=t.x,this._pixelSize.y=t.y):(this._pixelSize.x=1,this._pixelSize.y=1)}get pixelSize(){return this._pixelSize}get quality(){return this._quality}set quality(t){this._quality=Math.max(1,Math.round(t)),this._generateKernels()}get blur(){return this._blur}set blur(t){this._blur=t,this._generateKernels()}};var OI=`attribute vec2 aVertexPosition;
1254
+ `;let Y0=class extends pe{constructor(t=4,e=3,s=!1){super(DI,s?LI:OI),this._kernels=[],this._blur=4,this._quality=3,this.uniforms.uOffset=new Float32Array(2),this._pixelSize=new st,this.pixelSize=1,this._clamp=s,Array.isArray(t)?this.kernels=t:(this._blur=t,this.quality=e)}apply(t,e,s,r){const n=this._pixelSize.x/e._frame.width,a=this._pixelSize.y/e._frame.height;let h;if(this._quality===1||this._blur===0)h=this._kernels[0]+.5,this.uniforms.uOffset[0]=h*n,this.uniforms.uOffset[1]=h*a,t.applyFilter(this,e,s,r);else{const o=t.getFilterTexture();let l=e,u=o,c;const d=this._quality-1;for(let f=0;f<d;f++)h=this._kernels[f]+.5,this.uniforms.uOffset[0]=h*n,this.uniforms.uOffset[1]=h*a,t.applyFilter(this,l,u,1),c=l,l=u,u=c;h=this._kernels[d]+.5,this.uniforms.uOffset[0]=h*n,this.uniforms.uOffset[1]=h*a,t.applyFilter(this,l,s,r),t.returnFilterTexture(o)}}_updatePadding(){this.padding=Math.ceil(this._kernels.reduce((t,e)=>t+e+.5,0))}_generateKernels(){const t=this._blur,e=this._quality,s=[t];if(t>0){let r=t;const n=t/e;for(let a=1;a<e;a++)r-=n,s.push(r)}this._kernels=s,this._updatePadding()}get kernels(){return this._kernels}set kernels(t){Array.isArray(t)&&t.length>0?(this._kernels=t,this._quality=t.length,this._blur=Math.max(...t)):(this._kernels=[0],this._quality=1)}get clamp(){return this._clamp}set pixelSize(t){typeof t=="number"?(this._pixelSize.x=t,this._pixelSize.y=t):Array.isArray(t)?(this._pixelSize.x=t[0],this._pixelSize.y=t[1]):t instanceof st?(this._pixelSize.x=t.x,this._pixelSize.y=t.y):(this._pixelSize.x=1,this._pixelSize.y=1)}get pixelSize(){return this._pixelSize}get quality(){return this._quality}set quality(t){this._quality=Math.max(1,Math.round(t)),this._generateKernels()}get blur(){return this._blur}set blur(t){this._blur=t,this._generateKernels()}};var NI=`attribute vec2 aVertexPosition;
1255
1255
  attribute vec2 aTextureCoord;
1256
1256
 
1257
1257
  uniform mat3 projectionMatrix;
@@ -1262,7 +1262,7 @@ void main(void)
1262
1262
  {
1263
1263
  gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
1264
1264
  vTextureCoord = aTextureCoord;
1265
- }`,LI=`varying vec2 vTextureCoord;
1265
+ }`,VI=`varying vec2 vTextureCoord;
1266
1266
  uniform sampler2D uSampler;
1267
1267
  uniform float alpha;
1268
1268
  uniform vec3 color;
@@ -1280,4 +1280,4 @@ void main(void){
1280
1280
  sample *= alpha;
1281
1281
 
1282
1282
  gl_FragColor = sample;
1283
- }`,NI=Object.defineProperty,Z0=Object.getOwnPropertySymbols,VI=Object.prototype.hasOwnProperty,UI=Object.prototype.propertyIsEnumerable,K0=(i,t,e)=>t in i?NI(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Q0=(i,t)=>{for(var e in t||(t={}))VI.call(t,e)&&K0(i,e,t[e]);if(Z0)for(var e of Z0(t))UI.call(t,e)&&K0(i,e,t[e]);return i};const fd=class extends pe{constructor(i){super(),this.angle=45,this._distance=5,this._resolution=z.FILTER_RESOLUTION;const t=i?Q0(Q0({},fd.defaults),i):fd.defaults,{kernels:e,blur:s,quality:r,pixelSize:n,resolution:a}=t;this._offset=new qs(this._updatePadding,this),this._tintFilter=new pe(OI,LI),this._tintFilter.uniforms.color=new Float32Array(4),this._tintFilter.uniforms.shift=this._offset,this._tintFilter.resolution=a,this._blurFilter=e?new q0(e):new q0(s,r),this.pixelSize=n,this.resolution=a;const{shadowOnly:h,rotation:o,distance:l,offset:u,alpha:c,color:d}=t;this.shadowOnly=h,o!==void 0&&l!==void 0?(this.rotation=o,this.distance=l):this.offset=u,this.alpha=c,this.color=d}apply(i,t,e,s){const r=i.getFilterTexture();this._tintFilter.apply(i,t,r,1),this._blurFilter.apply(i,r,e,s),this.shadowOnly!==!0&&i.applyFilter(this,t,e,0),i.returnFilterTexture(r)}_updatePadding(){const i=Math.max(Math.abs(this._offset.x),Math.abs(this._offset.y));this.padding=i+this.blur*2}_updateShift(){this._tintFilter.uniforms.shift.set(this.distance*Math.cos(this.angle),this.distance*Math.sin(this.angle))}set offset(i){this._offset.copyFrom(i),this._updatePadding()}get offset(){return this._offset}get resolution(){return this._resolution}set resolution(i){this._resolution=i,this._tintFilter&&(this._tintFilter.resolution=i),this._blurFilter&&(this._blurFilter.resolution=i)}get distance(){return this._distance}set distance(i){ot("5.3.0","DropShadowFilter distance is deprecated, use offset"),this._distance=i,this._updatePadding(),this._updateShift()}get rotation(){return this.angle/Oh}set rotation(i){ot("5.3.0","DropShadowFilter rotation is deprecated, use offset"),this.angle=i*Oh,this._updateShift()}get alpha(){return this._tintFilter.uniforms.alpha}set alpha(i){this._tintFilter.uniforms.alpha=i}get color(){return eo(this._tintFilter.uniforms.color)}set color(i){sp(i,this._tintFilter.uniforms.color)}get kernels(){return this._blurFilter.kernels}set kernels(i){this._blurFilter.kernels=i}get blur(){return this._blurFilter.blur}set blur(i){this._blurFilter.blur=i,this._updatePadding()}get quality(){return this._blurFilter.quality}set quality(i){this._blurFilter.quality=i}get pixelSize(){return this._blurFilter.pixelSize}set pixelSize(i){this._blurFilter.pixelSize=i}};let J0=fd;J0.defaults={offset:{x:4,y:4},color:0,alpha:.5,shadowOnly:!1,kernels:null,blur:2,quality:3,pixelSize:1,resolution:z.FILTER_RESOLUTION};const GI=(i,t)=>{const{color:e="#000",alpha:s=.25,blur:r=1,distance:n=0,offset:a={x:0,y:0}}=t||{},h=new J0({color:e,alpha:s,blur:r,distance:n,offset:a});h.resolution=window.devicePixelRatio||1,i.filters=[h]},XI=(i,t=1)=>{let e=0;const s=new wt,r=()=>{if(e+=s.deltaMS,e>=t){i==null||i();try{s.destroy()}catch{}}};return s.add(r),s.start(),()=>{try{s.destroy()}catch{}}};class $I{constructor(t){this._isDragging=!1,this._moveX=0,this._lastMoveX=0,this._progress=0;const{app:e,clickArea:s,maxMoveDistance:r,onChange:n,onDown:a,onUp:h,sideArea:o}=t;this._app=e,this._maxMoveDistance=r,this._onChange=n,this._onDown=a,this._onUp=h,this._sideArea=o,s.forEach(l=>{Mr(l,"pointerdown",this._onDragStart.bind(this))}),Mr(o,"pointerdown",this._onDragMove.bind(this)),e.stage.on("pointermove",this._onDragMove.bind(this)),e.stage.on("pointerup",this._onDragEnd.bind(this))}setValue(t){this._progress=t,this._lastMoveX=this._maxMoveDistance*t,this._onChange(this._lastMoveX,t)}_onDragStart(){var t;this._app.stage.eventMode="static",this._isDragging=!0,(t=this._onDown)==null||t.call(this)}_onDragMove(t){const e=t.getLocalPosition(this._sideArea);this._isDragging&&(this._moveX=Math.max(0,Math.min(e.x,this._maxMoveDistance)),this._progress=Number((this._moveX/this._maxMoveDistance).toFixed(2)),this._onChange(this._moveX,this._progress))}_onDragEnd(){var t;this._app.stage.eventMode="auto",this._isDragging=!1,this._lastMoveX=this._moveX,(t=this._onUp)==null||t.call(this)}}class YI{constructor(){this.instances=new Map}setInstance(t,e){this.instances.has(t)&&this.instances.delete(t),this.instances.set(t,e)}getInstance(t){return this.instances.get(t)}}class HI{constructor(t){this._drawing=!1,this._points=[],this._startPoint=[],this._realPoints=[],this._pointElements=[],this._app=t,this._app.stage.sortableChildren=!0,this._polygon=new hs,this._app.stage.addChild(this._polygon),this._polygon.zIndex=999999,this._setupListeners()}_setupListeners(){window.addEventListener("keydown",t=>{t.code==="Space"?this.toggleDrawing():t.code==="Backspace"&&(this._points.pop(),this._realPoints.pop(),this._drawPolygon())}),this._app.stage.eventMode="static",this._app.stage.on("pointerdown",t=>{this._drawing&&this._addPoint(t)})}toggleDrawing(){this._drawing?(console.warn("绘制结束"),this._points.push({x:0,y:0}),console.log(this._points.flat())):(console.warn("开始绘制"),this._startPoint=[],this._points=[],this._realPoints=[],this._polygon.clear(),this._pointElements.forEach(t=>t.destroy()),this._pointElements=[]),this._drawing=!this._drawing}_addPoint(t){const e=Number(t.clientX.toFixed(0)),s=Number(t.clientY.toFixed(0));if(this._realPoints.push({x:e,y:s}),this._startPoint.length===0)this._startPoint=[{x:e,y:s}],this._points.push({x:0,y:0});else{const r=e-this._startPoint[0].x,n=s-this._startPoint[0].y;this._points.push({x:Number(r.toFixed(0)),y:Number(n.toFixed(0))})}this._drawPolygon()}_drawPolygon(){this._polygon.clear(),this._polygon.beginFill(6737151),this._polygon.drawPolygon(this._realPoints),this._polygon.endFill(),this._polygon.alpha=.5,this._pointElements.forEach(t=>t.destroy()),this._pointElements=[],this._realPoints.forEach(t=>{this._pointElements.push(this._drawDot(t.x,t.y))})}_drawDot(t,e){const s=new hs;return s.beginFill(16711680),s.drawCircle(t,e,5),s.endFill(),s.alpha=.5,this._app.stage.addChild(s),s.zIndex=999999,s}}const WI=Object.freeze(Object.defineProperty({__proto__:null,Components:{Base:{LibPixiBitText:lA,LibPixiContainer:Ao,LibPixiParticleMove:kS,LibPixiRectBgColor:du,LibPixiSpine:eI,LibPixiText:Nu},Custom:{LibPixiButtonHover:sI,LibPixiCloseBtn:rI,LibPixiDrawer:iI,LibPixiPerforMon:nI,LibPixiProgress:oI,LibPixiScrollContainer:aI,LibPixiScrollNum:lI,LibPixiSlider:hI,LibPixiSubAddMinMax:uI,LibPixiTable:dI}},Utils:{LibPixiAudio:AI,libPixiCreateNineGrid:SI,libPixiEvent:Mr,libPixiEventControlled:CI,libPixiFilter:FI,libPixiIntervalTrigger:PI,libPixiOutsideClick:RI,libPixiOverflowHidden:G0,libPixiPromiseTickerTimeout:MI,libPixiScaleContainer:X0,libPixiShadow:GI,libPixiTickerTimeout:XI,LibPixiSlideInput:$I,LibPixiGlobalUpdater:YI,LibPixiPolygonDrawTool:HI}},Symbol.toStringTag,{value:"Module"}));window.LibPixiJs=WI});
1283
+ }`,UI=Object.defineProperty,H0=Object.getOwnPropertySymbols,GI=Object.prototype.hasOwnProperty,XI=Object.prototype.propertyIsEnumerable,W0=(i,t,e)=>t in i?UI(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,z0=(i,t)=>{for(var e in t||(t={}))GI.call(t,e)&&W0(i,e,t[e]);if(H0)for(var e of H0(t))XI.call(t,e)&&W0(i,e,t[e]);return i};const cd=class extends pe{constructor(i){super(),this.angle=45,this._distance=5,this._resolution=z.FILTER_RESOLUTION;const t=i?z0(z0({},cd.defaults),i):cd.defaults,{kernels:e,blur:s,quality:r,pixelSize:n,resolution:a}=t;this._offset=new qs(this._updatePadding,this),this._tintFilter=new pe(NI,VI),this._tintFilter.uniforms.color=new Float32Array(4),this._tintFilter.uniforms.shift=this._offset,this._tintFilter.resolution=a,this._blurFilter=e?new Y0(e):new Y0(s,r),this.pixelSize=n,this.resolution=a;const{shadowOnly:h,rotation:o,distance:l,offset:u,alpha:c,color:d}=t;this.shadowOnly=h,o!==void 0&&l!==void 0?(this.rotation=o,this.distance=l):this.offset=u,this.alpha=c,this.color=d}apply(i,t,e,s){const r=i.getFilterTexture();this._tintFilter.apply(i,t,r,1),this._blurFilter.apply(i,r,e,s),this.shadowOnly!==!0&&i.applyFilter(this,t,e,0),i.returnFilterTexture(r)}_updatePadding(){const i=Math.max(Math.abs(this._offset.x),Math.abs(this._offset.y));this.padding=i+this.blur*2}_updateShift(){this._tintFilter.uniforms.shift.set(this.distance*Math.cos(this.angle),this.distance*Math.sin(this.angle))}set offset(i){this._offset.copyFrom(i),this._updatePadding()}get offset(){return this._offset}get resolution(){return this._resolution}set resolution(i){this._resolution=i,this._tintFilter&&(this._tintFilter.resolution=i),this._blurFilter&&(this._blurFilter.resolution=i)}get distance(){return this._distance}set distance(i){ot("5.3.0","DropShadowFilter distance is deprecated, use offset"),this._distance=i,this._updatePadding(),this._updateShift()}get rotation(){return this.angle/kh}set rotation(i){ot("5.3.0","DropShadowFilter rotation is deprecated, use offset"),this.angle=i*kh,this._updateShift()}get alpha(){return this._tintFilter.uniforms.alpha}set alpha(i){this._tintFilter.uniforms.alpha=i}get color(){return eo(this._tintFilter.uniforms.color)}set color(i){Kf(i,this._tintFilter.uniforms.color)}get kernels(){return this._blurFilter.kernels}set kernels(i){this._blurFilter.kernels=i}get blur(){return this._blurFilter.blur}set blur(i){this._blurFilter.blur=i,this._updatePadding()}get quality(){return this._blurFilter.quality}set quality(i){this._blurFilter.quality=i}get pixelSize(){return this._blurFilter.pixelSize}set pixelSize(i){this._blurFilter.pixelSize=i}};let j0=cd;j0.defaults={offset:{x:4,y:4},color:0,alpha:.5,shadowOnly:!1,kernels:null,blur:2,quality:3,pixelSize:1,resolution:z.FILTER_RESOLUTION};const $I=(i,t)=>{const{color:e="#000",alpha:s=.25,blur:r=1,distance:n=0,offset:a={x:0,y:0}}=t||{},h=new j0({color:e,alpha:s,blur:r,distance:n,offset:a});h.resolution=window.devicePixelRatio||1,i.filters=[h]},YI=(i,t=1)=>{let e=0;const s=new wt,r=()=>{if(e+=s.deltaMS,e>=t){i==null||i();try{s.destroy()}catch{}}};return s.add(r),s.start(),()=>{try{s.destroy()}catch{}}};class HI{constructor(t){this._isDragging=!1,this._moveX=0,this._lastMoveX=0,this._progress=0;const{app:e,clickArea:s,maxMoveDistance:r,onChange:n,onDown:a,onUp:h,sideArea:o}=t;this._app=e,this._maxMoveDistance=r,this._onChange=n,this._onDown=a,this._onUp=h,this._sideArea=o,s.forEach(l=>{Mr(l,"pointerdown",this._onDragStart.bind(this))}),Mr(o,"pointerdown",this._onDragMove.bind(this)),e.stage.on("pointermove",this._onDragMove.bind(this)),e.stage.on("pointerup",this._onDragEnd.bind(this))}setValue(t){this._progress=t,this._lastMoveX=this._maxMoveDistance*t,this._onChange(this._lastMoveX,t)}_onDragStart(){var t;this._app.stage.eventMode="static",this._isDragging=!0,(t=this._onDown)==null||t.call(this)}_onDragMove(t){const e=t.getLocalPosition(this._sideArea);this._isDragging&&(this._moveX=Math.max(0,Math.min(e.x,this._maxMoveDistance)),this._progress=Number((this._moveX/this._maxMoveDistance).toFixed(2)),this._onChange(this._moveX,this._progress))}_onDragEnd(){var t;this._app.stage.eventMode="auto",this._isDragging=!1,this._lastMoveX=this._moveX,(t=this._onUp)==null||t.call(this)}}class WI{constructor(){this.instances=new Map}setInstance(t,e){this.instances.has(t)&&this.instances.delete(t),this.instances.set(t,e)}getInstance(t){return this.instances.get(t)}}class zI{constructor(t,e={}){this._drawing=!1,this._points=[],this._startPoint=[],this._realPoints=[],this._pointElements=[],this._app=t,this._params={outFormat:"number",dotRadius:2,dotColor:"#fff",polygonColor:"#68CCFF",polygonAlpha:.5,...e},this._app.stage.sortableChildren=!0,this._polygon=new hs,this._app.stage.addChild(this._polygon),this._polygon.zIndex=999999,this._setupListeners()}_setupListeners(){window.addEventListener("keydown",t=>{t.code==="Space"?this.toggleDrawing():t.code==="Backspace"&&(this._points.pop(),this._realPoints.pop(),this._drawPolygon())}),this._app.stage.eventMode="static",this._app.stage.on("pointerdown",t=>{this._drawing&&this._addPoint(t)})}toggleDrawing(){this._drawing?(alert("绘制结束"),this._points.push({x:0,y:0}),this._params.outFormat==="object"?console.log(this._points):console.log(this._points.map(t=>[t.x,t.y]).flat())):(alert("开始绘制"),this._startPoint=[],this._points=[],this._realPoints=[],this._polygon.clear(),this._pointElements.forEach(t=>t.destroy()),this._pointElements=[]),this._drawing=!this._drawing}_addPoint(t){const e=Number(t.clientX.toFixed(0)),s=Number(t.clientY.toFixed(0));if(this._realPoints.push({x:e,y:s}),this._startPoint.length===0)this._startPoint=[{x:e,y:s}],this._points.push({x:0,y:0});else{const r=e-this._startPoint[0].x,n=s-this._startPoint[0].y;this._points.push({x:Number(r.toFixed(0)),y:Number(n.toFixed(0))})}this._drawPolygon()}_drawPolygon(){this._polygon.clear(),this._polygon.beginFill(this._params.polygonColor),this._polygon.drawPolygon(this._realPoints),this._polygon.endFill(),this._polygon.alpha=this._params.polygonAlpha,this._pointElements.forEach(t=>t.destroy()),this._pointElements=[],this._realPoints.forEach(t=>{this._pointElements.push(this._drawDot(t.x,t.y))})}_drawDot(t,e){const s=new hs;return s.beginFill(this._params.dotColor),s.drawCircle(t,e,this._params.dotRadius||2),s.endFill(),this._app.stage.addChild(s),s.zIndex=999999,s}}const jI=Object.freeze(Object.defineProperty({__proto__:null,Components:{Base:{LibPixiBitText:cA,LibPixiContainer:Ao,LibPixiParticleMove:DS,LibPixiRectBgColor:hu,LibPixiSpine:rI,LibPixiText:Du},Custom:{LibPixiButtonHover:iI,LibPixiCloseBtn:nI,LibPixiDrawer:oI,LibPixiPerforMon:aI,LibPixiProgress:lI,LibPixiScrollContainer:hI,LibPixiScrollNum:cI,LibPixiSlider:uI,LibPixiSubAddMinMax:fI,LibPixiTable:pI}},Utils:{LibPixiAudio:CI,libPixiCreateNineGrid:II,libPixiEvent:Mr,libPixiEventControlled:PI,libPixiFilter:BI,libPixiIntervalTrigger:MI,libPixiOutsideClick:FI,libPixiOverflowHidden:O0,libPixiPromiseTickerTimeout:kI,libPixiScaleContainer:L0,libPixiShadow:$I,libPixiTickerTimeout:YI,LibPixiSlideInput:HI,LibPixiGlobalUpdater:WI,LibPixiPolygonDrawTool:zI}},Symbol.toStringTag,{value:"Module"}));window.LibPixiJs=jI});