lyb-pixi-js 1.1.17 → 1.1.19
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/Components/Base/LibPixiSpine.d.ts +1 -0
- package/Components/Base/LibPixiSpine.js +1 -0
- package/Components/Custom/LibPixiScrollContainer.js +1 -1
- package/README.md +39 -2
- package/Utils/LibPixiSlideInput.d.ts +55 -0
- package/Utils/LibPixiSlideInput.js +61 -0
- package/libPixiJs.d.ts +5 -0
- package/libPixiJs.js +5 -0
- package/lyb-pixi.js +143 -141
- package/package.json +2 -1
package/lyb-pixi.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
(function(qe){typeof define=="function"&&define.amd?define(qe):qe()})(function(){"use strict";var qe=(s=>(s[s.WEBGL_LEGACY=0]="WEBGL_LEGACY",s[s.WEBGL=1]="WEBGL",s[s.WEBGL2=2]="WEBGL2",s))(qe||{}),Jc=(s=>(s[s.UNKNOWN=0]="UNKNOWN",s[s.WEBGL=1]="WEBGL",s[s.CANVAS=2]="CANVAS",s))(Jc||{}),Eo=(s=>(s[s.COLOR=16384]="COLOR",s[s.DEPTH=256]="DEPTH",s[s.STENCIL=1024]="STENCIL",s))(Eo||{}),K=(s=>(s[s.NORMAL=0]="NORMAL",s[s.ADD=1]="ADD",s[s.MULTIPLY=2]="MULTIPLY",s[s.SCREEN=3]="SCREEN",s[s.OVERLAY=4]="OVERLAY",s[s.DARKEN=5]="DARKEN",s[s.LIGHTEN=6]="LIGHTEN",s[s.COLOR_DODGE=7]="COLOR_DODGE",s[s.COLOR_BURN=8]="COLOR_BURN",s[s.HARD_LIGHT=9]="HARD_LIGHT",s[s.SOFT_LIGHT=10]="SOFT_LIGHT",s[s.DIFFERENCE=11]="DIFFERENCE",s[s.EXCLUSION=12]="EXCLUSION",s[s.HUE=13]="HUE",s[s.SATURATION=14]="SATURATION",s[s.COLOR=15]="COLOR",s[s.LUMINOSITY=16]="LUMINOSITY",s[s.NORMAL_NPM=17]="NORMAL_NPM",s[s.ADD_NPM=18]="ADD_NPM",s[s.SCREEN_NPM=19]="SCREEN_NPM",s[s.NONE=20]="NONE",s[s.SRC_OVER=0]="SRC_OVER",s[s.SRC_IN=21]="SRC_IN",s[s.SRC_OUT=22]="SRC_OUT",s[s.SRC_ATOP=23]="SRC_ATOP",s[s.DST_OVER=24]="DST_OVER",s[s.DST_IN=25]="DST_IN",s[s.DST_OUT=26]="DST_OUT",s[s.DST_ATOP=27]="DST_ATOP",s[s.ERASE=26]="ERASE",s[s.SUBTRACT=28]="SUBTRACT",s[s.XOR=29]="XOR",s))(K||{}),Ue=(s=>(s[s.POINTS=0]="POINTS",s[s.LINES=1]="LINES",s[s.LINE_LOOP=2]="LINE_LOOP",s[s.LINE_STRIP=3]="LINE_STRIP",s[s.TRIANGLES=4]="TRIANGLES",s[s.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",s[s.TRIANGLE_FAN=6]="TRIANGLE_FAN",s))(Ue||{}),O=(s=>(s[s.RGBA=6408]="RGBA",s[s.RGB=6407]="RGB",s[s.RG=33319]="RG",s[s.RED=6403]="RED",s[s.RGBA_INTEGER=36249]="RGBA_INTEGER",s[s.RGB_INTEGER=36248]="RGB_INTEGER",s[s.RG_INTEGER=33320]="RG_INTEGER",s[s.RED_INTEGER=36244]="RED_INTEGER",s[s.ALPHA=6406]="ALPHA",s[s.LUMINANCE=6409]="LUMINANCE",s[s.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",s[s.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",s[s.DEPTH_STENCIL=34041]="DEPTH_STENCIL",s))(O||{}),Xs=(s=>(s[s.TEXTURE_2D=3553]="TEXTURE_2D",s[s.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",s[s.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",s[s.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",s[s.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",s[s.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",s[s.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",s[s.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",s[s.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",s))(Xs||{}),Z=(s=>(s[s.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",s[s.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",s[s.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",s[s.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",s[s.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",s[s.UNSIGNED_INT=5125]="UNSIGNED_INT",s[s.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",s[s.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",s[s.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",s[s.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",s[s.BYTE=5120]="BYTE",s[s.SHORT=5122]="SHORT",s[s.INT=5124]="INT",s[s.FLOAT=5126]="FLOAT",s[s.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",s[s.HALF_FLOAT=36193]="HALF_FLOAT",s))(Z||{}),V=(s=>(s[s.FLOAT=0]="FLOAT",s[s.INT=1]="INT",s[s.UINT=2]="UINT",s))(V||{}),Ti=(s=>(s[s.NEAREST=0]="NEAREST",s[s.LINEAR=1]="LINEAR",s))(Ti||{}),Ui=(s=>(s[s.CLAMP=33071]="CLAMP",s[s.REPEAT=10497]="REPEAT",s[s.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",s))(Ui||{}),Ke=(s=>(s[s.OFF=0]="OFF",s[s.POW2=1]="POW2",s[s.ON=2]="ON",s[s.ON_MANUAL=3]="ON_MANUAL",s))(Ke||{}),he=(s=>(s[s.NPM=0]="NPM",s[s.UNPACK=1]="UNPACK",s[s.PMA=2]="PMA",s[s.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",s[s.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",s[s.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",s))(he||{}),Ze=(s=>(s[s.NO=0]="NO",s[s.YES=1]="YES",s[s.AUTO=2]="AUTO",s[s.BLEND=0]="BLEND",s[s.CLEAR=1]="CLEAR",s[s.BLIT=2]="BLIT",s))(Ze||{}),Ao=(s=>(s[s.AUTO=0]="AUTO",s[s.MANUAL=1]="MANUAL",s))(Ao||{}),Ce=(s=>(s.LOW="lowp",s.MEDIUM="mediump",s.HIGH="highp",s))(Ce||{}),Wt=(s=>(s[s.NONE=0]="NONE",s[s.SCISSOR=1]="SCISSOR",s[s.STENCIL=2]="STENCIL",s[s.SPRITE=3]="SPRITE",s[s.COLOR=4]="COLOR",s))(Wt||{}),Ht=(s=>(s[s.NONE=0]="NONE",s[s.LOW=2]="LOW",s[s.MEDIUM=4]="MEDIUM",s[s.HIGH=8]="HIGH",s))(Ht||{}),Qe=(s=>(s[s.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",s[s.ARRAY_BUFFER=34962]="ARRAY_BUFFER",s[s.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",s))(Qe||{});const H={ADAPTER:{createCanvas:(s,t)=>{const e=document.createElement("canvas");return e.width=s,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(s,t)=>fetch(s,t),parseXML:s=>new DOMParser().parseFromString(s,"text/xml")},RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var So=/iPhone/i,tu=/iPod/i,eu=/iPad/i,iu=/\biOS-universal(?:.+)Mac\b/i,Co=/\bAndroid(?:.+)Mobile\b/i,su=/Android/i,$s=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Fn=/Silk/i,wi=/Windows Phone/i,ru=/\bWindows(?:.+)ARM\b/i,nu=/BlackBerry/i,au=/BB10/i,ou=/Opera Mini/i,hu=/\b(CriOS|Chrome)(?:.+)Mobile/i,lu=/Mobile(?:.+)Firefox\b/i,cu=function(s){return typeof s<"u"&&s.platform==="MacIntel"&&typeof s.maxTouchPoints=="number"&&s.maxTouchPoints>1&&typeof MSStream>"u"};function P_(s){return function(t){return t.test(s)}}function uu(s){var t={userAgent:"",platform:"",maxTouchPoints:0};!s&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof s=="string"?t.userAgent=s:s&&s.userAgent&&(t={userAgent:s.userAgent,platform:s.platform,maxTouchPoints:s.maxTouchPoints||0});var e=t.userAgent,i=e.split("[FBAN");typeof i[1]<"u"&&(e=i[0]),i=e.split("Twitter"),typeof i[1]<"u"&&(e=i[0]);var r=P_(e),n={apple:{phone:r(So)&&!r(wi),ipod:r(tu),tablet:!r(So)&&(r(eu)||cu(t))&&!r(wi),universal:r(iu),device:(r(So)||r(tu)||r(eu)||r(iu)||cu(t))&&!r(wi)},amazon:{phone:r($s),tablet:!r($s)&&r(Fn),device:r($s)||r(Fn)},android:{phone:!r(wi)&&r($s)||!r(wi)&&r(Co),tablet:!r(wi)&&!r($s)&&!r(Co)&&(r(Fn)||r(su)),device:!r(wi)&&(r($s)||r(Fn)||r(Co)||r(su))||r(/\bokhttp\b/i)},windows:{phone:r(wi),tablet:r(ru),device:r(wi)||r(ru)},other:{blackberry:r(nu),blackberry10:r(au),opera:r(ou),firefox:r(lu),chrome:r(hu),device:r(nu)||r(au)||r(ou)||r(lu)||r(hu)},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 R_=uu.default??uu,Ei=R_(globalThis.navigator);H.RETINA_PREFIX=/@([0-9\.]+)x/,H.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Nr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function du(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function I_(s){if(s.__esModule)return s;var t=s.default;if(typeof t=="function"){var e=function i(){return this instanceof i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(s).forEach(function(i){var r=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return s[i]}})}),e}var fu={exports:{}};(function(s){var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function r(h,l,c){this.fn=h,this.context=l,this.once=c||!1}function n(h,l,c,d,u){if(typeof c!="function")throw new TypeError("The listener must be a function");var f=new r(c,d||h,u),p=e?e+l:l;return h._events[p]?h._events[p].fn?h._events[p]=[h._events[p],f]:h._events[p].push(f):(h._events[p]=f,h._eventsCount++),h}function a(h,l){--h._eventsCount===0?h._events=new i:delete h._events[l]}function o(){this._events=new i,this._eventsCount=0}o.prototype.eventNames=function(){var l=[],c,d;if(this._eventsCount===0)return l;for(d in c=this._events)t.call(c,d)&&l.push(e?d.slice(1):d);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},o.prototype.listeners=function(l){var c=e?e+l:l,d=this._events[c];if(!d)return[];if(d.fn)return[d.fn];for(var u=0,f=d.length,p=new Array(f);u<f;u++)p[u]=d[u].fn;return p},o.prototype.listenerCount=function(l){var c=e?e+l:l,d=this._events[c];return d?d.fn?1:d.length:0},o.prototype.emit=function(l,c,d,u,f,p){var m=e?e+l:l;if(!this._events[m])return!1;var _=this._events[m],y=arguments.length,v,g;if(_.fn){switch(_.once&&this.removeListener(l,_.fn,void 0,!0),y){case 1:return _.fn.call(_.context),!0;case 2:return _.fn.call(_.context,c),!0;case 3:return _.fn.call(_.context,c,d),!0;case 4:return _.fn.call(_.context,c,d,u),!0;case 5:return _.fn.call(_.context,c,d,u,f),!0;case 6:return _.fn.call(_.context,c,d,u,f,p),!0}for(g=1,v=new Array(y-1);g<y;g++)v[g-1]=arguments[g];_.fn.apply(_.context,v)}else{var x=_.length,b;for(g=0;g<x;g++)switch(_[g].once&&this.removeListener(l,_[g].fn,void 0,!0),y){case 1:_[g].fn.call(_[g].context);break;case 2:_[g].fn.call(_[g].context,c);break;case 3:_[g].fn.call(_[g].context,c,d);break;case 4:_[g].fn.call(_[g].context,c,d,u);break;default:if(!v)for(b=1,v=new Array(y-1);b<y;b++)v[b-1]=arguments[b];_[g].fn.apply(_[g].context,v)}}return!0},o.prototype.on=function(l,c,d){return n(this,l,c,d,!1)},o.prototype.once=function(l,c,d){return n(this,l,c,d,!0)},o.prototype.removeListener=function(l,c,d,u){var f=e?e+l:l;if(!this._events[f])return this;if(!c)return a(this,f),this;var p=this._events[f];if(p.fn)p.fn===c&&(!u||p.once)&&(!d||p.context===d)&&a(this,f);else{for(var m=0,_=[],y=p.length;m<y;m++)(p[m].fn!==c||u&&!p[m].once||d&&p[m].context!==d)&&_.push(p[m]);_.length?this._events[f]=_.length===1?_[0]:_:a(this,f)}return this},o.prototype.removeAllListeners=function(l){var c;return l?(c=e?e+l:l,this._events[c]&&a(this,c)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=e,o.EventEmitter=o,s.exports=o})(fu);var M_=fu.exports;const Je=du(M_);var Po={exports:{}};Po.exports=Ln,Po.exports.default=Ln;function Ln(s,t,e){e=e||2;var i=t&&t.length,r=i?t[0]*e:s.length,n=pu(s,0,r,e,!0),a=[];if(!n||n.next===n.prev)return a;var o,h,l,c,d,u,f;if(i&&(n=L_(s,t,n,e)),s.length>80*e){o=l=s[0],h=c=s[1];for(var p=e;p<r;p+=e)d=s[p],u=s[p+1],d<o&&(o=d),u<h&&(h=u),d>l&&(l=d),u>c&&(c=u);f=Math.max(l-o,c-h),f=f!==0?32767/f:0}return Ur(n,a,e,o,h,f,0),a}function pu(s,t,e,i,r){var n,a;if(r===Mo(s,t,e,i)>0)for(n=t;n<e;n+=i)a=gu(n,s[n],s[n+1],a);else for(n=e-i;n>=t;n-=i)a=gu(n,s[n],s[n+1],a);return a&&kn(a,a.next)&&(Hr(a),a=a.next),a}function ds(s,t){if(!s)return s;t||(t=s);var e=s,i;do if(i=!1,!e.steiner&&(kn(e,e.next)||Et(e.prev,e,e.next)===0)){if(Hr(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Ur(s,t,e,i,r,n,a){if(s){!a&&n&&H_(s,i,r,n);for(var o=s,h,l;s.prev!==s.next;){if(h=s.prev,l=s.next,n?B_(s,i,r,n):D_(s)){t.push(h.i/e|0),t.push(s.i/e|0),t.push(l.i/e|0),Hr(s),s=l.next,o=l.next;continue}if(s=l,s===o){a?a===1?(s=O_(ds(s),t,e),Ur(s,t,e,i,r,n,2)):a===2&&F_(s,t,e,i,r,n):Ur(ds(s),t,e,i,r,n,1);break}}}}function D_(s){var t=s.prev,e=s,i=s.next;if(Et(t,e,i)>=0)return!1;for(var r=t.x,n=e.x,a=i.x,o=t.y,h=e.y,l=i.y,c=r<n?r<a?r:a:n<a?n:a,d=o<h?o<l?o:l:h<l?h:l,u=r>n?r>a?r:a:n>a?n:a,f=o>h?o>l?o:l:h>l?h:l,p=i.next;p!==t;){if(p.x>=c&&p.x<=u&&p.y>=d&&p.y<=f&&zs(r,o,n,h,a,l,p.x,p.y)&&Et(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function B_(s,t,e,i){var r=s.prev,n=s,a=s.next;if(Et(r,n,a)>=0)return!1;for(var o=r.x,h=n.x,l=a.x,c=r.y,d=n.y,u=a.y,f=o<h?o<l?o:l:h<l?h:l,p=c<d?c<u?c:u:d<u?d:u,m=o>h?o>l?o:l:h>l?h:l,_=c>d?c>u?c:u:d>u?d:u,y=Ro(f,p,t,e,i),v=Ro(m,_,t,e,i),g=s.prevZ,x=s.nextZ;g&&g.z>=y&&x&&x.z<=v;){if(g.x>=f&&g.x<=m&&g.y>=p&&g.y<=_&&g!==r&&g!==a&&zs(o,c,h,d,l,u,g.x,g.y)&&Et(g.prev,g,g.next)>=0||(g=g.prevZ,x.x>=f&&x.x<=m&&x.y>=p&&x.y<=_&&x!==r&&x!==a&&zs(o,c,h,d,l,u,x.x,x.y)&&Et(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;g&&g.z>=y;){if(g.x>=f&&g.x<=m&&g.y>=p&&g.y<=_&&g!==r&&g!==a&&zs(o,c,h,d,l,u,g.x,g.y)&&Et(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;x&&x.z<=v;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=_&&x!==r&&x!==a&&zs(o,c,h,d,l,u,x.x,x.y)&&Et(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function O_(s,t,e){var i=s;do{var r=i.prev,n=i.next.next;!kn(r,n)&&mu(r,i,i.next,n)&&Gr(r,n)&&Gr(n,r)&&(t.push(r.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),Hr(i),Hr(i.next),i=s=n),i=i.next}while(i!==s);return ds(i)}function F_(s,t,e,i,r,n){var a=s;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&X_(a,o)){var h=_u(a,o);a=ds(a,a.next),h=ds(h,h.next),Ur(a,t,e,i,r,n,0),Ur(h,t,e,i,r,n,0);return}o=o.next}a=a.next}while(a!==s)}function L_(s,t,e,i){var r=[],n,a,o,h,l;for(n=0,a=t.length;n<a;n++)o=t[n]*i,h=n<a-1?t[n+1]*i:s.length,l=pu(s,o,h,i,!1),l===l.next&&(l.steiner=!0),r.push(W_(l));for(r.sort(k_),n=0;n<r.length;n++)e=N_(r[n],e);return e}function k_(s,t){return s.x-t.x}function N_(s,t){var e=U_(s,t);if(!e)return t;var i=_u(e,s);return ds(i,i.next),ds(e,e.next)}function U_(s,t){var e=t,i=s.x,r=s.y,n=-1/0,a;do{if(r<=e.y&&r>=e.next.y&&e.next.y!==e.y){var o=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(o<=i&&o>n&&(n=o,a=e.x<e.next.x?e:e.next,o===i))return a}e=e.next}while(e!==t);if(!a)return null;var h=a,l=a.x,c=a.y,d=1/0,u;e=a;do i>=e.x&&e.x>=l&&i!==e.x&&zs(r<c?i:n,r,l,c,r<c?n:i,r,e.x,e.y)&&(u=Math.abs(r-e.y)/(i-e.x),Gr(e,s)&&(u<d||u===d&&(e.x>a.x||e.x===a.x&&G_(a,e)))&&(a=e,d=u)),e=e.next;while(e!==h);return a}function G_(s,t){return Et(s.prev,s,t.prev)<0&&Et(t.next,s,s.next)<0}function H_(s,t,e,i){var r=s;do r.z===0&&(r.z=Ro(r.x,r.y,t,e,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==s);r.prevZ.nextZ=null,r.prevZ=null,V_(r)}function V_(s){var t,e,i,r,n,a,o,h,l=1;do{for(e=s,s=null,n=null,a=0;e;){for(a++,i=e,o=0,t=0;t<l&&(o++,i=i.nextZ,!!i);t++);for(h=l;o>0||h>0&&i;)o!==0&&(h===0||!i||e.z<=i.z)?(r=e,e=e.nextZ,o--):(r=i,i=i.nextZ,h--),n?n.nextZ=r:s=r,r.prevZ=n,n=r;e=i}n.nextZ=null,l*=2}while(a>1);return s}function Ro(s,t,e,i,r){return s=(s-e)*r|0,t=(t-i)*r|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,s|t<<1}function W_(s){var t=s,e=s;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==s);return e}function zs(s,t,e,i,r,n,a,o){return(r-a)*(t-o)>=(s-a)*(n-o)&&(s-a)*(i-o)>=(e-a)*(t-o)&&(e-a)*(n-o)>=(r-a)*(i-o)}function X_(s,t){return s.next.i!==t.i&&s.prev.i!==t.i&&!$_(s,t)&&(Gr(s,t)&&Gr(t,s)&&z_(s,t)&&(Et(s.prev,s,t.prev)||Et(s,t.prev,t))||kn(s,t)&&Et(s.prev,s,s.next)>0&&Et(t.prev,t,t.next)>0)}function Et(s,t,e){return(t.y-s.y)*(e.x-t.x)-(t.x-s.x)*(e.y-t.y)}function kn(s,t){return s.x===t.x&&s.y===t.y}function mu(s,t,e,i){var r=Un(Et(s,t,e)),n=Un(Et(s,t,i)),a=Un(Et(e,i,s)),o=Un(Et(e,i,t));return!!(r!==n&&a!==o||r===0&&Nn(s,e,t)||n===0&&Nn(s,i,t)||a===0&&Nn(e,s,i)||o===0&&Nn(e,t,i))}function Nn(s,t,e){return t.x<=Math.max(s.x,e.x)&&t.x>=Math.min(s.x,e.x)&&t.y<=Math.max(s.y,e.y)&&t.y>=Math.min(s.y,e.y)}function Un(s){return s>0?1:s<0?-1:0}function $_(s,t){var e=s;do{if(e.i!==s.i&&e.next.i!==s.i&&e.i!==t.i&&e.next.i!==t.i&&mu(e,e.next,s,t))return!0;e=e.next}while(e!==s);return!1}function Gr(s,t){return Et(s.prev,s,s.next)<0?Et(s,t,s.next)>=0&&Et(s,s.prev,t)>=0:Et(s,t,s.prev)<0||Et(s,s.next,t)<0}function z_(s,t){var e=s,i=!1,r=(s.x+t.x)/2,n=(s.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&&(i=!i),e=e.next;while(e!==s);return i}function _u(s,t){var e=new Io(s.i,s.x,s.y),i=new Io(t.i,t.x,t.y),r=s.next,n=t.prev;return s.next=t,t.prev=s,e.next=r,r.prev=e,i.next=e,e.prev=i,n.next=i,i.prev=n,i}function gu(s,t,e,i){var r=new Io(s,t,e);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Hr(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function Io(s,t,e){this.i=s,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Ln.deviation=function(s,t,e,i){var r=t&&t.length,n=r?t[0]*e:s.length,a=Math.abs(Mo(s,0,n,e));if(r)for(var o=0,h=t.length;o<h;o++){var l=t[o]*e,c=o<h-1?t[o+1]*e:s.length;a-=Math.abs(Mo(s,l,c,e))}var d=0;for(o=0;o<i.length;o+=3){var u=i[o]*e,f=i[o+1]*e,p=i[o+2]*e;d+=Math.abs((s[u]-s[p])*(s[f+1]-s[u+1])-(s[u]-s[f])*(s[p+1]-s[u+1]))}return a===0&&d===0?0:Math.abs((d-a)/a)};function Mo(s,t,e,i){for(var r=0,n=t,a=e-i;n<e;n+=i)r+=(s[a]-s[n])*(s[n+1]+s[a+1]),a=n;return r}Ln.flatten=function(s){for(var t=s[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,r=0;r<s.length;r++){for(var n=0;n<s[r].length;n++)for(var a=0;a<t;a++)e.vertices.push(s[r][n][a]);r>0&&(i+=s[r-1].length,e.holes.push(i))}return e};var Y_=Po.exports;const j_=du(Y_);var Gn={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */Gn.exports,function(s,t){(function(e){var i=t&&!t.nodeType&&t,r=s&&!s.nodeType&&s,n=typeof Nr=="object"&&Nr;(n.global===n||n.window===n||n.self===n)&&(e=n);var a,o=2147483647,h=36,l=1,c=26,d=38,u=700,f=72,p=128,m="-",_=/^xn--/,y=/[^\x20-\x7E]/,v=/[\x2E\u3002\uFF0E\uFF61]/g,g={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},x=h-l,b=Math.floor,w=String.fromCharCode,T;function E(I){throw new RangeError(g[I])}function A(I,D){for(var $=I.length,Y=[];$--;)Y[$]=D(I[$]);return Y}function P(I,D){var $=I.split("@"),Y="";$.length>1&&(Y=$[0]+"@",I=$[1]),I=I.replace(v,".");var U=I.split("."),rt=A(U,D).join(".");return Y+rt}function L(I){for(var D=[],$=0,Y=I.length,U,rt;$<Y;)U=I.charCodeAt($++),U>=55296&&U<=56319&&$<Y?(rt=I.charCodeAt($++),(rt&64512)==56320?D.push(((U&1023)<<10)+(rt&1023)+65536):(D.push(U),$--)):D.push(U);return D}function M(I){return A(I,function(D){var $="";return D>65535&&(D-=65536,$+=w(D>>>10&1023|55296),D=56320|D&1023),$+=w(D),$}).join("")}function S(I){return I-48<10?I-22:I-65<26?I-65:I-97<26?I-97:h}function C(I,D){return I+22+75*(I<26)-((D!=0)<<5)}function R(I,D,$){var Y=0;for(I=$?b(I/u):I>>1,I+=b(I/D);I>x*c>>1;Y+=h)I=b(I/x);return b(Y+(x+1)*I/(I+d))}function N(I){var D=[],$=I.length,Y,U=0,rt=p,dt=f,lt,vt,Dt,kt,_t,Bt,wt,me,Ae;for(lt=I.lastIndexOf(m),lt<0&&(lt=0),vt=0;vt<lt;++vt)I.charCodeAt(vt)>=128&&E("not-basic"),D.push(I.charCodeAt(vt));for(Dt=lt>0?lt+1:0;Dt<$;){for(kt=U,_t=1,Bt=h;Dt>=$&&E("invalid-input"),wt=S(I.charCodeAt(Dt++)),(wt>=h||wt>b((o-U)/_t))&&E("overflow"),U+=wt*_t,me=Bt<=dt?l:Bt>=dt+c?c:Bt-dt,!(wt<me);Bt+=h)Ae=h-me,_t>b(o/Ae)&&E("overflow"),_t*=Ae;Y=D.length+1,dt=R(U-kt,Y,kt==0),b(U/Y)>o-rt&&E("overflow"),rt+=b(U/Y),U%=Y,D.splice(U++,0,rt)}return M(D)}function F(I){var D,$,Y,U,rt,dt,lt,vt,Dt,kt,_t,Bt=[],wt,me,Ae,cs;for(I=L(I),wt=I.length,D=p,$=0,rt=f,dt=0;dt<wt;++dt)_t=I[dt],_t<128&&Bt.push(w(_t));for(Y=U=Bt.length,U&&Bt.push(m);Y<wt;){for(lt=o,dt=0;dt<wt;++dt)_t=I[dt],_t>=D&&_t<lt&&(lt=_t);for(me=Y+1,lt-D>b((o-$)/me)&&E("overflow"),$+=(lt-D)*me,D=lt,dt=0;dt<wt;++dt)if(_t=I[dt],_t<D&&++$>o&&E("overflow"),_t==D){for(vt=$,Dt=h;kt=Dt<=rt?l:Dt>=rt+c?c:Dt-rt,!(vt<kt);Dt+=h)cs=vt-kt,Ae=h-kt,Bt.push(w(C(kt+cs%Ae,0))),vt=b(cs/Ae);Bt.push(w(C(vt,0))),rt=R($,me,Y==U),$=0,++Y}++$,++D}return Bt.join("")}function B(I){return P(I,function(D){return _.test(D)?N(D.slice(4).toLowerCase()):D})}function W(I){return P(I,function(D){return y.test(D)?"xn--"+F(D):D})}if(a={version:"1.4.1",ucs2:{decode:L,encode:M},decode:N,encode:F,toASCII:W,toUnicode:B},i&&r)if(s.exports==i)r.exports=a;else for(T in a)a.hasOwnProperty(T)&&(i[T]=a[T]);else e.punycode=a})(Nr)}(Gn,Gn.exports);var q_=Gn.exports,Ys=TypeError;const K_=I_(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Do=typeof Map=="function"&&Map.prototype,Bo=Object.getOwnPropertyDescriptor&&Do?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Hn=Do&&Bo&&typeof Bo.get=="function"?Bo.get:null,yu=Do&&Map.prototype.forEach,Oo=typeof Set=="function"&&Set.prototype,Fo=Object.getOwnPropertyDescriptor&&Oo?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Vn=Oo&&Fo&&typeof Fo.get=="function"?Fo.get:null,xu=Oo&&Set.prototype.forEach,Z_=typeof WeakMap=="function"&&WeakMap.prototype,Vr=Z_?WeakMap.prototype.has:null,Q_=typeof WeakSet=="function"&&WeakSet.prototype,Wr=Q_?WeakSet.prototype.has:null,J_=typeof WeakRef=="function"&&WeakRef.prototype,vu=J_?WeakRef.prototype.deref:null,tg=Boolean.prototype.valueOf,eg=Object.prototype.toString,ig=Function.prototype.toString,sg=String.prototype.match,Lo=String.prototype.slice,Gi=String.prototype.replace,rg=String.prototype.toUpperCase,bu=String.prototype.toLowerCase,Tu=RegExp.prototype.test,wu=Array.prototype.concat,ti=Array.prototype.join,ng=Array.prototype.slice,Eu=Math.floor,ko=typeof BigInt=="function"?BigInt.prototype.valueOf:null,No=Object.getOwnPropertySymbols,Uo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,js=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Jt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===js||"symbol")?Symbol.toStringTag:null,Au=Object.prototype.propertyIsEnumerable,Su=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(s){return s.__proto__}:null);function Cu(s,t){if(s===1/0||s===-1/0||s!==s||s&&s>-1e3&&s<1e3||Tu.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof s=="number"){var i=s<0?-Eu(-s):Eu(s);if(i!==s){var r=String(i),n=Lo.call(t,r.length+1);return Gi.call(r,e,"$&_")+"."+Gi.call(Gi.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Gi.call(t,e,"$&_")}var Go=K_,Pu=Go.custom,Ru=Bu(Pu)?Pu:null,Iu={__proto__:null,double:'"',single:"'"},ag={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},Wn=function s(t,e,i,r){var n=e||{};if(Ai(n,"quoteStyle")&&!Ai(Iu,n.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Ai(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=Ai(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(Ai(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(Ai(n,"numericSeparator")&&typeof n.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var o=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 Fu(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return o?Cu(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return o?Cu(t,l):l}var c=typeof n.depth>"u"?5:n.depth;if(typeof i>"u"&&(i=0),i>=c&&c>0&&typeof t=="object")return Ho(t)?"[Array]":"[Object]";var d=Eg(n,i);if(typeof r>"u")r=[];else if(Ou(r,t)>=0)return"[Circular]";function u(S,C,R){if(C&&(r=ng.call(r),r.push(C)),R){var N={depth:n.depth};return Ai(n,"quoteStyle")&&(N.quoteStyle=n.quoteStyle),s(S,N,i+1,r)}return s(S,n,i+1,r)}if(typeof t=="function"&&!Du(t)){var f=mg(t),p=Xn(t,u);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+ti.call(p,", ")+" }":"")}if(Bu(t)){var m=js?Gi.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Uo.call(t);return typeof t=="object"&&!js?Xr(m):m}if(bg(t)){for(var _="<"+bu.call(String(t.nodeName)),y=t.attributes||[],v=0;v<y.length;v++)_+=" "+y[v].name+"="+Mu(og(y[v].value),"double",n);return _+=">",t.childNodes&&t.childNodes.length&&(_+="..."),_+="</"+bu.call(String(t.nodeName))+">",_}if(Ho(t)){if(t.length===0)return"[]";var g=Xn(t,u);return d&&!wg(g)?"["+Wo(g,d)+"]":"[ "+ti.call(g,", ")+" ]"}if(lg(t)){var x=Xn(t,u);return!("cause"in Error.prototype)&&"cause"in t&&!Au.call(t,"cause")?"{ ["+String(t)+"] "+ti.call(wu.call("[cause]: "+u(t.cause),x),", ")+" }":x.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+ti.call(x,", ")+" }"}if(typeof t=="object"&&a){if(Ru&&typeof t[Ru]=="function"&&Go)return Go(t,{depth:c-i});if(a!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(_g(t)){var b=[];return yu&&yu.call(t,function(S,C){b.push(u(C,t,!0)+" => "+u(S,t))}),Lu("Map",Hn.call(t),b,d)}if(xg(t)){var w=[];return xu&&xu.call(t,function(S){w.push(u(S,t))}),Lu("Set",Vn.call(t),w,d)}if(gg(t))return Vo("WeakMap");if(vg(t))return Vo("WeakSet");if(yg(t))return Vo("WeakRef");if(ug(t))return Xr(u(Number(t)));if(fg(t))return Xr(u(ko.call(t)));if(dg(t))return Xr(tg.call(t));if(cg(t))return Xr(u(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof Nr<"u"&&t===Nr)return"{ [object globalThis] }";if(!hg(t)&&!Du(t)){var T=Xn(t,u),E=Su?Su(t)===Object.prototype:t instanceof Object||t.constructor===Object,A=t instanceof Object?"":"null prototype",P=!E&&Jt&&Object(t)===t&&Jt in t?Lo.call(Hi(t),8,-1):A?"Object":"",L=E||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",M=L+(P||A?"["+ti.call(wu.call([],P||[],A||[]),": ")+"] ":"");return T.length===0?M+"{}":d?M+"{"+Wo(T,d)+"}":M+"{ "+ti.call(T,", ")+" }"}return String(t)};function Mu(s,t,e){var i=e.quoteStyle||t,r=Iu[i];return r+s+r}function og(s){return Gi.call(String(s),/"/g,""")}function Ho(s){return Hi(s)==="[object Array]"&&(!Jt||!(typeof s=="object"&&Jt in s))}function hg(s){return Hi(s)==="[object Date]"&&(!Jt||!(typeof s=="object"&&Jt in s))}function Du(s){return Hi(s)==="[object RegExp]"&&(!Jt||!(typeof s=="object"&&Jt in s))}function lg(s){return Hi(s)==="[object Error]"&&(!Jt||!(typeof s=="object"&&Jt in s))}function cg(s){return Hi(s)==="[object String]"&&(!Jt||!(typeof s=="object"&&Jt in s))}function ug(s){return Hi(s)==="[object Number]"&&(!Jt||!(typeof s=="object"&&Jt in s))}function dg(s){return Hi(s)==="[object Boolean]"&&(!Jt||!(typeof s=="object"&&Jt in s))}function Bu(s){if(js)return s&&typeof s=="object"&&s instanceof Symbol;if(typeof s=="symbol")return!0;if(!s||typeof s!="object"||!Uo)return!1;try{return Uo.call(s),!0}catch{}return!1}function fg(s){if(!s||typeof s!="object"||!ko)return!1;try{return ko.call(s),!0}catch{}return!1}var pg=Object.prototype.hasOwnProperty||function(s){return s in this};function Ai(s,t){return pg.call(s,t)}function Hi(s){return eg.call(s)}function mg(s){if(s.name)return s.name;var t=sg.call(ig.call(s),/^function\s*([\w$]+)/);return t?t[1]:null}function Ou(s,t){if(s.indexOf)return s.indexOf(t);for(var e=0,i=s.length;e<i;e++)if(s[e]===t)return e;return-1}function _g(s){if(!Hn||!s||typeof s!="object")return!1;try{Hn.call(s);try{Vn.call(s)}catch{return!0}return s instanceof Map}catch{}return!1}function gg(s){if(!Vr||!s||typeof s!="object")return!1;try{Vr.call(s,Vr);try{Wr.call(s,Wr)}catch{return!0}return s instanceof WeakMap}catch{}return!1}function yg(s){if(!vu||!s||typeof s!="object")return!1;try{return vu.call(s),!0}catch{}return!1}function xg(s){if(!Vn||!s||typeof s!="object")return!1;try{Vn.call(s);try{Hn.call(s)}catch{return!0}return s instanceof Set}catch{}return!1}function vg(s){if(!Wr||!s||typeof s!="object")return!1;try{Wr.call(s,Wr);try{Vr.call(s,Vr)}catch{return!0}return s instanceof WeakSet}catch{}return!1}function bg(s){return!s||typeof s!="object"?!1:typeof HTMLElement<"u"&&s instanceof HTMLElement?!0:typeof s.nodeName=="string"&&typeof s.getAttribute=="function"}function Fu(s,t){if(s.length>t.maxStringLength){var e=s.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return Fu(Lo.call(s,0,t.maxStringLength),t)+i}var r=ag[t.quoteStyle||"single"];r.lastIndex=0;var n=Gi.call(Gi.call(s,r,"\\$1"),/[\x00-\x1f]/g,Tg);return Mu(n,"single",t)}function Tg(s){var t=s.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+rg.call(t.toString(16))}function Xr(s){return"Object("+s+")"}function Vo(s){return s+" { ? }"}function Lu(s,t,e,i){var r=i?Wo(e,i):ti.call(e,", ");return s+" ("+t+") {"+r+"}"}function wg(s){for(var t=0;t<s.length;t++)if(Ou(s[t],`
|
|
2
|
-
`)>=0)return!1;return!0}function
|
|
3
|
-
`+t.prev+t.base;return e+
|
|
4
|
-
`+t.prev}function Xn(s,t){var e=Ho(s),i=[];if(e){i.length=s.length;for(var r=0;r<s.length;r++)i[r]=Ai(s,r)?t(s[r],s):""}var n=typeof No=="function"?No(s):[],a;if(js){a={};for(var o=0;o<n.length;o++)a["$"+n[o]]=n[o]}for(var h in s)Ai(s,h)&&(e&&String(Number(h))===h&&h<s.length||js&&a["$"+h]instanceof Symbol||(Tu.call(/[^\w$]/,h)?i.push(t(h,s)+": "+t(s[h],s)):i.push(h+": "+t(s[h],s))));if(typeof No=="function")for(var l=0;l<n.length;l++)Au.call(s,n[l])&&i.push("["+t(n[l])+"]: "+t(s[n[l]],s));return i}var Ag=Wn,Sg=Ys,$n=function(s,t,e){for(var i=s,r;(r=i.next)!=null;i=r)if(r.key===t)return i.next=r.next,e||(r.next=s.next,s.next=r),r},Cg=function(s,t){if(s){var e=$n(s,t);return e&&e.value}},Pg=function(s,t,e){var i=$n(s,t);i?i.value=e:s.next={key:t,next:s.next,value:e}},Rg=function(s,t){return s?!!$n(s,t):!1},Ig=function(s,t){if(s)return $n(s,t,!0)},Mg=function(){var t,e={assert:function(i){if(!e.has(i))throw new Sg("Side channel does not contain "+Ag(i))},delete:function(i){var r=t&&t.next,n=Ig(t,i);return n&&r&&r===n&&(t=void 0),!!n},get:function(i){return Cg(t,i)},has:function(i){return Rg(t,i)},set:function(i,r){t||(t={next:void 0}),Pg(t,i,r)}};return e},ku=Object,Dg=Error,Bg=EvalError,Og=RangeError,Fg=ReferenceError,Lg=SyntaxError,kg=URIError,Ng=Math.abs,Ug=Math.floor,Gg=Math.max,Hg=Math.min,Vg=Math.pow,Wg=Math.round,Xg=Number.isNaN||function(t){return t!==t},$g=Xg,zg=function(t){return $g(t)||t===0?t:t<0?-1:1},Yg=Object.getOwnPropertyDescriptor,zn=Yg;if(zn)try{zn([],"length")}catch{zn=null}var Nu=zn,Yn=Object.defineProperty||!1;if(Yn)try{Yn({},"a",{value:1})}catch{Yn=!1}var jg=Yn,Xo,Uu;function qg(){return Uu||(Uu=1,Xo=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),i=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var 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 o=Object.getOwnPropertyDescriptor(t,e);if(o.value!==r||o.enumerable!==!0)return!1}return!0}),Xo}var $o,Gu;function Kg(){if(Gu)return $o;Gu=1;var s=typeof Symbol<"u"&&Symbol,t=qg();return $o=function(){return typeof s!="function"||typeof Symbol!="function"||typeof s("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},$o}var zo,Hu;function Vu(){return Hu||(Hu=1,zo=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),zo}var Yo,Wu;function Xu(){if(Wu)return Yo;Wu=1;var s=ku;return Yo=s.getPrototypeOf||null,Yo}var jo,$u;function Zg(){if($u)return jo;$u=1;var s="Function.prototype.bind called on incompatible ",t=Object.prototype.toString,e=Math.max,i="[object Function]",r=function(h,l){for(var c=[],d=0;d<h.length;d+=1)c[d]=h[d];for(var u=0;u<l.length;u+=1)c[u+h.length]=l[u];return c},n=function(h,l){for(var c=[],d=l||0,u=0;d<h.length;d+=1,u+=1)c[u]=h[d];return c},a=function(o,h){for(var l="",c=0;c<o.length;c+=1)l+=o[c],c+1<o.length&&(l+=h);return l};return jo=function(h){var l=this;if(typeof l!="function"||t.apply(l)!==i)throw new TypeError(s+l);for(var c=n(arguments,1),d,u=function(){if(this instanceof d){var y=l.apply(this,r(c,arguments));return Object(y)===y?y:this}return l.apply(h,r(c,arguments))},f=e(0,l.length-c.length),p=[],m=0;m<f;m++)p[m]="$"+m;if(d=Function("binder","return function ("+a(p,",")+"){ return binder.apply(this,arguments); }")(u),l.prototype){var _=function(){};_.prototype=l.prototype,d.prototype=new _,_.prototype=null}return d},jo}var qo,zu;function jn(){if(zu)return qo;zu=1;var s=Zg();return qo=Function.prototype.bind||s,qo}var Ko,Yu;function Zo(){return Yu||(Yu=1,Ko=Function.prototype.call),Ko}var Qo,ju;function qu(){return ju||(ju=1,Qo=Function.prototype.apply),Qo}var Qg=typeof Reflect<"u"&&Reflect&&Reflect.apply,Jg=jn(),t0=qu(),e0=Zo(),i0=Qg,s0=i0||Jg.call(e0,t0),r0=jn(),n0=Ys,a0=Zo(),o0=s0,Ku=function(t){if(t.length<1||typeof t[0]!="function")throw new n0("a function is required");return o0(r0,a0,t)},Jo,Zu;function h0(){if(Zu)return Jo;Zu=1;var s=Ku,t=Nu,e;try{e=[].__proto__===Array.prototype}catch(a){if(!a||typeof a!="object"||!("code"in a)||a.code!=="ERR_PROTO_ACCESS")throw a}var i=!!e&&t&&t(Object.prototype,"__proto__"),r=Object,n=r.getPrototypeOf;return Jo=i&&typeof i.get=="function"?s([i.get]):typeof n=="function"?function(o){return n(o==null?o:r(o))}:!1,Jo}var th,Qu;function l0(){if(Qu)return th;Qu=1;var s=Vu(),t=Xu(),e=h0();return th=s?function(r){return s(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,Ju;function c0(){if(Ju)return eh;Ju=1;var s=Function.prototype.call,t=Object.prototype.hasOwnProperty,e=jn();return eh=e.call(s,t),eh}var nt,u0=ku,d0=Dg,f0=Bg,p0=Og,m0=Fg,qs=Lg,Ks=Ys,_0=kg,g0=Ng,y0=Ug,x0=Gg,v0=Hg,b0=Vg,T0=Wg,w0=zg,td=Function,ih=function(s){try{return td('"use strict"; return ('+s+").constructor;")()}catch{}},$r=Nu,E0=jg,sh=function(){throw new Ks},A0=$r?function(){try{return arguments.callee,sh}catch{try{return $r(arguments,"callee").get}catch{return sh}}}():sh,Zs=Kg()(),$t=l0(),S0=Xu(),C0=Vu(),ed=qu(),zr=Zo(),Qs={},P0=typeof Uint8Array>"u"||!$t?nt:$t(Uint8Array),fs={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?nt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?nt:ArrayBuffer,"%ArrayIteratorPrototype%":Zs&&$t?$t([][Symbol.iterator]()):nt,"%AsyncFromSyncIteratorPrototype%":nt,"%AsyncFunction%":Qs,"%AsyncGenerator%":Qs,"%AsyncGeneratorFunction%":Qs,"%AsyncIteratorPrototype%":Qs,"%Atomics%":typeof Atomics>"u"?nt:Atomics,"%BigInt%":typeof BigInt>"u"?nt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?nt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?nt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?nt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":d0,"%eval%":eval,"%EvalError%":f0,"%Float32Array%":typeof Float32Array>"u"?nt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?nt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?nt:FinalizationRegistry,"%Function%":td,"%GeneratorFunction%":Qs,"%Int8Array%":typeof Int8Array>"u"?nt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?nt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?nt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Zs&&$t?$t($t([][Symbol.iterator]())):nt,"%JSON%":typeof JSON=="object"?JSON:nt,"%Map%":typeof Map>"u"?nt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Zs||!$t?nt:$t(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":u0,"%Object.getOwnPropertyDescriptor%":$r,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?nt:Promise,"%Proxy%":typeof Proxy>"u"?nt:Proxy,"%RangeError%":p0,"%ReferenceError%":m0,"%Reflect%":typeof Reflect>"u"?nt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?nt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Zs||!$t?nt:$t(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?nt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Zs&&$t?$t(""[Symbol.iterator]()):nt,"%Symbol%":Zs?Symbol:nt,"%SyntaxError%":qs,"%ThrowTypeError%":A0,"%TypedArray%":P0,"%TypeError%":Ks,"%Uint8Array%":typeof Uint8Array>"u"?nt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?nt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?nt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?nt:Uint32Array,"%URIError%":_0,"%WeakMap%":typeof WeakMap>"u"?nt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?nt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?nt:WeakSet,"%Function.prototype.call%":zr,"%Function.prototype.apply%":ed,"%Object.defineProperty%":E0,"%Object.getPrototypeOf%":S0,"%Math.abs%":g0,"%Math.floor%":y0,"%Math.max%":x0,"%Math.min%":v0,"%Math.pow%":b0,"%Math.round%":T0,"%Math.sign%":w0,"%Reflect.getPrototypeOf%":C0};if($t)try{null.error}catch(s){var R0=$t($t(s));fs["%Error.prototype%"]=R0}var I0=function s(t){var e;if(t==="%AsyncFunction%")e=ih("async function () {}");else if(t==="%GeneratorFunction%")e=ih("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=ih("async function* () {}");else if(t==="%AsyncGenerator%"){var i=s("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var r=s("%AsyncGenerator%");r&&$t&&(e=$t(r.prototype))}return fs[t]=e,e},id={__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"]},Yr=jn(),qn=c0(),M0=Yr.call(zr,Array.prototype.concat),D0=Yr.call(ed,Array.prototype.splice),sd=Yr.call(zr,String.prototype.replace),Kn=Yr.call(zr,String.prototype.slice),B0=Yr.call(zr,RegExp.prototype.exec),O0=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,F0=/\\(\\)?/g,L0=function(t){var e=Kn(t,0,1),i=Kn(t,-1);if(e==="%"&&i!=="%")throw new qs("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new qs("invalid intrinsic syntax, expected opening `%`");var r=[];return sd(t,O0,function(n,a,o,h){r[r.length]=o?sd(h,F0,"$1"):a||n}),r},k0=function(t,e){var i=t,r;if(qn(id,i)&&(r=id[i],i="%"+r[0]+"%"),qn(fs,i)){var n=fs[i];if(n===Qs&&(n=I0(i)),typeof n>"u"&&!e)throw new Ks("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:i,value:n}}throw new qs("intrinsic "+t+" does not exist!")},rh=function(t,e){if(typeof t!="string"||t.length===0)throw new Ks("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Ks('"allowMissing" argument must be a boolean');if(B0(/^%?[^%]*%?$/,t)===null)throw new qs("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=L0(t),r=i.length>0?i[0]:"",n=k0("%"+r+"%",e),a=n.name,o=n.value,h=!1,l=n.alias;l&&(r=l[0],D0(i,M0([0,1],l)));for(var c=1,d=!0;c<i.length;c+=1){var u=i[c],f=Kn(u,0,1),p=Kn(u,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new qs("property names with quotes must have matching quotes");if((u==="constructor"||!d)&&(h=!0),r+="."+u,a="%"+r+"%",qn(fs,a))o=fs[a];else if(o!=null){if(!(u in o)){if(!e)throw new Ks("base intrinsic for "+t+" exists, but the property is not available.");return}if($r&&c+1>=i.length){var m=$r(o,u);d=!!m,d&&"get"in m&&!("originalValue"in m.get)?o=m.get:o=o[u]}else d=qn(o,u),o=o[u];d&&!h&&(fs[a]=o)}}return o},rd=rh,nd=Ku,N0=nd([rd("%String.prototype.indexOf%")]),ad=function(t,e){var i=rd(t,!!e);return typeof i=="function"&&N0(t,".prototype.")>-1?nd([i]):i},U0=rh,jr=ad,G0=Wn,H0=Ys,od=U0("%Map%",!0),V0=jr("Map.prototype.get",!0),W0=jr("Map.prototype.set",!0),X0=jr("Map.prototype.has",!0),$0=jr("Map.prototype.delete",!0),z0=jr("Map.prototype.size",!0),hd=!!od&&function(){var t,e={assert:function(i){if(!e.has(i))throw new H0("Side channel does not contain "+G0(i))},delete:function(i){if(t){var r=$0(t,i);return z0(t)===0&&(t=void 0),r}return!1},get:function(i){if(t)return V0(t,i)},has:function(i){return t?X0(t,i):!1},set:function(i,r){t||(t=new od),W0(t,i,r)}};return e},Y0=rh,Zn=ad,j0=Wn,Qn=hd,q0=Ys,Js=Y0("%WeakMap%",!0),K0=Zn("WeakMap.prototype.get",!0),Z0=Zn("WeakMap.prototype.set",!0),Q0=Zn("WeakMap.prototype.has",!0),J0=Zn("WeakMap.prototype.delete",!0),ty=Js?function(){var t,e,i={assert:function(r){if(!i.has(r))throw new q0("Side channel does not contain "+j0(r))},delete:function(r){if(Js&&r&&(typeof r=="object"||typeof r=="function")){if(t)return J0(t,r)}else if(Qn&&e)return e.delete(r);return!1},get:function(r){return Js&&r&&(typeof r=="object"||typeof r=="function")&&t?K0(t,r):e&&e.get(r)},has:function(r){return Js&&r&&(typeof r=="object"||typeof r=="function")&&t?Q0(t,r):!!e&&e.has(r)},set:function(r,n){Js&&r&&(typeof r=="object"||typeof r=="function")?(t||(t=new Js),Z0(t,r,n)):Qn&&(e||(e=Qn()),e.set(r,n))}};return i}:Qn,ey=Ys,iy=Wn,sy=Mg,ry=hd,ny=ty,ay=ny||ry||sy,oy=function(){var t,e={assert:function(i){if(!e.has(i))throw new ey("Side channel does not contain "+iy(i))},delete:function(i){return!!t&&t.delete(i)},get:function(i){return t&&t.get(i)},has:function(i){return!!t&&t.has(i)},set:function(i,r){t||(t=ay()),t.set(i,r)}};return e},hy=String.prototype.replace,ly=/%20/g,nh={RFC1738:"RFC1738",RFC3986:"RFC3986"},ah={default:nh.RFC3986,formatters:{RFC1738:function(s){return hy.call(s,ly,"+")},RFC3986:function(s){return String(s)}},RFC1738:nh.RFC1738,RFC3986:nh.RFC3986},cy=ah,oh=Object.prototype.hasOwnProperty,ps=Array.isArray,ei=function(){for(var s=[],t=0;t<256;++t)s.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return s}(),uy=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(ps(i)){for(var r=[],n=0;n<i.length;++n)typeof i[n]<"u"&&r.push(i[n]);e.obj[e.prop]=r}}},ld=function(t,e){for(var i=e&&e.plainObjects?{__proto__:null}:{},r=0;r<t.length;++r)typeof t[r]<"u"&&(i[r]=t[r]);return i},dy=function s(t,e,i){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(ps(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!oh.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 ps(t)&&!ps(e)&&(r=ld(t,i)),ps(t)&&ps(e)?(e.forEach(function(n,a){if(oh.call(t,a)){var o=t[a];o&&typeof o=="object"&&n&&typeof n=="object"?t[a]=s(o,n,i):t.push(n)}else t[a]=n}),t):Object.keys(e).reduce(function(n,a){var o=e[a];return oh.call(n,a)?n[a]=s(n[a],o,i):n[a]=o,n},r)},fy=function(t,e){return Object.keys(e).reduce(function(i,r){return i[r]=e[r],i},t)},py=function(s,t,e){var i=s.replace(/\+/g," ");if(e==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},hh=1024,my=function(t,e,i,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)),i==="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 o="",h=0;h<a.length;h+=hh){for(var l=a.length>=hh?a.slice(h,h+hh):a,c=[],d=0;d<l.length;++d){var u=l.charCodeAt(d);if(u===45||u===46||u===95||u===126||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||n===cy.RFC1738&&(u===40||u===41)){c[c.length]=l.charAt(d);continue}if(u<128){c[c.length]=ei[u];continue}if(u<2048){c[c.length]=ei[192|u>>6]+ei[128|u&63];continue}if(u<55296||u>=57344){c[c.length]=ei[224|u>>12]+ei[128|u>>6&63]+ei[128|u&63];continue}d+=1,u=65536+((u&1023)<<10|l.charCodeAt(d)&1023),c[c.length]=ei[240|u>>18]+ei[128|u>>12&63]+ei[128|u>>6&63]+ei[128|u&63]}o+=c.join("")}return o},_y=function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],r=0;r<e.length;++r)for(var n=e[r],a=n.obj[n.prop],o=Object.keys(a),h=0;h<o.length;++h){var l=o[h],c=a[l];typeof c=="object"&&c!==null&&i.indexOf(c)===-1&&(e.push({obj:a,prop:l}),i.push(c))}return uy(e),t},gy=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},yy=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},xy=function(t,e){return[].concat(t,e)},vy=function(t,e){if(ps(t)){for(var i=[],r=0;r<t.length;r+=1)i.push(e(t[r]));return i}return e(t)},cd={arrayToObject:ld,assign:fy,combine:xy,compact:_y,decode:py,encode:my,isBuffer:yy,isRegExp:gy,maybeMap:vy,merge:dy},ud=oy,Jn=cd,qr=ah,by=Object.prototype.hasOwnProperty,dd={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},ii=Array.isArray,Ty=Array.prototype.push,fd=function(s,t){Ty.apply(s,ii(t)?t:[t])},wy=Date.prototype.toISOString,pd=qr.default,Xt={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Jn.encode,encodeValuesOnly:!1,filter:void 0,format:pd,formatter:qr.formatters[pd],indices:!1,serializeDate:function(t){return wy.call(t)},skipNulls:!1,strictNullHandling:!1},Ey=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},lh={},Ay=function s(t,e,i,r,n,a,o,h,l,c,d,u,f,p,m,_,y,v){for(var g=t,x=v,b=0,w=!1;(x=x.get(lh))!==void 0&&!w;){var T=x.get(t);if(b+=1,typeof T<"u"){if(T===b)throw new RangeError("Cyclic object value");w=!0}typeof x.get(lh)>"u"&&(b=0)}if(typeof c=="function"?g=c(e,g):g instanceof Date?g=f(g):i==="comma"&&ii(g)&&(g=Jn.maybeMap(g,function(I){return I instanceof Date?f(I):I})),g===null){if(a)return l&&!_?l(e,Xt.encoder,y,"key",p):e;g=""}if(Ey(g)||Jn.isBuffer(g)){if(l){var E=_?e:l(e,Xt.encoder,y,"key",p);return[m(E)+"="+m(l(g,Xt.encoder,y,"value",p))]}return[m(e)+"="+m(String(g))]}var A=[];if(typeof g>"u")return A;var P;if(i==="comma"&&ii(g))_&&l&&(g=Jn.maybeMap(g,l)),P=[{value:g.length>0?g.join(",")||null:void 0}];else if(ii(c))P=c;else{var L=Object.keys(g);P=d?L.sort(d):L}var M=h?String(e).replace(/\./g,"%2E"):String(e),S=r&&ii(g)&&g.length===1?M+"[]":M;if(n&&ii(g)&&g.length===0)return S+"[]";for(var C=0;C<P.length;++C){var R=P[C],N=typeof R=="object"&&R&&typeof R.value<"u"?R.value:g[R];if(!(o&&N===null)){var F=u&&h?String(R).replace(/\./g,"%2E"):String(R),B=ii(g)?typeof i=="function"?i(S,F):S:S+(u?"."+F:"["+F+"]");v.set(t,b);var W=ud();W.set(lh,v),fd(A,s(N,B,i,r,n,a,o,h,i==="comma"&&_&&ii(g)?null:l,c,d,u,f,p,m,_,y,W))}}return A},Sy=function(t){if(!t)return Xt;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||Xt.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 i=qr.default;if(typeof t.format<"u"){if(!by.call(qr.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var r=qr.formatters[i],n=Xt.filter;(typeof t.filter=="function"||ii(t.filter))&&(n=t.filter);var a;if(t.arrayFormat in dd?a=t.arrayFormat:"indices"in t?a=t.indices?"indices":"repeat":a=Xt.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var o=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:Xt.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Xt.addQueryPrefix,allowDots:o,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Xt.allowEmptyArrays,arrayFormat:a,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Xt.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Xt.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Xt.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Xt.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Xt.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Xt.encodeValuesOnly,filter:n,format:i,formatter:r,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Xt.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Xt.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Xt.strictNullHandling}},Cy=function(s,t){var e=s,i=Sy(t),r,n;typeof i.filter=="function"?(n=i.filter,e=n("",e)):ii(i.filter)&&(n=i.filter,r=n);var a=[];if(typeof e!="object"||e===null)return"";var o=dd[i.arrayFormat],h=o==="comma"&&i.commaRoundTrip;r||(r=Object.keys(e)),i.sort&&r.sort(i.sort);for(var l=ud(),c=0;c<r.length;++c){var d=r[c],u=e[d];i.skipNulls&&u===null||fd(a,Ay(u,d,o,h,i.allowEmptyArrays,i.strictNullHandling,i.skipNulls,i.encodeDotInKeys,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,l))}var f=a.join(i.delimiter),p=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""},ms=cd,ch=Object.prototype.hasOwnProperty,md=Array.isArray,Ot={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:ms.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},Py=function(s){return s.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},_d=function(s,t,e){if(s&&typeof s=="string"&&t.comma&&s.indexOf(",")>-1)return s.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 s},Ry="utf8=%26%2310003%3B",Iy="utf8=%E2%9C%93",My=function(t,e){var i={__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 o=-1,h,l=e.charset;if(e.charsetSentinel)for(h=0;h<a.length;++h)a[h].indexOf("utf8=")===0&&(a[h]===Iy?l="utf-8":a[h]===Ry&&(l="iso-8859-1"),o=h,h=a.length);for(h=0;h<a.length;++h)if(h!==o){var c=a[h],d=c.indexOf("]="),u=d===-1?c.indexOf("="):d+1,f,p;u===-1?(f=e.decoder(c,Ot.decoder,l,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,u),Ot.decoder,l,"key"),p=ms.maybeMap(_d(c.slice(u+1),e,md(i[f])?i[f].length:0),function(_){return e.decoder(_,Ot.decoder,l,"value")})),p&&e.interpretNumericEntities&&l==="iso-8859-1"&&(p=Py(String(p))),c.indexOf("[]=")>-1&&(p=md(p)?[p]:p);var m=ch.call(i,f);m&&e.duplicates==="combine"?i[f]=ms.combine(i[f],p):(!m||e.duplicates==="last")&&(i[f]=p)}return i},Dy=function(s,t,e,i){var r=0;if(s.length>0&&s[s.length-1]==="[]"){var n=s.slice(0,-1).join("");r=Array.isArray(t)&&t[n]?t[n].length:0}for(var a=i?t:_d(t,e,r),o=s.length-1;o>=0;--o){var h,l=s[o];if(l==="[]"&&e.parseArrays)h=e.allowEmptyArrays&&(a===""||e.strictNullHandling&&a===null)?[]:ms.combine([],a);else{h=e.plainObjects?{__proto__:null}:{};var c=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,d=e.decodeDotInKeys?c.replace(/%2E/g,"."):c,u=parseInt(d,10);!e.parseArrays&&d===""?h={0:a}:!isNaN(u)&&l!==d&&String(u)===d&&u>=0&&e.parseArrays&&u<=e.arrayLimit?(h=[],h[u]=a):d!=="__proto__"&&(h[d]=a)}a=h}return a},By=function(t,e,i,r){if(t){var n=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,a=/(\[[^[\]]*])/,o=/(\[[^[\]]*])/g,h=i.depth>0&&a.exec(n),l=h?n.slice(0,h.index):n,c=[];if(l){if(!i.plainObjects&&ch.call(Object.prototype,l)&&!i.allowPrototypes)return;c.push(l)}for(var d=0;i.depth>0&&(h=o.exec(n))!==null&&d<i.depth;){if(d+=1,!i.plainObjects&&ch.call(Object.prototype,h[1].slice(1,-1))&&!i.allowPrototypes)return;c.push(h[1])}if(h){if(i.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+i.depth+" and strictDepth is true");c.push("["+n.slice(h.index)+"]")}return Dy(c,e,i,r)}},Oy=function(t){if(!t)return Ot;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"?Ot.charset:t.charset,i=typeof t.duplicates>"u"?Ot.duplicates:t.duplicates;if(i!=="combine"&&i!=="first"&&i!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var r=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:Ot.allowDots:!!t.allowDots;return{allowDots:r,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Ot.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:Ot.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:Ot.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:Ot.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Ot.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:Ot.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:Ot.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:Ot.decoder,delimiter:typeof t.delimiter=="string"||ms.isRegExp(t.delimiter)?t.delimiter:Ot.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:Ot.depth,duplicates:i,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:Ot.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:Ot.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:Ot.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:Ot.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Ot.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}},Fy=function(s,t){var e=Oy(t);if(s===""||s===null||typeof s>"u")return e.plainObjects?{__proto__:null}:{};for(var i=typeof s=="string"?My(s,e):s,r=e.plainObjects?{__proto__:null}:{},n=Object.keys(i),a=0;a<n.length;++a){var o=n[a],h=By(o,i[o],e,typeof s=="string");r=ms.merge(r,h,e)}return e.allowSparse===!0?r:ms.compact(r)},Ly=Cy,ky=Fy,Ny=ah,Uy={formats:Ny,parse:ky,stringify:Ly},Gy=q_;function Si(){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 Hy=/^([a-z0-9.+-]+:)/i,Vy=/:[0-9]*$/,Wy=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,Xy=["<",">",'"',"`"," ","\r",`
|
|
5
|
-
`," "]
|
|
6
|
-
Deprecated since v${
|
|
1
|
+
(function(Ls){typeof define=="function"&&define.amd?define(Ls):Ls()})(function(){"use strict";var Ls=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Ls||{}),yd=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(yd||{}),Ch=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Ch||{}),W=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(W||{}),xs=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(xs||{}),X=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(X||{}),Hr=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(Hr||{}),tt=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(tt||{}),j=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(j||{}),je=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(je||{}),Mi=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Mi||{}),ys=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(ys||{}),Re=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(Re||{}),Ns=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(Ns||{}),Ih=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Ih||{}),as=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(as||{}),ce=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(ce||{}),ie=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(ie||{}),Us=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(Us||{});const z={ADAPTER:{createCanvas:(r,t)=>{const e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")},RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var Ph=/iPhone/i,vd=/iPod/i,bd=/iPad/i,wd=/\biOS-universal(?:.+)Mac\b/i,Rh=/\bAndroid(?:.+)Mobile\b/i,Ed=/Android/i,Wr=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Ua=/Silk/i,ui=/Windows Phone/i,Td=/\bWindows(?:.+)ARM\b/i,Ad=/BlackBerry/i,Sd=/BB10/i,Cd=/Opera Mini/i,Id=/\b(CriOS|Chrome)(?:.+)Mobile/i,Pd=/Mobile(?:.+)Firefox\b/i,Rd=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function nx(r){return function(t){return t.test(r)}}function Md(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,s=e.split("[FBAN");typeof s[1]<"u"&&(e=s[0]),s=e.split("Twitter"),typeof s[1]<"u"&&(e=s[0]);var i=nx(e),n={apple:{phone:i(Ph)&&!i(ui),ipod:i(vd),tablet:!i(Ph)&&(i(bd)||Rd(t))&&!i(ui),universal:i(wd),device:(i(Ph)||i(vd)||i(bd)||i(wd)||Rd(t))&&!i(ui)},amazon:{phone:i(Wr),tablet:!i(Wr)&&i(Ua),device:i(Wr)||i(Ua)},android:{phone:!i(ui)&&i(Wr)||!i(ui)&&i(Rh),tablet:!i(ui)&&!i(Wr)&&!i(Rh)&&(i(Ua)||i(Ed)),device:!i(ui)&&(i(Wr)||i(Ua)||i(Rh)||i(Ed))||i(/\bokhttp\b/i)},windows:{phone:i(ui),tablet:i(Td),device:i(ui)||i(Td)},other:{blackberry:i(Ad),blackberry10:i(Sd),opera:i(Cd),firefox:i(Pd),chrome:i(Id),device:i(Ad)||i(Sd)||i(Cd)||i(Pd)||i(Id)},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 ax=Md.default??Md,di=ax(globalThis.navigator);z.RETINA_PREFIX=/@([0-9\.]+)x/,z.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Xn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Fd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function ox(r){if(r.__esModule)return r;var t=r.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(r).forEach(function(s){var i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:function(){return r[s]}})}),e}var kd={exports:{}};(function(r){var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function i(a,l,c){this.fn=a,this.context=l,this.once=c||!1}function n(a,l,c,d,u){if(typeof c!="function")throw new TypeError("The listener must be a function");var f=new i(c,d||a,u),p=e?e+l:l;return a._events[p]?a._events[p].fn?a._events[p]=[a._events[p],f]:a._events[p].push(f):(a._events[p]=f,a._eventsCount++),a}function o(a,l){--a._eventsCount===0?a._events=new s:delete a._events[l]}function h(){this._events=new s,this._eventsCount=0}h.prototype.eventNames=function(){var l=[],c,d;if(this._eventsCount===0)return l;for(d in c=this._events)t.call(c,d)&&l.push(e?d.slice(1):d);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},h.prototype.listeners=function(l){var c=e?e+l:l,d=this._events[c];if(!d)return[];if(d.fn)return[d.fn];for(var u=0,f=d.length,p=new Array(f);u<f;u++)p[u]=d[u].fn;return p},h.prototype.listenerCount=function(l){var c=e?e+l:l,d=this._events[c];return d?d.fn?1:d.length:0},h.prototype.emit=function(l,c,d,u,f,p){var m=e?e+l:l;if(!this._events[m])return!1;var g=this._events[m],y=arguments.length,x,_;if(g.fn){switch(g.once&&this.removeListener(l,g.fn,void 0,!0),y){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,c),!0;case 3:return g.fn.call(g.context,c,d),!0;case 4:return g.fn.call(g.context,c,d,u),!0;case 5:return g.fn.call(g.context,c,d,u,f),!0;case 6:return g.fn.call(g.context,c,d,u,f,p),!0}for(_=1,x=new Array(y-1);_<y;_++)x[_-1]=arguments[_];g.fn.apply(g.context,x)}else{var v=g.length,b;for(_=0;_<v;_++)switch(g[_].once&&this.removeListener(l,g[_].fn,void 0,!0),y){case 1:g[_].fn.call(g[_].context);break;case 2:g[_].fn.call(g[_].context,c);break;case 3:g[_].fn.call(g[_].context,c,d);break;case 4:g[_].fn.call(g[_].context,c,d,u);break;default:if(!x)for(b=1,x=new Array(y-1);b<y;b++)x[b-1]=arguments[b];g[_].fn.apply(g[_].context,x)}}return!0},h.prototype.on=function(l,c,d){return n(this,l,c,d,!1)},h.prototype.once=function(l,c,d){return n(this,l,c,d,!0)},h.prototype.removeListener=function(l,c,d,u){var f=e?e+l:l;if(!this._events[f])return this;if(!c)return o(this,f),this;var p=this._events[f];if(p.fn)p.fn===c&&(!u||p.once)&&(!d||p.context===d)&&o(this,f);else{for(var m=0,g=[],y=p.length;m<y;m++)(p[m].fn!==c||u&&!p[m].once||d&&p[m].context!==d)&&g.push(p[m]);g.length?this._events[f]=g.length===1?g[0]:g:o(this,f)}return this},h.prototype.removeAllListeners=function(l){var c;return l?(c=e?e+l:l,this._events[c]&&o(this,c)):(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,r.exports=h})(kd);var hx=kd.exports;const Vs=Fd(hx);var Mh={exports:{}};Mh.exports=Va,Mh.exports.default=Va;function Va(r,t,e){e=e||2;var s=t&&t.length,i=s?t[0]*e:r.length,n=Bd(r,0,i,e,!0),o=[];if(!n||n.next===n.prev)return o;var h,a,l,c,d,u,f;if(s&&(n=fx(r,t,n,e)),r.length>80*e){h=l=r[0],a=c=r[1];for(var p=e;p<i;p+=e)d=r[p],u=r[p+1],d<h&&(h=d),u<a&&(a=u),d>l&&(l=d),u>c&&(c=u);f=Math.max(l-h,c-a),f=f!==0?32767/f:0}return Gn(n,o,e,h,a,f,0),o}function Bd(r,t,e,s,i){var n,o;if(i===Bh(r,t,e,s)>0)for(n=t;n<e;n+=s)o=Ld(n,r[n],r[n+1],o);else for(n=e-s;n>=t;n-=s)o=Ld(n,r[n],r[n+1],o);return o&&Xa(o,o.next)&&(Yn(o),o=o.next),o}function ur(r,t){if(!r)return r;t||(t=r);var e=r,s;do if(s=!1,!e.steiner&&(Xa(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 Gn(r,t,e,s,i,n,o){if(r){!o&&n&&xx(r,s,i,n);for(var h=r,a,l;r.prev!==r.next;){if(a=r.prev,l=r.next,n?cx(r,s,i,n):lx(r)){t.push(a.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),Yn(r),r=l.next,h=l.next;continue}if(r=l,r===h){o?o===1?(r=ux(ur(r),t,e),Gn(r,t,e,s,i,n,2)):o===2&&dx(r,t,e,s,i,n):Gn(ur(r),t,e,s,i,n,1);break}}}}function lx(r){var t=r.prev,e=r,s=r.next;if(Lt(t,e,s)>=0)return!1;for(var i=t.x,n=e.x,o=s.x,h=t.y,a=e.y,l=s.y,c=i<n?i<o?i:o:n<o?n:o,d=h<a?h<l?h:l:a<l?a:l,u=i>n?i>o?i:o:n>o?n:o,f=h>a?h>l?h:l:a>l?a:l,p=s.next;p!==t;){if(p.x>=c&&p.x<=u&&p.y>=d&&p.y<=f&&zr(i,h,n,a,o,l,p.x,p.y)&&Lt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function cx(r,t,e,s){var i=r.prev,n=r,o=r.next;if(Lt(i,n,o)>=0)return!1;for(var h=i.x,a=n.x,l=o.x,c=i.y,d=n.y,u=o.y,f=h<a?h<l?h:l:a<l?a:l,p=c<d?c<u?c:u:d<u?d:u,m=h>a?h>l?h:l:a>l?a:l,g=c>d?c>u?c:u:d>u?d:u,y=Fh(f,p,t,e,s),x=Fh(m,g,t,e,s),_=r.prevZ,v=r.nextZ;_&&_.z>=y&&v&&v.z<=x;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==i&&_!==o&&zr(h,c,a,d,l,u,_.x,_.y)&&Lt(_.prev,_,_.next)>=0||(_=_.prevZ,v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==i&&v!==o&&zr(h,c,a,d,l,u,v.x,v.y)&&Lt(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;_&&_.z>=y;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==i&&_!==o&&zr(h,c,a,d,l,u,_.x,_.y)&&Lt(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;v&&v.z<=x;){if(v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==i&&v!==o&&zr(h,c,a,d,l,u,v.x,v.y)&&Lt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function ux(r,t,e){var s=r;do{var i=s.prev,n=s.next.next;!Xa(i,n)&&Dd(i,s,s.next,n)&&$n(i,n)&&$n(n,i)&&(t.push(i.i/e|0),t.push(s.i/e|0),t.push(n.i/e|0),Yn(s),Yn(s.next),s=r=n),s=s.next}while(s!==r);return ur(s)}function dx(r,t,e,s,i,n){var o=r;do{for(var h=o.next.next;h!==o.prev;){if(o.i!==h.i&&bx(o,h)){var a=Od(o,h);o=ur(o,o.next),a=ur(a,a.next),Gn(o,t,e,s,i,n,0),Gn(a,t,e,s,i,n,0);return}h=h.next}o=o.next}while(o!==r)}function fx(r,t,e,s){var i=[],n,o,h,a,l;for(n=0,o=t.length;n<o;n++)h=t[n]*s,a=n<o-1?t[n+1]*s:r.length,l=Bd(r,h,a,s,!1),l===l.next&&(l.steiner=!0),i.push(vx(l));for(i.sort(px),n=0;n<i.length;n++)e=mx(i[n],e);return e}function px(r,t){return r.x-t.x}function mx(r,t){var e=gx(r,t);if(!e)return t;var s=Od(e,r);return ur(s,s.next),ur(e,e.next)}function gx(r,t){var e=t,s=r.x,i=r.y,n=-1/0,o;do{if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){var h=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=s&&h>n&&(n=h,o=e.x<e.next.x?e:e.next,h===s))return o}e=e.next}while(e!==t);if(!o)return null;var a=o,l=o.x,c=o.y,d=1/0,u;e=o;do s>=e.x&&e.x>=l&&s!==e.x&&zr(i<c?s:n,i,l,c,i<c?n:s,i,e.x,e.y)&&(u=Math.abs(i-e.y)/(s-e.x),$n(e,r)&&(u<d||u===d&&(e.x>o.x||e.x===o.x&&_x(o,e)))&&(o=e,d=u)),e=e.next;while(e!==a);return o}function _x(r,t){return Lt(r.prev,r,t.prev)<0&&Lt(t.next,r,r.next)<0}function xx(r,t,e,s){var i=r;do i.z===0&&(i.z=Fh(i.x,i.y,t,e,s)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,yx(i)}function yx(r){var t,e,s,i,n,o,h,a,l=1;do{for(e=r,r=null,n=null,o=0;e;){for(o++,s=e,h=0,t=0;t<l&&(h++,s=s.nextZ,!!s);t++);for(a=l;h>0||a>0&&s;)h!==0&&(a===0||!s||e.z<=s.z)?(i=e,e=e.nextZ,h--):(i=s,s=s.nextZ,a--),n?n.nextZ=i:r=i,i.prevZ=n,n=i;e=s}n.nextZ=null,l*=2}while(o>1);return r}function Fh(r,t,e,s,i){return r=(r-e)*i|0,t=(t-s)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function vx(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function zr(r,t,e,s,i,n,o,h){return(i-o)*(t-h)>=(r-o)*(n-h)&&(r-o)*(s-h)>=(e-o)*(t-h)&&(e-o)*(n-h)>=(i-o)*(s-h)}function bx(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!wx(r,t)&&($n(r,t)&&$n(t,r)&&Ex(r,t)&&(Lt(r.prev,r,t.prev)||Lt(r,t.prev,t))||Xa(r,t)&&Lt(r.prev,r,r.next)>0&&Lt(t.prev,t,t.next)>0)}function Lt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Xa(r,t){return r.x===t.x&&r.y===t.y}function Dd(r,t,e,s){var i=$a(Lt(r,t,e)),n=$a(Lt(r,t,s)),o=$a(Lt(e,s,r)),h=$a(Lt(e,s,t));return!!(i!==n&&o!==h||i===0&&Ga(r,e,t)||n===0&&Ga(r,s,t)||o===0&&Ga(e,r,s)||h===0&&Ga(e,t,s))}function Ga(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function $a(r){return r>0?1:r<0?-1:0}function wx(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Dd(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function $n(r,t){return Lt(r.prev,r,r.next)<0?Lt(r,t,r.next)>=0&&Lt(r,r.prev,t)>=0:Lt(r,t,r.prev)<0||Lt(r,r.next,t)<0}function Ex(r,t){var e=r,s=!1,i=(r.x+t.x)/2,n=(r.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&i<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(s=!s),e=e.next;while(e!==r);return s}function Od(r,t){var e=new kh(r.i,r.x,r.y),s=new kh(t.i,t.x,t.y),i=r.next,n=t.prev;return r.next=t,t.prev=r,e.next=i,i.prev=e,s.next=e,e.prev=s,n.next=s,s.prev=n,s}function Ld(r,t,e,s){var i=new kh(r,t,e);return s?(i.next=s.next,i.prev=s,s.next.prev=i,s.next=i):(i.prev=i,i.next=i),i}function Yn(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function kh(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Va.deviation=function(r,t,e,s){var i=t&&t.length,n=i?t[0]*e:r.length,o=Math.abs(Bh(r,0,n,e));if(i)for(var h=0,a=t.length;h<a;h++){var l=t[h]*e,c=h<a-1?t[h+1]*e:r.length;o-=Math.abs(Bh(r,l,c,e))}var d=0;for(h=0;h<s.length;h+=3){var u=s[h]*e,f=s[h+1]*e,p=s[h+2]*e;d+=Math.abs((r[u]-r[p])*(r[f+1]-r[u+1])-(r[u]-r[f])*(r[p+1]-r[u+1]))}return o===0&&d===0?0:Math.abs((d-o)/o)};function Bh(r,t,e,s){for(var i=0,n=t,o=e-s;n<e;n+=s)i+=(r[o]-r[n])*(r[n+1]+r[o+1]),o=n;return i}Va.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},s=0,i=0;i<r.length;i++){for(var n=0;n<r[i].length;n++)for(var o=0;o<t;o++)e.vertices.push(r[i][n][o]);i>0&&(s+=r[i-1].length,e.holes.push(s))}return e};var Tx=Mh.exports;const Ax=Fd(Tx);var Ya={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */Ya.exports,function(r,t){(function(e){var s=t&&!t.nodeType&&t,i=r&&!r.nodeType&&r,n=typeof Xn=="object"&&Xn;(n.global===n||n.window===n||n.self===n)&&(e=n);var o,h=2147483647,a=36,l=1,c=26,d=38,u=700,f=72,p=128,m="-",g=/^xn--/,y=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=a-l,b=Math.floor,w=String.fromCharCode,E;function T(O){throw new RangeError(_[O])}function A(O,N){for(var K=O.length,Q=[];K--;)Q[K]=N(O[K]);return Q}function I(O,N){var K=O.split("@"),Q="";K.length>1&&(Q=K[0]+"@",O=K[1]),O=O.replace(x,".");var H=O.split("."),ht=A(H,N).join(".");return Q+ht}function M(O){for(var N=[],K=0,Q=O.length,H,ht;K<Q;)H=O.charCodeAt(K++),H>=55296&&H<=56319&&K<Q?(ht=O.charCodeAt(K++),(ht&64512)==56320?N.push(((H&1023)<<10)+(ht&1023)+65536):(N.push(H),K--)):N.push(H);return N}function R(O){return A(O,function(N){var K="";return N>65535&&(N-=65536,K+=w(N>>>10&1023|55296),N=56320|N&1023),K+=w(N),K}).join("")}function C(O){return O-48<10?O-22:O-65<26?O-65:O-97<26?O-97:a}function P(O,N){return O+22+75*(O<26)-((N!=0)<<5)}function k(O,N,K){var Q=0;for(O=K?b(O/u):O>>1,O+=b(O/N);O>v*c>>1;Q+=a)O=b(O/v);return b(Q+(v+1)*O/(O+d))}function V(O){var N=[],K=O.length,Q,H=0,ht=p,Et=f,_t,kt,zt,Qt,Pt,jt,Ot,ze,rs;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<K;){for(Qt=H,Pt=1,jt=a;zt>=K&&T("invalid-input"),Ot=C(O.charCodeAt(zt++)),(Ot>=a||Ot>b((h-H)/Pt))&&T("overflow"),H+=Ot*Pt,ze=jt<=Et?l:jt>=Et+c?c:jt-Et,!(Ot<ze);jt+=a)rs=a-ze,Pt>b(h/rs)&&T("overflow"),Pt*=rs;Q=N.length+1,Et=k(H-Qt,Q,Qt==0),b(H/Q)>h-ht&&T("overflow"),ht+=b(H/Q),H%=Q,N.splice(H++,0,ht)}return R(N)}function U(O){var N,K,Q,H,ht,Et,_t,kt,zt,Qt,Pt,jt=[],Ot,ze,rs,or;for(O=M(O),Ot=O.length,N=p,K=0,ht=f,Et=0;Et<Ot;++Et)Pt=O[Et],Pt<128&&jt.push(w(Pt));for(Q=H=jt.length,H&&jt.push(m);Q<Ot;){for(_t=h,Et=0;Et<Ot;++Et)Pt=O[Et],Pt>=N&&Pt<_t&&(_t=Pt);for(ze=Q+1,_t-N>b((h-K)/ze)&&T("overflow"),K+=(_t-N)*ze,N=_t,Et=0;Et<Ot;++Et)if(Pt=O[Et],Pt<N&&++K>h&&T("overflow"),Pt==N){for(kt=K,zt=a;Qt=zt<=ht?l:zt>=ht+c?c:zt-ht,!(kt<Qt);zt+=a)or=kt-Qt,rs=a-Qt,jt.push(w(P(Qt+or%rs,0))),kt=b(or/rs);jt.push(w(P(kt,0))),ht=k(K,ze,Q==H),K=0,++Q}++K,++N}return jt.join("")}function L(O){return I(O,function(N){return g.test(N)?V(N.slice(4).toLowerCase()):N})}function $(O){return I(O,function(N){return y.test(N)?"xn--"+U(N):N})}if(o={version:"1.4.1",ucs2:{decode:M,encode:R},decode:V,encode:U,toASCII:$,toUnicode:L},s&&i)if(r.exports==s)i.exports=o;else for(E in o)o.hasOwnProperty(E)&&(s[E]=o[E]);else e.punycode=o})(Xn)}(Ya,Ya.exports);var Sx=Ya.exports,jr=TypeError;const Cx=ox(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Dh=typeof Map=="function"&&Map.prototype,Oh=Object.getOwnPropertyDescriptor&&Dh?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Ha=Dh&&Oh&&typeof Oh.get=="function"?Oh.get:null,Nd=Dh&&Map.prototype.forEach,Lh=typeof Set=="function"&&Set.prototype,Nh=Object.getOwnPropertyDescriptor&&Lh?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Wa=Lh&&Nh&&typeof Nh.get=="function"?Nh.get:null,Ud=Lh&&Set.prototype.forEach,Ix=typeof WeakMap=="function"&&WeakMap.prototype,Hn=Ix?WeakMap.prototype.has:null,Px=typeof WeakSet=="function"&&WeakSet.prototype,Wn=Px?WeakSet.prototype.has:null,Rx=typeof WeakRef=="function"&&WeakRef.prototype,Vd=Rx?WeakRef.prototype.deref:null,Mx=Boolean.prototype.valueOf,Fx=Object.prototype.toString,kx=Function.prototype.toString,Bx=String.prototype.match,Uh=String.prototype.slice,Fi=String.prototype.replace,Dx=String.prototype.toUpperCase,Xd=String.prototype.toLowerCase,Gd=RegExp.prototype.test,$d=Array.prototype.concat,Xs=Array.prototype.join,Ox=Array.prototype.slice,Yd=Math.floor,Vh=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Xh=Object.getOwnPropertySymbols,Gh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,qr=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Te=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===qr||"symbol")?Symbol.toStringTag:null,Hd=Object.prototype.propertyIsEnumerable,Wd=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function zd(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||Gd.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var s=r<0?-Yd(-r):Yd(r);if(s!==r){var i=String(s),n=Uh.call(t,i.length+1);return Fi.call(i,e,"$&_")+"."+Fi.call(Fi.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Fi.call(t,e,"$&_")}var $h=Cx,jd=$h.custom,qd=Jd(jd)?jd:null,Kd={__proto__:null,double:'"',single:"'"},Lx={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},za=function r(t,e,s,i){var n=e||{};if(fi(n,"quoteStyle")&&!fi(Kd,n.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(fi(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 o=fi(n,"customInspect")?n.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(fi(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(fi(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 ef(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var a=String(t);return h?zd(t,a):a}if(typeof t=="bigint"){var l=String(t)+"n";return h?zd(t,l):l}var c=typeof n.depth>"u"?5:n.depth;if(typeof s>"u"&&(s=0),s>=c&&c>0&&typeof t=="object")return Yh(t)?"[Array]":"[Object]";var d=ey(n,s);if(typeof i>"u")i=[];else if(tf(i,t)>=0)return"[Circular]";function u(C,P,k){if(P&&(i=Ox.call(i),i.push(P)),k){var V={depth:n.depth};return fi(n,"quoteStyle")&&(V.quoteStyle=n.quoteStyle),r(C,V,s+1,i)}return r(C,n,s+1,i)}if(typeof t=="function"&&!Qd(t)){var f=Wx(t),p=ja(t,u);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+Xs.call(p,", ")+" }":"")}if(Jd(t)){var m=qr?Fi.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Gh.call(t);return typeof t=="object"&&!qr?zn(m):m}if(Qx(t)){for(var g="<"+Xd.call(String(t.nodeName)),y=t.attributes||[],x=0;x<y.length;x++)g+=" "+y[x].name+"="+Zd(Nx(y[x].value),"double",n);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+Xd.call(String(t.nodeName))+">",g}if(Yh(t)){if(t.length===0)return"[]";var _=ja(t,u);return d&&!ty(_)?"["+Wh(_,d)+"]":"[ "+Xs.call(_,", ")+" ]"}if(Vx(t)){var v=ja(t,u);return!("cause"in Error.prototype)&&"cause"in t&&!Hd.call(t,"cause")?"{ ["+String(t)+"] "+Xs.call($d.call("[cause]: "+u(t.cause),v),", ")+" }":v.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Xs.call(v,", ")+" }"}if(typeof t=="object"&&o){if(qd&&typeof t[qd]=="function"&&$h)return $h(t,{depth:c-s});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(zx(t)){var b=[];return Nd&&Nd.call(t,function(C,P){b.push(u(P,t,!0)+" => "+u(C,t))}),sf("Map",Ha.call(t),b,d)}if(Kx(t)){var w=[];return Ud&&Ud.call(t,function(C){w.push(u(C,t))}),sf("Set",Wa.call(t),w,d)}if(jx(t))return Hh("WeakMap");if(Zx(t))return Hh("WeakSet");if(qx(t))return Hh("WeakRef");if(Gx(t))return zn(u(Number(t)));if(Yx(t))return zn(u(Vh.call(t)));if($x(t))return zn(Mx.call(t));if(Xx(t))return zn(u(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof Xn<"u"&&t===Xn)return"{ [object globalThis] }";if(!Ux(t)&&!Qd(t)){var E=ja(t,u),T=Wd?Wd(t)===Object.prototype:t instanceof Object||t.constructor===Object,A=t instanceof Object?"":"null prototype",I=!T&&Te&&Object(t)===t&&Te in t?Uh.call(ki(t),8,-1):A?"Object":"",M=T||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",R=M+(I||A?"["+Xs.call($d.call([],I||[],A||[]),": ")+"] ":"");return E.length===0?R+"{}":d?R+"{"+Wh(E,d)+"}":R+"{ "+Xs.call(E,", ")+" }"}return String(t)};function Zd(r,t,e){var s=e.quoteStyle||t,i=Kd[s];return i+r+i}function Nx(r){return Fi.call(String(r),/"/g,""")}function Yh(r){return ki(r)==="[object Array]"&&(!Te||!(typeof r=="object"&&Te in r))}function Ux(r){return ki(r)==="[object Date]"&&(!Te||!(typeof r=="object"&&Te in r))}function Qd(r){return ki(r)==="[object RegExp]"&&(!Te||!(typeof r=="object"&&Te in r))}function Vx(r){return ki(r)==="[object Error]"&&(!Te||!(typeof r=="object"&&Te in r))}function Xx(r){return ki(r)==="[object String]"&&(!Te||!(typeof r=="object"&&Te in r))}function Gx(r){return ki(r)==="[object Number]"&&(!Te||!(typeof r=="object"&&Te in r))}function $x(r){return ki(r)==="[object Boolean]"&&(!Te||!(typeof r=="object"&&Te in r))}function Jd(r){if(qr)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Gh)return!1;try{return Gh.call(r),!0}catch{}return!1}function Yx(r){if(!r||typeof r!="object"||!Vh)return!1;try{return Vh.call(r),!0}catch{}return!1}var Hx=Object.prototype.hasOwnProperty||function(r){return r in this};function fi(r,t){return Hx.call(r,t)}function ki(r){return Fx.call(r)}function Wx(r){if(r.name)return r.name;var t=Bx.call(kx.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function tf(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,s=r.length;e<s;e++)if(r[e]===t)return e;return-1}function zx(r){if(!Ha||!r||typeof r!="object")return!1;try{Ha.call(r);try{Wa.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function jx(r){if(!Hn||!r||typeof r!="object")return!1;try{Hn.call(r,Hn);try{Wn.call(r,Wn)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function qx(r){if(!Vd||!r||typeof r!="object")return!1;try{return Vd.call(r),!0}catch{}return!1}function Kx(r){if(!Wa||!r||typeof r!="object")return!1;try{Wa.call(r);try{Ha.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function Zx(r){if(!Wn||!r||typeof r!="object")return!1;try{Wn.call(r,Wn);try{Hn.call(r,Hn)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function Qx(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function ef(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,s="... "+e+" more character"+(e>1?"s":"");return ef(Uh.call(r,0,t.maxStringLength),t)+s}var i=Lx[t.quoteStyle||"single"];i.lastIndex=0;var n=Fi.call(Fi.call(r,i,"\\$1"),/[\x00-\x1f]/g,Jx);return Zd(n,"single",t)}function Jx(r){var t=r.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+Dx.call(t.toString(16))}function zn(r){return"Object("+r+")"}function Hh(r){return r+" { ? }"}function sf(r,t,e,s){var i=s?Wh(e,s):Xs.call(e,", ");return r+" ("+t+") {"+i+"}"}function ty(r){for(var t=0;t<r.length;t++)if(tf(r[t],`
|
|
2
|
+
`)>=0)return!1;return!0}function ey(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=Xs.call(Array(r.indent+1)," ");else return null;return{base:e,prev:Xs.call(Array(t+1),e)}}function Wh(r,t){if(r.length===0)return"";var e=`
|
|
3
|
+
`+t.prev+t.base;return e+Xs.call(r,","+e)+`
|
|
4
|
+
`+t.prev}function ja(r,t){var e=Yh(r),s=[];if(e){s.length=r.length;for(var i=0;i<r.length;i++)s[i]=fi(r,i)?t(r[i],r):""}var n=typeof Xh=="function"?Xh(r):[],o;if(qr){o={};for(var h=0;h<n.length;h++)o["$"+n[h]]=n[h]}for(var a in r)fi(r,a)&&(e&&String(Number(a))===a&&a<r.length||qr&&o["$"+a]instanceof Symbol||(Gd.call(/[^\w$]/,a)?s.push(t(a,r)+": "+t(r[a],r)):s.push(a+": "+t(r[a],r))));if(typeof Xh=="function")for(var l=0;l<n.length;l++)Hd.call(r,n[l])&&s.push("["+t(n[l])+"]: "+t(r[n[l]],r));return s}var sy=za,iy=jr,qa=function(r,t,e){for(var s=r,i;(i=s.next)!=null;s=i)if(i.key===t)return s.next=i.next,e||(i.next=r.next,r.next=i),i},ry=function(r,t){if(r){var e=qa(r,t);return e&&e.value}},ny=function(r,t,e){var s=qa(r,t);s?s.value=e:r.next={key:t,next:r.next,value:e}},ay=function(r,t){return r?!!qa(r,t):!1},oy=function(r,t){if(r)return qa(r,t,!0)},hy=function(){var t,e={assert:function(s){if(!e.has(s))throw new iy("Side channel does not contain "+sy(s))},delete:function(s){var i=t&&t.next,n=oy(t,s);return n&&i&&i===n&&(t=void 0),!!n},get:function(s){return ry(t,s)},has:function(s){return ay(t,s)},set:function(s,i){t||(t={next:void 0}),ny(t,s,i)}};return e},rf=Object,ly=Error,cy=EvalError,uy=RangeError,dy=ReferenceError,fy=SyntaxError,py=URIError,my=Math.abs,gy=Math.floor,_y=Math.max,xy=Math.min,yy=Math.pow,vy=Math.round,by=Number.isNaN||function(t){return t!==t},wy=by,Ey=function(t){return wy(t)||t===0?t:t<0?-1:1},Ty=Object.getOwnPropertyDescriptor,Ka=Ty;if(Ka)try{Ka([],"length")}catch{Ka=null}var nf=Ka,Za=Object.defineProperty||!1;if(Za)try{Za({},"a",{value:1})}catch{Za=!1}var Ay=Za,zh,af;function Sy(){return af||(af=1,zh=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 i=42;t[e]=i;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 o=Object.getOwnPropertySymbols(t);if(o.length!==1||o[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var h=Object.getOwnPropertyDescriptor(t,e);if(h.value!==i||h.enumerable!==!0)return!1}return!0}),zh}var jh,of;function Cy(){if(of)return jh;of=1;var r=typeof Symbol<"u"&&Symbol,t=Sy();return jh=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},jh}var qh,hf;function lf(){return hf||(hf=1,qh=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),qh}var Kh,cf;function uf(){if(cf)return Kh;cf=1;var r=rf;return Kh=r.getPrototypeOf||null,Kh}var Iy="Function.prototype.bind called on incompatible ",Py=Object.prototype.toString,Ry=Math.max,My="[object Function]",df=function(t,e){for(var s=[],i=0;i<t.length;i+=1)s[i]=t[i];for(var n=0;n<e.length;n+=1)s[n+t.length]=e[n];return s},Fy=function(t,e){for(var s=[],i=e||0,n=0;i<t.length;i+=1,n+=1)s[n]=t[i];return s},ky=function(r,t){for(var e="",s=0;s<r.length;s+=1)e+=r[s],s+1<r.length&&(e+=t);return e},By=function(t){var e=this;if(typeof e!="function"||Py.apply(e)!==My)throw new TypeError(Iy+e);for(var s=Fy(arguments,1),i,n=function(){if(this instanceof i){var c=e.apply(this,df(s,arguments));return Object(c)===c?c:this}return e.apply(t,df(s,arguments))},o=Ry(0,e.length-s.length),h=[],a=0;a<o;a++)h[a]="$"+a;if(i=Function("binder","return function ("+ky(h,",")+"){ return binder.apply(this,arguments); }")(n),e.prototype){var l=function(){};l.prototype=e.prototype,i.prototype=new l,l.prototype=null}return i},Dy=By,Qa=Function.prototype.bind||Dy,Zh=Function.prototype.call,Qh,ff;function pf(){return ff||(ff=1,Qh=Function.prototype.apply),Qh}var Oy=typeof Reflect<"u"&&Reflect&&Reflect.apply,Ly=Qa,Ny=pf(),Uy=Zh,Vy=Oy,Xy=Vy||Ly.call(Uy,Ny),Gy=Qa,$y=jr,Yy=Zh,Hy=Xy,mf=function(t){if(t.length<1||typeof t[0]!="function")throw new $y("a function is required");return Hy(Gy,Yy,t)},Jh,gf;function Wy(){if(gf)return Jh;gf=1;var r=mf,t=nf,e;try{e=[].__proto__===Array.prototype}catch(o){if(!o||typeof o!="object"||!("code"in o)||o.code!=="ERR_PROTO_ACCESS")throw o}var s=!!e&&t&&t(Object.prototype,"__proto__"),i=Object,n=i.getPrototypeOf;return Jh=s&&typeof s.get=="function"?r([s.get]):typeof n=="function"?function(h){return n(h==null?h:i(h))}:!1,Jh}var tl,_f;function zy(){if(_f)return tl;_f=1;var r=lf(),t=uf(),e=Wy();return tl=r?function(i){return r(i)}:t?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return t(i)}:e?function(i){return e(i)}:null,tl}var el,xf;function jy(){if(xf)return el;xf=1;var r=Function.prototype.call,t=Object.prototype.hasOwnProperty,e=Qa;return el=e.call(r,t),el}var lt,qy=rf,Ky=ly,Zy=cy,Qy=uy,Jy=dy,Kr=fy,Zr=jr,tv=py,ev=my,sv=gy,iv=_y,rv=xy,nv=yy,av=vy,ov=Ey,yf=Function,sl=function(r){try{return yf('"use strict"; return ('+r+").constructor;")()}catch{}},jn=nf,hv=Ay,il=function(){throw new Zr},lv=jn?function(){try{return arguments.callee,il}catch{try{return jn(arguments,"callee").get}catch{return il}}}():il,Qr=Cy()(),de=zy(),cv=uf(),uv=lf(),vf=pf(),qn=Zh,Jr={},dv=typeof Uint8Array>"u"||!de?lt:de(Uint8Array),dr={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?lt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?lt:ArrayBuffer,"%ArrayIteratorPrototype%":Qr&&de?de([][Symbol.iterator]()):lt,"%AsyncFromSyncIteratorPrototype%":lt,"%AsyncFunction%":Jr,"%AsyncGenerator%":Jr,"%AsyncGeneratorFunction%":Jr,"%AsyncIteratorPrototype%":Jr,"%Atomics%":typeof Atomics>"u"?lt:Atomics,"%BigInt%":typeof BigInt>"u"?lt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?lt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?lt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?lt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Ky,"%eval%":eval,"%EvalError%":Zy,"%Float32Array%":typeof Float32Array>"u"?lt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?lt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?lt:FinalizationRegistry,"%Function%":yf,"%GeneratorFunction%":Jr,"%Int8Array%":typeof Int8Array>"u"?lt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?lt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?lt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Qr&&de?de(de([][Symbol.iterator]())):lt,"%JSON%":typeof JSON=="object"?JSON:lt,"%Map%":typeof Map>"u"?lt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Qr||!de?lt:de(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":qy,"%Object.getOwnPropertyDescriptor%":jn,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?lt:Promise,"%Proxy%":typeof Proxy>"u"?lt:Proxy,"%RangeError%":Qy,"%ReferenceError%":Jy,"%Reflect%":typeof Reflect>"u"?lt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?lt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Qr||!de?lt:de(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?lt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Qr&&de?de(""[Symbol.iterator]()):lt,"%Symbol%":Qr?Symbol:lt,"%SyntaxError%":Kr,"%ThrowTypeError%":lv,"%TypedArray%":dv,"%TypeError%":Zr,"%Uint8Array%":typeof Uint8Array>"u"?lt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?lt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?lt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?lt:Uint32Array,"%URIError%":tv,"%WeakMap%":typeof WeakMap>"u"?lt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?lt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?lt:WeakSet,"%Function.prototype.call%":qn,"%Function.prototype.apply%":vf,"%Object.defineProperty%":hv,"%Object.getPrototypeOf%":cv,"%Math.abs%":ev,"%Math.floor%":sv,"%Math.max%":iv,"%Math.min%":rv,"%Math.pow%":nv,"%Math.round%":av,"%Math.sign%":ov,"%Reflect.getPrototypeOf%":uv};if(de)try{null.error}catch(r){var fv=de(de(r));dr["%Error.prototype%"]=fv}var pv=function r(t){var e;if(t==="%AsyncFunction%")e=sl("async function () {}");else if(t==="%GeneratorFunction%")e=sl("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=sl("async function* () {}");else if(t==="%AsyncGenerator%"){var s=r("%AsyncGeneratorFunction%");s&&(e=s.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=r("%AsyncGenerator%");i&&de&&(e=de(i.prototype))}return dr[t]=e,e},bf={__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"]},Kn=Qa,Ja=jy(),mv=Kn.call(qn,Array.prototype.concat),gv=Kn.call(vf,Array.prototype.splice),wf=Kn.call(qn,String.prototype.replace),to=Kn.call(qn,String.prototype.slice),_v=Kn.call(qn,RegExp.prototype.exec),xv=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,yv=/\\(\\)?/g,vv=function(t){var e=to(t,0,1),s=to(t,-1);if(e==="%"&&s!=="%")throw new Kr("invalid intrinsic syntax, expected closing `%`");if(s==="%"&&e!=="%")throw new Kr("invalid intrinsic syntax, expected opening `%`");var i=[];return wf(t,xv,function(n,o,h,a){i[i.length]=h?wf(a,yv,"$1"):o||n}),i},bv=function(t,e){var s=t,i;if(Ja(bf,s)&&(i=bf[s],s="%"+i[0]+"%"),Ja(dr,s)){var n=dr[s];if(n===Jr&&(n=pv(s)),typeof n>"u"&&!e)throw new Zr("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:s,value:n}}throw new Kr("intrinsic "+t+" does not exist!")},rl=function(t,e){if(typeof t!="string"||t.length===0)throw new Zr("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Zr('"allowMissing" argument must be a boolean');if(_v(/^%?[^%]*%?$/,t)===null)throw new Kr("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var s=vv(t),i=s.length>0?s[0]:"",n=bv("%"+i+"%",e),o=n.name,h=n.value,a=!1,l=n.alias;l&&(i=l[0],gv(s,mv([0,1],l)));for(var c=1,d=!0;c<s.length;c+=1){var u=s[c],f=to(u,0,1),p=to(u,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new Kr("property names with quotes must have matching quotes");if((u==="constructor"||!d)&&(a=!0),i+="."+u,o="%"+i+"%",Ja(dr,o))h=dr[o];else if(h!=null){if(!(u in h)){if(!e)throw new Zr("base intrinsic for "+t+" exists, but the property is not available.");return}if(jn&&c+1>=s.length){var m=jn(h,u);d=!!m,d&&"get"in m&&!("originalValue"in m.get)?h=m.get:h=h[u]}else d=Ja(h,u),h=h[u];d&&!a&&(dr[o]=h)}}return h},Ef=rl,Tf=mf,wv=Tf([Ef("%String.prototype.indexOf%")]),Af=function(t,e){var s=Ef(t,!!e);return typeof s=="function"&&wv(t,".prototype.")>-1?Tf([s]):s},Ev=rl,Zn=Af,Tv=za,Av=jr,Sf=Ev("%Map%",!0),Sv=Zn("Map.prototype.get",!0),Cv=Zn("Map.prototype.set",!0),Iv=Zn("Map.prototype.has",!0),Pv=Zn("Map.prototype.delete",!0),Rv=Zn("Map.prototype.size",!0),Cf=!!Sf&&function(){var t,e={assert:function(s){if(!e.has(s))throw new Av("Side channel does not contain "+Tv(s))},delete:function(s){if(t){var i=Pv(t,s);return Rv(t)===0&&(t=void 0),i}return!1},get:function(s){if(t)return Sv(t,s)},has:function(s){return t?Iv(t,s):!1},set:function(s,i){t||(t=new Sf),Cv(t,s,i)}};return e},Mv=rl,eo=Af,Fv=za,so=Cf,kv=jr,tn=Mv("%WeakMap%",!0),Bv=eo("WeakMap.prototype.get",!0),Dv=eo("WeakMap.prototype.set",!0),Ov=eo("WeakMap.prototype.has",!0),Lv=eo("WeakMap.prototype.delete",!0),Nv=tn?function(){var t,e,s={assert:function(i){if(!s.has(i))throw new kv("Side channel does not contain "+Fv(i))},delete:function(i){if(tn&&i&&(typeof i=="object"||typeof i=="function")){if(t)return Lv(t,i)}else if(so&&e)return e.delete(i);return!1},get:function(i){return tn&&i&&(typeof i=="object"||typeof i=="function")&&t?Bv(t,i):e&&e.get(i)},has:function(i){return tn&&i&&(typeof i=="object"||typeof i=="function")&&t?Ov(t,i):!!e&&e.has(i)},set:function(i,n){tn&&i&&(typeof i=="object"||typeof i=="function")?(t||(t=new tn),Dv(t,i,n)):so&&(e||(e=so()),e.set(i,n))}};return s}:so,Uv=jr,Vv=za,Xv=hy,Gv=Cf,$v=Nv,Yv=$v||Gv||Xv,Hv=function(){var t,e={assert:function(s){if(!e.has(s))throw new Uv("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,i){t||(t=Yv()),t.set(s,i)}};return e},Wv=String.prototype.replace,zv=/%20/g,nl={RFC1738:"RFC1738",RFC3986:"RFC3986"},al={default:nl.RFC3986,formatters:{RFC1738:function(r){return Wv.call(r,zv,"+")},RFC3986:function(r){return String(r)}},RFC1738:nl.RFC1738,RFC3986:nl.RFC3986},jv=al,ol=Object.prototype.hasOwnProperty,fr=Array.isArray,Gs=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),qv=function(t){for(;t.length>1;){var e=t.pop(),s=e.obj[e.prop];if(fr(s)){for(var i=[],n=0;n<s.length;++n)typeof s[n]<"u"&&i.push(s[n]);e.obj[e.prop]=i}}},If=function(t,e){for(var s=e&&e.plainObjects?{__proto__:null}:{},i=0;i<t.length;++i)typeof t[i]<"u"&&(s[i]=t[i]);return s},Kv=function r(t,e,s){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(fr(t))t.push(e);else if(t&&typeof t=="object")(s&&(s.plainObjects||s.allowPrototypes)||!ol.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var i=t;return fr(t)&&!fr(e)&&(i=If(t,s)),fr(t)&&fr(e)?(e.forEach(function(n,o){if(ol.call(t,o)){var h=t[o];h&&typeof h=="object"&&n&&typeof n=="object"?t[o]=r(h,n,s):t.push(n)}else t[o]=n}),t):Object.keys(e).reduce(function(n,o){var h=e[o];return ol.call(n,o)?n[o]=r(n[o],h,s):n[o]=h,n},i)},Zv=function(t,e){return Object.keys(e).reduce(function(s,i){return s[i]=e[i],s},t)},Qv=function(r,t,e){var s=r.replace(/\+/g," ");if(e==="iso-8859-1")return s.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(s)}catch{return s}},hl=1024,Jv=function(t,e,s,i,n){if(t.length===0)return t;var o=t;if(typeof t=="symbol"?o=Symbol.prototype.toString.call(t):typeof t!="string"&&(o=String(t)),s==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var h="",a=0;a<o.length;a+=hl){for(var l=o.length>=hl?o.slice(a,a+hl):o,c=[],d=0;d<l.length;++d){var u=l.charCodeAt(d);if(u===45||u===46||u===95||u===126||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||n===jv.RFC1738&&(u===40||u===41)){c[c.length]=l.charAt(d);continue}if(u<128){c[c.length]=Gs[u];continue}if(u<2048){c[c.length]=Gs[192|u>>6]+Gs[128|u&63];continue}if(u<55296||u>=57344){c[c.length]=Gs[224|u>>12]+Gs[128|u>>6&63]+Gs[128|u&63];continue}d+=1,u=65536+((u&1023)<<10|l.charCodeAt(d)&1023),c[c.length]=Gs[240|u>>18]+Gs[128|u>>12&63]+Gs[128|u>>6&63]+Gs[128|u&63]}h+=c.join("")}return h},t1=function(t){for(var e=[{obj:{o:t},prop:"o"}],s=[],i=0;i<e.length;++i)for(var n=e[i],o=n.obj[n.prop],h=Object.keys(o),a=0;a<h.length;++a){var l=h[a],c=o[l];typeof c=="object"&&c!==null&&s.indexOf(c)===-1&&(e.push({obj:o,prop:l}),s.push(c))}return qv(e),t},e1=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},s1=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},i1=function(t,e){return[].concat(t,e)},r1=function(t,e){if(fr(t)){for(var s=[],i=0;i<t.length;i+=1)s.push(e(t[i]));return s}return e(t)},Pf={arrayToObject:If,assign:Zv,combine:i1,compact:t1,decode:Qv,encode:Jv,isBuffer:s1,isRegExp:e1,maybeMap:r1,merge:Kv},Rf=Hv,io=Pf,Qn=al,n1=Object.prototype.hasOwnProperty,Mf={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},$s=Array.isArray,a1=Array.prototype.push,Ff=function(r,t){a1.apply(r,$s(t)?t:[t])},o1=Date.prototype.toISOString,kf=Qn.default,ue={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:io.encode,encodeValuesOnly:!1,filter:void 0,format:kf,formatter:Qn.formatters[kf],indices:!1,serializeDate:function(t){return o1.call(t)},skipNulls:!1,strictNullHandling:!1},h1=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},ll={},l1=function r(t,e,s,i,n,o,h,a,l,c,d,u,f,p,m,g,y,x){for(var _=t,v=x,b=0,w=!1;(v=v.get(ll))!==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(ll)>"u"&&(b=0)}if(typeof c=="function"?_=c(e,_):_ instanceof Date?_=f(_):s==="comma"&&$s(_)&&(_=io.maybeMap(_,function(O){return O instanceof Date?f(O):O})),_===null){if(o)return l&&!g?l(e,ue.encoder,y,"key",p):e;_=""}if(h1(_)||io.isBuffer(_)){if(l){var T=g?e:l(e,ue.encoder,y,"key",p);return[m(T)+"="+m(l(_,ue.encoder,y,"value",p))]}return[m(e)+"="+m(String(_))]}var A=[];if(typeof _>"u")return A;var I;if(s==="comma"&&$s(_))g&&l&&(_=io.maybeMap(_,l)),I=[{value:_.length>0?_.join(",")||null:void 0}];else if($s(c))I=c;else{var M=Object.keys(_);I=d?M.sort(d):M}var R=a?String(e).replace(/\./g,"%2E"):String(e),C=i&&$s(_)&&_.length===1?R+"[]":R;if(n&&$s(_)&&_.length===0)return C+"[]";for(var P=0;P<I.length;++P){var k=I[P],V=typeof k=="object"&&k&&typeof k.value<"u"?k.value:_[k];if(!(h&&V===null)){var U=u&&a?String(k).replace(/\./g,"%2E"):String(k),L=$s(_)?typeof s=="function"?s(C,U):C:C+(u?"."+U:"["+U+"]");x.set(t,b);var $=Rf();$.set(ll,x),Ff(A,r(V,L,s,i,n,o,h,a,s==="comma"&&g&&$s(_)?null:l,c,d,u,f,p,m,g,y,$))}}return A},c1=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(!n1.call(Qn.formatters,t.format))throw new TypeError("Unknown format option provided.");s=t.format}var i=Qn.formatters[s],n=ue.filter;(typeof t.filter=="function"||$s(t.filter))&&(n=t.filter);var o;if(t.arrayFormat in Mf?o=t.arrayFormat:"indices"in t?o=t.indices?"indices":"repeat":o=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:o,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:i,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}},u1=function(r,t){var e=r,s=c1(t),i,n;typeof s.filter=="function"?(n=s.filter,e=n("",e)):$s(s.filter)&&(n=s.filter,i=n);var o=[];if(typeof e!="object"||e===null)return"";var h=Mf[s.arrayFormat],a=h==="comma"&&s.commaRoundTrip;i||(i=Object.keys(e)),s.sort&&i.sort(s.sort);for(var l=Rf(),c=0;c<i.length;++c){var d=i[c],u=e[d];s.skipNulls&&u===null||Ff(o,l1(u,d,h,a,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=o.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:""},pr=Pf,cl=Object.prototype.hasOwnProperty,Bf=Array.isArray,qt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:pr.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},d1=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},Df=function(r,t,e){if(r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1)return r.split(",");if(t.throwOnLimitExceeded&&e>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(t.arrayLimit===1?"":"s")+" allowed in an array.");return r},f1="utf8=%26%2310003%3B",p1="utf8=%E2%9C%93",m1=function(t,e){var s={__proto__:null},i=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;i=i.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var n=e.parameterLimit===1/0?void 0:e.parameterLimit,o=i.split(e.delimiter,e.throwOnLimitExceeded?n+1:n);if(e.throwOnLimitExceeded&&o.length>n)throw new RangeError("Parameter limit exceeded. Only "+n+" parameter"+(n===1?"":"s")+" allowed.");var h=-1,a,l=e.charset;if(e.charsetSentinel)for(a=0;a<o.length;++a)o[a].indexOf("utf8=")===0&&(o[a]===p1?l="utf-8":o[a]===f1&&(l="iso-8859-1"),h=a,a=o.length);for(a=0;a<o.length;++a)if(a!==h){var c=o[a],d=c.indexOf("]="),u=d===-1?c.indexOf("="):d+1,f,p;u===-1?(f=e.decoder(c,qt.decoder,l,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,u),qt.decoder,l,"key"),p=pr.maybeMap(Df(c.slice(u+1),e,Bf(s[f])?s[f].length:0),function(g){return e.decoder(g,qt.decoder,l,"value")})),p&&e.interpretNumericEntities&&l==="iso-8859-1"&&(p=d1(String(p))),c.indexOf("[]=")>-1&&(p=Bf(p)?[p]:p);var m=cl.call(s,f);m&&e.duplicates==="combine"?s[f]=pr.combine(s[f],p):(!m||e.duplicates==="last")&&(s[f]=p)}return s},g1=function(r,t,e,s){var i=0;if(r.length>0&&r[r.length-1]==="[]"){var n=r.slice(0,-1).join("");i=Array.isArray(t)&&t[n]?t[n].length:0}for(var o=s?t:Df(t,e,i),h=r.length-1;h>=0;--h){var a,l=r[h];if(l==="[]"&&e.parseArrays)a=e.allowEmptyArrays&&(o===""||e.strictNullHandling&&o===null)?[]:pr.combine([],o);else{a=e.plainObjects?{__proto__:null}:{};var c=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,d=e.decodeDotInKeys?c.replace(/%2E/g,"."):c,u=parseInt(d,10);!e.parseArrays&&d===""?a={0:o}:!isNaN(u)&&l!==d&&String(u)===d&&u>=0&&e.parseArrays&&u<=e.arrayLimit?(a=[],a[u]=o):d!=="__proto__"&&(a[d]=o)}o=a}return o},_1=function(t,e,s,i){if(t){var n=s.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/,h=/(\[[^[\]]*])/g,a=s.depth>0&&o.exec(n),l=a?n.slice(0,a.index):n,c=[];if(l){if(!s.plainObjects&&cl.call(Object.prototype,l)&&!s.allowPrototypes)return;c.push(l)}for(var d=0;s.depth>0&&(a=h.exec(n))!==null&&d<s.depth;){if(d+=1,!s.plainObjects&&cl.call(Object.prototype,a[1].slice(1,-1))&&!s.allowPrototypes)return;c.push(a[1])}if(a){if(s.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+s.depth+" and strictDepth is true");c.push("["+n.slice(a.index)+"]")}return g1(c,e,s,i)}},x1=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 i=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:qt.allowDots:!!t.allowDots;return{allowDots:i,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"||pr.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}},y1=function(r,t){var e=x1(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?{__proto__:null}:{};for(var s=typeof r=="string"?m1(r,e):r,i=e.plainObjects?{__proto__:null}:{},n=Object.keys(s),o=0;o<n.length;++o){var h=n[o],a=_1(h,s[h],e,typeof r=="string");i=pr.merge(i,a,e)}return e.allowSparse===!0?i:pr.compact(i)},v1=u1,b1=y1,w1=al,E1={formats:w1,parse:b1,stringify:v1},T1=Sx;function pi(){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 A1=/^([a-z0-9.+-]+:)/i,S1=/:[0-9]*$/,C1=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,I1=["<",">",'"',"`"," ","\r",`
|
|
5
|
+
`," "],P1=["{","}","|","\\","^","`"].concat(I1),ul=["'"].concat(P1),Of=["%","/","?",";","#"].concat(ul),Lf=["/","?","#"],R1=255,Nf=/^[+a-z0-9A-Z_-]{0,63}$/,M1=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,F1={javascript:!0,"javascript:":!0},dl={javascript:!0,"javascript:":!0},en={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},fl=E1;function k1(r,t,e){if(r&&typeof r=="object"&&r instanceof pi)return r;var s=new pi;return s.parse(r,t,e),s}pi.prototype.parse=function(r,t,e){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var s=r.indexOf("?"),i=s!==-1&&s<r.indexOf("#")?"?":"#",n=r.split(i),o=/\\/g;n[0]=n[0].replace(o,"/"),r=n.join(i);var h=r;if(h=h.trim(),!e&&r.split("#").length===1){var a=C1.exec(h);if(a)return this.path=h,this.href=h,this.pathname=a[1],a[2]?(this.search=a[2],t?this.query=fl.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=A1.exec(h);if(l){l=l[0];var c=l.toLowerCase();this.protocol=c,h=h.substr(l.length)}if(e||l||h.match(/^\/\/[^@/]+@[^@/]+/)){var d=h.substr(0,2)==="//";d&&!(l&&dl[l])&&(h=h.substr(2),this.slashes=!0)}if(!dl[l]&&(d||l&&!en[l])){for(var u=-1,f=0;f<Lf.length;f++){var p=h.indexOf(Lf[f]);p!==-1&&(u===-1||p<u)&&(u=p)}var m,g;u===-1?g=h.lastIndexOf("@"):g=h.lastIndexOf("@",u),g!==-1&&(m=h.slice(0,g),h=h.slice(g+1),this.auth=decodeURIComponent(m)),u=-1;for(var f=0;f<Of.length;f++){var p=h.indexOf(Of[f]);p!==-1&&(u===-1||p<u)&&(u=p)}u===-1&&(u=h.length),this.host=h.slice(0,u),h=h.slice(u),this.parseHost(),this.hostname=this.hostname||"";var y=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!y)for(var x=this.hostname.split(/\./),f=0,_=x.length;f<_;f++){var v=x[f];if(v&&!v.match(Nf)){for(var b="",w=0,E=v.length;w<E;w++)v.charCodeAt(w)>127?b+="x":b+=v[w];if(!b.match(Nf)){var T=x.slice(0,f),A=x.slice(f+1),I=v.match(M1);I&&(T.push(I[1]),A.unshift(I[2])),A.length&&(h="/"+A.join(".")+h),this.hostname=T.join(".");break}}}this.hostname.length>R1?this.hostname="":this.hostname=this.hostname.toLowerCase(),y||(this.hostname=T1.toASCII(this.hostname));var M=this.port?":"+this.port:"",R=this.hostname||"";this.host=R+M,this.href+=this.host,y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),h[0]!=="/"&&(h="/"+h))}if(!F1[c])for(var f=0,_=ul.length;f<_;f++){var C=ul[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 V=h.indexOf("?");if(V!==-1?(this.search=h.substr(V),this.query=h.substr(V+1),t&&(this.query=fl.parse(this.query)),h=h.slice(0,V)):t&&(this.search="",this.query={}),h&&(this.pathname=h),en[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var M=this.pathname||"",U=this.search||"";this.path=M+U}return this.href=this.format(),this},pi.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",s=this.hash||"",i=!1,n="";this.host?i=r+this.host:this.hostname&&(i=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(n=fl.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var o=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||en[t])&&i!==!1?(i="//"+(i||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):i||(i=""),s&&s.charAt(0)!=="#"&&(s="#"+s),o&&o.charAt(0)!=="?"&&(o="?"+o),e=e.replace(/[?#]/g,function(h){return encodeURIComponent(h)}),o=o.replace("#","%23"),t+i+e+o+s},pi.prototype.resolve=function(r){return this.resolveObject(k1(r,!1,!0)).format()},pi.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new pi;t.parse(r,!1,!0),r=t}for(var e=new pi,s=Object.keys(this),i=0;i<s.length;i++){var n=s[i];e[n]=this[n]}if(e.hash=r.hash,r.href==="")return e.href=e.format(),e;if(r.slashes&&!r.protocol){for(var o=Object.keys(r),h=0;h<o.length;h++){var a=o[h];a!=="protocol"&&(e[a]=r[a])}return en[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(r.protocol&&r.protocol!==e.protocol){if(!en[r.protocol]){for(var l=Object.keys(r),c=0;c<l.length;c++){var d=l[c];e[d]=r[d]}return e.href=e.format(),e}if(e.protocol=r.protocol,!r.host&&!dl[r.protocol]){for(var _=(r.pathname||"").split("/");_.length&&!(r.host=_.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),_[0]!==""&&_.unshift(""),_.length<2&&_.unshift(""),e.pathname=_.join("/")}else e.pathname=r.pathname;if(e.search=r.search,e.query=r.query,e.host=r.host||"",e.auth=r.auth,e.hostname=r.hostname||r.host,e.port=r.port,e.pathname||e.search){var u=e.pathname||"",f=e.search||"";e.path=u+f}return e.slashes=e.slashes||r.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",m=r.host||r.pathname&&r.pathname.charAt(0)==="/",g=m||p||e.host&&r.pathname,y=g,x=e.pathname&&e.pathname.split("/")||[],_=r.pathname&&r.pathname.split("/")||[],v=e.protocol&&!en[e.protocol];if(v&&(e.hostname="",e.port=null,e.host&&(x[0]===""?x[0]=e.host:x.unshift(e.host)),e.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(_[0]===""?_[0]=r.host:_.unshift(r.host)),r.host=null),g=g&&(_[0]===""||x[0]==="")),m)e.host=r.host||r.host===""?r.host:e.host,e.hostname=r.hostname||r.hostname===""?r.hostname:e.hostname,e.search=r.search,e.query=r.query,x=_;else if(_.length)x||(x=[]),x.pop(),x=x.concat(_),e.search=r.search,e.query=r.query;else if(r.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=r.search,e.query=r.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!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||r.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&&!y)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=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e},pi.prototype.parseHost=function(){var r=this.host,t=S1.exec(r);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),r=r.substr(0,r.length-t.length)),r&&(this.hostname=r)};const Uf={};function at(r,t,e=3){if(Uf[t])return;let s=new Error().stack;typeof s>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
6
|
+
Deprecated since v${r}`):(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
|
-
Deprecated since v${
|
|
10
|
-
Deprecated since v${s}`),console.warn(i))),vd[t]=!0}function Ge(s){if(typeof s!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(s)}`)}function Kr(s){return s.split("?")[0].split("#")[0]}function Ky(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Zy(s,t,e){return s.replace(new RegExp(Ky(t),"g"),e)}function Qy(s,t){let e="",i=0,r=-1,n=0,a=-1;for(let o=0;o<=s.length;++o){if(o<s.length)a=s.charCodeAt(o);else{if(a===47)break;a=47}if(a===47){if(!(r===o-1||n===1))if(r!==o-1&&n===2){if(e.length<2||i!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",i=0):(e=e.slice(0,h),i=e.length-1-e.lastIndexOf("/")),r=o,n=0;continue}}else if(e.length===2||e.length===1){e="",i=0,r=o,n=0;continue}}t&&(e.length>0?e+="/..":e="..",i=2)}else e.length>0?e+=`/${s.slice(r+1,o)}`:e=s.slice(r+1,o),i=o-r-1;r=o,n=0}else a===46&&n!==-1?++n:n=-1}return e}const Ft={toPosix(s){return Zy(s,"\\","/")},isUrl(s){return/^https?:/.test(this.toPosix(s))},isDataUrl(s){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(s)},isBlobUrl(s){return s.startsWith("blob:")},hasProtocol(s){return/^[^/:]+:/.test(this.toPosix(s))},getProtocol(s){Ge(s),s=this.toPosix(s);const t=/^file:\/\/\//.exec(s);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(s);return e?e[0]:""},toAbsolute(s,t,e){if(Ge(s),this.isDataUrl(s)||this.isBlobUrl(s))return s;const i=Kr(this.toPosix(t??H.ADAPTER.getBaseUrl())),r=Kr(this.toPosix(e??this.rootname(i)));return s=this.toPosix(s),s.startsWith("/")?Ft.join(r,s.slice(1)):this.isAbsolute(s)?s:this.join(i,s)},normalize(s){if(Ge(s),s.length===0)return".";if(this.isDataUrl(s)||this.isBlobUrl(s))return s;s=this.toPosix(s);let t="";const e=s.startsWith("/");this.hasProtocol(s)&&(t=this.rootname(s),s=s.slice(t.length));const i=s.endsWith("/");return s=Qy(s,!1),s.length>0&&i&&(s+="/"),e?`/${s}`:t+s},isAbsolute(s){return Ge(s),s=this.toPosix(s),this.hasProtocol(s)?!0:s.startsWith("/")},join(...s){if(s.length===0)return".";let t;for(let e=0;e<s.length;++e){const i=s[e];if(Ge(i),i.length>0)if(t===void 0)t=i;else{const r=s[e-1]??"";this.joinExtensions.includes(this.extname(r).toLowerCase())?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(s){if(Ge(s),s.length===0)return".";s=this.toPosix(s);let t=s.charCodeAt(0);const e=t===47;let i=-1,r=!0;const n=this.getProtocol(s),a=s;s=s.slice(n.length);for(let o=s.length-1;o>=1;--o)if(t=s.charCodeAt(o),t===47){if(!r){i=o;break}}else r=!1;return i===-1?e?"/":this.isUrl(a)?n+s:n:e&&i===1?"//":n+s.slice(0,i)},rootname(s){Ge(s),s=this.toPosix(s);let t="";if(s.startsWith("/")?t="/":t=this.getProtocol(s),this.isUrl(s)){const e=s.indexOf("/",t.length);e!==-1?t=s.slice(0,e):t=s,t.endsWith("/")||(t+="/")}return t},basename(s,t){Ge(s),t&&Ge(t),s=Kr(this.toPosix(s));let e=0,i=-1,r=!0,n;if(t!==void 0&&t.length>0&&t.length<=s.length){if(t.length===s.length&&t===s)return"";let a=t.length-1,o=-1;for(n=s.length-1;n>=0;--n){const h=s.charCodeAt(n);if(h===47){if(!r){e=n+1;break}}else o===-1&&(r=!1,o=n+1),a>=0&&(h===t.charCodeAt(a)?--a===-1&&(i=n):(a=-1,i=o))}return e===i?i=o:i===-1&&(i=s.length),s.slice(e,i)}for(n=s.length-1;n>=0;--n)if(s.charCodeAt(n)===47){if(!r){e=n+1;break}}else i===-1&&(r=!1,i=n+1);return i===-1?"":s.slice(e,i)},extname(s){Ge(s),s=Kr(this.toPosix(s));let t=-1,e=0,i=-1,r=!0,n=0;for(let a=s.length-1;a>=0;--a){const o=s.charCodeAt(a);if(o===47){if(!r){e=a+1;break}continue}i===-1&&(r=!1,i=a+1),o===46?t===-1?t=a:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||i===-1||n===0||n===1&&t===i-1&&t===e+1?"":s.slice(t,i)},parse(s){Ge(s);const t={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return t;s=Kr(this.toPosix(s));let e=s.charCodeAt(0);const i=this.isAbsolute(s);let r;t.root=this.rootname(s),i||this.hasProtocol(s)?r=1:r=0;let n=-1,a=0,o=-1,h=!0,l=s.length-1,c=0;for(;l>=r;--l){if(e=s.charCodeAt(l),e===47){if(!h){a=l+1;break}continue}o===-1&&(h=!1,o=l+1),e===46?n===-1?n=l:c!==1&&(c=1):n!==-1&&(c=-1)}return n===-1||o===-1||c===0||c===1&&n===o-1&&n===a+1?o!==-1&&(a===0&&i?t.base=t.name=s.slice(1,o):t.base=t.name=s.slice(a,o)):(a===0&&i?(t.name=s.slice(1,n),t.base=s.slice(1,o)):(t.name=s.slice(a,n),t.base=s.slice(a,o)),t.ext=s.slice(n,o)),t.dir=this.dirname(s),t},sep:"/",delimiter:":",joinExtensions:[".html"]};let ph;async function Jy(){return ph??(ph=(async()=>{var n;const s=document.createElement("canvas").getContext("webgl");if(!s)return he.UNPACK;const t=await new Promise(a=>{const o=document.createElement("video");o.onloadeddata=()=>a(o),o.onerror=()=>a(null),o.autoplay=!1,o.crossOrigin="anonymous",o.preload="auto",o.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",o.load()});if(!t)return he.UNPACK;const e=s.createTexture();s.bindTexture(s.TEXTURE_2D,e);const i=s.createFramebuffer();s.bindFramebuffer(s.FRAMEBUFFER,i),s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,e,0),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,s.NONE),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,t);const r=new Uint8Array(4);return s.readPixels(0,0,1,1,s.RGBA,s.UNSIGNED_BYTE,r),s.deleteFramebuffer(i),s.deleteTexture(e),(n=s.getExtension("WEBGL_lose_context"))==null||n.loseContext(),r[0]<=r[3]?he.PMA:he.UNPACK})()),ph}let mh;function tx(){return typeof mh>"u"&&(mh=function(){var t;const s={stencil:!0,failIfMajorPerformanceCaveat:H.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!H.ADAPTER.getWebGLRenderingContext())return!1;const e=H.ADAPTER.createCanvas();let i=e.getContext("webgl",s)||e.getContext("experimental-webgl",s);const r=!!((t=i==null?void 0:i.getContextAttributes())!=null&&t.stencil);if(i){const n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,r}catch{return!1}}()),mh}var ex={grad:.9,turn:360,rad:360/(2*Math.PI)},Ci=function(s){return typeof s=="string"?s.length>0:typeof s=="number"},zt=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*s)/e+0},Pe=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),s>e?e:s>t?s:t},bd=function(s){return(s=isFinite(s)?s%360:0)>0?s:s+360},Td=function(s){return{r:Pe(s.r,0,255),g:Pe(s.g,0,255),b:Pe(s.b,0,255),a:Pe(s.a)}},_h=function(s){return{r:zt(s.r),g:zt(s.g),b:zt(s.b),a:zt(s.a,3)}},ix=/^#([0-9a-f]{3,8})$/i,ta=function(s){var t=s.toString(16);return t.length<2?"0"+t:t},wd=function(s){var t=s.r,e=s.g,i=s.b,r=s.a,n=Math.max(t,e,i),a=n-Math.min(t,e,i),o=a?n===t?(e-i)/a:n===e?2+(i-t)/a:4+(t-e)/a:0;return{h:60*(o<0?o+6:o),s:n?a/n*100:0,v:n/255*100,a:r}},Ed=function(s){var t=s.h,e=s.s,i=s.v,r=s.a;t=t/360*6,e/=100,i/=100;var n=Math.floor(t),a=i*(1-e),o=i*(1-(t-n)*e),h=i*(1-(1-t+n)*e),l=n%6;return{r:255*[i,o,a,a,h,i][l],g:255*[h,i,i,o,a,a][l],b:255*[a,a,h,i,i,o][l],a:r}},Ad=function(s){return{h:bd(s.h),s:Pe(s.s,0,100),l:Pe(s.l,0,100),a:Pe(s.a)}},Sd=function(s){return{h:zt(s.h),s:zt(s.s),l:zt(s.l),a:zt(s.a,3)}},Cd=function(s){return Ed((e=(t=s).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},Zr=function(s){return{h:(t=wd(s)).h,s:(r=(200-(e=t.s))*(i=t.v)/100)>0&&r<200?e*i/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,e,i,r},sx=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,rx=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,nx=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ax=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,gh={string:[[function(s){var t=ix.exec(s);return t?(s=t[1]).length<=4?{r:parseInt(s[0]+s[0],16),g:parseInt(s[1]+s[1],16),b:parseInt(s[2]+s[2],16),a:s.length===4?zt(parseInt(s[3]+s[3],16)/255,2):1}:s.length===6||s.length===8?{r:parseInt(s.substr(0,2),16),g:parseInt(s.substr(2,2),16),b:parseInt(s.substr(4,2),16),a:s.length===8?zt(parseInt(s.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(s){var t=nx.exec(s)||ax.exec(s);return t?t[2]!==t[4]||t[4]!==t[6]?null:Td({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(s){var t=sx.exec(s)||rx.exec(s);if(!t)return null;var e,i,r=Ad({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(ex[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Cd(r)},"hsl"]],object:[[function(s){var t=s.r,e=s.g,i=s.b,r=s.a,n=r===void 0?1:r;return Ci(t)&&Ci(e)&&Ci(i)?Td({r:Number(t),g:Number(e),b:Number(i),a:Number(n)}):null},"rgb"],[function(s){var t=s.h,e=s.s,i=s.l,r=s.a,n=r===void 0?1:r;if(!Ci(t)||!Ci(e)||!Ci(i))return null;var a=Ad({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return Cd(a)},"hsl"],[function(s){var t=s.h,e=s.s,i=s.v,r=s.a,n=r===void 0?1:r;if(!Ci(t)||!Ci(e)||!Ci(i))return null;var a=function(o){return{h:bd(o.h),s:Pe(o.s,0,100),v:Pe(o.v,0,100),a:Pe(o.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return Ed(a)},"hsv"]]},Pd=function(s,t){for(var e=0;e<t.length;e++){var i=t[e][0](s);if(i)return[i,t[e][1]]}return[null,void 0]},ox=function(s){return typeof s=="string"?Pd(s.trim(),gh.string):typeof s=="object"&&s!==null?Pd(s,gh.object):[null,void 0]},yh=function(s,t){var e=Zr(s);return{h:e.h,s:Pe(e.s+100*t,0,100),l:e.l,a:e.a}},xh=function(s){return(299*s.r+587*s.g+114*s.b)/1e3/255},Rd=function(s,t){var e=Zr(s);return{h:e.h,s:e.s,l:Pe(e.l+100*t,0,100),a:e.a}},vh=function(){function s(t){this.parsed=ox(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return s.prototype.isValid=function(){return this.parsed!==null},s.prototype.brightness=function(){return zt(xh(this.rgba),2)},s.prototype.isDark=function(){return xh(this.rgba)<.5},s.prototype.isLight=function(){return xh(this.rgba)>=.5},s.prototype.toHex=function(){return t=_h(this.rgba),e=t.r,i=t.g,r=t.b,a=(n=t.a)<1?ta(zt(255*n)):"","#"+ta(e)+ta(i)+ta(r)+a;var t,e,i,r,n,a},s.prototype.toRgb=function(){return _h(this.rgba)},s.prototype.toRgbString=function(){return t=_h(this.rgba),e=t.r,i=t.g,r=t.b,(n=t.a)<1?"rgba("+e+", "+i+", "+r+", "+n+")":"rgb("+e+", "+i+", "+r+")";var t,e,i,r,n},s.prototype.toHsl=function(){return Sd(Zr(this.rgba))},s.prototype.toHslString=function(){return t=Sd(Zr(this.rgba)),e=t.h,i=t.s,r=t.l,(n=t.a)<1?"hsla("+e+", "+i+"%, "+r+"%, "+n+")":"hsl("+e+", "+i+"%, "+r+"%)";var t,e,i,r,n},s.prototype.toHsv=function(){return t=wd(this.rgba),{h:zt(t.h),s:zt(t.s),v:zt(t.v),a:zt(t.a,3)};var t},s.prototype.invert=function(){return si({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},s.prototype.saturate=function(t){return t===void 0&&(t=.1),si(yh(this.rgba,t))},s.prototype.desaturate=function(t){return t===void 0&&(t=.1),si(yh(this.rgba,-t))},s.prototype.grayscale=function(){return si(yh(this.rgba,-1))},s.prototype.lighten=function(t){return t===void 0&&(t=.1),si(Rd(this.rgba,t))},s.prototype.darken=function(t){return t===void 0&&(t=.1),si(Rd(this.rgba,-t))},s.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},s.prototype.alpha=function(t){return typeof t=="number"?si({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):zt(this.rgba.a,3);var e},s.prototype.hue=function(t){var e=Zr(this.rgba);return typeof t=="number"?si({h:t,s:e.s,l:e.l,a:e.a}):zt(e.h)},s.prototype.isEqual=function(t){return this.toHex()===si(t).toHex()},s}(),si=function(s){return s instanceof vh?s:new vh(s)},Id=[],hx=function(s){s.forEach(function(t){Id.indexOf(t)<0&&(t(vh,gh),Id.push(t))})};function lx(s,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var r in e)i[e[r]]=r;var n={};s.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,h,l=i[this.toHex()];if(l)return l;if(a!=null&&a.closest){var c=this.toRgb(),d=1/0,u="black";if(!n.length)for(var f in e)n[f]=new s(e[f]).toRgb();for(var p in e){var m=(o=c,h=n[p],Math.pow(o.r-h.r,2)+Math.pow(o.g-h.g,2)+Math.pow(o.b-h.b,2));m<d&&(d=m,u=p)}return u}},t.string.push([function(a){var o=a.toLowerCase(),h=o==="transparent"?"#0000":e[o];return h?new s(h).toRgb():null},"name"])}hx([lx]);const er=class xo{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 xo)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 i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((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,i,r]=this._components;return{r:t,g:e,b:i,a:r}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,r]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(r*255),t}toRgbArray(t){t=t??[];const[e,i,r]=this._components;return t[0]=e,t[1]=i,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,i,r,n]=xo.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,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 i=this._int>>16&255,r=this._int>>8&255,n=this._int&255;return e&&(i=i*t+.5|0,r=r*t+.5|0,n=n*t+.5|0),(t*255<<24)+(i<<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,i,r]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(i*t)/t,this._components[2]=Math.round(r*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];const[e,i,r,n]=this._components;return t[0]=e,t[1]=i,t[2]=r,t[3]=n,t}normalize(t){let e,i,r,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const a=t;e=(a>>16&255)/255,i=(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,i,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,i,r,n=255]=t,e/=255,i/=255,r/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const o=xo.HEX_PATTERN.exec(t);o&&(t=`#${o[2]}`)}const a=si(t);a.isValid()&&({r:e,g:i,b:r,a:n}=a.rgba,e/=255,i/=255,r/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,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,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((r,n)=>{t[n]=Math.min(Math.max(r,e),i)}),t)}};er.shared=new er,er.temp=new er,er.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let pt=er;function Md(s,t=[]){return it("7.2.0","utils.hex2rgb is deprecated, use Color#toRgbArray instead"),pt.shared.setValue(s).toRgbArray(t)}function cx(s){return it("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),pt.shared.setValue(s).toHex()}function Qr(s){return it("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),pt.shared.setValue(s).toNumber()}function ux(){const s=[],t=[];for(let i=0;i<32;i++)s[i]=i,t[i]=i;s[K.NORMAL_NPM]=K.NORMAL,s[K.ADD_NPM]=K.ADD,s[K.SCREEN_NPM]=K.SCREEN,t[K.NORMAL]=K.NORMAL_NPM,t[K.ADD]=K.ADD_NPM,t[K.SCREEN]=K.SCREEN_NPM;const e=[];return e.push(t),e.push(s),e}const Dd=ux();function Bd(s,t){return Dd[t?1:0][s]}function dx(s,t=null){const e=s*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 i=0,r=0;i<e;i+=6,r+=4)t[i+0]=r+0,t[i+1]=r+1,t[i+2]=r+2,t[i+3]=r+0,t[i+4]=r+2,t[i+5]=r+3;return t}function Od(s){if(s.BYTES_PER_ELEMENT===4)return s instanceof Float32Array?"Float32Array":s instanceof Uint32Array?"Uint32Array":"Int32Array";if(s.BYTES_PER_ELEMENT===2){if(s instanceof Uint16Array)return"Uint16Array"}else if(s.BYTES_PER_ELEMENT===1&&s instanceof Uint8Array)return"Uint8Array";return null}function ea(s){return s+=s===0?1:0,--s,s|=s>>>1,s|=s>>>2,s|=s>>>4,s|=s>>>8,s|=s>>>16,s+1}function Fd(s){return!(s&s-1)&&!!s}function Ld(s){let t=(s>65535?1:0)<<4;s>>>=t;let e=(s>255?1:0)<<3;return s>>>=e,t|=e,e=(s>15?1:0)<<2,s>>>=e,t|=e,e=(s>3?1:0)<<1,s>>>=e,t|=e,t|s>>1}function ir(s,t,e){const i=s.length;let r;if(t>=i||e===0)return;e=t+e>i?i-t:e;const n=i-e;for(r=t;r<n;++r)s[r]=s[r+e];s.length=n}function Vi(s){return s===0?0:s<0?-1:1}let fx=0;function _s(){return++fx}const bh=class{constructor(s,t,e,i){this.left=s,this.top=t,this.right=e,this.bottom=i}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 kd=bh;const Nd={},ri=Object.create(null),Wi=Object.create(null);class px{constructor(t,e,i){this._canvas=H.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||H.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 Ud(s,t,e){for(let i=0,r=4*e*t;i<t;++i,r+=4)if(s[r+3]!==0)return!1;return!0}function Gd(s,t,e,i,r){const n=4*t;for(let a=i,o=i*n+4*e;a<=r;++a,o+=n)if(s[o+3]!==0)return!1;return!0}function mx(s){const{width:t,height:e}=s,i=s.getContext("2d",{willReadFrequently:!0});if(i===null)throw new TypeError("Failed to get canvas 2D context");const r=i.getImageData(0,0,t,e).data;let n=0,a=0,o=t-1,h=e-1;for(;a<e&&Ud(r,t,a);)++a;if(a===e)return kd.EMPTY;for(;Ud(r,t,h);)--h;for(;Gd(r,t,n,a,h);)++n;for(;Gd(r,t,o,a,h);)--o;return++o,++h,new kd(n,a,o,h)}function _x(s){const t=mx(s),{width:e,height:i}=t;let r=null;if(!t.isEmpty()){const n=s.getContext("2d");if(n===null)throw new TypeError("Failed to get canvas 2D context");r=n.getImageData(t.left,t.top,e,i)}return{width:e,height:i,data:r}}function gx(s,t=globalThis.location){if(s.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(s,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function Pi(s,t=1){var i;const e=(i=H.RETINA_PREFIX)==null?void 0:i.exec(s);return e?parseFloat(e[1]):t}var G=(s=>(s.Renderer="renderer",s.Application="application",s.RendererSystem="renderer-webgl-system",s.RendererPlugin="renderer-webgl-plugin",s.CanvasRendererSystem="renderer-canvas-system",s.CanvasRendererPlugin="renderer-canvas-plugin",s.Asset="asset",s.LoadParser="load-parser",s.ResolveParser="resolve-parser",s.CacheParser="cache-parser",s.DetectionParser="detection-parser",s))(G||{});const Th=s=>{if(typeof s=="function"||typeof s=="object"&&s.extension){if(!s.extension)throw new Error("Extension class must have an extension object");s={...typeof s.extension!="object"?{type:s.extension}:s.extension,ref:s}}if(typeof s=="object")s={...s};else throw new Error("Invalid extension type");return typeof s.type=="string"&&(s.type=[s.type]),s},Hd=(s,t)=>Th(s).priority??t,z={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...s){return s.map(Th).forEach(t=>{t.type.forEach(e=>{var i,r;return(r=(i=this._removeHandlers)[e])==null?void 0:r.call(i,t)})}),this},add(...s){return s.map(Th).forEach(t=>{t.type.forEach(e=>{var n,a;const i=this._addHandlers,r=this._queue;i[e]?(n=i[e])==null||n.call(i,t):(r[e]=r[e]||[],(a=r[e])==null||a.push(t))})}),this},handle(s,t,e){var a;const i=this._addHandlers,r=this._removeHandlers;if(i[s]||r[s])throw new Error(`Extension type ${s} already has a handler`);i[s]=t,r[s]=e;const n=this._queue;return n[s]&&((a=n[s])==null||a.forEach(o=>t(o)),delete n[s]),this},handleByMap(s,t){return this.handle(s,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(s,t,e=-1){return this.handle(s,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((r,n)=>Hd(n,e)-Hd(r,e)))},i=>{const r=t.indexOf(i.ref);r!==-1&&t.splice(r,1)})}};class wh{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 yx=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
11
|
-
`);function
|
|
12
|
-
else `),e<s-1&&(t+=`if(test == ${e}.0){}`);return t}function vx(s,t){if(s===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);for(;;){const i=yx.replace(/%forloop%/gi,xx(s));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))s=s/2|0;else break}return s}const Eh=0,Ah=1,Sh=2,Ch=3,Ph=4,Rh=5;class ni{constructor(){this.data=0,this.blendMode=K.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Eh)}set blend(t){!!(this.data&1<<Eh)!==t&&(this.data^=1<<Eh)}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<<Rh)}set depthMask(t){!!(this.data&1<<Rh)!==t&&(this.data^=1<<Rh)}get clockwiseFrontFace(){return!!(this.data&1<<Ph)}set clockwiseFrontFace(t){!!(this.data&1<<Ph)!==t&&(this.data^=1<<Ph)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==K.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new ni;return t.depthTest=!1,t.blend=!0,t}}ni.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const Ih=[];function Vd(s,t){if(!s)return null;let e="";if(typeof s=="string"){const i=/\.(\w{3,4})(?:$|\?|#)/i.exec(s);i&&(e=i[1].toLowerCase())}for(let i=Ih.length-1;i>=0;--i){const r=Ih[i];if(r.test&&r.test(s,e))return new r(s,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class He{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,r,n,a,o,h){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:c}=this;this._aliasCount++;for(let d=0,u=c.length;d<u;d++)c[d][l](t,e,i,r,n,a,o,h);return c===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(He.prototype,{dispatch:{value:He.prototype.emit},run:{value:He.prototype.emit}});class Jr{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new He("setRealSize"),this.onUpdate=new He("update"),this.onError=new He("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,i){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}}class ia extends Jr{constructor(t,e){const{width:i,height:r}=e||{};if(!i||!r)throw new Error("BufferResource width or height invalid");super(i,r),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,i){const r=t.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,this.unpackAlignment),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===he.UNPACK);const n=e.realWidth,a=e.realHeight;return i.width===n&&i.height===a?r.texSubImage2D(e.target,0,0,0,n,a,e.format,i.type,this.data):(i.width=n,i.height=a,r.texImage2D(e.target,0,i.internalFormat,n,a,0,e.format,i.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}const bx={scaleMode:Ti.NEAREST,alphaMode:he.NPM},Mh=class Or extends Je{constructor(t=null,e=null){super(),e=Object.assign({},Or.defaultOptions,e);const{alphaMode:i,mipmap:r,anisotropicLevel:n,scaleMode:a,width:o,height:h,wrapMode:l,format:c,type:d,target:u,resolution:f,resourceOptions:p}=e;t&&!(t instanceof Jr)&&(t=Vd(t,p),t.internal=!0),this.resolution=f||H.RESOLUTION,this.width=Math.round((o||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=r,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=a,this.format=c,this.type=d,this.target=u,this.alphaMode=i,this.uid=_s(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=o>0&&h>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let i;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,i=!0),i&&this.dirtyStyleId++,this}setSize(t,e,i){return i=i||this.resolution,this.setRealSize(t*i,e*i,i)}setRealSize(t,e,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=Fd(this.realWidth)&&Fd(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 Wi[this.cacheId],delete ri[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Or.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,i=H.STRICT_TEXTURE_CACHE){const r=typeof t=="string";let n=null;if(r)n=t;else{if(!t._pixiId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${o}_${_s()}`}n=t._pixiId}let a=Wi[n];if(r&&i&&!a)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return a||(a=new Or(t,e),a.cacheId=n,Or.addToCache(a,n)),a}static fromBuffer(t,e,i,r){t=t||new Float32Array(e*i*4);const n=new ia(t,{width:e,height:i,...r==null?void 0:r.resourceOptions});let a,o;return t instanceof Float32Array?(a=O.RGBA,o=Z.FLOAT):t instanceof Int32Array?(a=O.RGBA_INTEGER,o=Z.INT):t instanceof Uint32Array?(a=O.RGBA_INTEGER,o=Z.UNSIGNED_INT):t instanceof Int16Array?(a=O.RGBA_INTEGER,o=Z.SHORT):t instanceof Uint16Array?(a=O.RGBA_INTEGER,o=Z.UNSIGNED_SHORT):t instanceof Int8Array?(a=O.RGBA,o=Z.BYTE):(a=O.RGBA,o=Z.UNSIGNED_BYTE),n.internal=!0,new Or(n,Object.assign({},bx,{type:o,format:a},r))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Wi[e]&&Wi[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),Wi[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Wi[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Wi[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete Wi[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Mh.defaultOptions={mipmap:Ke.POW2,anisotropicLevel:0,scaleMode:Ti.LINEAR,wrapMode:Ui.CLAMP,alphaMode:he.UNPACK,target:Xs.TEXTURE_2D,format:O.RGBA,type:Z.UNSIGNED_BYTE},Mh._globalBatch=0;let J=Mh;class Dh{constructor(){this.texArray=null,this.blend=0,this.type=Ue.TRIANGLES,this.start=0,this.size=0,this.data=null}}let Tx=0;class Nt{constructor(t,e=!0,i=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=e,this.id=Tx++,this.disposeRunner=new He("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?Qe.ELEMENT_ARRAY_BUFFER:Qe.ARRAY_BUFFER}get index(){return this.type===Qe.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new Nt(t)}}class sa{constructor(t,e=0,i=!1,r=Z.FLOAT,n,a,o,h=1){this.buffer=t,this.size=e,this.normalized=i,this.type=r,this.stride=n,this.start=a,this.instance=o,this.divisor=h}destroy(){this.buffer=null}static from(t,e,i,r,n){return new sa(t,e,i,r,n)}}const wx={Float32Array,Uint32Array,Int32Array,Uint8Array};function Ex(s,t){let e=0,i=0;const r={};for(let h=0;h<s.length;h++)i+=t[h],e+=s[h].length;const n=new ArrayBuffer(e*4);let a=null,o=0;for(let h=0;h<s.length;h++){const l=t[h],c=s[h],d=Od(c);r[d]||(r[d]=new wx[d](n)),a=r[d];for(let u=0;u<c.length;u++){const f=(u/l|0)*i+o,p=u%l;a[f+p]=c[u]}o+=l}return new Float32Array(n)}const Wd={5126:4,5123:2,5121:1};let Ax=0;const Sx={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class Xi{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=Ax++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new He("disposeGeometry"),this.refCount=0}addAttribute(t,e,i=0,r=!1,n,a,o,h=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof Nt||(e instanceof Array&&(e=new Float32Array(e)),e=new Nt(e));const l=t.split("|");if(l.length>1){for(let d=0;d<l.length;d++)this.addAttribute(l[d],e,i,r,n);return this}let c=this.buffers.indexOf(e);return c===-1&&(this.buffers.push(e),c=this.buffers.length-1),this.attributes[t]=new sa(c,i,r,n,a,o,h),this.instanced=this.instanced||h,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof Nt||(t instanceof Array&&(t=new Uint16Array(t)),t=new Nt(t)),t.type=Qe.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=[],i=new Nt;let r;for(r in this.attributes){const n=this.attributes[r],a=this.buffers[n.buffer];t.push(a.data),e.push(n.size*Wd[n.type]/4),n.buffer=0}for(i.data=Ex(t,e),r=0;r<this.buffers.length;r++)this.buffers[r]!==this.indexBuffer&&this.buffers[r].destroy();return this.buffers=[i],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 Xi;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new Nt(this.buffers[e].data.slice(0));for(const e in this.attributes){const i=this.attributes[e];t.attributes[e]=new sa(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=Qe.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new Xi,i=[],r=[],n=[];let a;for(let o=0;o<t.length;o++){a=t[o];for(let h=0;h<a.buffers.length;h++)r[h]=r[h]||0,r[h]+=a.buffers[h].data.length,n[h]=0}for(let o=0;o<a.buffers.length;o++)i[o]=new Sx[Od(a.buffers[o].data)](r[o]),e.buffers[o]=new Nt(i[o]);for(let o=0;o<t.length;o++){a=t[o];for(let h=0;h<a.buffers.length;h++)i[h].set(a.buffers[h].data,n[h]),n[h]+=a.buffers[h].data.length}if(e.attributes=a.attributes,a.indexBuffer){e.indexBuffer=e.buffers[a.buffers.indexOf(a.indexBuffer)],e.indexBuffer.type=Qe.ELEMENT_ARRAY_BUFFER;let o=0,h=0,l=0,c=0;for(let d=0;d<a.buffers.length;d++)if(a.buffers[d]!==a.indexBuffer){c=d;break}for(const d in a.attributes){const u=a.attributes[d];(u.buffer|0)===c&&(h+=u.size*Wd[u.type]/4)}for(let d=0;d<t.length;d++){const u=t[d].indexBuffer.data;for(let f=0;f<u.length;f++)e.indexBuffer.data[f+l]+=o;o+=t[d].buffers[c].data.length/h,l+=u.length}}return e}}class Xd extends Xi{constructor(t=!1){super(),this._buffer=new Nt(null,t,!1),this._indexBuffer=new Nt(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,Z.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,Z.FLOAT).addAttribute("aColor",this._buffer,4,!0,Z.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,Z.FLOAT).addIndex(this._indexBuffer)}}const ra=Math.PI*2,Cx=180/Math.PI,Bh=Math.PI/180;var Zt=(s=>(s[s.POLY=0]="POLY",s[s.RECT=1]="RECT",s[s.CIRC=2]="CIRC",s[s.ELIP=3]="ELIP",s[s.RREC=4]="RREC",s))(Zt||{});class tt{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new tt(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}}tt.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const na=[new tt,new tt,new tt,new tt];let st=class $c{constructor(t=0,e=0,i=0,r=0){this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(r),this.type=Zt.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 $c(0,0,0,0)}clone(){return new $c(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){const E=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=E)return!1;const A=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>A}const i=this.left,r=this.right,n=this.top,a=this.bottom;if(r<=i||a<=n)return!1;const o=na[0].set(t.left,t.top),h=na[1].set(t.left,t.bottom),l=na[2].set(t.right,t.top),c=na[3].set(t.right,t.bottom);if(l.x<=o.x||h.y<=o.y)return!1;const d=Math.sign(e.a*e.d-e.b*e.c);if(d===0||(e.apply(o,o),e.apply(h,h),e.apply(l,l),e.apply(c,c),Math.max(o.x,h.x,l.x,c.x)<=i||Math.min(o.x,h.x,l.x,c.x)>=r||Math.max(o.y,h.y,l.y,c.y)<=n||Math.min(o.y,h.y,l.y,c.y)>=a))return!1;const u=d*(h.y-o.y),f=d*(o.x-h.x),p=u*i+f*n,m=u*r+f*n,_=u*i+f*a,y=u*r+f*a;if(Math.max(p,m,_,y)<=u*o.x+f*o.y||Math.min(p,m,_,y)>=u*c.x+f*c.y)return!1;const v=d*(o.y-l.y),g=d*(l.x-o.x),x=v*i+g*n,b=v*r+g*n,w=v*i+g*a,T=v*r+g*a;return!(Math.max(x,b,w,T)<=v*o.x+g*o.y||Math.min(x,b,w,T)>=v*c.x+g*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),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(i-e,0),this.y=r,this.height=Math.max(n-r,0),this}ceil(t=1,e=.001){const i=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=i-this.x,this.height=r-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),i=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=i-e,this.y=r,this.height=n-r,this}};st.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class aa{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=Zt.CIRC}clone(){return new aa(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let r=this.x-t,n=this.y-e;return r*=r,n*=n,r+n<=i}getBounds(){return new st(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}aa.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class oa{constructor(t=0,e=0,i=0,r=0){this.x=t,this.y=e,this.width=i,this.height=r,this.type=Zt.ELIP}clone(){return new oa(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let i=(t-this.x)/this.width,r=(e-this.y)/this.height;return i*=i,r*=r,i+r<=1}getBounds(){return new st(this.x-this.width,this.y-this.height,this.width,this.height)}}oa.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class $i{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const i=[];for(let r=0,n=e.length;r<n;r++)i.push(e[r].x,e[r].y);e=i}this.points=e,this.type=Zt.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new $i(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let i=!1;const r=this.points.length/2;for(let n=0,a=r-1;n<r;a=n++){const o=this.points[n*2],h=this.points[n*2+1],l=this.points[a*2],c=this.points[a*2+1];h>e!=c>e&&t<(l-o)*((e-h)/(c-h))+o&&(i=!i)}return i}}$i.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((s,t)=>`${s}, ${t}`,"")}]`};class ha{constructor(t=0,e=0,i=0,r=0,n=20){this.x=t,this.y=e,this.width=i,this.height=r,this.radius=n,this.type=Zt.RREC}clone(){return new ha(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 i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let r=t-(this.x+i),n=e-(this.y+i);const a=i*i;if(r*r+n*n<=a||(r=t-(this.x+this.width-i),r*r+n*n<=a)||(n=e-(this.y+this.height-i),r*r+n*n<=a)||(r=t-(this.x+i),r*r+n*n<=a))return!0}return!1}}ha.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class gt{constructor(t=1,e=0,i=0,r=1,n=0,a=0){this.array=null,this.a=t,this.b=e,this.c=i,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,i,r,n,a){return this.a=t,this.b=e,this.c=i,this.d=r,this.tx=n,this.ty=a,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new tt;const i=t.x,r=t.y;return e.x=this.a*i+this.c*r+this.tx,e.y=this.b*i+this.d*r+this.ty,e}applyInverse(t,e){e=e||new tt;const i=1/(this.a*this.d+this.c*-this.b),r=t.x,n=t.y;return e.x=this.d*i*r+-this.c*i*n+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*n+-this.b*i*r+(-this.ty*this.a+this.tx*this.b)*i,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),r=this.a,n=this.c,a=this.tx;return this.a=r*e-this.b*i,this.b=r*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=a*e-this.ty*i,this.ty=a*i+this.ty*e,this}append(t){const e=this.a,i=this.b,r=this.c,n=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*r,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this}setTransform(t,e,i,r,n,a,o,h,l){return this.a=Math.cos(o+l)*n,this.b=Math.sin(o+l)*n,this.c=-Math.sin(o-h)*a,this.d=Math.cos(o-h)*a,this.tx=t-(i*this.a+r*this.c),this.ty=e-(i*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 i=this.a,r=this.c;this.a=i*t.a+this.b*t.c,this.b=i*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,i=this.b,r=this.c,n=this.d,a=t.pivot,o=-Math.atan2(-r,n),h=Math.atan2(i,e),l=Math.abs(o+h);return l<1e-5||Math.abs(ra-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=h),t.scale.x=Math.sqrt(e*e+i*i),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*i+a.y*n),t}invert(){const t=this.a,e=this.b,i=this.c,r=this.d,n=this.tx,a=t*r-e*i;return this.a=r/a,this.b=-e/a,this.c=-i/a,this.d=t/a,this.tx=(i*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 gt;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 gt}static get TEMP_MATRIX(){return new gt}}gt.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};const gs=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ys=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],xs=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],vs=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Oh=[],$d=[],la=Math.sign;function Px(){for(let s=0;s<16;s++){const t=[];Oh.push(t);for(let e=0;e<16;e++){const i=la(gs[s]*gs[e]+xs[s]*ys[e]),r=la(ys[s]*gs[e]+vs[s]*ys[e]),n=la(gs[s]*xs[e]+xs[s]*vs[e]),a=la(ys[s]*xs[e]+vs[s]*vs[e]);for(let o=0;o<16;o++)if(gs[o]===i&&ys[o]===r&&xs[o]===n&&vs[o]===a){t.push(o);break}}}for(let s=0;s<16;s++){const t=new gt;t.set(gs[s],ys[s],xs[s],vs[s],0,0),$d.push(t)}}Px();const At={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:s=>gs[s],uY:s=>ys[s],vX:s=>xs[s],vY:s=>vs[s],inv:s=>s&8?s&15:-s&7,add:(s,t)=>Oh[s][t],sub:(s,t)=>Oh[s][At.inv(t)],rotate180:s=>s^4,isVertical:s=>(s&3)===2,byDirection:(s,t)=>Math.abs(s)*2<=Math.abs(t)?t>=0?At.S:At.N:Math.abs(t)*2<=Math.abs(s)?s>0?At.E:At.W:t>0?s>0?At.SE:At.SW:s>0?At.NE:At.NW,matrixAppendRotationInv:(s,t,e=0,i=0)=>{const r=$d[At.inv(t)];r.tx=e,r.ty=i,s.append(r)}};class ai{constructor(t,e,i=0,r=0){this._x=i,this._y=r,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new ai(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))}}ai.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Fh=class{constructor(){this.worldTransform=new gt,this.localTransform=new gt,this.position=new ai(this.onChange,this,0,0),this.scale=new ai(this.onChange,this,1,1),this.pivot=new ai(this.onChange,this,0,0),this.skew=new ai(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 s=this.localTransform;this._localID!==this._currentLocalID&&(s.a=this._cx*this.scale.x,s.b=this._sx*this.scale.x,s.c=this._cy*this.scale.y,s.d=this._sy*this.scale.y,s.tx=this.position.x-(this.pivot.x*s.a+this.pivot.y*s.c),s.ty=this.position.y-(this.pivot.x*s.b+this.pivot.y*s.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(s){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!==s._worldID){const e=s.worldTransform,i=this.worldTransform;i.a=t.a*e.a+t.b*e.c,i.b=t.a*e.b+t.b*e.d,i.c=t.c*e.a+t.d*e.c,i.d=t.c*e.b+t.d*e.d,i.tx=t.tx*e.a+t.ty*e.c+e.tx,i.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=s._worldID,this._worldID++}}setFromMatrix(s){s.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(s){this._rotation!==s&&(this._rotation=s,this.updateSkew())}};Fh.IDENTITY=new Fh;let ca=Fh;ca.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 Rx=`varying vec2 vTextureCoord;
|
|
9
|
+
Deprecated since v${r}`),console.warn(s),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
10
|
+
Deprecated since v${r}`),console.warn(s))),Uf[t]=!0}function vs(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function Jn(r){return r.split("?")[0].split("#")[0]}function B1(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function D1(r,t,e){return r.replace(new RegExp(B1(t),"g"),e)}function O1(r,t){let e="",s=0,i=-1,n=0,o=-1;for(let h=0;h<=r.length;++h){if(h<r.length)o=r.charCodeAt(h);else{if(o===47)break;o=47}if(o===47){if(!(i===h-1||n===1))if(i!==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 a=e.lastIndexOf("/");if(a!==e.length-1){a===-1?(e="",s=0):(e=e.slice(0,a),s=e.length-1-e.lastIndexOf("/")),i=h,n=0;continue}}else if(e.length===2||e.length===1){e="",s=0,i=h,n=0;continue}}t&&(e.length>0?e+="/..":e="..",s=2)}else e.length>0?e+=`/${r.slice(i+1,h)}`:e=r.slice(i+1,h),s=h-i-1;i=h,n=0}else o===46&&n!==-1?++n:n=-1}return e}const vt={toPosix(r){return D1(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){vs(r),r=this.toPosix(r);const t=/^file:\/\/\//.exec(r);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if(vs(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const s=Jn(this.toPosix(t??z.ADAPTER.getBaseUrl())),i=Jn(this.toPosix(e??this.rootname(s)));return r=this.toPosix(r),r.startsWith("/")?vt.join(i,r.slice(1)):this.isAbsolute(r)?r:this.join(s,r)},normalize(r){if(vs(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="";const e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));const s=r.endsWith("/");return r=O1(r,!1),r.length>0&&s&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return vs(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){if(r.length===0)return".";let t;for(let e=0;e<r.length;++e){const s=r[e];if(vs(s),s.length>0)if(t===void 0)t=s;else{const i=r[e-1]??"";this.joinExtensions.includes(this.extname(i).toLowerCase())?t+=`/../${s}`:t+=`/${s}`}}return t===void 0?".":this.normalize(t)},dirname(r){if(vs(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0);const e=t===47;let s=-1,i=!0;const n=this.getProtocol(r),o=r;r=r.slice(n.length);for(let h=r.length-1;h>=1;--h)if(t=r.charCodeAt(h),t===47){if(!i){s=h;break}}else i=!1;return s===-1?e?"/":this.isUrl(o)?n+r:n:e&&s===1?"//":n+r.slice(0,s)},rootname(r){vs(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){const e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){vs(r),t&&vs(t),r=Jn(this.toPosix(r));let e=0,s=-1,i=!0,n;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let o=t.length-1,h=-1;for(n=r.length-1;n>=0;--n){const a=r.charCodeAt(n);if(a===47){if(!i){e=n+1;break}}else h===-1&&(i=!1,h=n+1),o>=0&&(a===t.charCodeAt(o)?--o===-1&&(s=n):(o=-1,s=h))}return e===s?s=h:s===-1&&(s=r.length),r.slice(e,s)}for(n=r.length-1;n>=0;--n)if(r.charCodeAt(n)===47){if(!i){e=n+1;break}}else s===-1&&(i=!1,s=n+1);return s===-1?"":r.slice(e,s)},extname(r){vs(r),r=Jn(this.toPosix(r));let t=-1,e=0,s=-1,i=!0,n=0;for(let o=r.length-1;o>=0;--o){const h=r.charCodeAt(o);if(h===47){if(!i){e=o+1;break}continue}s===-1&&(i=!1,s=o+1),h===46?t===-1?t=o:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||s===-1||n===0||n===1&&t===s-1&&t===e+1?"":r.slice(t,s)},parse(r){vs(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=Jn(this.toPosix(r));let e=r.charCodeAt(0);const s=this.isAbsolute(r);let i;t.root=this.rootname(r),s||this.hasProtocol(r)?i=1:i=0;let n=-1,o=0,h=-1,a=!0,l=r.length-1,c=0;for(;l>=i;--l){if(e=r.charCodeAt(l),e===47){if(!a){o=l+1;break}continue}h===-1&&(a=!1,h=l+1),e===46?n===-1?n=l:c!==1&&(c=1):n!==-1&&(c=-1)}return n===-1||h===-1||c===0||c===1&&n===h-1&&n===o+1?h!==-1&&(o===0&&s?t.base=t.name=r.slice(1,h):t.base=t.name=r.slice(o,h)):(o===0&&s?(t.name=r.slice(1,n),t.base=r.slice(1,h)):(t.name=r.slice(o,n),t.base=r.slice(o,h)),t.ext=r.slice(n,h)),t.dir=this.dirname(r),t},sep:"/",delimiter:":",joinExtensions:[".html"]};let pl;async function L1(){return pl??(pl=(async()=>{var n;const r=document.createElement("canvas").getContext("webgl");if(!r)return Re.UNPACK;const t=await new Promise(o=>{const h=document.createElement("video");h.onloadeddata=()=>o(h),h.onerror=()=>o(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=r.createTexture();r.bindTexture(r.TEXTURE_2D,e);const s=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,s),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t);const i=new Uint8Array(4);return r.readPixels(0,0,1,1,r.RGBA,r.UNSIGNED_BYTE,i),r.deleteFramebuffer(s),r.deleteTexture(e),(n=r.getExtension("WEBGL_lose_context"))==null||n.loseContext(),i[0]<=i[3]?Re.PMA:Re.UNPACK})()),pl}let ml;function N1(){return typeof ml>"u"&&(ml=function(){var t;const r={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",r)||e.getContext("experimental-webgl",r);const i=!!((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,i}catch{return!1}}()),ml}var U1={grad:.9,turn:360,rad:360/(2*Math.PI)},mi=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},fe=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},os=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Vf=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Xf=function(r){return{r:os(r.r,0,255),g:os(r.g,0,255),b:os(r.b,0,255),a:os(r.a)}},gl=function(r){return{r:fe(r.r),g:fe(r.g),b:fe(r.b),a:fe(r.a,3)}},V1=/^#([0-9a-f]{3,8})$/i,ro=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},Gf=function(r){var t=r.r,e=r.g,s=r.b,i=r.a,n=Math.max(t,e,s),o=n-Math.min(t,e,s),h=o?n===t?(e-s)/o:n===e?2+(s-t)/o:4+(t-e)/o:0;return{h:60*(h<0?h+6:h),s:n?o/n*100:0,v:n/255*100,a:i}},$f=function(r){var t=r.h,e=r.s,s=r.v,i=r.a;t=t/360*6,e/=100,s/=100;var n=Math.floor(t),o=s*(1-e),h=s*(1-(t-n)*e),a=s*(1-(1-t+n)*e),l=n%6;return{r:255*[s,h,o,o,a,s][l],g:255*[a,s,s,h,o,o][l],b:255*[o,o,a,s,s,h][l],a:i}},Yf=function(r){return{h:Vf(r.h),s:os(r.s,0,100),l:os(r.l,0,100),a:os(r.a)}},Hf=function(r){return{h:fe(r.h),s:fe(r.s),l:fe(r.l),a:fe(r.a,3)}},Wf=function(r){return $f((e=(t=r).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},ta=function(r){return{h:(t=Gf(r)).h,s:(i=(200-(e=t.s))*(s=t.v)/100)>0&&i<200?e*s/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,e,s,i},X1=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,G1=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,$1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Y1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_l={string:[[function(r){var t=V1.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?fe(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?fe(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=$1.exec(r)||Y1.exec(r);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(r){var t=X1.exec(r)||G1.exec(r);if(!t)return null;var e,s,i=Yf({h:(e=t[1],s=t[2],s===void 0&&(s="deg"),Number(e)*(U1[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Wf(i)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,s=r.b,i=r.a,n=i===void 0?1:i;return mi(t)&&mi(e)&&mi(s)?Xf({r:Number(t),g:Number(e),b:Number(s),a:Number(n)}):null},"rgb"],[function(r){var t=r.h,e=r.s,s=r.l,i=r.a,n=i===void 0?1:i;if(!mi(t)||!mi(e)||!mi(s))return null;var o=Yf({h:Number(t),s:Number(e),l:Number(s),a:Number(n)});return Wf(o)},"hsl"],[function(r){var t=r.h,e=r.s,s=r.v,i=r.a,n=i===void 0?1:i;if(!mi(t)||!mi(e)||!mi(s))return null;var o=function(h){return{h:Vf(h.h),s:os(h.s,0,100),v:os(h.v,0,100),a:os(h.a)}}({h:Number(t),s:Number(e),v:Number(s),a:Number(n)});return $f(o)},"hsv"]]},zf=function(r,t){for(var e=0;e<t.length;e++){var s=t[e][0](r);if(s)return[s,t[e][1]]}return[null,void 0]},H1=function(r){return typeof r=="string"?zf(r.trim(),_l.string):typeof r=="object"&&r!==null?zf(r,_l.object):[null,void 0]},xl=function(r,t){var e=ta(r);return{h:e.h,s:os(e.s+100*t,0,100),l:e.l,a:e.a}},yl=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},jf=function(r,t){var e=ta(r);return{h:e.h,s:e.s,l:os(e.l+100*t,0,100),a:e.a}},vl=function(){function r(t){this.parsed=H1(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return fe(yl(this.rgba),2)},r.prototype.isDark=function(){return yl(this.rgba)<.5},r.prototype.isLight=function(){return yl(this.rgba)>=.5},r.prototype.toHex=function(){return t=gl(this.rgba),e=t.r,s=t.g,i=t.b,o=(n=t.a)<1?ro(fe(255*n)):"","#"+ro(e)+ro(s)+ro(i)+o;var t,e,s,i,n,o},r.prototype.toRgb=function(){return gl(this.rgba)},r.prototype.toRgbString=function(){return t=gl(this.rgba),e=t.r,s=t.g,i=t.b,(n=t.a)<1?"rgba("+e+", "+s+", "+i+", "+n+")":"rgb("+e+", "+s+", "+i+")";var t,e,s,i,n},r.prototype.toHsl=function(){return Hf(ta(this.rgba))},r.prototype.toHslString=function(){return t=Hf(ta(this.rgba)),e=t.h,s=t.s,i=t.l,(n=t.a)<1?"hsla("+e+", "+s+"%, "+i+"%, "+n+")":"hsl("+e+", "+s+"%, "+i+"%)";var t,e,s,i,n},r.prototype.toHsv=function(){return t=Gf(this.rgba),{h:fe(t.h),s:fe(t.s),v:fe(t.v),a:fe(t.a,3)};var t},r.prototype.invert=function(){return Ys({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),Ys(xl(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),Ys(xl(this.rgba,-t))},r.prototype.grayscale=function(){return Ys(xl(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),Ys(jf(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),Ys(jf(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?Ys({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):fe(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=ta(this.rgba);return typeof t=="number"?Ys({h:t,s:e.s,l:e.l,a:e.a}):fe(e.h)},r.prototype.isEqual=function(t){return this.toHex()===Ys(t).toHex()},r}(),Ys=function(r){return r instanceof vl?r:new vl(r)},qf=[],W1=function(r){r.forEach(function(t){qf.indexOf(t)<0&&(t(vl,_l),qf.push(t))})};function z1(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},s={};for(var i in e)s[e[i]]=i;var n={};r.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var h,a,l=s[this.toHex()];if(l)return l;if(o!=null&&o.closest){var c=this.toRgb(),d=1/0,u="black";if(!n.length)for(var f in e)n[f]=new r(e[f]).toRgb();for(var p in e){var m=(h=c,a=n[p],Math.pow(h.r-a.r,2)+Math.pow(h.g-a.g,2)+Math.pow(h.b-a.b,2));m<d&&(d=m,u=p)}return u}},t.string.push([function(o){var h=o.toLowerCase(),a=h==="transparent"?"#0000":e[h];return a?new r(a).toRgb():null},"name"])}W1([z1]);const sn=class wh{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 wh)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((i,n)=>i===e[n]);if(t!==null&&e!==null){const i=Object.keys(t),n=Object.keys(e);return i.length!==n.length?!1:i.every(o=>t[o]===e[o])}return t===e}toRgba(){const[t,e,s,i]=this._components;return{r:t,g:e,b:s,a:i}}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,i]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(s*255),t[2]=Math.round(i*255),t}toRgbArray(t){t=t??[];const[e,s,i]=this._components;return t[0]=e,t[1]=s,t[2]=i,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,s,i,n]=wh.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=s,this._components[2]*=i,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,i=this._int>>8&255,n=this._int&255;return e&&(s=s*t+.5|0,i=i*t+.5|0,n=n*t+.5|0),(t*255<<24)+(s<<16)+(i<<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,i]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(s*t)/t,this._components[2]=Math.round(i*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];const[e,s,i,n]=this._components;return t[0]=e,t[1]=s,t[2]=i,t[3]=n,t}normalize(t){let e,s,i,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const o=t;e=(o>>16&255)/255,s=(o>>8&255)/255,i=(o&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,s,i,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,i,n=255]=t,e/=255,s/=255,i/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const h=wh.HEX_PATTERN.exec(t);h&&(t=`#${h[2]}`)}const o=Ys(t);o.isValid()&&({r:e,g:s,b:i,a:n}=o.rgba,e/=255,s/=255,i/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=s,this._components[2]=i,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((i,n)=>{t[n]=Math.min(Math.max(i,e),s)}),t)}};sn.shared=new sn,sn.temp=new sn,sn.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Ct=sn;function Kf(r,t=[]){return at("7.2.0","utils.hex2rgb is deprecated, use Color#toRgbArray instead"),Ct.shared.setValue(r).toRgbArray(t)}function j1(r){return at("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Ct.shared.setValue(r).toHex()}function ea(r){return at("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Ct.shared.setValue(r).toNumber()}function q1(){const r=[],t=[];for(let s=0;s<32;s++)r[s]=s,t[s]=s;r[W.NORMAL_NPM]=W.NORMAL,r[W.ADD_NPM]=W.ADD,r[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(r),e}const Zf=q1();function Qf(r,t){return Zf[t?1:0][r]}function K1(r,t=null){const e=r*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,i=0;s<e;s+=6,i+=4)t[s+0]=i+0,t[s+1]=i+1,t[s+2]=i+2,t[s+3]=i+0,t[s+4]=i+2,t[s+5]=i+3;return t}function Jf(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function no(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function tp(r){return!(r&r-1)&&!!r}function ep(r){let t=(r>65535?1:0)<<4;r>>>=t;let e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function rn(r,t,e){const s=r.length;let i;if(t>=s||e===0)return;e=t+e>s?s-t:e;const n=s-e;for(i=t;i<n;++i)r[i]=r[i+e];r.length=n}function Bi(r){return r===0?0:r<0?-1:1}let Z1=0;function mr(){return++Z1}const bl=class{constructor(r,t,e,s){this.left=r,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}};bl.EMPTY=new bl(0,0,0,0);let sp=bl;const ip={},Hs=Object.create(null),Di=Object.create(null);class Q1{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 rp(r,t,e){for(let s=0,i=4*e*t;s<t;++s,i+=4)if(r[i+3]!==0)return!1;return!0}function np(r,t,e,s,i){const n=4*t;for(let o=s,h=s*n+4*e;o<=i;++o,h+=n)if(r[h+3]!==0)return!1;return!0}function J1(r){const{width:t,height:e}=r,s=r.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");const i=s.getImageData(0,0,t,e).data;let n=0,o=0,h=t-1,a=e-1;for(;o<e&&rp(i,t,o);)++o;if(o===e)return sp.EMPTY;for(;rp(i,t,a);)--a;for(;np(i,t,n,o,a);)++n;for(;np(i,t,h,o,a);)--h;return++h,++a,new sp(n,o,h,a)}function tb(r){const t=J1(r),{width:e,height:s}=t;let i=null;if(!t.isEmpty()){const n=r.getContext("2d");if(n===null)throw new TypeError("Failed to get canvas 2D context");i=n.getImageData(t.left,t.top,e,s)}return{width:e,height:s,data:i}}function eb(r,t=globalThis.location){if(r.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function gi(r,t=1){var s;const e=(s=z.RETINA_PREFIX)==null?void 0:s.exec(r);return e?parseFloat(e[1]):t}var Y=(r=>(r.Renderer="renderer",r.Application="application",r.RendererSystem="renderer-webgl-system",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererSystem="renderer-canvas-system",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r))(Y||{});const wl=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},ap=(r,t)=>wl(r).priority??t,Z={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(wl).forEach(t=>{t.type.forEach(e=>{var s,i;return(i=(s=this._removeHandlers)[e])==null?void 0:i.call(s,t)})}),this},add(...r){return r.map(wl).forEach(t=>{t.type.forEach(e=>{var n,o;const s=this._addHandlers,i=this._queue;s[e]?(n=s[e])==null||n.call(s,t):(i[e]=i[e]||[],(o=i[e])==null||o.push(t))})}),this},handle(r,t,e){var o;const s=this._addHandlers,i=this._removeHandlers;if(s[r]||i[r])throw new Error(`Extension type ${r} already has a handler`);s[r]=t,i[r]=e;const n=this._queue;return n[r]&&((o=n[r])==null||o.forEach(h=>t(h)),delete n[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(r,t,e=-1){return this.handle(r,s=>{t.includes(s.ref)||(t.push(s.ref),t.sort((i,n)=>ap(n,e)-ap(i,e)))},s=>{const i=t.indexOf(s.ref);i!==-1&&t.splice(i,1)})}};class El{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 sb=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
11
|
+
`);function ib(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
|
|
12
|
+
else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function rb(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);for(;;){const s=sb.replace(/%forloop%/gi,ib(r));if(t.shaderSource(e,s),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}const Tl=0,Al=1,Sl=2,Cl=3,Il=4,Pl=5;class Ws{constructor(){this.data=0,this.blendMode=W.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Tl)}set blend(t){!!(this.data&1<<Tl)!==t&&(this.data^=1<<Tl)}get offsets(){return!!(this.data&1<<Al)}set offsets(t){!!(this.data&1<<Al)!==t&&(this.data^=1<<Al)}get culling(){return!!(this.data&1<<Sl)}set culling(t){!!(this.data&1<<Sl)!==t&&(this.data^=1<<Sl)}get depthTest(){return!!(this.data&1<<Cl)}set depthTest(t){!!(this.data&1<<Cl)!==t&&(this.data^=1<<Cl)}get depthMask(){return!!(this.data&1<<Pl)}set depthMask(t){!!(this.data&1<<Pl)!==t&&(this.data^=1<<Pl)}get clockwiseFrontFace(){return!!(this.data&1<<Il)}set clockwiseFrontFace(t){!!(this.data&1<<Il)!==t&&(this.data^=1<<Il)}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 Ws;return t.depthTest=!1,t.blend=!0,t}}Ws.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const Rl=[];function op(r,t){if(!r)return null;let e="";if(typeof r=="string"){const s=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);s&&(e=s[1].toLowerCase())}for(let s=Rl.length-1;s>=0;--s){const i=Rl[s];if(i.test&&i.test(r,e))return new i(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class bs{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,s,i,n,o,h,a){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:c}=this;this._aliasCount++;for(let d=0,u=c.length;d<u;d++)c[d][l](t,e,s,i,n,o,h,a);return c===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(bs.prototype,{dispatch:{value:bs.prototype.emit},run:{value:bs.prototype.emit}});class sa{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new bs("setRealSize"),this.onUpdate=new bs("update"),this.onError=new bs("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 ao extends sa{constructor(t,e){const{width:s,height:i}=e||{};if(!s||!i)throw new Error("BufferResource width or height invalid");super(s,i),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,s){const i=t.gl;i.pixelStorei(i.UNPACK_ALIGNMENT,this.unpackAlignment),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Re.UNPACK);const n=e.realWidth,o=e.realHeight;return s.width===n&&s.height===o?i.texSubImage2D(e.target,0,0,0,n,o,e.format,s.type,this.data):(s.width=n,s.height=o,i.texImage2D(e.target,0,s.internalFormat,n,o,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 nb={scaleMode:je.NEAREST,alphaMode:Re.NPM},Ml=class Dn extends Vs{constructor(t=null,e=null){super(),e=Object.assign({},Dn.defaultOptions,e);const{alphaMode:s,mipmap:i,anisotropicLevel:n,scaleMode:o,width:h,height:a,wrapMode:l,format:c,type:d,target:u,resolution:f,resourceOptions:p}=e;t&&!(t instanceof sa)&&(t=op(t,p),t.internal=!0),this.resolution=f||z.RESOLUTION,this.width=Math.round((h||0)*this.resolution)/this.resolution,this.height=Math.round((a||0)*this.resolution)/this.resolution,this._mipmap=i,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=o,this.format=c,this.type=d,this.target=u,this.alphaMode=s,this.uid=mr(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=h>0&&a>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=tp(this.realWidth)&&tp(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 Di[this.cacheId],delete Hs[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Dn.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 i=typeof t=="string";let n=null;if(i)n=t;else{if(!t._pixiId){const h=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${h}_${mr()}`}n=t._pixiId}let o=Di[n];if(i&&s&&!o)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return o||(o=new Dn(t,e),o.cacheId=n,Dn.addToCache(o,n)),o}static fromBuffer(t,e,s,i){t=t||new Float32Array(e*s*4);const n=new ao(t,{width:e,height:s,...i==null?void 0:i.resourceOptions});let o,h;return t instanceof Float32Array?(o=X.RGBA,h=tt.FLOAT):t instanceof Int32Array?(o=X.RGBA_INTEGER,h=tt.INT):t instanceof Uint32Array?(o=X.RGBA_INTEGER,h=tt.UNSIGNED_INT):t instanceof Int16Array?(o=X.RGBA_INTEGER,h=tt.SHORT):t instanceof Uint16Array?(o=X.RGBA_INTEGER,h=tt.UNSIGNED_SHORT):t instanceof Int8Array?(o=X.RGBA,h=tt.BYTE):(o=X.RGBA,h=tt.UNSIGNED_BYTE),n.internal=!0,new Dn(n,Object.assign({},nb,{type:h,format:o},i))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Di[e]&&Di[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),Di[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Di[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete Di[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete Di[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Ml.defaultOptions={mipmap:ys.POW2,anisotropicLevel:0,scaleMode:je.LINEAR,wrapMode:Mi.CLAMP,alphaMode:Re.UNPACK,target:Hr.TEXTURE_2D,format:X.RGBA,type:tt.UNSIGNED_BYTE},Ml._globalBatch=0;let et=Ml;class Fl{constructor(){this.texArray=null,this.blend=0,this.type=xs.TRIANGLES,this.start=0,this.size=0,this.data=null}}let ab=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=ab++,this.disposeRunner=new bs("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 oo{constructor(t,e=0,s=!1,i=tt.FLOAT,n,o,h,a=1){this.buffer=t,this.size=e,this.normalized=s,this.type=i,this.stride=n,this.start=o,this.instance=h,this.divisor=a}destroy(){this.buffer=null}static from(t,e,s,i,n){return new oo(t,e,s,i,n)}}const ob={Float32Array,Uint32Array,Int32Array,Uint8Array};function hb(r,t){let e=0,s=0;const i={};for(let a=0;a<r.length;a++)s+=t[a],e+=r[a].length;const n=new ArrayBuffer(e*4);let o=null,h=0;for(let a=0;a<r.length;a++){const l=t[a],c=r[a],d=Jf(c);i[d]||(i[d]=new ob[d](n)),o=i[d];for(let u=0;u<c.length;u++){const f=(u/l|0)*s+h,p=u%l;o[f+p]=c[u]}h+=l}return new Float32Array(n)}const hp={5126:4,5123:2,5121:1};let lb=0;const cb={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class Oi{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=lb++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new bs("disposeGeometry"),this.refCount=0}addAttribute(t,e,s=0,i=!1,n,o,h,a=!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 d=0;d<l.length;d++)this.addAttribute(l[d],e,s,i,n);return this}let c=this.buffers.indexOf(e);return c===-1&&(this.buffers.push(e),c=this.buffers.length-1),this.attributes[t]=new oo(c,s,i,n,o,h,a),this.instanced=this.instanced||a,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 i;for(i in this.attributes){const n=this.attributes[i],o=this.buffers[n.buffer];t.push(o.data),e.push(n.size*hp[n.type]/4),n.buffer=0}for(s.data=hb(t,e),i=0;i<this.buffers.length;i++)this.buffers[i]!==this.indexBuffer&&this.buffers[i].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 Oi;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 oo(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 Oi,s=[],i=[],n=[];let o;for(let h=0;h<t.length;h++){o=t[h];for(let a=0;a<o.buffers.length;a++)i[a]=i[a]||0,i[a]+=o.buffers[a].data.length,n[a]=0}for(let h=0;h<o.buffers.length;h++)s[h]=new cb[Jf(o.buffers[h].data)](i[h]),e.buffers[h]=new Jt(s[h]);for(let h=0;h<t.length;h++){o=t[h];for(let a=0;a<o.buffers.length;a++)s[a].set(o.buffers[a].data,n[a]),n[a]+=o.buffers[a].data.length}if(e.attributes=o.attributes,o.indexBuffer){e.indexBuffer=e.buffers[o.buffers.indexOf(o.indexBuffer)],e.indexBuffer.type=Us.ELEMENT_ARRAY_BUFFER;let h=0,a=0,l=0,c=0;for(let d=0;d<o.buffers.length;d++)if(o.buffers[d]!==o.indexBuffer){c=d;break}for(const d in o.attributes){const u=o.attributes[d];(u.buffer|0)===c&&(a+=u.size*hp[u.type]/4)}for(let d=0;d<t.length;d++){const u=t[d].indexBuffer.data;for(let f=0;f<u.length;f++)e.indexBuffer.data[f+l]+=h;h+=t[d].buffers[c].data.length/a,l+=u.length}}return e}}class lp extends Oi{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 ho=Math.PI*2,ub=180/Math.PI,kl=Math.PI/180;var ye=(r=>(r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC",r))(ye||{});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 lo=[new st,new st,new st,new st];let it=class cd{constructor(t=0,e=0,s=0,i=0){this.x=Number(t),this.y=Number(e),this.width=Number(s),this.height=Number(i),this.type=ye.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 cd(0,0,0,0)}clone(){return new cd(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,i=this.right,n=this.top,o=this.bottom;if(i<=s||o<=n)return!1;const h=lo[0].set(t.left,t.top),a=lo[1].set(t.left,t.bottom),l=lo[2].set(t.right,t.top),c=lo[3].set(t.right,t.bottom);if(l.x<=h.x||a.y<=h.y)return!1;const d=Math.sign(e.a*e.d-e.b*e.c);if(d===0||(e.apply(h,h),e.apply(a,a),e.apply(l,l),e.apply(c,c),Math.max(h.x,a.x,l.x,c.x)<=s||Math.min(h.x,a.x,l.x,c.x)>=i||Math.max(h.y,a.y,l.y,c.y)<=n||Math.min(h.y,a.y,l.y,c.y)>=o))return!1;const u=d*(a.y-h.y),f=d*(h.x-a.x),p=u*s+f*n,m=u*i+f*n,g=u*s+f*o,y=u*i+f*o;if(Math.max(p,m,g,y)<=u*h.x+f*h.y||Math.min(p,m,g,y)>=u*c.x+f*c.y)return!1;const x=d*(h.y-l.y),_=d*(l.x-h.x),v=x*s+_*n,b=x*i+_*n,w=x*s+_*o,E=x*i+_*o;return!(Math.max(v,b,w,E)<=x*h.x+_*h.y||Math.min(v,b,w,E)>=x*c.x+_*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),s=Math.min(this.x+this.width,t.x+t.width),i=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=i,this.height=Math.max(n-i,0),this}ceil(t=1,e=.001){const s=Math.ceil((this.x+this.width-e)*t)/t,i=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=i-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),s=Math.max(this.x+this.width,t.x+t.width),i=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=i,this.height=n-i,this}};it.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class co{constructor(t=0,e=0,s=0){this.x=t,this.y=e,this.radius=s,this.type=ye.CIRC}clone(){return new co(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const s=this.radius*this.radius;let i=this.x-t,n=this.y-e;return i*=i,n*=n,i+n<=s}getBounds(){return new it(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}co.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class uo{constructor(t=0,e=0,s=0,i=0){this.x=t,this.y=e,this.width=s,this.height=i,this.type=ye.ELIP}clone(){return new uo(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,i=(e-this.y)/this.height;return s*=s,i*=i,s+i<=1}getBounds(){return new it(this.x-this.width,this.y-this.height,this.width,this.height)}}uo.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Li{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const s=[];for(let i=0,n=e.length;i<n;i++)s.push(e[i].x,e[i].y);e=s}this.points=e,this.type=ye.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new Li(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let s=!1;const i=this.points.length/2;for(let n=0,o=i-1;n<i;o=n++){const h=this.points[n*2],a=this.points[n*2+1],l=this.points[o*2],c=this.points[o*2+1];a>e!=c>e&&t<(l-h)*((e-a)/(c-a))+h&&(s=!s)}return s}}Li.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};class fo{constructor(t=0,e=0,s=0,i=0,n=20){this.x=t,this.y=e,this.width=s,this.height=i,this.radius=n,this.type=ye.RREC}clone(){return new fo(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 i=t-(this.x+s),n=e-(this.y+s);const o=s*s;if(i*i+n*n<=o||(i=t-(this.x+this.width-s),i*i+n*n<=o)||(n=e-(this.y+this.height-s),i*i+n*n<=o)||(i=t-(this.x+s),i*i+n*n<=o))return!0}return!1}}fo.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,i=1,n=0,o=0){this.array=null,this.a=t,this.b=e,this.c=s,this.d=i,this.tx=n,this.ty=o}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,s,i,n,o){return this.a=t,this.b=e,this.c=s,this.d=i,this.tx=n,this.ty=o,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,i=t.y;return e.x=this.a*s+this.c*i+this.tx,e.y=this.b*s+this.d*i+this.ty,e}applyInverse(t,e){e=e||new st;const s=1/(this.a*this.d+this.c*-this.b),i=t.x,n=t.y;return e.x=this.d*s*i+-this.c*s*n+(this.ty*this.c-this.tx*this.d)*s,e.y=this.a*s*n+-this.b*s*i+(-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),i=this.a,n=this.c,o=this.tx;return this.a=i*e-this.b*s,this.b=i*s+this.b*e,this.c=n*e-this.d*s,this.d=n*s+this.d*e,this.tx=o*e-this.ty*s,this.ty=o*s+this.ty*e,this}append(t){const e=this.a,s=this.b,i=this.c,n=this.d;return this.a=t.a*e+t.b*i,this.b=t.a*s+t.b*n,this.c=t.c*e+t.d*i,this.d=t.c*s+t.d*n,this.tx=t.tx*e+t.ty*i+this.tx,this.ty=t.tx*s+t.ty*n+this.ty,this}setTransform(t,e,s,i,n,o,h,a,l){return this.a=Math.cos(h+l)*n,this.b=Math.sin(h+l)*n,this.c=-Math.sin(h-a)*o,this.d=Math.cos(h-a)*o,this.tx=t-(s*this.a+i*this.c),this.ty=e-(s*this.b+i*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,i=this.c;this.a=s*t.a+this.b*t.c,this.b=s*t.b+this.b*t.d,this.c=i*t.a+this.d*t.c,this.d=i*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,i=this.c,n=this.d,o=t.pivot,h=-Math.atan2(-i,n),a=Math.atan2(s,e),l=Math.abs(h+a);return l<1e-5||Math.abs(ho-l)<1e-5?(t.rotation=a,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=h,t.skew.y=a),t.scale.x=Math.sqrt(e*e+s*s),t.scale.y=Math.sqrt(i*i+n*n),t.position.x=this.tx+(o.x*e+o.y*i),t.position.y=this.ty+(o.x*s+o.y*n),t}invert(){const t=this.a,e=this.b,s=this.c,i=this.d,n=this.tx,o=t*i-e*s;return this.a=i/o,this.b=-e/o,this.c=-s/o,this.d=t/o,this.tx=(s*this.ty-i*n)/o,this.ty=-(t*this.ty-e*n)/o,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 gr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],_r=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],xr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],yr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Bl=[],cp=[],po=Math.sign;function db(){for(let r=0;r<16;r++){const t=[];Bl.push(t);for(let e=0;e<16;e++){const s=po(gr[r]*gr[e]+xr[r]*_r[e]),i=po(_r[r]*gr[e]+yr[r]*_r[e]),n=po(gr[r]*xr[e]+xr[r]*yr[e]),o=po(_r[r]*xr[e]+yr[r]*yr[e]);for(let h=0;h<16;h++)if(gr[h]===s&&_r[h]===i&&xr[h]===n&&yr[h]===o){t.push(h);break}}}for(let r=0;r<16;r++){const t=new Rt;t.set(gr[r],_r[r],xr[r],yr[r],0,0),cp.push(t)}}db();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:r=>gr[r],uY:r=>_r[r],vX:r=>xr[r],vY:r=>yr[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>Bl[r][t],sub:(r,t)=>Bl[r][Nt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Nt.S:Nt.N:Math.abs(t)*2<=Math.abs(r)?r>0?Nt.E:Nt.W:t>0?r>0?Nt.SE:Nt.SW:r>0?Nt.NE:Nt.NW,matrixAppendRotationInv:(r,t,e=0,s=0)=>{const i=cp[Nt.inv(t)];i.tx=e,i.ty=s,r.append(i)}};class zs{constructor(t,e,s=0,i=0){this._x=s,this._y=i,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new zs(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))}}zs.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Dl=class{constructor(){this.worldTransform=new Rt,this.localTransform=new Rt,this.position=new zs(this.onChange,this,0,0),this.scale=new zs(this.onChange,this,1,1),this.pivot=new zs(this.onChange,this,0,0),this.skew=new zs(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 r=this.localTransform;this._localID!==this._currentLocalID&&(r.a=this._cx*this.scale.x,r.b=this._sx*this.scale.x,r.c=this._cy*this.scale.y,r.d=this._sy*this.scale.y,r.tx=this.position.x-(this.pivot.x*r.a+this.pivot.y*r.c),r.ty=this.position.y-(this.pivot.x*r.b+this.pivot.y*r.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(r){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!==r._worldID){const e=r.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=r._worldID,this._worldID++}}setFromMatrix(r){r.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(r){this._rotation!==r&&(this._rotation=r,this.updateSkew())}};Dl.IDENTITY=new Dl;let mo=Dl;mo.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 fb=`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
|
-
}`,
|
|
18
|
+
}`,pb=`attribute vec2 aVertexPosition;
|
|
19
19
|
attribute vec2 aTextureCoord;
|
|
20
20
|
|
|
21
21
|
uniform mat3 projectionMatrix;
|
|
@@ -26,64 +26,64 @@ 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
|
|
30
|
-
if(uv["${
|
|
29
|
+
`;function up(r,t,e){const s=r.createShader(t);return r.shaderSource(s,e),r.compileShader(s),s}function Ol(r){const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function dp(r,t){switch(r){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return Ol(2*t);case"bvec3":return Ol(3*t);case"bvec4":return Ol(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 nn=[{test:r=>r.type==="float"&&r.size===1&&!r.isArray,code:r=>`
|
|
30
|
+
if(uv["${r}"] !== ud["${r}"].value)
|
|
31
31
|
{
|
|
32
|
-
ud["${
|
|
33
|
-
gl.uniform1f(ud["${
|
|
32
|
+
ud["${r}"].value = uv["${r}"]
|
|
33
|
+
gl.uniform1f(ud["${r}"].location, uv["${r}"])
|
|
34
34
|
}
|
|
35
|
-
`},{test:(
|
|
35
|
+
`},{test:(r,t)=>(r.type==="sampler2D"||r.type==="samplerCube"||r.type==="sampler2DArray")&&r.size===1&&!r.isArray&&(t==null||t.castToBaseTexture!==void 0),code:r=>`t = syncData.textureCount++;
|
|
36
36
|
|
|
37
|
-
renderer.texture.bind(uv["${
|
|
37
|
+
renderer.texture.bind(uv["${r}"], t);
|
|
38
38
|
|
|
39
|
-
if(ud["${
|
|
39
|
+
if(ud["${r}"].value !== t)
|
|
40
40
|
{
|
|
41
|
-
ud["${
|
|
42
|
-
gl.uniform1i(ud["${
|
|
41
|
+
ud["${r}"].value = t;
|
|
42
|
+
gl.uniform1i(ud["${r}"].location, t);
|
|
43
43
|
; // eslint-disable-line max-len
|
|
44
|
-
}`},{test:(
|
|
45
|
-
gl.uniformMatrix3fv(ud["${
|
|
46
|
-
`,codeUbo:
|
|
47
|
-
var ${
|
|
48
|
-
|
|
49
|
-
data[offset] = ${
|
|
50
|
-
data[offset+1] = ${
|
|
51
|
-
data[offset+2] = ${
|
|
44
|
+
}`},{test:(r,t)=>r.type==="mat3"&&r.size===1&&!r.isArray&&t.a!==void 0,code:r=>`
|
|
45
|
+
gl.uniformMatrix3fv(ud["${r}"].location, false, uv["${r}"].toArray(true));
|
|
46
|
+
`,codeUbo:r=>`
|
|
47
|
+
var ${r}_matrix = uv.${r}.toArray(true);
|
|
48
|
+
|
|
49
|
+
data[offset] = ${r}_matrix[0];
|
|
50
|
+
data[offset+1] = ${r}_matrix[1];
|
|
51
|
+
data[offset+2] = ${r}_matrix[2];
|
|
52
52
|
|
|
53
|
-
data[offset + 4] = ${
|
|
54
|
-
data[offset + 5] = ${
|
|
55
|
-
data[offset + 6] = ${
|
|
53
|
+
data[offset + 4] = ${r}_matrix[3];
|
|
54
|
+
data[offset + 5] = ${r}_matrix[4];
|
|
55
|
+
data[offset + 6] = ${r}_matrix[5];
|
|
56
56
|
|
|
57
|
-
data[offset + 8] = ${
|
|
58
|
-
data[offset + 9] = ${
|
|
59
|
-
data[offset + 10] = ${
|
|
60
|
-
`},{test:(
|
|
61
|
-
cv = ud["${
|
|
62
|
-
v = uv["${
|
|
57
|
+
data[offset + 8] = ${r}_matrix[6];
|
|
58
|
+
data[offset + 9] = ${r}_matrix[7];
|
|
59
|
+
data[offset + 10] = ${r}_matrix[8];
|
|
60
|
+
`},{test:(r,t)=>r.type==="vec2"&&r.size===1&&!r.isArray&&t.x!==void 0,code:r=>`
|
|
61
|
+
cv = ud["${r}"].value;
|
|
62
|
+
v = uv["${r}"];
|
|
63
63
|
|
|
64
64
|
if(cv[0] !== v.x || cv[1] !== v.y)
|
|
65
65
|
{
|
|
66
66
|
cv[0] = v.x;
|
|
67
67
|
cv[1] = v.y;
|
|
68
|
-
gl.uniform2f(ud["${
|
|
69
|
-
}`,codeUbo:
|
|
70
|
-
v = uv.${
|
|
68
|
+
gl.uniform2f(ud["${r}"].location, v.x, v.y);
|
|
69
|
+
}`,codeUbo:r=>`
|
|
70
|
+
v = uv.${r};
|
|
71
71
|
|
|
72
72
|
data[offset] = v.x;
|
|
73
73
|
data[offset+1] = v.y;
|
|
74
|
-
`},{test:
|
|
75
|
-
cv = ud["${
|
|
76
|
-
v = uv["${
|
|
74
|
+
`},{test:r=>r.type==="vec2"&&r.size===1&&!r.isArray,code:r=>`
|
|
75
|
+
cv = ud["${r}"].value;
|
|
76
|
+
v = uv["${r}"];
|
|
77
77
|
|
|
78
78
|
if(cv[0] !== v[0] || cv[1] !== v[1])
|
|
79
79
|
{
|
|
80
80
|
cv[0] = v[0];
|
|
81
81
|
cv[1] = v[1];
|
|
82
|
-
gl.uniform2f(ud["${
|
|
82
|
+
gl.uniform2f(ud["${r}"].location, v[0], v[1]);
|
|
83
83
|
}
|
|
84
|
-
`},{test:(
|
|
85
|
-
cv = ud["${
|
|
86
|
-
v = uv["${
|
|
84
|
+
`},{test:(r,t)=>r.type==="vec4"&&r.size===1&&!r.isArray&&t.width!==void 0,code:r=>`
|
|
85
|
+
cv = ud["${r}"].value;
|
|
86
|
+
v = uv["${r}"];
|
|
87
87
|
|
|
88
88
|
if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)
|
|
89
89
|
{
|
|
@@ -91,17 +91,17 @@ void main(void){
|
|
|
91
91
|
cv[1] = v.y;
|
|
92
92
|
cv[2] = v.width;
|
|
93
93
|
cv[3] = v.height;
|
|
94
|
-
gl.uniform4f(ud["${
|
|
95
|
-
}`,codeUbo:
|
|
96
|
-
v = uv.${
|
|
94
|
+
gl.uniform4f(ud["${r}"].location, v.x, v.y, v.width, v.height)
|
|
95
|
+
}`,codeUbo:r=>`
|
|
96
|
+
v = uv.${r};
|
|
97
97
|
|
|
98
98
|
data[offset] = v.x;
|
|
99
99
|
data[offset+1] = v.y;
|
|
100
100
|
data[offset+2] = v.width;
|
|
101
101
|
data[offset+3] = v.height;
|
|
102
|
-
`},{test:(
|
|
103
|
-
cv = ud["${
|
|
104
|
-
v = uv["${
|
|
102
|
+
`},{test:(r,t)=>r.type==="vec4"&&r.size===1&&!r.isArray&&t.red!==void 0,code:r=>`
|
|
103
|
+
cv = ud["${r}"].value;
|
|
104
|
+
v = uv["${r}"];
|
|
105
105
|
|
|
106
106
|
if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha)
|
|
107
107
|
{
|
|
@@ -109,17 +109,17 @@ void main(void){
|
|
|
109
109
|
cv[1] = v.green;
|
|
110
110
|
cv[2] = v.blue;
|
|
111
111
|
cv[3] = v.alpha;
|
|
112
|
-
gl.uniform4f(ud["${
|
|
113
|
-
}`,codeUbo:
|
|
114
|
-
v = uv.${
|
|
112
|
+
gl.uniform4f(ud["${r}"].location, v.red, v.green, v.blue, v.alpha)
|
|
113
|
+
}`,codeUbo:r=>`
|
|
114
|
+
v = uv.${r};
|
|
115
115
|
|
|
116
116
|
data[offset] = v.red;
|
|
117
117
|
data[offset+1] = v.green;
|
|
118
118
|
data[offset+2] = v.blue;
|
|
119
119
|
data[offset+3] = v.alpha;
|
|
120
|
-
`},{test:(
|
|
121
|
-
cv = ud["${
|
|
122
|
-
v = uv["${
|
|
120
|
+
`},{test:(r,t)=>r.type==="vec3"&&r.size===1&&!r.isArray&&t.red!==void 0,code:r=>`
|
|
121
|
+
cv = ud["${r}"].value;
|
|
122
|
+
v = uv["${r}"];
|
|
123
123
|
|
|
124
124
|
if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a)
|
|
125
125
|
{
|
|
@@ -127,16 +127,16 @@ void main(void){
|
|
|
127
127
|
cv[1] = v.green;
|
|
128
128
|
cv[2] = v.blue;
|
|
129
129
|
|
|
130
|
-
gl.uniform3f(ud["${
|
|
131
|
-
}`,codeUbo:
|
|
132
|
-
v = uv.${
|
|
130
|
+
gl.uniform3f(ud["${r}"].location, v.red, v.green, v.blue)
|
|
131
|
+
}`,codeUbo:r=>`
|
|
132
|
+
v = uv.${r};
|
|
133
133
|
|
|
134
134
|
data[offset] = v.red;
|
|
135
135
|
data[offset+1] = v.green;
|
|
136
136
|
data[offset+2] = v.blue;
|
|
137
|
-
`},{test:
|
|
138
|
-
cv = ud["${
|
|
139
|
-
v = uv["${
|
|
137
|
+
`},{test:r=>r.type==="vec4"&&r.size===1&&!r.isArray,code:r=>`
|
|
138
|
+
cv = ud["${r}"].value;
|
|
139
|
+
v = uv["${r}"];
|
|
140
140
|
|
|
141
141
|
if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
142
142
|
{
|
|
@@ -145,8 +145,8 @@ void main(void){
|
|
|
145
145
|
cv[2] = v[2];
|
|
146
146
|
cv[3] = v[3];
|
|
147
147
|
|
|
148
|
-
gl.uniform4f(ud["${
|
|
149
|
-
}`}],
|
|
148
|
+
gl.uniform4f(ud["${r}"].location, v[0], v[1], v[2], v[3])
|
|
149
|
+
}`}],mb={float:`
|
|
150
150
|
if (cv !== v)
|
|
151
151
|
{
|
|
152
152
|
cu.value = v;
|
|
@@ -282,36 +282,36 @@ void main(void){
|
|
|
282
282
|
cu.value = v;
|
|
283
283
|
|
|
284
284
|
gl.uniform1i(location, v);
|
|
285
|
-
}`},
|
|
285
|
+
}`},gb={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 _b(r,t){var s;const e=[`
|
|
286
286
|
var v = null;
|
|
287
287
|
var cv = null;
|
|
288
288
|
var cu = null;
|
|
289
289
|
var t = 0;
|
|
290
290
|
var gl = renderer.gl;
|
|
291
|
-
`];for(const
|
|
292
|
-
renderer.shader.syncUniformBufferGroup(uv.${
|
|
291
|
+
`];for(const i in r.uniforms){const n=t[i];if(!n){((s=r.uniforms[i])==null?void 0:s.group)===!0&&(r.uniforms[i].ubo?e.push(`
|
|
292
|
+
renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}');
|
|
293
293
|
`):e.push(`
|
|
294
|
-
renderer.shader.syncUniformGroup(uv.${
|
|
295
|
-
`));continue}const
|
|
296
|
-
cu = ud["${
|
|
294
|
+
renderer.shader.syncUniformGroup(uv.${i}, syncData);
|
|
295
|
+
`));continue}const o=r.uniforms[i];let h=!1;for(let a=0;a<nn.length;a++)if(nn[a].test(n,o)){e.push(nn[a].code(i,o)),h=!0;break}if(!h){const a=(n.size===1&&!n.isArray?mb:gb)[n.type].replace("location",`ud["${i}"].location`);e.push(`
|
|
296
|
+
cu = ud["${i}"];
|
|
297
297
|
cv = cu.value;
|
|
298
|
-
v = uv["${
|
|
299
|
-
${
|
|
300
|
-
`))}const
|
|
301
|
-
`).map((l,c)=>`${c}: ${l}`),
|
|
302
|
-
`),n={},
|
|
303
|
-
`);
|
|
304
|
-
${
|
|
305
|
-
${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${
|
|
306
|
-
${this.fragmentSrc}`,this.vertexSrc=
|
|
298
|
+
v = uv["${i}"];
|
|
299
|
+
${a};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
|
|
300
|
+
`))}const fp={};let an=fp;function xb(){if(an===fp||an!=null&&an.isContextLost()){const r=z.ADAPTER.createCanvas();let t;z.PREFER_ENV>=Ls.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),an=t}return an}let go;function yb(){if(!go){go=as.MEDIUM;const r=xb();if(r&&r.getShaderPrecisionFormat){const t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(go=t.precision?as.HIGH:as.MEDIUM)}}return go}function pp(r,t){const e=r.getShaderSource(t).split(`
|
|
301
|
+
`).map((l,c)=>`${c}: ${l}`),s=r.getShaderInfoLog(t),i=s.split(`
|
|
302
|
+
`),n={},o=i.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!n[l]?(n[l]=!0,!0):!1),h=[""];o.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,h.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const a=e.join(`
|
|
303
|
+
`);h[0]=a,console.error(s),console.groupCollapsed("click to view full shader code"),console.warn(...h),console.groupEnd()}function vb(r,t,e,s){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||pp(r,e),r.getShaderParameter(s,r.COMPILE_STATUS)||pp(r,s),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}const bb={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 mp(r){return bb[r]}let _o=null;const gp={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 _p(r,t){if(!_o){const e=Object.keys(gp);_o={};for(let s=0;s<e.length;++s){const i=e[s];_o[r[i]]=gp[i]}}return _o[t]}function xp(r,t,e){if(r.substring(0,9)!=="precision"){let s=t;return t===as.HIGH&&e!==as.HIGH&&(s=as.MEDIUM),`precision ${s} float;
|
|
304
|
+
${r}`}else if(e!==as.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}let ia;function wb(){if(typeof ia=="boolean")return ia;try{ia=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ia=!1}return ia}let Eb=0;const xo={},Ll=class On{constructor(t,e,s="pixi-shader",i={}){this.extra={},this.id=Eb++,this.vertexSrc=t||On.defaultVertexSrc,this.fragmentSrc=e||On.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=i,this.vertexSrc.substring(0,8)!=="#version"&&(s=s.replace(/\s+/g,"-"),xo[s]?(xo[s]++,s+=`-${xo[s]}`):xo[s]=1,this.vertexSrc=`#define SHADER_NAME ${s}
|
|
305
|
+
${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${s}
|
|
306
|
+
${this.fragmentSrc}`,this.vertexSrc=xp(this.vertexSrc,On.defaultVertexPrecision,as.HIGH),this.fragmentSrc=xp(this.fragmentSrc,On.defaultFragmentPrecision,yb())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return pb}static get defaultFragmentSrc(){return fb}static from(t,e,s){const i=t+e;let n=ip[i];return n||(ip[i]=n=new On(t,e,s)),n}};Ll.defaultVertexPrecision=as.HIGH,Ll.defaultFragmentPrecision=di.apple.device?as.HIGH:as.MEDIUM;let _i=Ll,Tb=0;class ws{constructor(t,e,s){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=Tb++,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 ws(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 ws(t,e,s)}static uboFrom(t,e){return new ws(t,e??!0,!0)}}class js{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof ws?this.uniformGroup=e:this.uniformGroup=new ws(e):this.uniformGroup=new ws({}),this.disposeRunner=new bs("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(const s in e.uniforms){const i=e.uniforms[s];if(i.group===!0&&this.checkUniformExists(t,i))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 i=_i.from(t,e);return new js(i,s)}}class Ab{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]=ws.from({uSamplers:s},!0);let i=this.fragTemplate;i=i.replace(/%count%/gi,`${t}`),i=i.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new _i(this.vertexSrc,i)}const e={tint:new Float32Array([1,1,1,1]),translationMatrix:new Rt,default:this.defaultGroupCache[t]};return new js(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
|
|
307
307
|
`,e+=`
|
|
308
|
-
`;for(let
|
|
309
|
-
else `),
|
|
308
|
+
`;for(let s=0;s<t;s++)s>0&&(e+=`
|
|
309
|
+
else `),s<t-1&&(e+=`if(vTextureId < ${s}.5)`),e+=`
|
|
310
310
|
{`,e+=`
|
|
311
|
-
color = texture2D(uSamplers[${
|
|
311
|
+
color = texture2D(uSamplers[${s}], vTextureCoord);`,e+=`
|
|
312
312
|
}`;return e+=`
|
|
313
313
|
`,e+=`
|
|
314
|
-
`,e}}class
|
|
314
|
+
`,e}}class Nl{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 Sb(){return!di.apple.device}function Cb(r){let t=!0;const e=z.ADAPTER.getNavigator();if(di.tablet||di.phone){if(di.apple.device){const s=e.userAgent.match(/OS (\d+)_(\d+)?/);s&&parseInt(s[1],10)<11&&(t=!1)}if(di.android.device){const s=e.userAgent.match(/Android\s([0-9.]*)/);s&&parseInt(s[1],10)<7&&(t=!1)}}return t?r:4}class yo{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}var Ib=`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
|
-
|
|
324
|
+
`,Pb=`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
|
|
345
|
+
`;const ra=class Fs extends yo{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=lp,this.vertexSize=6,this.state=Ws.for2d(),this.size=Fs.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??Cb(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??Sb(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return at("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return Pb}static get defaultFragmentTemplate(){return Ib}setShaderGenerator({vertex:t=Fs.defaultVertexSrc,fragment:e=Fs.defaultFragmentTemplate}={}){this.shaderGenerator=new Ab(t,e)}contextChange(){const t=this.renderer.gl;z.PREFER_ENV===Ls.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),Fs.defaultMaxTextures),this.maxTextures=rb(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}=Fs,s=this.size/4,i=Math.floor(s/this.maxTextures)+1;for(;t.length<s;)t.push(new Fl);for(;e.length<i;)e.push(new Nl);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=Fs._textureArrayPool,i=this.renderer.batch,n=this._tempBoundTextures,o=this.renderer.textureGC.count;let h=++et._globalBatch,a=0,l=s[0],c=0;i.copyBoundTextures(n,e);for(let d=0;d<this._bufferSize;++d){const u=t[d];t[d]=null,u._batchEnabled!==h&&(l.count>=e&&(i.boundArray(l,n,h,e),this.buildDrawCalls(l,c,d),c=d,l=s[++a],++h),u._batchEnabled=h,u.touched=o,l.elements[l.count++]=u)}l.count>0&&(i.boundArray(l,n,h,e),this.buildDrawCalls(l,c,this._bufferSize),++a,++h);for(let d=0;d<n.length;d++)n[d]=null;et._globalBatch=h}buildDrawCalls(t,e,s){const{_bufferedElements:i,_attributeBuffer:n,_indexBuffer:o,vertexSize:h}=this,a=Fs._drawCallPool;let l=this._dcIndex,c=this._aIndex,d=this._iIndex,u=a[l];u.start=this._iIndex,u.texArray=t;for(let f=e;f<s;++f){const p=i[f],m=p._texture.baseTexture,g=Zf[m.alphaMode?1:0][p.blendMode];i[f]=null,e<f&&u.blend!==g&&(u.size=d-u.start,e=f,u=a[++l],u.texArray=t,u.start=d),this.packInterleavedGeometry(p,n,o,c,d),c+=p.vertexData.length/2*h,d+=p.indices.length,u.blend=g}e<s&&(u.size=d-u.start,++l),this._dcIndex=l,this._aIndex=c,this._iIndex=d}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;Fs.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,i=Fs._drawCallPool;let n=null;for(let o=0;o<t;o++){const{texArray:h,type:a,size:l,start:c,blend:d}=i[o];n!==h&&(n=h,this.bindAndClearTexArray(h)),this.state.blendMode=d,s.set(this.state),e.drawElements(a,l,e.UNSIGNED_SHORT,c*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),Fs.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=no(Math.ceil(t/8)),s=ep(e),i=e*8;this._aBuffers.length<=s&&(this._iBuffers.length=s+1);let n=this._aBuffers[i];return n||(this._aBuffers[i]=n=new El(i*this.vertexSize*4)),n}getIndexBuffer(t){const e=no(Math.ceil(t/12)),s=ep(e),i=e*12;this._iBuffers.length<=s&&(this._iBuffers.length=s+1);let n=this._iBuffers[s];return n||(this._iBuffers[s]=n=new Uint16Array(i)),n}packInterleavedGeometry(t,e,s,i,n){const{uint32View:o,float32View:h}=e,a=i/this.vertexSize,l=t.uvs,c=t.indices,d=t.vertexData,u=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<d.length;m+=2)h[i++]=d[m],h[i++]=d[m+1],h[i++]=l[m],h[i++]=l[m+1],o[i++]=p,h[i++]=u;for(let m=0;m<c.length;m++)s[n++]=a+c[m]}};ra.defaultBatchSize=4096,ra.extension={name:"batch",type:Y.RendererPlugin},ra._drawCallPool=[],ra._textureArrayPool=[];let vr=ra;Z.add(vr);var Rb=`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
|
-
`,
|
|
352
|
+
`,Mb=`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 Uh=class In extends oi{constructor(t,e,i){const r=Ri.from(t||In.defaultVertexSrc,e||In.defaultFragmentSrc);super(r,i),this.padding=0,this.resolution=In.defaultResolution,this.multisample=In.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new ni}apply(t,e,i,r,n){t.applyFilter(this,e,i,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 Yx}static get defaultFragmentSrc(){return zx}};Uh.defaultResolution=1,Uh.defaultMultisample=Ht.NONE;let Yt=Uh;class ma{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new pt(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;const{backgroundColor:e,background:i,backgroundAlpha:r}=t,n=i??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(){}}ma.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},ma.extension={type:[G.RendererSystem,G.CanvasRendererSystem],name:"background"},z.add(ma);class tf{constructor(t){this.renderer=t,this.emptyRenderer=new pa(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:i}=this.renderer.texture;for(let r=e-1;r>=0;--r)t[r]=i[r]||null,t[r]&&(t[r]._batchLocation=r)}boundArray(t,e,i,r){const{elements:n,ids:a,count:o}=t;let h=0;for(let l=0;l<o;l++){const c=n[l],d=c._batchLocation;if(d>=0&&d<r&&e[d]===c){a[l]=d;continue}for(;h<r;){const u=e[h];if(u&&u._batchEnabled===i&&u._batchLocation===h){h++;continue}a[l]=h,c._batchLocation=h,e[h]=c;break}}}destroy(){this.renderer=null}}tf.extension={type:G.RendererSystem,name:"batch"},z.add(tf);let ef=0;class _a{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=ef++}init(t){if(t.context)this.initFromContext(t.context);else{const e=this.renderer.background.alpha<1,i=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:i,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=ef++,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 i;if(H.PREFER_ENV>=qe.WEBGL2&&(i=t.getContext("webgl2",e)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl}getExtensions(){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(),i="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const r=i||!!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")}}_a.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},_a.extension={type:G.RendererSystem,name:"context"},z.add(_a);class Gh{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 He("disposeFramebuffer"),this.multisample=Ht.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new J(null,{scaleMode:Ti.NEAREST,resolution:1,mipmap:Ke.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new J(null,{scaleMode:Ti.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Ke.OFF,format:O.DEPTH_COMPONENT,type:Z.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let i=0;i<this.colorTextures.length;i++){const r=this.colorTextures[i],n=r.resolution;r.setSize(t/n,e/n)}if(this.depthTexture){const i=this.depthTexture.resolution;this.depthTexture.setSize(t/i,e/i)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}}class sf extends J{constructor(t={}){if(typeof t=="number"){const e=arguments[0],i=arguments[1],r=arguments[2],n=arguments[3];t={width:e,height:i,scaleMode:r,resolution:n}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=Ht.NONE),super(null,t),this.mipmap=Ke.OFF,this.valid=!0,this._clear=new pt([0,0,0,0]),this.framebuffer=new Gh(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 Ii extends Jr{constructor(t){const e=t,i=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,r=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(i,r),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,i){i===void 0&&!e.startsWith("data:")?t.crossOrigin=gx(e):i!==!1&&(t.crossOrigin=typeof i=="string"?i:"anonymous")}upload(t,e,i,r){const n=t.gl,a=e.realWidth,o=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===he.UNPACK),!this.noSubImage&&e.target===n.TEXTURE_2D&&i.width===a&&i.height===o?n.texSubImage2D(n.TEXTURE_2D,0,0,0,e.format,i.type,r):(i.width=a,i.height=o,n.texImage2D(e.target,0,i.internalFormat,e.format,i.type,r)),!0}update(){if(this.destroyed)return;const t=this.source,e=t.naturalWidth||t.videoWidth||t.width,i=t.naturalHeight||t.videoHeight||t.height;this.resize(e,i),super.update()}dispose(){this.source=null}}class rf extends Ii{constructor(t,e){if(e=e||{},typeof t=="string"){const i=new Image;Ii.crossOrigin(i,t,e.crossorigin),i.src=t,t=i}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??H.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,i)=>{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=>{i(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,i=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:i?"cors":"no-cors"}).then(r=>r.blob()).then(r=>e(r,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===he.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,i){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,i,this.bitmap),!this.preserveBitmap){let r=!0;const n=e._glTextures;for(const a in n){const o=n[a];if(o!==i&&o.dirtyId!==e.dirtyId){r=!1;break}}r&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}}class Hh{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,i){const r=e.width,n=e.height;if(i){const a=t.width/2/r,o=t.height/2/n,h=t.x/r+a,l=t.y/n+o;i=At.add(i,At.NW),this.x0=h+a*At.uX(i),this.y0=l+o*At.uY(i),i=At.add(i,2),this.x1=h+a*At.uX(i),this.y1=l+o*At.uY(i),i=At.add(i,2),this.x2=h+a*At.uX(i),this.y2=l+o*At.uY(i),i=At.add(i,2),this.x3=h+a*At.uX(i),this.y3=l+o*At.uY(i)}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}}Hh.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 nf=new Hh;function ga(s){s.destroy=function(){},s.on=function(){},s.once=function(){},s.emit=function(){}}class X extends Je{constructor(t,e,i,r,n,a,o){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new st(0,0,1,1)),t instanceof X&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=r,this.valid=!1,this.destroyed=!1,this._uvs=nf,this.uvMatrix=null,this.orig=i||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 tt(a.x,a.y):new tt(0,0),this.defaultBorders=o,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){const{resource:e}=this.baseTexture;e!=null&&e.url&&ri[e.url]&&X.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,X.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(),i=new X(this.baseTexture,!this.noFrame&&t,e,(r=this.trim)==null?void 0:r.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=t),i}updateUvs(){this._uvs===nf&&(this._uvs=new Hh),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=H.STRICT_TEXTURE_CACHE){const r=typeof t=="string";let n=null;if(r)n=t;else if(t instanceof J){if(!t.cacheId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${o}-${_s()}`,J.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${o}_${_s()}`}n=t._pixiId}let a=ri[n];if(r&&i&&!a)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!a&&!(t instanceof J)?(e.resolution||(e.resolution=Pi(t)),a=new X(new J(t,e)),a.baseTexture.cacheId=n,J.addToCache(a.baseTexture,n),X.addToCache(a,n)):!a&&t instanceof J&&(a=new X(t),X.addToCache(a,n)),a}static fromURL(t,e){const i=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),r=X.from(t,Object.assign({resourceOptions:i},e),!1),n=r.baseTexture.resource;return r.baseTexture.valid?Promise.resolve(r):n.load().then(()=>Promise.resolve(r))}static fromBuffer(t,e,i,r){return new X(J.fromBuffer(t,e,i,r))}static fromLoader(t,e,i,r){const n=new J(t,Object.assign({scaleMode:J.defaultOptions.scaleMode,resolution:Pi(e)},r)),{resource:a}=n;a instanceof rf&&(a.url=e);const o=new X(n);return i||(i=e),J.addToCache(o.baseTexture,i),X.addToCache(o,i),i!==e&&(J.addToCache(o.baseTexture,e),X.addToCache(o,e)),o.baseTexture.valid?Promise.resolve(o):new Promise(h=>{o.baseTexture.once("loaded",()=>h(o))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),ri[e]&&ri[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),ri[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=ri[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete ri[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)ri[t.textureCacheIds[e]]===t&&delete ri[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:i,width:r,height:n}=t,a=e+r>this.baseTexture.width,o=i+n>this.baseTexture.height;if(a||o){const h=a&&o?"and":"or",l=`X: ${e} + ${r} = ${e+r} > ${this.baseTexture.width}`,c=`Y: ${i} + ${n} = ${i+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${c}`)}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 X._EMPTY||(X._EMPTY=new X(new J),ga(X._EMPTY),ga(X._EMPTY.baseTexture)),X._EMPTY}static get WHITE(){if(!X._WHITE){const t=H.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),X._WHITE=new X(J.from(t)),ga(X._WHITE),ga(X._WHITE.baseTexture)}return X._WHITE}}class Ts extends X{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,i=!0){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,i&&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 Ts(new sf(t))}}class af{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=Ht.NONE){const r=new sf(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new Ts(r)}getOptimalTexture(t,e,i=1,r=Ht.NONE){let n;t=Math.max(Math.ceil(t*i-1e-6),1),e=Math.max(Math.ceil(e*i-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=ea(t),e=ea(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(i),a}getFilterTexture(t,e,i){const r=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||Ht.NONE);return r.filterFrame=t.filterFrame,r}returnTexture(t){const e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(const e in this.texturePool){const i=this.texturePool[e];if(i)for(let r=0;r<i.length;r++)i[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 i=this.texturePool[e];if(i)for(let r=0;r<i.length;r++)i[r].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}}af.SCREEN_KEY=-1;class jx extends Xi{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class of extends Xi{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new Nt(this.vertices),this.uvBuffer=new Nt(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let i=0,r=0;return this.uvs[0]=i,this.uvs[1]=r,this.uvs[2]=i+e.width/t.width,this.uvs[3]=r,this.uvs[4]=i+e.width/t.width,this.uvs[5]=r+e.height/t.height,this.uvs[6]=i,this.uvs[7]=r+e.height/t.height,i=e.x,r=e.y,this.vertices[0]=i,this.vertices[1]=r,this.vertices[2]=i+e.width,this.vertices[3]=r,this.vertices[4]=i+e.width,this.vertices[5]=r+e.height,this.vertices[6]=i,this.vertices[7]=r+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class qx{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Ht.NONE,this.sourceFrame=new st,this.destinationFrame=new st,this.bindingSourceFrame=new st,this.bindingDestinationFrame=new st,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const ya=[new tt,new tt,new tt,new tt],Vh=new gt;class hf{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new af,this.statePool=[],this.quad=new jx,this.quadUv=new of,this.tempRect=new st,this.activeState={},this.globalUniforms=new Ve({outputFrame:new st,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 i=this.renderer,r=this.defaultFilterStack,n=this.statePool.pop()||new qx,a=i.renderTexture;let o,h;if(a.current){const _=a.current;o=_.resolution,h=_.multisample}else o=i.resolution,h=i.multisample;let l=e[0].resolution||o,c=e[0].multisample??h,d=e[0].padding,u=e[0].autoFit,f=e[0].legacy??!0;for(let _=1;_<e.length;_++){const y=e[_];l=Math.min(l,y.resolution||o),c=Math.min(c,y.multisample??h),d=this.useMaxPadding?Math.max(d,y.padding):d+y.padding,u=u&&y.autoFit,f=f||(y.legacy??!0)}r.length===1&&(this.defaultFilterStack[0].renderTexture=a.current),r.push(n),n.resolution=l,n.multisample=c,n.legacy=f,n.target=t,n.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),n.sourceFrame.pad(d);const p=this.tempRect.copyFrom(a.sourceFrame);i.projection.transform&&this.transformAABB(Vh.copyFrom(i.projection.transform).invert(),p),u?(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:i.resolution,a.sourceFrame,a.destinationFrame,i.projection.transform),n.renderTexture=this.getOptimalFilterTexture(n.sourceFrame.width,n.sourceFrame.height,l,c),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=i.projection.transform,i.projection.transform=null,a.bind(n.renderTexture,n.sourceFrame,m),i.framebuffer.clear(0,0,0,0)}pop(){const t=this.defaultFilterStack,e=t.pop(),i=e.filters;this.activeState=e;const r=this.globalUniforms.uniforms;r.outputFrame=e.sourceFrame,r.resolution=e.resolution;const n=r.inputSize,a=r.inputPixel,o=r.inputClamp;if(n[0]=e.destinationFrame.width,n[1]=e.destinationFrame.height,n[2]=1/n[0],n[3]=1/n[1],a[0]=Math.round(n[0]*e.resolution),a[1]=Math.round(n[1]*e.resolution),a[2]=1/a[0],a[3]=1/a[1],o[0]=.5*a[2],o[1]=.5*a[3],o[2]=e.sourceFrame.width*n[2]-.5*a[2],o[3]=e.sourceFrame.height*n[3]-.5*a[3],e.legacy){const l=r.filterArea;l[0]=e.destinationFrame.width,l[1]=e.destinationFrame.height,l[2]=e.sourceFrame.x,l[3]=e.sourceFrame.y,r.filterClamp=r.inputClamp}this.globalUniforms.update();const h=t[t.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,e.renderTexture,h.renderTexture,Ze.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let l=e.renderTexture,c=this.getOptimalFilterTexture(l.width,l.height,e.resolution);c.filterFrame=l.filterFrame;let d=0;for(d=0;d<i.length-1;++d){d===1&&e.multisample>1&&(c=this.getOptimalFilterTexture(l.width,l.height,e.resolution),c.filterFrame=l.filterFrame),i[d].apply(this,l,c,Ze.CLEAR,e);const u=l;l=c,c=u}i[d].apply(this,l,h.renderTexture,Ze.BLEND,e),d>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(c)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Ze.CLEAR){const{renderTexture:i,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,i.bind(t,t.filterFrame,a)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const n=r.stateId&1||this.forceClear;(e===Ze.CLEAR||e===Ze.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,i,r){const n=this.renderer;n.state.set(t.state),this.bindAndClear(i,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(Ue.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(Ue.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:i,destinationFrame:r}=this.activeState,{orig:n}=e._texture,a=t.set(r.width,0,0,r.height,i.x,i.y),o=e.worldTransform.copyTo(gt.TEMP_MATRIX);return o.invert(),a.prepend(o),a.scale(1/n.width,1/n.height),a.translate(e.anchor.x,e.anchor.y),a}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,i=1,r=Ht.NONE){return this.texturePool.getOptimalTexture(t,e,i,r)}getFilterTexture(t,e,i){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,i||Ht.NONE);return r.filterFrame=t.filterFrame,r}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const i=ya[0],r=ya[1],n=ya[2],a=ya[3];i.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(i,i),t.apply(r,r),t.apply(n,n),t.apply(a,a);const o=Math.min(i.x,r.x,n.x,a.x),h=Math.min(i.y,r.y,n.y,a.y),l=Math.max(i.x,r.x,n.x,a.x),c=Math.max(i.y,r.y,n.y,a.y);e.x=o,e.y=h,e.width=l-o,e.height=c-h}roundFrame(t,e,i,r,n){if(!(t.width<=0||t.height<=0||i.width<=0||i.height<=0)){if(n){const{a,b:o,c:h,d:l}=n;if((Math.abs(o)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(a)>1e-4||Math.abs(l)>1e-4))return}n=n?Vh.copyFrom(n):Vh.identity(),n.translate(-i.x,-i.y).scale(r.width/i.width,r.height/i.height).translate(r.x,r.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}}}hf.extension={type:G.RendererSystem,name:"filter"},z.add(hf);class Kx{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Ht.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const Zx=new st;class lf{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Gh(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 st,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;H.PREFER_ENV===qe.WEBGL_LEGACY&&(e=null,i=null),e?t.drawBuffers=r=>e.drawBuffersWEBGL(r):(this.hasMRT=!1,t.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,i=0){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!==i&&(t.dirtyId++,t.dirtyFormat++,n.mipLevel=i),n.dirtyId!==t.dirtyId&&(n.dirtyId=t.dirtyId,n.dirtyFormat!==t.dirtyFormat?(n.dirtyFormat=t.dirtyFormat,n.dirtySize=t.dirtySize,this.updateFramebuffer(t,i)):n.dirtySize!==t.dirtySize&&(n.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let a=0;a<t.colorTextures.length;a++){const o=t.colorTextures[a];this.renderer.texture.unbind(o.parentTextureArray||o)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){const a=e.width>>i,o=e.height>>i,h=a/e.width;this.setViewport(e.x*h,e.y*h,a,o)}else{const a=t.width>>i,o=t.height>>i;this.setViewport(0,0,a,o)}}else this.current&&(this.current=null,r.bindFramebuffer(r.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,i,r){const n=this.viewport;t=Math.round(t),e=Math.round(e),i=Math.round(i),r=Math.round(r),(n.width!==i||n.height!==r||n.x!==t||n.y!==e)&&(n.x=t,n.y=e,n.width=i,n.height=r,this.gl.viewport(t,e,i,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,i,r,n=Eo.COLOR|Eo.DEPTH){const{gl:a}=this;a.clearColor(t,e,i,r),a.clear(n)}initFramebuffer(t){const{gl:e}=this,i=new Kx(e.createFramebuffer());return i.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(t),t.disposeRunner.add(this),i}resizeFramebuffer(t){const{gl:e}=this,i=t.glFramebuffers[this.CONTEXT_UID];if(i.stencil){e.bindRenderbuffer(e.RENDERBUFFER,i.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,i.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,a,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,a,t.width,t.height)}const r=t.colorTextures;let n=r.length;e.drawBuffers||(n=Math.min(n,1));for(let a=0;a<n;a++){const o=r[a],h=o.parentTextureArray||o;this.renderer.texture.bind(h,0),a===0&&i.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,i.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,h._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){const{gl:i}=this,r=t.glFramebuffers[this.CONTEXT_UID],n=t.colorTextures;let a=n.length;i.drawBuffers||(a=Math.min(a,1)),r.multisample>1&&this.canMultisampleFramebuffer(t)?r.msaaBuffer=r.msaaBuffer||i.createRenderbuffer():r.msaaBuffer&&(i.deleteRenderbuffer(r.msaaBuffer),r.msaaBuffer=null,r.blitFramebuffer&&(r.blitFramebuffer.dispose(),r.blitFramebuffer=null));const o=[];for(let h=0;h<a;h++){const l=n[h],c=l.parentTextureArray||l;this.renderer.texture.bind(c,0),h===0&&r.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,r.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,r.multisample,c._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,r.msaaBuffer)):(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+h,l.target,c._glTextures[this.CONTEXT_UID].texture,e),o.push(i.COLOR_ATTACHMENT0+h))}if(o.length>1&&i.drawBuffers(o),t.depthTexture&&this.writeDepthTexture){const h=t.depthTexture;this.renderer.texture.bind(h,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){r.stencil=r.stencil||i.createRenderbuffer();let h,l;this.renderer.context.webGLVersion===1?(h=i.DEPTH_STENCIL_ATTACHMENT,l=i.DEPTH_STENCIL):t.depth&&t.stencil?(h=i.DEPTH_STENCIL_ATTACHMENT,l=i.DEPTH24_STENCIL8):t.depth?(h=i.DEPTH_ATTACHMENT,l=i.DEPTH_COMPONENT24):(h=i.STENCIL_ATTACHMENT,l=i.STENCIL_INDEX8),i.bindRenderbuffer(i.RENDERBUFFER,r.stencil),r.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,r.multisample,l,t.width,t.height):i.renderbufferStorage(i.RENDERBUFFER,l,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,h,i.RENDERBUFFER,r.stencil)}else r.stencil&&(i.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 i=Ht.NONE;if(t<=1||e===null)return i;for(let r=0;r<e.length;r++)if(e[r]<=t){i=e[r];break}return i===1&&(i=Ht.NONE),i}blit(t,e,i){const{current:r,renderer:n,gl:a,CONTEXT_UID:o}=this;if(n.context.webGLVersion!==2||!r)return;const h=r.glFramebuffers[o];if(!h)return;if(!t){if(!h.msaaBuffer)return;const c=r.colorTextures[0];if(!c)return;h.blitFramebuffer||(h.blitFramebuffer=new Gh(r.width,r.height),h.blitFramebuffer.addColorTexture(0,c)),t=h.blitFramebuffer,t.colorTextures[0]!==c&&(t.colorTextures[0]=c,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=Zx,e.width=r.width,e.height=r.height),i||(i=e);const l=e.width===i.width&&e.height===i.height;this.bind(t),a.bindFramebuffer(a.READ_FRAMEBUFFER,h.framebuffer),a.blitFramebuffer(e.left,e.top,e.right,e.bottom,i.left,i.top,i.right,i.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 i=t.glFramebuffers[this.CONTEXT_UID],r=this.gl;if(!i)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(i.framebuffer),i.msaaBuffer&&r.deleteRenderbuffer(i.msaaBuffer),i.stencil&&r.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,e)}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;i<e.length;i++)this.disposeFramebuffer(e[i],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 i=t.width,r=t.height,n=this.gl,a=e.stencil=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,a);let o,h;this.renderer.context.webGLVersion===1?(o=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH_STENCIL):t.depth?(o=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH24_STENCIL8):(o=n.STENCIL_ATTACHMENT,h=n.STENCIL_INDEX8),e.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,e.multisample,h,i,r):n.renderbufferStorage(n.RENDERBUFFER,h,i,r),n.framebufferRenderbuffer(n.FRAMEBUFFER,o,n.RENDERBUFFER,a)}reset(){this.current=this.unknownFramebuffer,this.viewport=new st}destroy(){this.renderer=null}}lf.extension={type:G.RendererSystem,name:"framebuffer"},z.add(lf);const Wh={5126:4,5123:2,5121:1};class cf{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 i=this.renderer.context.extensions.vertexArrayObject;H.PREFER_ENV===qe.WEBGL_LEGACY&&(i=null),i?(t.createVertexArray=()=>i.createVertexArrayOES(),t.bindVertexArray=r=>i.bindVertexArrayOES(r),t.deleteVertexArray=r=>i.deleteVertexArrayOES(r)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){const i=t.getExtension("ANGLE_instanced_arrays");i?(t.vertexAttribDivisor=(r,n)=>i.vertexAttribDivisorANGLE(r,n),t.drawElementsInstanced=(r,n,a,o,h)=>i.drawElementsInstancedANGLE(r,n,a,o,h),t.drawArraysInstanced=(r,n,a,o)=>i.drawArraysInstancedANGLE(r,n,a,o)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;const{gl:i}=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?i.bindVertexArray(a):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let i=0;i<t.buffers.length;i++){const r=t.buffers[i];e.update(r)}}checkCompatibility(t,e){const i=t.attributes,r=e.attributeData;for(const n in r)if(!i[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(t,e){const i=t.attributes,r=e.attributeData,n=["g",t.id];for(const a in i)r[a]&&n.push(a,r[a].location);return n.join("-")}initGeometryVao(t,e,i=!0){const r=this.gl,n=this.CONTEXT_UID,a=this.renderer.buffer,o=e.program;o.glPrograms[n]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,o);const h=this.getSignature(t,o),l=t.glVertexArrayObjects[this.CONTEXT_UID];let c=l[h];if(c)return l[o.id]=c,c;const d=t.buffers,u=t.attributes,f={},p={};for(const m in d)f[m]=0,p[m]=0;for(const m in u)!u[m].size&&o.attributeData[m]?u[m].size=o.attributeData[m].size:u[m].size||console.warn(`PIXI Geometry attribute '${m}' size cannot be determined (likely the bound shader does not have the attribute)`),f[u[m].buffer]+=u[m].size*Wh[u[m].type];for(const m in u){const _=u[m],y=_.size;_.stride===void 0&&(f[_.buffer]===y*Wh[_.type]?_.stride=0:_.stride=f[_.buffer]),_.start===void 0&&(_.start=p[_.buffer],p[_.buffer]+=y*Wh[_.type])}c=r.createVertexArray(),r.bindVertexArray(c);for(let m=0;m<d.length;m++){const _=d[m];a.bind(_),i&&_._glBuffers[n].refCount++}return this.activateVao(t,o),l[o.id]=c,l[h]=c,r.bindVertexArray(null),a.unbind(Qe.ARRAY_BUFFER),c}disposeGeometry(t,e){var o;if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];const i=t.glVertexArrayObjects[this.CONTEXT_UID],r=this.gl,n=t.buffers,a=(o=this.renderer)==null?void 0:o.buffer;if(t.disposeRunner.remove(this),!!i){if(a)for(let h=0;h<n.length;h++){const l=n[h]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&a.dispose(n[h],e))}if(!e){for(const h in i)if(h[0]==="g"){const l=i[h];this._activeVao===l&&this.unbind(),r.deleteVertexArray(l)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){const e=Object.keys(this.managedGeometries);for(let i=0;i<e.length;i++)this.disposeGeometry(this.managedGeometries[e[i]],t)}activateVao(t,e){const i=this.gl,r=this.CONTEXT_UID,n=this.renderer.buffer,a=t.buffers,o=t.attributes;t.indexBuffer&&n.bind(t.indexBuffer);let h=null;for(const l in o){const c=o[l],d=a[c.buffer],u=d._glBuffers[r];if(e.attributeData[l]){h!==u&&(n.bind(d),h=u);const f=e.attributeData[l].location;if(i.enableVertexAttribArray(f),i.vertexAttribPointer(f,c.size,c.type||i.FLOAT,c.normalized,c.stride,c.start),c.instance)if(this.hasInstance)i.vertexAttribDivisor(f,c.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,i,r){const{gl:n}=this,a=this._activeGeometry;if(a.indexBuffer){const o=a.indexBuffer.data.BYTES_PER_ELEMENT,h=o===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;o===2||o===4&&this.canUseUInt32ElementIndex?a.instanced?n.drawElementsInstanced(t,e||a.indexBuffer.data.length,h,(i||0)*o,r||1):n.drawElements(t,e||a.indexBuffer.data.length,h,(i||0)*o):console.warn("unsupported index buffer type: uint32")}else a.instanced?n.drawArraysInstanced(t,i,e||a.getSize(),r||1):n.drawArrays(t,i,e||a.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}cf.extension={type:G.RendererSystem,name:"geometry"},z.add(cf);const uf=new gt;class df{constructor(t,e){this._texture=t,this.mapCoord=new gt,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 i=this.mapCoord;for(let r=0;r<t.length;r+=2){const n=t[r],a=t[r+1];e[r]=n*i.a+a*i.c+i.tx,e[r+1]=n*i.b+a*i.d+i.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 i=e._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);const r=e.orig,n=e.trim;n&&(uf.set(r.width/n.width,0,0,r.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(uf));const a=e.baseTexture,o=this.uClampFrame,h=this.clampMargin/a.resolution,l=this.clampOffset;return o[0]=(e._frame.x+h+l)/a.width,o[1]=(e._frame.y+h+l)/a.height,o[2]=(e._frame.x+e._frame.width-h+l)/a.width,o[3]=(e._frame.y+e._frame.height-h+l)/a.height,this.uClampOffset[0]=l/a.realWidth,this.uClampOffset[1]=l/a.realHeight,this.isSimple=e._frame.width===a.width&&e._frame.height===a.height&&e.rotate===0,!0}}var Qx=`varying vec2 vMaskCoord;
|
|
378
|
+
`;const Ul=class Ba extends js{constructor(t,e,s){const i=_i.from(t||Ba.defaultVertexSrc,e||Ba.defaultFragmentSrc);super(i,s),this.padding=0,this.resolution=Ba.defaultResolution,this.multisample=Ba.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Ws}apply(t,e,s,i,n){t.applyFilter(this,e,s,i)}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 Mb}static get defaultFragmentSrc(){return Rb}};Ul.defaultResolution=1,Ul.defaultMultisample=ie.NONE;let pe=Ul;class vo{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Ct(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;const{backgroundColor:e,background:s,backgroundAlpha:i}=t,n=s??e;n!==void 0&&(this.color=n),this.alpha=i}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(){}}vo.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},vo.extension={type:[Y.RendererSystem,Y.CanvasRendererSystem],name:"background"},Z.add(vo);class yp{constructor(t){this.renderer=t,this.emptyRenderer=new yo(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 i=e-1;i>=0;--i)t[i]=s[i]||null,t[i]&&(t[i]._batchLocation=i)}boundArray(t,e,s,i){const{elements:n,ids:o,count:h}=t;let a=0;for(let l=0;l<h;l++){const c=n[l],d=c._batchLocation;if(d>=0&&d<i&&e[d]===c){o[l]=d;continue}for(;a<i;){const u=e[a];if(u&&u._batchEnabled===s&&u._batchLocation===a){a++;continue}o[l]=a,c._batchLocation=a,e[a]=c;break}}}destroy(){this.renderer=null}}yp.extension={type:Y.RendererSystem,name:"batch"},Z.add(yp);let vp=0;class bo{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=vp++}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=vp++,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>=Ls.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 i=s||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=i,i||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}bo.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},bo.extension={type:Y.RendererSystem,name:"context"},Z.add(bo);class Vl{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 bs("disposeFramebuffer"),this.multisample=ie.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:ys.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:ys.OFF,format:X.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 i=this.colorTextures[s],n=i.resolution;i.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 bp extends et{constructor(t={}){if(typeof t=="number"){const e=arguments[0],s=arguments[1],i=arguments[2],n=arguments[3];t={width:e,height:s,scaleMode:i,resolution:n}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=ie.NONE),super(null,t),this.mipmap=ys.OFF,this.valid=!0,this._clear=new Ct([0,0,0,0]),this.framebuffer=new Vl(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 xi extends sa{constructor(t){const e=t,s=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,i=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(s,i),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,s){s===void 0&&!e.startsWith("data:")?t.crossOrigin=eb(e):s!==!1&&(t.crossOrigin=typeof s=="string"?s:"anonymous")}upload(t,e,s,i){const n=t.gl,o=e.realWidth,h=e.realHeight;if(i=i||this.source,typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement){if(!i.complete||i.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&i instanceof HTMLVideoElement&&i.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===o&&s.height===h?n.texSubImage2D(n.TEXTURE_2D,0,0,0,e.format,s.type,i):(s.width=o,s.height=h,n.texImage2D(e.target,0,s.internalFormat,e.format,s.type,i)),!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 wp extends xi{constructor(t,e){if(e=e||{},typeof t=="string"){const s=new Image;xi.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 i=this.source;this.url=i.src;const n=()=>{this.destroyed||(i.onload=null,i.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};i.complete&&i.src?n():(i.onload=n,i.onerror=o=>{s(o),this.onError.emit(o)})}),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(i=>i.blob()).then(i=>e(i,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Re.UNPACK?"premultiply":"none"})).then(i=>this.destroyed?Promise.reject():(this.bitmap=i,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 i=!0;const n=e._glTextures;for(const o in n){const h=n[o];if(h!==s&&h.dirtyId!==e.dirtyId){i=!1;break}}i&&(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 Xl{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 i=e.width,n=e.height;if(s){const o=t.width/2/i,h=t.height/2/n,a=t.x/i+o,l=t.y/n+h;s=Nt.add(s,Nt.NW),this.x0=a+o*Nt.uX(s),this.y0=l+h*Nt.uY(s),s=Nt.add(s,2),this.x1=a+o*Nt.uX(s),this.y1=l+h*Nt.uY(s),s=Nt.add(s,2),this.x2=a+o*Nt.uX(s),this.y2=l+h*Nt.uY(s),s=Nt.add(s,2),this.x3=a+o*Nt.uX(s),this.y3=l+h*Nt.uY(s)}else this.x0=t.x/i,this.y0=t.y/n,this.x1=(t.x+t.width)/i,this.y1=t.y/n,this.x2=(t.x+t.width)/i,this.y2=(t.y+t.height)/n,this.x3=t.x/i,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}}Xl.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 Ep=new Xl;function wo(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}class q extends Vs{constructor(t,e,s,i,n,o,h){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new it(0,0,1,1)),t instanceof q&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=i,this.valid=!1,this.destroyed=!1,this._uvs=Ep,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=o?new st(o.x,o.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&&Hs[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 i;const t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),s=new q(this.baseTexture,!this.noFrame&&t,e,(i=this.trim)==null?void 0:i.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(s._frame=t),s}updateUvs(){this._uvs===Ep&&(this._uvs=new Xl),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},s=z.STRICT_TEXTURE_CACHE){const i=typeof t=="string";let n=null;if(i)n=t;else if(t instanceof et){if(!t.cacheId){const h=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${h}-${mr()}`,et.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const h=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${h}_${mr()}`}n=t._pixiId}let o=Hs[n];if(i&&s&&!o)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!o&&!(t instanceof et)?(e.resolution||(e.resolution=gi(t)),o=new q(new et(t,e)),o.baseTexture.cacheId=n,et.addToCache(o.baseTexture,n),q.addToCache(o,n)):!o&&t instanceof et&&(o=new q(t),q.addToCache(o,n)),o}static fromURL(t,e){const s=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),i=q.from(t,Object.assign({resourceOptions:s},e),!1),n=i.baseTexture.resource;return i.baseTexture.valid?Promise.resolve(i):n.load().then(()=>Promise.resolve(i))}static fromBuffer(t,e,s,i){return new q(et.fromBuffer(t,e,s,i))}static fromLoader(t,e,s,i){const n=new et(t,Object.assign({scaleMode:et.defaultOptions.scaleMode,resolution:gi(e)},i)),{resource:o}=n;o instanceof wp&&(o.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(a=>{h.baseTexture.once("loaded",()=>a(h))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Hs[e]&&Hs[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),Hs[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Hs[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete Hs[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)Hs[t.textureCacheIds[e]]===t&&delete Hs[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:i,height:n}=t,o=e+i>this.baseTexture.width,h=s+n>this.baseTexture.height;if(o||h){const a=o&&h?"and":"or",l=`X: ${e} + ${i} = ${e+i} > ${this.baseTexture.width}`,c=`Y: ${s} + ${n} = ${s+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${a} ${c}`)}this.valid=i&&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),wo(q._EMPTY),wo(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)),wo(q._WHITE),wo(q._WHITE.baseTexture)}return q._WHITE}}class br 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 i=this.baseTexture.resolution,n=Math.round(t*i)/i,o=Math.round(e*i)/i;this.valid=n>0&&o>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=o,s&&this.baseTexture.resize(n,o),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 br(new bp(t))}}class Tp{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,s=ie.NONE){const i=new bp(Object.assign({width:t,height:e,resolution:1,multisample:s},this.textureOptions));return new br(i)}getOptimalTexture(t,e,s=1,i=ie.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=no(t),e=no(e),n=((t&65535)<<16|e&65535)>>>0,i>1&&(n+=i*4294967296)):n=i>1?-i:-1,this.texturePool[n]||(this.texturePool[n]=[]);let o=this.texturePool[n].pop();return o||(o=this.createTexture(t,e,i)),o.filterPoolKey=n,o.setResolution(s),o}getFilterTexture(t,e,s){const i=this.getOptimalTexture(t.width,t.height,e||t.resolution,s||ie.NONE);return i.filterFrame=t.filterFrame,i}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 i=0;i<s.length;i++)s[i].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 i=0;i<s.length;i++)s[i].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}}Tp.SCREEN_KEY=-1;class Fb extends Oi{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class Ap extends Oi{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,i=0;return this.uvs[0]=s,this.uvs[1]=i,this.uvs[2]=s+e.width/t.width,this.uvs[3]=i,this.uvs[4]=s+e.width/t.width,this.uvs[5]=i+e.height/t.height,this.uvs[6]=s,this.uvs[7]=i+e.height/t.height,s=e.x,i=e.y,this.vertices[0]=s,this.vertices[1]=i,this.vertices[2]=s+e.width,this.vertices[3]=i,this.vertices[4]=s+e.width,this.vertices[5]=i+e.height,this.vertices[6]=s,this.vertices[7]=i+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class kb{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=ie.NONE,this.sourceFrame=new it,this.destinationFrame=new it,this.bindingSourceFrame=new it,this.bindingDestinationFrame=new it,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const Eo=[new st,new st,new st,new st],Gl=new Rt;class Sp{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new Tp,this.statePool=[],this.quad=new Fb,this.quadUv=new Ap,this.tempRect=new it,this.activeState={},this.globalUniforms=new ws({outputFrame:new it,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,i=this.defaultFilterStack,n=this.statePool.pop()||new kb,o=s.renderTexture;let h,a;if(o.current){const g=o.current;h=g.resolution,a=g.multisample}else h=s.resolution,a=s.multisample;let l=e[0].resolution||h,c=e[0].multisample??a,d=e[0].padding,u=e[0].autoFit,f=e[0].legacy??!0;for(let g=1;g<e.length;g++){const y=e[g];l=Math.min(l,y.resolution||h),c=Math.min(c,y.multisample??a),d=this.useMaxPadding?Math.max(d,y.padding):d+y.padding,u=u&&y.autoFit,f=f||(y.legacy??!0)}i.length===1&&(this.defaultFilterStack[0].renderTexture=o.current),i.push(n),n.resolution=l,n.multisample=c,n.legacy=f,n.target=t,n.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),n.sourceFrame.pad(d);const p=this.tempRect.copyFrom(o.sourceFrame);s.projection.transform&&this.transformAABB(Gl.copyFrom(s.projection.transform).invert(),p),u?(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,o.current?o.current.resolution:s.resolution,o.sourceFrame,o.destinationFrame,s.projection.transform),n.renderTexture=this.getOptimalFilterTexture(n.sourceFrame.width,n.sourceFrame.height,l,c),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(o.sourceFrame),n.bindingDestinationFrame.copyFrom(o.destinationFrame),n.transform=s.projection.transform,s.projection.transform=null,o.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 i=this.globalUniforms.uniforms;i.outputFrame=e.sourceFrame,i.resolution=e.resolution;const n=i.inputSize,o=i.inputPixel,h=i.inputClamp;if(n[0]=e.destinationFrame.width,n[1]=e.destinationFrame.height,n[2]=1/n[0],n[3]=1/n[1],o[0]=Math.round(n[0]*e.resolution),o[1]=Math.round(n[1]*e.resolution),o[2]=1/o[0],o[3]=1/o[1],h[0]=.5*o[2],h[1]=.5*o[3],h[2]=e.sourceFrame.width*n[2]-.5*o[2],h[3]=e.sourceFrame.height*n[3]-.5*o[3],e.legacy){const l=i.filterArea;l[0]=e.destinationFrame.width,l[1]=e.destinationFrame.height,l[2]=e.sourceFrame.x,l[3]=e.sourceFrame.y,i.filterClamp=i.inputClamp}this.globalUniforms.update();const a=t[t.length-1];if(this.renderer.framebuffer.blit(),s.length===1)s[0].apply(this,e.renderTexture,a.renderTexture,Ns.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let l=e.renderTexture,c=this.getOptimalFilterTexture(l.width,l.height,e.resolution);c.filterFrame=l.filterFrame;let d=0;for(d=0;d<s.length-1;++d){d===1&&e.multisample>1&&(c=this.getOptimalFilterTexture(l.width,l.height,e.resolution),c.filterFrame=l.filterFrame),s[d].apply(this,l,c,Ns.CLEAR,e);const u=l;l=c,c=u}s[d].apply(this,l,a.renderTexture,Ns.BLEND,e),d>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(c)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Ns.CLEAR){const{renderTexture:s,state:i}=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 o=this.tempRect;o.x=0,o.y=0,o.width=t.filterFrame.width,o.height=t.filterFrame.height,s.bind(t,t.filterFrame,o)}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=i.stateId&1||this.forceClear;(e===Ns.CLEAR||e===Ns.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,s,i){const n=this.renderer;n.state.set(t.state),this.bindAndClear(s,i),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:i}=this.activeState,{orig:n}=e._texture,o=t.set(i.width,0,0,i.height,s.x,s.y),h=e.worldTransform.copyTo(Rt.TEMP_MATRIX);return h.invert(),o.prepend(h),o.scale(1/n.width,1/n.height),o.translate(e.anchor.x,e.anchor.y),o}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,s=1,i=ie.NONE){return this.texturePool.getOptimalTexture(t,e,s,i)}getFilterTexture(t,e,s){if(typeof t=="number"){const n=t;t=e,e=n}t=t||this.activeState.renderTexture;const i=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,s||ie.NONE);return i.filterFrame=t.filterFrame,i}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const s=Eo[0],i=Eo[1],n=Eo[2],o=Eo[3];s.set(e.left,e.top),i.set(e.left,e.bottom),n.set(e.right,e.top),o.set(e.right,e.bottom),t.apply(s,s),t.apply(i,i),t.apply(n,n),t.apply(o,o);const h=Math.min(s.x,i.x,n.x,o.x),a=Math.min(s.y,i.y,n.y,o.y),l=Math.max(s.x,i.x,n.x,o.x),c=Math.max(s.y,i.y,n.y,o.y);e.x=h,e.y=a,e.width=l-h,e.height=c-a}roundFrame(t,e,s,i,n){if(!(t.width<=0||t.height<=0||s.width<=0||s.height<=0)){if(n){const{a:o,b:h,c:a,d:l}=n;if((Math.abs(h)>1e-4||Math.abs(a)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(l)>1e-4))return}n=n?Gl.copyFrom(n):Gl.identity(),n.translate(-s.x,-s.y).scale(i.width/s.width,i.height/s.height).translate(i.x,i.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}}}Sp.extension={type:Y.RendererSystem,name:"filter"},Z.add(Sp);class Bb{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=ie.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const Db=new it;class Cp{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Vl(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 it,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===Ls.WEBGL_LEGACY&&(e=null,s=null),e?t.drawBuffers=i=>e.drawBuffersWEBGL(i):(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:i}=this;if(t){const n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,i.bindFramebuffer(i.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 o=0;o<t.colorTextures.length;o++){const h=t.colorTextures[o];this.renderer.texture.unbind(h.parentTextureArray||h)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){const o=e.width>>s,h=e.height>>s,a=o/e.width;this.setViewport(e.x*a,e.y*a,o,h)}else{const o=t.width>>s,h=t.height>>s;this.setViewport(0,0,o,h)}}else this.current&&(this.current=null,i.bindFramebuffer(i.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,i){const n=this.viewport;t=Math.round(t),e=Math.round(e),s=Math.round(s),i=Math.round(i),(n.width!==s||n.height!==i||n.x!==t||n.y!==e)&&(n.x=t,n.y=e,n.width=s,n.height=i,this.gl.viewport(t,e,s,i))}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,i,n=Ch.COLOR|Ch.DEPTH){const{gl:o}=this;o.clearColor(t,e,s,i),o.clear(n)}initFramebuffer(t){const{gl:e}=this,s=new Bb(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 o;this.renderer.context.webGLVersion===1?o=e.DEPTH_STENCIL:t.depth&&t.stencil?o=e.DEPTH24_STENCIL8:t.depth?o=e.DEPTH_COMPONENT24:o=e.STENCIL_INDEX8,s.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,s.multisample,o,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,o,t.width,t.height)}const i=t.colorTextures;let n=i.length;e.drawBuffers||(n=Math.min(n,1));for(let o=0;o<n;o++){const h=i[o],a=h.parentTextureArray||h;this.renderer.texture.bind(a,0),o===0&&s.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,s.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,s.multisample,a._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,i=t.glFramebuffers[this.CONTEXT_UID],n=t.colorTextures;let o=n.length;s.drawBuffers||(o=Math.min(o,1)),i.multisample>1&&this.canMultisampleFramebuffer(t)?i.msaaBuffer=i.msaaBuffer||s.createRenderbuffer():i.msaaBuffer&&(s.deleteRenderbuffer(i.msaaBuffer),i.msaaBuffer=null,i.blitFramebuffer&&(i.blitFramebuffer.dispose(),i.blitFramebuffer=null));const h=[];for(let a=0;a<o;a++){const l=n[a],c=l.parentTextureArray||l;this.renderer.texture.bind(c,0),a===0&&i.msaaBuffer?(s.bindRenderbuffer(s.RENDERBUFFER,i.msaaBuffer),s.renderbufferStorageMultisample(s.RENDERBUFFER,i.multisample,c._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.RENDERBUFFER,i.msaaBuffer)):(s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+a,l.target,c._glTextures[this.CONTEXT_UID].texture,e),h.push(s.COLOR_ATTACHMENT0+a))}if(h.length>1&&s.drawBuffers(h),t.depthTexture&&this.writeDepthTexture){const a=t.depthTexture;this.renderer.texture.bind(a,0),s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,a._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){i.stencil=i.stencil||s.createRenderbuffer();let a,l;this.renderer.context.webGLVersion===1?(a=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH_STENCIL):t.depth&&t.stencil?(a=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH24_STENCIL8):t.depth?(a=s.DEPTH_ATTACHMENT,l=s.DEPTH_COMPONENT24):(a=s.STENCIL_ATTACHMENT,l=s.STENCIL_INDEX8),s.bindRenderbuffer(s.RENDERBUFFER,i.stencil),i.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,i.multisample,l,t.width,t.height):s.renderbufferStorage(s.RENDERBUFFER,l,t.width,t.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,a,s.RENDERBUFFER,i.stencil)}else i.stencil&&(s.deleteRenderbuffer(i.stencil),i.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let s=ie.NONE;if(t<=1||e===null)return s;for(let i=0;i<e.length;i++)if(e[i]<=t){s=e[i];break}return s===1&&(s=ie.NONE),s}blit(t,e,s){const{current:i,renderer:n,gl:o,CONTEXT_UID:h}=this;if(n.context.webGLVersion!==2||!i)return;const a=i.glFramebuffers[h];if(!a)return;if(!t){if(!a.msaaBuffer)return;const c=i.colorTextures[0];if(!c)return;a.blitFramebuffer||(a.blitFramebuffer=new Vl(i.width,i.height),a.blitFramebuffer.addColorTexture(0,c)),t=a.blitFramebuffer,t.colorTextures[0]!==c&&(t.colorTextures[0]=c,t.dirtyId++,t.dirtyFormat++),(t.width!==i.width||t.height!==i.height)&&(t.width=i.width,t.height=i.height,t.dirtyId++,t.dirtySize++)}e||(e=Db,e.width=i.width,e.height=i.height),s||(s=e);const l=e.width===s.width&&e.height===s.height;this.bind(t),o.bindFramebuffer(o.READ_FRAMEBUFFER,a.framebuffer),o.blitFramebuffer(e.left,e.top,e.right,e.bottom,s.left,s.top,s.right,s.bottom,o.COLOR_BUFFER_BIT,l?o.NEAREST:o.LINEAR),o.bindFramebuffer(o.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){const s=t.glFramebuffers[this.CONTEXT_UID],i=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||(i.deleteFramebuffer(s.framebuffer),s.msaaBuffer&&i.deleteRenderbuffer(s.msaaBuffer),s.stencil&&i.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,i=t.height,n=this.gl,o=e.stencil=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,o);let h,a;this.renderer.context.webGLVersion===1?(h=n.DEPTH_STENCIL_ATTACHMENT,a=n.DEPTH_STENCIL):t.depth?(h=n.DEPTH_STENCIL_ATTACHMENT,a=n.DEPTH24_STENCIL8):(h=n.STENCIL_ATTACHMENT,a=n.STENCIL_INDEX8),e.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,e.multisample,a,s,i):n.renderbufferStorage(n.RENDERBUFFER,a,s,i),n.framebufferRenderbuffer(n.FRAMEBUFFER,h,n.RENDERBUFFER,o)}reset(){this.current=this.unknownFramebuffer,this.viewport=new it}destroy(){this.renderer=null}}Cp.extension={type:Y.RendererSystem,name:"framebuffer"},Z.add(Cp);const $l={5126:4,5123:2,5121:1};class Ip{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===Ls.WEBGL_LEGACY&&(s=null),s?(t.createVertexArray=()=>s.createVertexArrayOES(),t.bindVertexArray=i=>s.bindVertexArrayOES(i),t.deleteVertexArray=i=>s.deleteVertexArrayOES(i)):(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=(i,n)=>s.vertexAttribDivisorANGLE(i,n),t.drawElementsInstanced=(i,n,o,h,a)=>s.drawElementsInstancedANGLE(i,n,o,h,a),t.drawArraysInstanced=(i,n,o,h)=>s.drawArraysInstancedANGLE(i,n,o,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 i=t.glVertexArrayObjects[this.CONTEXT_UID],n=!1;i||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=i={},n=!0);const o=i[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==o&&(this._activeVao=o,this.hasVao?s.bindVertexArray(o):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 i=t.buffers[s];e.update(i)}}checkCompatibility(t,e){const s=t.attributes,i=e.attributeData;for(const n in i)if(!s[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(t,e){const s=t.attributes,i=e.attributeData,n=["g",t.id];for(const o in s)i[o]&&n.push(o,i[o].location);return n.join("-")}initGeometryVao(t,e,s=!0){const i=this.gl,n=this.CONTEXT_UID,o=this.renderer.buffer,h=e.program;h.glPrograms[n]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,h);const a=this.getSignature(t,h),l=t.glVertexArrayObjects[this.CONTEXT_UID];let c=l[a];if(c)return l[h.id]=c,c;const d=t.buffers,u=t.attributes,f={},p={};for(const m in d)f[m]=0,p[m]=0;for(const m in u)!u[m].size&&h.attributeData[m]?u[m].size=h.attributeData[m].size:u[m].size||console.warn(`PIXI Geometry attribute '${m}' size cannot be determined (likely the bound shader does not have the attribute)`),f[u[m].buffer]+=u[m].size*$l[u[m].type];for(const m in u){const g=u[m],y=g.size;g.stride===void 0&&(f[g.buffer]===y*$l[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=p[g.buffer],p[g.buffer]+=y*$l[g.type])}c=i.createVertexArray(),i.bindVertexArray(c);for(let m=0;m<d.length;m++){const g=d[m];o.bind(g),s&&g._glBuffers[n].refCount++}return this.activateVao(t,h),l[h.id]=c,l[a]=c,i.bindVertexArray(null),o.unbind(Us.ARRAY_BUFFER),c}disposeGeometry(t,e){var h;if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];const s=t.glVertexArrayObjects[this.CONTEXT_UID],i=this.gl,n=t.buffers,o=(h=this.renderer)==null?void 0:h.buffer;if(t.disposeRunner.remove(this),!!s){if(o)for(let a=0;a<n.length;a++){const l=n[a]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&o.dispose(n[a],e))}if(!e){for(const a in s)if(a[0]==="g"){const l=s[a];this._activeVao===l&&this.unbind(),i.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,i=this.CONTEXT_UID,n=this.renderer.buffer,o=t.buffers,h=t.attributes;t.indexBuffer&&n.bind(t.indexBuffer);let a=null;for(const l in h){const c=h[l],d=o[c.buffer],u=d._glBuffers[i];if(e.attributeData[l]){a!==u&&(n.bind(d),a=u);const f=e.attributeData[l].location;if(s.enableVertexAttribArray(f),s.vertexAttribPointer(f,c.size,c.type||s.FLOAT,c.normalized,c.stride,c.start),c.instance)if(this.hasInstance)s.vertexAttribDivisor(f,c.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,s,i){const{gl:n}=this,o=this._activeGeometry;if(o.indexBuffer){const h=o.indexBuffer.data.BYTES_PER_ELEMENT,a=h===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;h===2||h===4&&this.canUseUInt32ElementIndex?o.instanced?n.drawElementsInstanced(t,e||o.indexBuffer.data.length,a,(s||0)*h,i||1):n.drawElements(t,e||o.indexBuffer.data.length,a,(s||0)*h):console.warn("unsupported index buffer type: uint32")}else o.instanced?n.drawArraysInstanced(t,s,e||o.getSize(),i||1):n.drawArrays(t,s,e||o.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}Ip.extension={type:Y.RendererSystem,name:"geometry"},Z.add(Ip);const Pp=new Rt;class Rp{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 i=0;i<t.length;i+=2){const n=t[i],o=t[i+1];e[i]=n*s.a+o*s.c+s.tx,e[i+1]=n*s.b+o*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 i=e.orig,n=e.trim;n&&(Pp.set(i.width/n.width,0,0,i.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(Pp));const o=e.baseTexture,h=this.uClampFrame,a=this.clampMargin/o.resolution,l=this.clampOffset;return h[0]=(e._frame.x+a+l)/o.width,h[1]=(e._frame.y+a+l)/o.height,h[2]=(e._frame.x+e._frame.width-a+l)/o.width,h[3]=(e._frame.y+e._frame.height-a+l)/o.height,this.uClampOffset[0]=l/o.realWidth,this.uClampOffset[1]=l/o.realHeight,this.isSimple=e._frame.width===o.width&&e._frame.height===o.height&&e.rotate===0,!0}}var Ob=`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
|
-
`,
|
|
403
|
+
`,Lb=`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 tv extends Yt{constructor(t,e,i){let r=null;typeof t!="string"&&e===void 0&&i===void 0&&(r=t,t=void 0,e=void 0,i=void 0),super(t||Jx,e||Qx,i),this.maskSprite=r,this.maskMatrix=new gt}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,i,r){const n=this._maskSprite,a=n._texture;a.valid&&(a.uvMatrix||(a.uvMatrix=new df(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,i,r))}}class ev{constructor(t=null){this.type=Wt.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=Yt.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=Wt.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 ff{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 i=e;if(!i.isMaskData){const n=this.maskDataPool.pop()||new ev;n.pooled=!0,n.maskObject=e,i=n}const r=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(r),i._colorMask=r?r._colorMask:15,i.autoDetect&&this.detect(i),i._target=t,i.type!==Wt.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case Wt.SCISSOR:this.renderer.scissor.push(i);break;case Wt.STENCIL:this.renderer.stencil.push(i);break;case Wt.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case Wt.COLOR:this.pushColorMask(i);break}i.type===Wt.SPRITE&&this.maskStack.push(i)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case Wt.SCISSOR:this.renderer.scissor.pop(e);break;case Wt.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case Wt.SPRITE:this.popSpriteMask(e);break;case Wt.COLOR:this.popColorMask(e);break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){const i=this.maskStack[this.maskStack.length-1];i.type===Wt.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=Wt.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=Wt.SCISSOR:t.type=Wt.STENCIL:t.type=Wt.COLOR}pushSpriteMask(t){const{maskObject:e}=t,i=t._target;let r=t._filters;r||(r=this.alphaMaskPool[this.alphaMaskIndex],r||(r=this.alphaMaskPool[this.alphaMaskIndex]=[new tv])),r[0].resolution=t.resolution,r[0].multisample=t.multisample,r[0].maskSprite=e;const n=i.filterArea;i.filterArea=e.getBounds(!0),this.renderer.filter.push(i,r),i.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,i=t._colorMask=e&t.colorMask;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(t){const e=t._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}}ff.extension={type:G.RendererSystem,name:"mask"},z.add(ff);class pf{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,i=this.getStackLength();this.maskStack=t;const r=this.getStackLength();r!==i&&(r===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const mf=new gt,_f=[],gf=class vo extends pf{constructor(t){super(t),this.glConst=H.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:i}=t,{renderer:r}=this,n=r.renderTexture,a=i.getBounds(!0,_f.pop()??new st);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:i,c:r,d:n}=t;return(Math.abs(i)>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()||vo.isMatrixRotated(e.worldTransform)||vo.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);const i=t._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(t,e,i,r,n){vo.isMatrixRotated(n)||(n=n?mf.copyFrom(n):mf.identity(),n.translate(-i.x,-i.y).scale(r.width/i.width,r.height/i.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&&_f.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)}};gf.extension={type:G.RendererSystem,name:"scissor"};let iv=gf;z.add(iv);class yf extends pf{constructor(t){super(t),this.glConst=H.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:i}=this.renderer,r=t._stencilCounter;r===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;const n=t._colorMask;n!==0&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,r,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,n!==0&&(t._colorMask=n,i.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 i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,r=i?i._colorMask:15;r!==0&&(i._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,r!==0&&(i._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)}}yf.extension={type:G.RendererSystem,name:"stencil"},z.add(yf);class xf{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return it("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return it("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return it("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}}xf.extension={type:[G.RendererSystem,G.CanvasRendererSystem],name:"_plugin"},z.add(xf);class vf{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new gt,this.transform=null}update(t,e,i,r){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,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,i,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}}vf.extension={type:G.RendererSystem,name:"projection"},z.add(vf);const sv=new ca,bf=new st;class Tf{constructor(t){this.renderer=t,this._tempMatrix=new gt}generateTexture(t,e){const{region:i,...r}=e||{},n=(i==null?void 0:i.copyTo(bf))||t.getLocalBounds(bf,!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 o=Ts.create(r);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const h=t.transform;return t.transform=sv,this.renderer.render(t,{renderTexture:o,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=h,o}destroy(){}}Tf.extension={type:[G.RendererSystem,G.CanvasRendererSystem],name:"textureGenerator"},z.add(Tf);const ws=new st,sn=new st;class wf{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new st,this.destinationFrame=new st,this.viewportFrame=new st}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,i){const r=this.renderer;this.current=t;let n,a,o;t?(n=t.baseTexture,o=n.resolution,e||(ws.width=t.frame.width,ws.height=t.frame.height,e=ws),i||(sn.x=t.frame.x,sn.y=t.frame.y,sn.width=e.width,sn.height=e.height,i=sn),a=n.framebuffer):(o=r.resolution,e||(ws.width=r._view.screen.width,ws.height=r._view.screen.height,e=ws),i||(i=ws,i.width=e.width,i.height=e.height));const h=this.viewportFrame;h.x=i.x*o,h.y=i.y*o,h.width=i.width*o,h.height=i.height*o,t||(h.y=r.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(a,h),this.renderer.projection.update(i,e,o,!a),t?this.renderer.mask.setMaskStack(n.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(i)}clear(t,e){const i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,r=pt.shared.setValue(t||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&r.premultiply(r.alpha);const n=this.destinationFrame,a=this.current?this.current.baseTexture:this.renderer._view.screen,o=n.width!==a.width||n.height!==a.height;if(o){let{x:h,y:l,width:c,height:d}=this.viewportFrame;h=Math.round(h),l=Math.round(l),c=Math.round(c),d=Math.round(d),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,c,d)}this.renderer.framebuffer.clear(r.red,r.green,r.blue,r.alpha,e),o&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}wf.extension={type:G.RendererSystem,name:"renderTexture"},z.add(wf);class rv{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 nv(s,t){const e={},i=t.getProgramParameter(s,t.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const n=t.getActiveAttrib(s,r);if(n.name.startsWith("gl_"))continue;const a=Qd(t,n.type),o={type:a,name:n.name,size:Kd(a),location:t.getAttribLocation(s,n.name)};e[n.name]=o}return e}function av(s,t){const e={},i=t.getProgramParameter(s,t.ACTIVE_UNIFORMS);for(let r=0;r<i;r++){const n=t.getActiveUniform(s,r),a=n.name.replace(/\[.*?\]$/,""),o=!!n.name.match(/\[.*?\]$/),h=Qd(t,n.type);e[a]={name:a,index:r,type:h,size:n.size,isArray:o,value:Yd(h,n.size)}}return e}function ov(s,t){var o;const e=zd(s,s.VERTEX_SHADER,t.vertexSrc),i=zd(s,s.FRAGMENT_SHADER,t.fragmentSrc),r=s.createProgram();s.attachShader(r,e),s.attachShader(r,i);const n=(o=t.extra)==null?void 0:o.transformFeedbackVaryings;if(n&&(typeof s.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):s.transformFeedbackVaryings(r,n.names,n.bufferMode==="separate"?s.SEPARATE_ATTRIBS:s.INTERLEAVED_ATTRIBS)),s.linkProgram(r),s.getProgramParameter(r,s.LINK_STATUS)||Lx(s,r,e,i),t.attributeData=nv(r,s),t.uniformData=av(r,s),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){const h=Object.keys(t.attributeData);h.sort((l,c)=>l>c?1:-1);for(let l=0;l<h.length;l++)t.attributeData[h[l]].location=l,s.bindAttribLocation(r,l,h[l]);s.linkProgram(r)}s.deleteShader(e),s.deleteShader(i);const a={};for(const h in t.uniformData){const l=t.uniformData[h];a[h]={location:s.getUniformLocation(r,h),value:Yd(l.type,l.size)}}return new rv(r,a)}function hv(s,t,e,i,r){e.buffer.update(r)}const lv={float:`
|
|
419
|
+
`;class Nb extends pe{constructor(t,e,s){let i=null;typeof t!="string"&&e===void 0&&s===void 0&&(i=t,t=void 0,e=void 0,s=void 0),super(t||Lb,e||Ob,s),this.maskSprite=i,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,i){const n=this._maskSprite,o=n._texture;o.valid&&(o.uvMatrix||(o.uvMatrix=new Rp(o,0)),o.uvMatrix.update(),this.uniforms.npmAlpha=o.baseTexture.alphaMode?0:1,this.uniforms.mask=o,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,n).prepend(o.uvMatrix.mapCoord),this.uniforms.alpha=n.worldAlpha,this.uniforms.maskClamp=o.uvMatrix.uClampFrame,t.applyFilter(this,e,s,i))}}class Ub{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 Mp{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 Ub;n.pooled=!0,n.maskObject=e,s=n}const i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(s.copyCountersOrReset(i),s._colorMask=i?i._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 i=t._filters;i||(i=this.alphaMaskPool[this.alphaMaskIndex],i||(i=this.alphaMaskPool[this.alphaMaskIndex]=[new Nb])),i[0].resolution=t.resolution,i[0].multisample=t.multisample,i[0].maskSprite=e;const n=s.filterArea;s.filterArea=e.getBounds(!0),this.renderer.filter.push(s,i),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}}Mp.extension={type:Y.RendererSystem,name:"mask"},Z.add(Mp);class Fp{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 i=this.getStackLength();i!==s&&(i===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const kp=new Rt,Bp=[],Dp=class Eh extends Fp{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:i}=this,n=i.renderTexture,o=s.getBounds(!0,Bp.pop()??new it);this.roundFrameToPixels(o,n.current?n.current.resolution:i.resolution,n.sourceFrame,n.destinationFrame,i.projection.transform),e&&o.fit(e),t._scissorRectLocal=o}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:s,c:i,d:n}=t;return(Math.abs(s)>1e-4||Math.abs(i)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||Eh.isMatrixRotated(e.worldTransform)||Eh.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,i,n){Eh.isMatrixRotated(n)||(n=n?kp.copyFrom(n):kp.identity(),n.translate(-s.x,-s.y).scale(i.width/s.width,i.height/s.height).translate(i.x,i.y),this.renderer.filter.transformAABB(n,t),t.fit(i),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&&Bp.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)}};Dp.extension={type:Y.RendererSystem,name:"scissor"};let Vb=Dp;Z.add(Vb);class Op extends Fp{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,i=t._stencilCounter;i===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,i,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,i=s?s._colorMask:15;i!==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,i!==0&&(s._colorMask=i,e.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&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)}}Op.extension={type:Y.RendererSystem,name:"stencil"},Z.add(Op);class Lp{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return at("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return at("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return at("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}}Lp.extension={type:[Y.RendererSystem,Y.CanvasRendererSystem],name:"_plugin"},Z.add(Lp);class Np{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,i){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,s,i),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,i){const n=this.projectionMatrix,o=i?-1:1;n.identity(),n.a=1/e.width*2,n.d=o*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-o-e.y*n.d}setTransform(t){}destroy(){this.renderer=null}}Np.extension={type:Y.RendererSystem,name:"projection"},Z.add(Np);const Xb=new mo,Up=new it;class Vp{constructor(t){this.renderer=t,this._tempMatrix=new Rt}generateTexture(t,e){const{region:s,...i}=e||{},n=(s==null?void 0:s.copyTo(Up))||t.getLocalBounds(Up,!0),o=i.resolution||this.renderer.resolution;n.width=Math.max(n.width,1/o),n.height=Math.max(n.height,1/o),i.width=n.width,i.height=n.height,i.resolution=o,i.multisample??(i.multisample=this.renderer.multisample);const h=br.create(i);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const a=t.transform;return t.transform=Xb,this.renderer.render(t,{renderTexture:h,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=a,h}destroy(){}}Vp.extension={type:[Y.RendererSystem,Y.CanvasRendererSystem],name:"textureGenerator"},Z.add(Vp);const wr=new it,na=new it;class Xp{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new it,this.destinationFrame=new it,this.viewportFrame=new it}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 i=this.renderer;this.current=t;let n,o,h;t?(n=t.baseTexture,h=n.resolution,e||(wr.width=t.frame.width,wr.height=t.frame.height,e=wr),s||(na.x=t.frame.x,na.y=t.frame.y,na.width=e.width,na.height=e.height,s=na),o=n.framebuffer):(h=i.resolution,e||(wr.width=i._view.screen.width,wr.height=i._view.screen.height,e=wr),s||(s=wr,s.width=e.width,s.height=e.height));const a=this.viewportFrame;a.x=s.x*h,a.y=s.y*h,a.width=s.width*h,a.height=s.height*h,t||(a.y=i.view.height-(a.y+a.height)),a.ceil(),this.renderer.framebuffer.bind(o,a),this.renderer.projection.update(s,e,h,!o),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,i=Ct.shared.setValue(t||s);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&i.premultiply(i.alpha);const n=this.destinationFrame,o=this.current?this.current.baseTexture:this.renderer._view.screen,h=n.width!==o.width||n.height!==o.height;if(h){let{x:a,y:l,width:c,height:d}=this.viewportFrame;a=Math.round(a),l=Math.round(l),c=Math.round(c),d=Math.round(d),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(a,l,c,d)}this.renderer.framebuffer.clear(i.red,i.green,i.blue,i.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"},Z.add(Xp);class Gb{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 $b(r,t){const e={},s=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let i=0;i<s;i++){const n=t.getActiveAttrib(r,i);if(n.name.startsWith("gl_"))continue;const o=_p(t,n.type),h={type:o,name:n.name,size:mp(o),location:t.getAttribLocation(r,n.name)};e[n.name]=h}return e}function Yb(r,t){const e={},s=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let i=0;i<s;i++){const n=t.getActiveUniform(r,i),o=n.name.replace(/\[.*?\]$/,""),h=!!n.name.match(/\[.*?\]$/),a=_p(t,n.type);e[o]={name:o,index:i,type:a,size:n.size,isArray:h,value:dp(a,n.size)}}return e}function Hb(r,t){var h;const e=up(r,r.VERTEX_SHADER,t.vertexSrc),s=up(r,r.FRAGMENT_SHADER,t.fragmentSrc),i=r.createProgram();r.attachShader(i,e),r.attachShader(i,s);const n=(h=t.extra)==null?void 0:h.transformFeedbackVaryings;if(n&&(typeof r.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(i,n.names,n.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(i),r.getProgramParameter(i,r.LINK_STATUS)||vb(r,i,e,s),t.attributeData=$b(i,r),t.uniformData=Yb(i,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){const a=Object.keys(t.attributeData);a.sort((l,c)=>l>c?1:-1);for(let l=0;l<a.length;l++)t.attributeData[a[l]].location=l,r.bindAttribLocation(i,l,a[l]);r.linkProgram(i)}r.deleteShader(e),r.deleteShader(s);const o={};for(const a in t.uniformData){const l=t.uniformData[a];o[a]={location:r.getUniformLocation(i,a),value:dp(l.type,l.size)}}return new Gb(i,o)}function Wb(r,t,e,s,i){e.buffer.update(i)}const zb={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
|
-
`},
|
|
457
|
+
`},Gp={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 jb(r){const t=r.map(n=>({data:n,offset:0,dataLen:0,dirty:0}));let e=0,s=0,i=0;for(let n=0;n<t.length;n++){const o=t[n];if(e=Gp[o.data.type],o.data.size>1&&(e=Math.max(e,16)*o.data.size),o.dataLen=e,s%e!==0&&s<16){const h=s%e%16;s+=h,i+=h}s+e>16?(i=Math.ceil(i/16)*16,o.offset=i,i+=e,s=e):(o.offset=i,s+=e,i+=e)}return i=Math.ceil(i/16)*16,{uboElements:t,size:i}}function qb(r,t){const e=[];for(const s in r)t[s]&&e.push(t[s]);return e.sort((s,i)=>s.index-i.index),e}function Kb(r,t){if(!r.autoManage)return{size:0,syncFunc:Wb};const e=qb(r.uniforms,t),{uboElements:s,size:i}=jb(e),n=[`
|
|
458
458
|
var v = null;
|
|
459
459
|
var v2 = null;
|
|
460
460
|
var cv = null;
|
|
@@ -462,14 +462,14 @@ void main(void)
|
|
|
462
462
|
var gl = renderer.gl
|
|
463
463
|
var index = 0;
|
|
464
464
|
var data = buffer.data;
|
|
465
|
-
`];for(let
|
|
465
|
+
`];for(let o=0;o<s.length;o++){const h=s[o],a=r.uniforms[h.data.name],l=h.data.name;let c=!1;for(let d=0;d<nn.length;d++){const u=nn[d];if(u.codeUbo&&u.test(h.data,a)){n.push(`offset = ${h.offset/4};`,nn[d].codeUbo(h.data.name,a)),c=!0;break}}if(!c)if(h.data.size>1){const d=mp(h.data.type),u=Math.max(Gp[h.data.type]/16,1),f=d/u,p=(4-f%4)%4;n.push(`
|
|
466
466
|
cv = ud.${l}.value;
|
|
467
467
|
v = uv.${l};
|
|
468
|
-
offset = ${
|
|
468
|
+
offset = ${h.offset/4};
|
|
469
469
|
|
|
470
470
|
t = 0;
|
|
471
471
|
|
|
472
|
-
for(var i=0; i < ${
|
|
472
|
+
for(var i=0; i < ${h.data.size*u}; i++)
|
|
473
473
|
{
|
|
474
474
|
for(var j = 0; j < ${f}; j++)
|
|
475
475
|
{
|
|
@@ -478,15 +478,15 @@ void main(void)
|
|
|
478
478
|
offset += ${p};
|
|
479
479
|
}
|
|
480
480
|
|
|
481
|
-
`)}else{const d=
|
|
481
|
+
`)}else{const d=zb[h.data.type];n.push(`
|
|
482
482
|
cv = ud.${l}.value;
|
|
483
483
|
v = uv.${l};
|
|
484
|
-
offset = ${
|
|
484
|
+
offset = ${h.offset/4};
|
|
485
485
|
${d};
|
|
486
486
|
`)}}return n.push(`
|
|
487
487
|
renderer.buffer.update(buffer);
|
|
488
|
-
`),{size:
|
|
489
|
-
`))}}let fv=0;const xa={textureCount:0,uboCount:0};class Af{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=fv++}systemCheck(){if(!Nx())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 i=t.program,r=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(r.program)),e||(xa.textureCount=0,xa.uboCount=0,this.syncUniformGroup(t.uniformGroup,xa)),r}setUniforms(t){const e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)}syncUniformGroup(t,e){const i=this.getGlProgram();(!t.static||t.dirtyId!==i.uniformDirtyGroups[t.id])&&(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))}syncUniforms(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Bx(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){const i=this.getGlProgram();if(!t.static||t.dirtyId!==0||!i.uniformGroups[t.id]){t.dirtyId=0;const r=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),r(i.uniformData,t.uniforms,this.renderer,xa,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])}createSyncBufferGroup(t,e,i){const{gl:r}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,r.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const a=this.getSignature(t,this.shader.program.uniformData,"ubo");let o=this._uboCache[a];if(o||(o=this._uboCache[a]=dv(t,this.shader.program.uniformData)),t.autoManage){const h=new Float32Array(o.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=o.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,i){const r=t.uniforms,n=[`${i}-`];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,i=t.program,r=ov(e,i);return i.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}}Af.extension={type:G.RendererSystem,name:"shader"},z.add(Af);class va{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(){}}va.defaultOptions={hello:!1},va.extension={type:[G.RendererSystem,G.CanvasRendererSystem],name:"startup"},z.add(va);function pv(s,t=[]){return t[K.NORMAL]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.ADD]=[s.ONE,s.ONE],t[K.MULTIPLY]=[s.DST_COLOR,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.SCREEN]=[s.ONE,s.ONE_MINUS_SRC_COLOR,s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.OVERLAY]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.DARKEN]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.LIGHTEN]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.COLOR_DODGE]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.COLOR_BURN]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.HARD_LIGHT]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.SOFT_LIGHT]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.DIFFERENCE]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.EXCLUSION]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.HUE]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.SATURATION]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.COLOR]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.LUMINOSITY]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.NONE]=[0,0],t[K.NORMAL_NPM]=[s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.ADD_NPM]=[s.SRC_ALPHA,s.ONE,s.ONE,s.ONE],t[K.SCREEN_NPM]=[s.SRC_ALPHA,s.ONE_MINUS_SRC_COLOR,s.ONE,s.ONE_MINUS_SRC_ALPHA],t[K.SRC_IN]=[s.DST_ALPHA,s.ZERO],t[K.SRC_OUT]=[s.ONE_MINUS_DST_ALPHA,s.ZERO],t[K.SRC_ATOP]=[s.DST_ALPHA,s.ONE_MINUS_SRC_ALPHA],t[K.DST_OVER]=[s.ONE_MINUS_DST_ALPHA,s.ONE],t[K.DST_IN]=[s.ZERO,s.SRC_ALPHA],t[K.DST_OUT]=[s.ZERO,s.ONE_MINUS_SRC_ALPHA],t[K.DST_ATOP]=[s.ONE_MINUS_DST_ALPHA,s.SRC_ALPHA],t[K.XOR]=[s.ONE_MINUS_DST_ALPHA,s.ONE_MINUS_SRC_ALPHA],t[K.SUBTRACT]=[s.ONE,s.ONE,s.ONE,s.ONE,s.FUNC_REVERSE_SUBTRACT,s.FUNC_ADD],t}const mv=0,_v=1,gv=2,yv=3,xv=4,vv=5,Sf=class zc{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=K.NONE,this._blendEq=!1,this.map=[],this.map[mv]=this.setBlend,this.map[_v]=this.setOffset,this.map[gv]=this.setCullFace,this.map[yv]=this.setDepthTest,this.map[xv]=this.setFrontFace,this.map[vv]=this.setDepthMask,this.checks=[],this.defaultState=new ni,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=pv(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this.updateCheck(zc.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(zc.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],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(t,e){const i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};Sf.extension={type:G.RendererSystem,name:"state"};let bv=Sf;z.add(bv);class Tv extends Je{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);const e=(t.priority??[]).filter(r=>t.systems[r]),i=[...e,...Object.keys(t.systems).filter(r=>!e.includes(r))];for(const r of i)this.addSystem(t.systems[r],r)}addRunners(...t){t.forEach(e=>{this.runners[e]=new He(e)})}addSystem(t,e){const i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(const r in this.runners)this.runners[r].add(i);return this}emitWithCustomOptions(t,e){const i=Object.keys(this._systemsHash);t.items.forEach(r=>{const n=i.find(a=>this._systemsHash[a]===r);r[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const rn=class bo{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=bo.defaultMaxIdle,this.checkCountMax=bo.defaultCheckCountMax,this.mode=bo.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Ao.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let i=!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,i=!0)}if(i){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,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(let r=t.children.length-1;r>=0;r--)this.unload(t.children[r])}destroy(){this.renderer=null}};rn.defaultMode=Ao.AUTO,rn.defaultMaxIdle=60*60,rn.defaultCheckCountMax=60*10,rn.extension={type:G.RendererSystem,name:"textureGC"};let Es=rn;z.add(Es);class Xh{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=Z.UNSIGNED_BYTE,this.internalFormat=O.RGBA,this.samplerType=0}}function wv(s){let t;return"WebGL2RenderingContext"in globalThis&&s instanceof globalThis.WebGL2RenderingContext?t={[s.RGB]:V.FLOAT,[s.RGBA]:V.FLOAT,[s.ALPHA]:V.FLOAT,[s.LUMINANCE]:V.FLOAT,[s.LUMINANCE_ALPHA]:V.FLOAT,[s.R8]:V.FLOAT,[s.R8_SNORM]:V.FLOAT,[s.RG8]:V.FLOAT,[s.RG8_SNORM]:V.FLOAT,[s.RGB8]:V.FLOAT,[s.RGB8_SNORM]:V.FLOAT,[s.RGB565]:V.FLOAT,[s.RGBA4]:V.FLOAT,[s.RGB5_A1]:V.FLOAT,[s.RGBA8]:V.FLOAT,[s.RGBA8_SNORM]:V.FLOAT,[s.RGB10_A2]:V.FLOAT,[s.RGB10_A2UI]:V.FLOAT,[s.SRGB8]:V.FLOAT,[s.SRGB8_ALPHA8]:V.FLOAT,[s.R16F]:V.FLOAT,[s.RG16F]:V.FLOAT,[s.RGB16F]:V.FLOAT,[s.RGBA16F]:V.FLOAT,[s.R32F]:V.FLOAT,[s.RG32F]:V.FLOAT,[s.RGB32F]:V.FLOAT,[s.RGBA32F]:V.FLOAT,[s.R11F_G11F_B10F]:V.FLOAT,[s.RGB9_E5]:V.FLOAT,[s.R8I]:V.INT,[s.R8UI]:V.UINT,[s.R16I]:V.INT,[s.R16UI]:V.UINT,[s.R32I]:V.INT,[s.R32UI]:V.UINT,[s.RG8I]:V.INT,[s.RG8UI]:V.UINT,[s.RG16I]:V.INT,[s.RG16UI]:V.UINT,[s.RG32I]:V.INT,[s.RG32UI]:V.UINT,[s.RGB8I]:V.INT,[s.RGB8UI]:V.UINT,[s.RGB16I]:V.INT,[s.RGB16UI]:V.UINT,[s.RGB32I]:V.INT,[s.RGB32UI]:V.UINT,[s.RGBA8I]:V.INT,[s.RGBA8UI]:V.UINT,[s.RGBA16I]:V.INT,[s.RGBA16UI]:V.UINT,[s.RGBA32I]:V.INT,[s.RGBA32UI]:V.UINT,[s.DEPTH_COMPONENT16]:V.FLOAT,[s.DEPTH_COMPONENT24]:V.FLOAT,[s.DEPTH_COMPONENT32F]:V.FLOAT,[s.DEPTH_STENCIL]:V.FLOAT,[s.DEPTH24_STENCIL8]:V.FLOAT,[s.DEPTH32F_STENCIL8]:V.FLOAT}:t={[s.RGB]:V.FLOAT,[s.RGBA]:V.FLOAT,[s.ALPHA]:V.FLOAT,[s.LUMINANCE]:V.FLOAT,[s.LUMINANCE_ALPHA]:V.FLOAT,[s.DEPTH_STENCIL]:V.FLOAT},t}function Ev(s){let t;return"WebGL2RenderingContext"in globalThis&&s instanceof globalThis.WebGL2RenderingContext?t={[Z.UNSIGNED_BYTE]:{[O.RGBA]:s.RGBA8,[O.RGB]:s.RGB8,[O.RG]:s.RG8,[O.RED]:s.R8,[O.RGBA_INTEGER]:s.RGBA8UI,[O.RGB_INTEGER]:s.RGB8UI,[O.RG_INTEGER]:s.RG8UI,[O.RED_INTEGER]:s.R8UI,[O.ALPHA]:s.ALPHA,[O.LUMINANCE]:s.LUMINANCE,[O.LUMINANCE_ALPHA]:s.LUMINANCE_ALPHA},[Z.BYTE]:{[O.RGBA]:s.RGBA8_SNORM,[O.RGB]:s.RGB8_SNORM,[O.RG]:s.RG8_SNORM,[O.RED]:s.R8_SNORM,[O.RGBA_INTEGER]:s.RGBA8I,[O.RGB_INTEGER]:s.RGB8I,[O.RG_INTEGER]:s.RG8I,[O.RED_INTEGER]:s.R8I},[Z.UNSIGNED_SHORT]:{[O.RGBA_INTEGER]:s.RGBA16UI,[O.RGB_INTEGER]:s.RGB16UI,[O.RG_INTEGER]:s.RG16UI,[O.RED_INTEGER]:s.R16UI,[O.DEPTH_COMPONENT]:s.DEPTH_COMPONENT16},[Z.SHORT]:{[O.RGBA_INTEGER]:s.RGBA16I,[O.RGB_INTEGER]:s.RGB16I,[O.RG_INTEGER]:s.RG16I,[O.RED_INTEGER]:s.R16I},[Z.UNSIGNED_INT]:{[O.RGBA_INTEGER]:s.RGBA32UI,[O.RGB_INTEGER]:s.RGB32UI,[O.RG_INTEGER]:s.RG32UI,[O.RED_INTEGER]:s.R32UI,[O.DEPTH_COMPONENT]:s.DEPTH_COMPONENT24},[Z.INT]:{[O.RGBA_INTEGER]:s.RGBA32I,[O.RGB_INTEGER]:s.RGB32I,[O.RG_INTEGER]:s.RG32I,[O.RED_INTEGER]:s.R32I},[Z.FLOAT]:{[O.RGBA]:s.RGBA32F,[O.RGB]:s.RGB32F,[O.RG]:s.RG32F,[O.RED]:s.R32F,[O.DEPTH_COMPONENT]:s.DEPTH_COMPONENT32F},[Z.HALF_FLOAT]:{[O.RGBA]:s.RGBA16F,[O.RGB]:s.RGB16F,[O.RG]:s.RG16F,[O.RED]:s.R16F},[Z.UNSIGNED_SHORT_5_6_5]:{[O.RGB]:s.RGB565},[Z.UNSIGNED_SHORT_4_4_4_4]:{[O.RGBA]:s.RGBA4},[Z.UNSIGNED_SHORT_5_5_5_1]:{[O.RGBA]:s.RGB5_A1},[Z.UNSIGNED_INT_2_10_10_10_REV]:{[O.RGBA]:s.RGB10_A2,[O.RGBA_INTEGER]:s.RGB10_A2UI},[Z.UNSIGNED_INT_10F_11F_11F_REV]:{[O.RGB]:s.R11F_G11F_B10F},[Z.UNSIGNED_INT_5_9_9_9_REV]:{[O.RGB]:s.RGB9_E5},[Z.UNSIGNED_INT_24_8]:{[O.DEPTH_STENCIL]:s.DEPTH24_STENCIL8},[Z.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[O.DEPTH_STENCIL]:s.DEPTH32F_STENCIL8}}:t={[Z.UNSIGNED_BYTE]:{[O.RGBA]:s.RGBA,[O.RGB]:s.RGB,[O.ALPHA]:s.ALPHA,[O.LUMINANCE]:s.LUMINANCE,[O.LUMINANCE_ALPHA]:s.LUMINANCE_ALPHA},[Z.UNSIGNED_SHORT_5_6_5]:{[O.RGB]:s.RGB},[Z.UNSIGNED_SHORT_4_4_4_4]:{[O.RGBA]:s.RGBA},[Z.UNSIGNED_SHORT_5_5_5_1]:{[O.RGBA]:s.RGBA}},t}class Cf{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new J,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=Ev(t),this.samplerTypes=wv(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 i=new Xh(t.createTexture());t.bindTexture(t.TEXTURE_2D,i.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]=i,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Xh(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:i}=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,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,r.texture)),r.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)):r.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.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:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let r=0;r<i.length;r++)i[r]===this.unknownTexture&&this.bind(null,r)}for(let r=0;r<i.length;r++)i[r]===t&&(this.currentLocation!==r&&(e.activeTexture(e.TEXTURE0+r),this.currentLocation=r),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[r]=null)}ensureSamplerType(t){const{boundTextures:e,hasIntegerTextures:i,CONTEXT_UID:r}=this;if(i)for(let n=t-1;n>=0;--n){const a=e[n];a&&a._glTextures[r].samplerType!==V.FLOAT&&this.renderer.texture.unbind(a)}}initTexture(t){const e=new Xh(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 i;e.internalFormat=((i=this.internalFormats[t.type])==null?void 0:i[t.format])??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??V.FLOAT,this.webGLVersion===2&&t.type===Z.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 i=this.renderer;if(this.initTextureType(t,e),(r=t.resource)==null?void 0:r.upload(i,t,e))e.samplerType!==V.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,a=t.realHeight,o=i.gl;(e.width!==n||e.height!==a||e.dirtyId<0)&&(e.width=n,e.height=a,o.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:i}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){const r=this.managedTextures.indexOf(t);r!==-1&&ir(this.managedTextures,r,1)}}updateTextureStyle(t){var i;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===Ke.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Ui.CLAMP:e.wrapMode=t.wrapMode,(i=t.resource)!=null&&i.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const i=this.gl;if(e.mipmap&&t.mipmap!==Ke.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===Ti.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const r=this.renderer.context.extensions.anisotropicFiltering;if(r&&t.anisotropicLevel>0&&t.scaleMode===Ti.LINEAR){const n=Math.min(t.anisotropicLevel,i.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,r.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===Ti.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===Ti.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}Cf.extension={type:G.RendererSystem,name:"texture"},z.add(Cf);class Pf{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:i}=this,r=t._glTransformFeedbacks[i]||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:i,renderer:r}=this;e&&r.shader.bind(e),i.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:i,CONTEXT_UID:r}=this,n=e.createTransformFeedback();t._glTransformFeedbacks[r]=n,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n);for(let a=0;a<t.buffers.length;a++){const o=t.buffers[a];o&&(i.buffer.update(o),o._glBuffers[r].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,a,o._glBuffers[r].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),n}disposeTransformFeedback(t,e){const i=t._glTransformFeedbacks[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this);const n=this.renderer.buffer;if(n)for(let a=0;a<t.buffers.length;a++){const o=t.buffers[a];if(!o)continue;const h=o._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&n.dispose(o,e))}i&&(e||r.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}Pf.extension={type:G.RendererSystem,name:"transformFeedback"},z.add(Pf);class ba{constructor(t){this.renderer=t}init(t){this.screen=new st(0,0,t.width,t.height),this.element=t.view||H.ADAPTER.createCanvas(),this.resolution=t.resolution||H.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 i=this.element.width/this.resolution,r=this.element.height/this.resolution;this.screen.width=i,this.screen.height=r,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${r}px`),this.renderer.emit("resize",i,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}}ba.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},ba.extension={type:[G.RendererSystem,G.CanvasRendererSystem],name:"_view"},z.add(ba),H.PREFER_ENV=qe.WEBGL2,H.STRICT_TEXTURE_CACHE=!1,H.RENDER_OPTIONS={..._a.defaultOptions,...ma.defaultOptions,...ba.defaultOptions,...va.defaultOptions},Object.defineProperties(H,{WRAP_MODE:{get(){return J.defaultOptions.wrapMode},set(s){it("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),J.defaultOptions.wrapMode=s}},SCALE_MODE:{get(){return J.defaultOptions.scaleMode},set(s){it("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),J.defaultOptions.scaleMode=s}},MIPMAP_TEXTURES:{get(){return J.defaultOptions.mipmap},set(s){it("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),J.defaultOptions.mipmap=s}},ANISOTROPIC_LEVEL:{get(){return J.defaultOptions.anisotropicLevel},set(s){it("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),J.defaultOptions.anisotropicLevel=s}},FILTER_RESOLUTION:{get(){return it("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Yt.defaultResolution},set(s){Yt.defaultResolution=s}},FILTER_MULTISAMPLE:{get(){return it("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Yt.defaultMultisample},set(s){Yt.defaultMultisample=s}},SPRITE_MAX_TEXTURES:{get(){return bs.defaultMaxTextures},set(s){it("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),bs.defaultMaxTextures=s}},SPRITE_BATCH_SIZE:{get(){return bs.defaultBatchSize},set(s){it("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),bs.defaultBatchSize=s}},CAN_UPLOAD_SAME_BUFFER:{get(){return bs.canUploadSameBuffer},set(s){it("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),bs.canUploadSameBuffer=s}},GC_MODE:{get(){return Es.defaultMode},set(s){it("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Es.defaultMode=s}},GC_MAX_IDLE:{get(){return Es.defaultMaxIdle},set(s){it("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Es.defaultMaxIdle=s}},GC_MAX_CHECK_COUNT:{get(){return Es.defaultCheckCountMax},set(s){it("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Es.defaultCheckCountMax=s}},PRECISION_VERTEX:{get(){return Ri.defaultVertexPrecision},set(s){it("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),Ri.defaultVertexPrecision=s}},PRECISION_FRAGMENT:{get(){return Ri.defaultFragmentPrecision},set(s){it("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),Ri.defaultFragmentPrecision=s}}});var zi=(s=>(s[s.INTERACTION=50]="INTERACTION",s[s.HIGH=25]="HIGH",s[s.NORMAL=0]="NORMAL",s[s.LOW=-25]="LOW",s[s.UTILITY=-50]="UTILITY",s))(zi||{});class $h{constructor(t,e=null,i=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,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 Rf=class Se{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 $h(null,null,1/0),this.deltaMS=1/Se.targetFPMS,this.elapsedMS=1/Se.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=zi.NORMAL){return this._addListener(new $h(t,e,i))}addOnce(t,e,i=zi.NORMAL){return this._addListener(new $h(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=t-n%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Se.targetFPMS;const i=this._head;let r=i.next;for(;r;)r=r.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){const e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,Se.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{const e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!Se._shared){const t=Se._shared=new Se;t.autoStart=!0,t._protected=!0}return Se._shared}static get system(){if(!Se._system){const t=Se._system=new Se;t.autoStart=!0,t._protected=!0}return Se._system}};Rf.targetFPMS=.06;let ft=Rf;Object.defineProperties(H,{TARGET_FPMS:{get(){return ft.targetFPMS},set(s){it("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),ft.targetFPMS=s}}});class If{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,zi.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?ft.shared:new ft,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}If.extension=G.Application,z.add(If);const Mf=[];z.handleByList(G.Renderer,Mf);function Av(s){for(const t of Mf)if(t.test(s))return new t(s);throw new Error("Unable to auto-detect a suitable renderer.")}var Sv=`attribute vec2 aVertexPosition;
|
|
488
|
+
`),{size:i,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(`
|
|
489
|
+
`))}}let Zb=0;const To={textureCount:0,uboCount:0};class $p{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=Zb++}systemCheck(){if(!wb())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,i=s.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==s&&(this.program=s,this.gl.useProgram(i.program)),e||(To.textureCount=0,To.uboCount=0,this.syncUniformGroup(t.uniformGroup,To)),i}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]=_b(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 i=s.uniformGroups[t.id]||this.createSyncBufferGroup(t,s,e);t.buffer.update(),i(s.uniformData,t.uniforms,this.renderer,To,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,s.uniformBufferBindings[e])}createSyncBufferGroup(t,e,s){const{gl:i}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(e.program,s);e.uniformBufferBindings[s]=this.shader.uniformBindCount,i.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const o=this.getSignature(t,this.shader.program.uniformData,"ubo");let h=this._uboCache[o];if(h||(h=this._uboCache[o]=Kb(t,this.shader.program.uniformData)),t.autoManage){const a=new Float32Array(h.size/4);t.buffer.update(a)}return e.uniformGroups[t.id]=h.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,s){const i=t.uniforms,n=[`${s}-`];for(const o in i)n.push(o),e[o]&&n.push(e[o].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,i=Hb(e,s);return s.glPrograms[this.renderer.CONTEXT_UID]=i,i}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}$p.extension={type:Y.RendererSystem,name:"shader"},Z.add($p);class Ao{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(){}}Ao.defaultOptions={hello:!1},Ao.extension={type:[Y.RendererSystem,Y.CanvasRendererSystem],name:"startup"},Z.add(Ao);function Qb(r,t=[]){return t[W.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.ADD]=[r.ONE,r.ONE],t[W.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.NONE]=[0,0],t[W.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[W.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[W.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[W.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[W.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[W.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[W.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[W.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[W.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[W.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[W.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}const Jb=0,tw=1,ew=2,sw=3,iw=4,rw=5,Yp=class ud{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=W.NONE,this._blendEq=!1,this.map=[],this.map[Jb]=this.setBlend,this.map[tw]=this.setOffset,this.map[ew]=this.setCullFace,this.map[sw]=this.setDepthTest,this.map[iw]=this.setFrontFace,this.map[rw]=this.setDepthMask,this.checks=[],this.defaultState=new Ws,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=Qb(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(ud.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(ud.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}};Yp.extension={type:Y.RendererSystem,name:"state"};let nw=Yp;Z.add(nw);class aw extends Vs{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);const e=(t.priority??[]).filter(i=>t.systems[i]),s=[...e,...Object.keys(t.systems).filter(i=>!e.includes(i))];for(const i of s)this.addSystem(t.systems[i],i)}addRunners(...t){t.forEach(e=>{this.runners[e]=new bs(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 i in this.runners)this.runners[i].add(s);return this}emitWithCustomOptions(t,e){const s=Object.keys(this._systemsHash);t.items.forEach(i=>{const n=s.find(o=>this._systemsHash[o]===i);i[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const aa=class Th{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=Th.defaultMaxIdle,this.checkCountMax=Th.defaultCheckCountMax,this.mode=Th.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Ih.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 i=0;i<e.length;i++){const n=e[i];n.resource&&this.count-n.touched>this.maxIdle&&(t.destroyTexture(n,!0),e[i]=null,s=!0)}if(s){let i=0;for(let n=0;n<e.length;n++)e[n]!==null&&(e[i++]=e[n]);e.length=i}}unload(t){const e=this.renderer.texture,s=t._texture;s&&!s.framebuffer&&e.destroyTexture(s);for(let i=t.children.length-1;i>=0;i--)this.unload(t.children[i])}destroy(){this.renderer=null}};aa.defaultMode=Ih.AUTO,aa.defaultMaxIdle=60*60,aa.defaultCheckCountMax=60*10,aa.extension={type:Y.RendererSystem,name:"textureGC"};let Er=aa;Z.add(Er);class Yl{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=X.RGBA,this.samplerType=0}}function ow(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:j.FLOAT,[r.RGBA]:j.FLOAT,[r.ALPHA]:j.FLOAT,[r.LUMINANCE]:j.FLOAT,[r.LUMINANCE_ALPHA]:j.FLOAT,[r.R8]:j.FLOAT,[r.R8_SNORM]:j.FLOAT,[r.RG8]:j.FLOAT,[r.RG8_SNORM]:j.FLOAT,[r.RGB8]:j.FLOAT,[r.RGB8_SNORM]:j.FLOAT,[r.RGB565]:j.FLOAT,[r.RGBA4]:j.FLOAT,[r.RGB5_A1]:j.FLOAT,[r.RGBA8]:j.FLOAT,[r.RGBA8_SNORM]:j.FLOAT,[r.RGB10_A2]:j.FLOAT,[r.RGB10_A2UI]:j.FLOAT,[r.SRGB8]:j.FLOAT,[r.SRGB8_ALPHA8]:j.FLOAT,[r.R16F]:j.FLOAT,[r.RG16F]:j.FLOAT,[r.RGB16F]:j.FLOAT,[r.RGBA16F]:j.FLOAT,[r.R32F]:j.FLOAT,[r.RG32F]:j.FLOAT,[r.RGB32F]:j.FLOAT,[r.RGBA32F]:j.FLOAT,[r.R11F_G11F_B10F]:j.FLOAT,[r.RGB9_E5]:j.FLOAT,[r.R8I]:j.INT,[r.R8UI]:j.UINT,[r.R16I]:j.INT,[r.R16UI]:j.UINT,[r.R32I]:j.INT,[r.R32UI]:j.UINT,[r.RG8I]:j.INT,[r.RG8UI]:j.UINT,[r.RG16I]:j.INT,[r.RG16UI]:j.UINT,[r.RG32I]:j.INT,[r.RG32UI]:j.UINT,[r.RGB8I]:j.INT,[r.RGB8UI]:j.UINT,[r.RGB16I]:j.INT,[r.RGB16UI]:j.UINT,[r.RGB32I]:j.INT,[r.RGB32UI]:j.UINT,[r.RGBA8I]:j.INT,[r.RGBA8UI]:j.UINT,[r.RGBA16I]:j.INT,[r.RGBA16UI]:j.UINT,[r.RGBA32I]:j.INT,[r.RGBA32UI]:j.UINT,[r.DEPTH_COMPONENT16]:j.FLOAT,[r.DEPTH_COMPONENT24]:j.FLOAT,[r.DEPTH_COMPONENT32F]:j.FLOAT,[r.DEPTH_STENCIL]:j.FLOAT,[r.DEPTH24_STENCIL8]:j.FLOAT,[r.DEPTH32F_STENCIL8]:j.FLOAT}:t={[r.RGB]:j.FLOAT,[r.RGBA]:j.FLOAT,[r.ALPHA]:j.FLOAT,[r.LUMINANCE]:j.FLOAT,[r.LUMINANCE_ALPHA]:j.FLOAT,[r.DEPTH_STENCIL]:j.FLOAT},t}function hw(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[tt.UNSIGNED_BYTE]:{[X.RGBA]:r.RGBA8,[X.RGB]:r.RGB8,[X.RG]:r.RG8,[X.RED]:r.R8,[X.RGBA_INTEGER]:r.RGBA8UI,[X.RGB_INTEGER]:r.RGB8UI,[X.RG_INTEGER]:r.RG8UI,[X.RED_INTEGER]:r.R8UI,[X.ALPHA]:r.ALPHA,[X.LUMINANCE]:r.LUMINANCE,[X.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[tt.BYTE]:{[X.RGBA]:r.RGBA8_SNORM,[X.RGB]:r.RGB8_SNORM,[X.RG]:r.RG8_SNORM,[X.RED]:r.R8_SNORM,[X.RGBA_INTEGER]:r.RGBA8I,[X.RGB_INTEGER]:r.RGB8I,[X.RG_INTEGER]:r.RG8I,[X.RED_INTEGER]:r.R8I},[tt.UNSIGNED_SHORT]:{[X.RGBA_INTEGER]:r.RGBA16UI,[X.RGB_INTEGER]:r.RGB16UI,[X.RG_INTEGER]:r.RG16UI,[X.RED_INTEGER]:r.R16UI,[X.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[tt.SHORT]:{[X.RGBA_INTEGER]:r.RGBA16I,[X.RGB_INTEGER]:r.RGB16I,[X.RG_INTEGER]:r.RG16I,[X.RED_INTEGER]:r.R16I},[tt.UNSIGNED_INT]:{[X.RGBA_INTEGER]:r.RGBA32UI,[X.RGB_INTEGER]:r.RGB32UI,[X.RG_INTEGER]:r.RG32UI,[X.RED_INTEGER]:r.R32UI,[X.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[tt.INT]:{[X.RGBA_INTEGER]:r.RGBA32I,[X.RGB_INTEGER]:r.RGB32I,[X.RG_INTEGER]:r.RG32I,[X.RED_INTEGER]:r.R32I},[tt.FLOAT]:{[X.RGBA]:r.RGBA32F,[X.RGB]:r.RGB32F,[X.RG]:r.RG32F,[X.RED]:r.R32F,[X.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[tt.HALF_FLOAT]:{[X.RGBA]:r.RGBA16F,[X.RGB]:r.RGB16F,[X.RG]:r.RG16F,[X.RED]:r.R16F},[tt.UNSIGNED_SHORT_5_6_5]:{[X.RGB]:r.RGB565},[tt.UNSIGNED_SHORT_4_4_4_4]:{[X.RGBA]:r.RGBA4},[tt.UNSIGNED_SHORT_5_5_5_1]:{[X.RGBA]:r.RGB5_A1},[tt.UNSIGNED_INT_2_10_10_10_REV]:{[X.RGBA]:r.RGB10_A2,[X.RGBA_INTEGER]:r.RGB10_A2UI},[tt.UNSIGNED_INT_10F_11F_11F_REV]:{[X.RGB]:r.R11F_G11F_B10F},[tt.UNSIGNED_INT_5_9_9_9_REV]:{[X.RGB]:r.RGB9_E5},[tt.UNSIGNED_INT_24_8]:{[X.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[tt.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[X.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[tt.UNSIGNED_BYTE]:{[X.RGBA]:r.RGBA,[X.RGB]:r.RGB,[X.ALPHA]:r.ALPHA,[X.LUMINANCE]:r.LUMINANCE,[X.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[tt.UNSIGNED_SHORT_5_6_5]:{[X.RGB]:r.RGB},[tt.UNSIGNED_SHORT_4_4_4_4]:{[X.RGBA]:r.RGBA},[tt.UNSIGNED_SHORT_5_5_5_1]:{[X.RGBA]:r.RGBA}},t}class Hp{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=ow(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let i=0;i<e;i++)this.boundTextures[i]=null;this.emptyTextures={};const s=new Yl(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 Yl(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let i=0;i<6;i++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+i,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 i=0;i<this.boundTextures.length;i++)this.bind(null,i)}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 i=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,i.texture)),i.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,s.activeTexture(s.TEXTURE0+e)),this.updateTexture(t)):i.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 i=0;i<s.length;i++)s[i]===this.unknownTexture&&this.bind(null,i)}for(let i=0;i<s.length;i++)s[i]===t&&(this.currentLocation!==i&&(e.activeTexture(e.TEXTURE0+i),this.currentLocation=i),e.bindTexture(t.target,this.emptyTextures[t.target].texture),s[i]=null)}ensureSamplerType(t){const{boundTextures:e,hasIntegerTextures:s,CONTEXT_UID:i}=this;if(s)for(let n=t-1;n>=0;--n){const o=e[n];o&&o._glTextures[i].samplerType!==j.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(t){const e=new Yl(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 i;const e=t._glTextures[this.CONTEXT_UID];if(!e)return;const s=this.renderer;if(this.initTextureType(t,e),(i=t.resource)==null?void 0:i.upload(s,t,e))e.samplerType!==j.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,o=t.realHeight,h=s.gl;(e.width!==n||e.height!==o||e.dirtyId<0)&&(e.width=n,e.height=o,h.texImage2D(t.target,0,e.internalFormat,n,o,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 i=this.managedTextures.indexOf(t);i!==-1&&rn(this.managedTextures,i,1)}}updateTextureStyle(t){var s;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===ys.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Mi.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!==ys.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 i=this.renderer.context.extensions.anisotropicFiltering;if(i&&t.anisotropicLevel>0&&t.scaleMode===je.LINEAR){const n=Math.min(t.anisotropicLevel,s.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));s.texParameterf(t.target,i.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}}Hp.extension={type:Y.RendererSystem,name:"texture"},Z.add(Hp);class Wp{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,i=t._glTransformFeedbacks[s]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,i)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:s,renderer:i}=this;e&&i.shader.bind(e),s.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:s,CONTEXT_UID:i}=this,n=e.createTransformFeedback();t._glTransformFeedbacks[i]=n,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n);for(let o=0;o<t.buffers.length;o++){const h=t.buffers[o];h&&(s.buffer.update(h),h._glBuffers[i].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,o,h._glBuffers[i].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),n}disposeTransformFeedback(t,e){const s=t._glTransformFeedbacks[this.CONTEXT_UID],i=this.gl;t.disposeRunner.remove(this);const n=this.renderer.buffer;if(n)for(let o=0;o<t.buffers.length;o++){const h=t.buffers[o];if(!h)continue;const a=h._glBuffers[this.CONTEXT_UID];a&&(a.refCount--,a.refCount===0&&!e&&n.dispose(h,e))}s&&(e||i.deleteTransformFeedback(s),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}Wp.extension={type:Y.RendererSystem,name:"transformFeedback"},Z.add(Wp);class So{constructor(t){this.renderer=t}init(t){this.screen=new it(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,i=this.element.height/this.resolution;this.screen.width=s,this.screen.height=i,this.autoDensity&&(this.element.style.width=`${s}px`,this.element.style.height=`${i}px`),this.renderer.emit("resize",s,i),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}}So.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},So.extension={type:[Y.RendererSystem,Y.CanvasRendererSystem],name:"_view"},Z.add(So),z.PREFER_ENV=Ls.WEBGL2,z.STRICT_TEXTURE_CACHE=!1,z.RENDER_OPTIONS={...bo.defaultOptions,...vo.defaultOptions,...So.defaultOptions,...Ao.defaultOptions},Object.defineProperties(z,{WRAP_MODE:{get(){return et.defaultOptions.wrapMode},set(r){at("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),et.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return et.defaultOptions.scaleMode},set(r){at("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),et.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return et.defaultOptions.mipmap},set(r){at("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),et.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return et.defaultOptions.anisotropicLevel},set(r){at("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),et.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return at("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),pe.defaultResolution},set(r){pe.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return at("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),pe.defaultMultisample},set(r){pe.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return vr.defaultMaxTextures},set(r){at("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),vr.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return vr.defaultBatchSize},set(r){at("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),vr.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return vr.canUploadSameBuffer},set(r){at("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),vr.canUploadSameBuffer=r}},GC_MODE:{get(){return Er.defaultMode},set(r){at("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Er.defaultMode=r}},GC_MAX_IDLE:{get(){return Er.defaultMaxIdle},set(r){at("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Er.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return Er.defaultCheckCountMax},set(r){at("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Er.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return _i.defaultVertexPrecision},set(r){at("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),_i.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return _i.defaultFragmentPrecision},set(r){at("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),_i.defaultFragmentPrecision=r}}});var Ni=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(Ni||{});class Hl{constructor(t,e=null,s=0,i=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=s,this.once=i}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 zp=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 Hl(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=Ni.NORMAL){return this._addListener(new Hl(t,e,s))}addOnce(t,e,s=Ni.NORMAL){return this._addListener(new Hl(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 i=s.next;for(;i;)i=i.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}};zp.targetFPMS=.06;let Tt=zp;Object.defineProperties(z,{TARGET_FPMS:{get(){return Tt.targetFPMS},set(r){at("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),Tt.targetFPMS=r}}});class jp{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,Ni.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Tt.shared:new Tt,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}jp.extension=Y.Application,Z.add(jp);const qp=[];Z.handleByList(Y.Renderer,qp);function lw(r){for(const t of qp)if(t.test(r))return new t(r);throw new Error("Unable to auto-detect a suitable renderer.")}var cw=`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
|
-
}`,
|
|
500
|
+
}`,uw=`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 Pv=Sv,Df=Cv;class Bf{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){const i=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,i)}else{const i=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,i)}e>=Ht.HIGH?this.multisample=Ht.HIGH:e>=Ht.MEDIUM?this.multisample=Ht.MEDIUM:e>=Ht.LOW?this.multisample=Ht.LOW:this.multisample=Ht.NONE}destroy(){}}Bf.extension={type:G.RendererSystem,name:"_multisample"},z.add(Bf);class Rv{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Of{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:i}=this,r=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,r.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:i,CONTEXT_UID:r}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[r]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,i){const{gl:r,CONTEXT_UID:n}=this;i=i||0;const a=t._glBuffers[n]||this.createGLBuffer(t);r.bindBufferRange(r.UNIFORM_BUFFER,e||0,a.buffer,i*256,256)}update(t){const{gl:e,CONTEXT_UID:i}=this,r=t._glBuffers[i]||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 i=t._glBuffers[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this),i&&(e||r.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)}createGLBuffer(t){const{CONTEXT_UID:e,gl:i}=this;return t._glBuffers[e]=new Rv(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}Of.extension={type:G.RendererSystem,name:"buffer"},z.add(Of);class Ff{constructor(t){this.renderer=t}render(t,e){const i=this.renderer;let r,n,a,o;if(e&&(r=e.renderTexture,n=e.clear,a=e.transform,o=e.skipUpdateTransform),this.renderingToScreen=!r,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=a,!i.context.isLost){if(r||(this.lastObjectRendered=t),!o){const h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}i.renderTexture.bind(r),i.batch.currentRenderer.start(),(n??i.background.clearBeforeRender)&&i.renderTexture.clear(),t.render(i),i.batch.currentRenderer.flush(),r&&(e.blit&&i.framebuffer.blit(),r.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}Ff.extension={type:G.RendererSystem,name:"objectRenderer"},z.add(Ff);const Ta=class Yc extends Tv{constructor(t){super(),this.type=Jc.WEBGL,t=Object.assign({},H.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new Ve({projectionMatrix:new gt},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:Yc.__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&&(it("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=Yc.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:tx()}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 it("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return it("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return it("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return it("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){it("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return it("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){it("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return it("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)}};Ta.extension={type:G.Renderer,priority:1},Ta.__plugins={},Ta.__systems={};let zh=Ta;z.handleByMap(G.RendererPlugin,zh.__plugins),z.handleByMap(G.RendererSystem,zh.__systems),z.add(zh);class Lf extends Jr{constructor(t,e){const{width:i,height:r}=e||{};super(i,r),this.items=[],this.itemDirtyIds=[];for(let n=0;n<t;n++){const a=new J;this.items.push(a),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let i=0;i<this.length;i++)t[i]&&(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof Jr?this.addResourceAt(t[i],i):this.addResourceAt(Vd(t[i],e),i))}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:i}=this.items[0];return this.resize(e,i),this.update(),Promise.resolve(this)}),this._load}}class Iv extends Lf{constructor(t,e){const{width:i,height:r}=e||{};let n,a;Array.isArray(t)?(n=t,a=t.length):a=t,super(a,{width:i,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=Xs.TEXTURE_2D_ARRAY}upload(t,e,i){const{length:r,itemDirtyIds:n,items:a}=this,{gl:o}=t;i.dirtyId<0&&o.texImage3D(o.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,r,0,e.format,i.type,null);for(let h=0;h<r;h++){const l=a[h];n[h]<l.dirtyId&&(n[h]=l.dirtyId,l.valid&&o.texSubImage3D(o.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,e.format,i.type,l.resource.source))}return!0}}class Mv extends Ii{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const kf=class Mn extends Lf{constructor(t,e){const{width:i,height:r,autoLoad:n,linkBaseTexture:a}=e||{};if(t&&t.length!==Mn.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:r});for(let o=0;o<Mn.SIDES;o++)this.items[o].target=Xs.TEXTURE_CUBE_MAP_POSITIVE_X+o;this.linkBaseTexture=a!==!1,t&&this.initFromArray(t,e),n!==!1&&this.load()}bind(t){super.bind(t),t.target=Xs.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,i){if(i===void 0&&(i=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=Xs.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,i){const r=this.itemDirtyIds;for(let n=0;n<Mn.SIDES;n++){const a=this.items[n];(r[n]<a.dirtyId||i.dirtyId<e.dirtyId)&&(a.valid&&a.resource?(a.resource.upload(t,a,i),r[n]=a.dirtyId):r[n]<-1&&(t.gl.texImage2D(a.target,0,i.internalFormat,e.realWidth,e.realHeight,0,e.format,i.type,null),r[n]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Mn.SIDES}};kf.SIDES=6;let Dv=kf;class nr extends Ii{constructor(t,e){e=e||{};let i,r,n;typeof t=="string"?(i=nr.EMPTY,r=t,n=!0):(i=t,r=null,n=!1),super(i),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 i=await H.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const r=await i.blob();if(this.destroyed)return;const n=await createImageBitmap(r,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===he.UNPACK?"premultiply":"none"});if(this.destroyed){n.close();return}this.source=n,this.update(),t(this)}catch(i){if(this.destroyed)return;e(i),this.onError.emit(i)}}),this._load)}upload(t,e,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return nr._EMPTY=nr._EMPTY??H.ADAPTER.createCanvas(0,0),nr._EMPTY}}const Yh=class To extends Ii{constructor(t,e){e=e||{},super(H.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)},To.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;Ii.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,i=t.height;if(!e||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let r=e*this.scale,n=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(r=this._overrideWidth||this._overrideHeight/i*e,n=this._overrideHeight||this._overrideWidth/e*i),r=Math.round(r),n=Math.round(n);const a=this.source;a.width=r,a.height=n,a._pixiId=`canvas_${_s()}`,a.getContext("2d").drawImage(t,0,0,e,i,0,0,r,n),this._resolve(),this._resolve=null}}static getSize(t){const e=To.SVG_SIZE.exec(t),i={};return e&&(i[e[1]]=Math.round(parseFloat(e[3])),i[e[5]]=Math.round(parseFloat(e[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&To.SVG_XML.test(t)}};Yh.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Yh.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let jh=Yh;class Bv extends Ii{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}}const qh=class jc extends Ii{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){const i=document.createElement("video");e.autoLoad!==!1&&i.setAttribute("preload","auto"),e.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),e.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),e.loop===!0&&i.setAttribute("loop",""),e.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);const r=t[0].src||t[0];Ii.crossOrigin(i,r,e.crossorigin);for(let n=0;n<t.length;++n){const a=document.createElement("source");let{src:o,mime:h}=t[n];if(o=o||t[n],o.startsWith("data:"))h=o.slice(5,o.indexOf(";"));else if(!o.startsWith("blob:")){const l=o.split("?").shift().toLowerCase(),c=l.slice(l.lastIndexOf(".")+1);h=h||jc.MIME_TYPES[c]||`video/${c}`}a.src=o,h&&(a.type=h),i.appendChild(a)}t=i}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=ft.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,i)=>{this.valid?e(this):(this._resolve=e,this._reject=i,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){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&&(ft.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||(ft.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ft.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||jc.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 Nf=qh;Ih.push(nr,rf,Mv,Nf,Bv,jh,ia,Dv,Iv);class wa{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?st.EMPTY:(t=t||new st(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:i,b:r,c:n,d:a,tx:o,ty:h}=t,l=i*e.x+n*e.y+o,c=r*e.x+a*e.y+h;this.minX=Math.min(this.minX,l),this.maxX=Math.max(this.maxX,l),this.minY=Math.min(this.minY,c),this.maxY=Math.max(this.maxY,c)}addQuad(t){let e=this.minX,i=this.minY,r=this.maxX,n=this.maxY,a=t[0],o=t[1];e=a<e?a:e,i=o<i?o:i,r=a>r?a:r,n=o>n?o:n,a=t[2],o=t[3],e=a<e?a:e,i=o<i?o:i,r=a>r?a:r,n=o>n?o:n,a=t[4],o=t[5],e=a<e?a:e,i=o<i?o:i,r=a>r?a:r,n=o>n?o:n,a=t[6],o=t[7],e=a<e?a:e,i=o<i?o:i,r=a>r?a:r,n=o>n?o:n,this.minX=e,this.minY=i,this.maxX=r,this.maxY=n}addFrame(t,e,i,r,n){this.addFrameMatrix(t.worldTransform,e,i,r,n)}addFrameMatrix(t,e,i,r,n){const a=t.a,o=t.b,h=t.c,l=t.d,c=t.tx,d=t.ty;let u=this.minX,f=this.minY,p=this.maxX,m=this.maxY,_=a*e+h*i+c,y=o*e+l*i+d;u=_<u?_:u,f=y<f?y:f,p=_>p?_:p,m=y>m?y:m,_=a*r+h*i+c,y=o*r+l*i+d,u=_<u?_:u,f=y<f?y:f,p=_>p?_:p,m=y>m?y:m,_=a*e+h*n+c,y=o*e+l*n+d,u=_<u?_:u,f=y<f?y:f,p=_>p?_:p,m=y>m?y:m,_=a*r+h*n+c,y=o*r+l*n+d,u=_<u?_:u,f=y<f?y:f,p=_>p?_:p,m=y>m?y:m,this.minX=u,this.minY=f,this.maxX=p,this.maxY=m}addVertexData(t,e,i){let r=this.minX,n=this.minY,a=this.maxX,o=this.maxY;for(let h=e;h<i;h+=2){const l=t[h],c=t[h+1];r=l<r?l:r,n=c<n?c:n,a=l>a?l:a,o=c>o?c:o}this.minX=r,this.minY=n,this.maxX=a,this.maxY=o}addVertices(t,e,i,r){this.addVerticesMatrix(t.worldTransform,e,i,r)}addVerticesMatrix(t,e,i,r,n=0,a=n){const o=t.a,h=t.b,l=t.c,c=t.d,d=t.tx,u=t.ty;let f=this.minX,p=this.minY,m=this.maxX,_=this.maxY;for(let y=i;y<r;y+=2){const v=e[y],g=e[y+1],x=o*v+l*g+d,b=c*g+h*v+u;f=Math.min(f,x-n),m=Math.max(m,x+n),p=Math.min(p,b-a),_=Math.max(_,b+a)}this.minX=f,this.minY=p,this.maxX=m,this.maxY=_}addBounds(t){const e=this.minX,i=this.minY,r=this.maxX,n=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<i?t.minY:i,this.maxX=t.maxX>r?t.maxX:r,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,e){const i=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(i<=n&&r<=a){const o=this.minX,h=this.minY,l=this.maxX,c=this.maxY;this.minX=i<o?i:o,this.minY=r<h?r:h,this.maxX=n>l?n:l,this.maxY=a>c?a:c}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const i=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(i<=n&&r<=a){const o=this.minX,h=this.minY,l=this.maxX,c=this.maxY;this.minX=i<o?i:o,this.minY=r<h?r:h,this.maxX=n>l?n:l,this.maxY=a>c?a:c}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,i,r,n,a){t-=n,e-=a,i+=n,r+=a,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>r?this.maxY:r}}class St extends Je{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new ca,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 wa,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 i=0;i<e.length;++i){const r=e[i];Object.defineProperty(St.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 st),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new st),t=this._localBoundsRect),this._localBounds||(this._localBounds=new wa);const e=this.transform,i=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=(i==null?void 0:i.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=i,this.transform=e,this._bounds=r,this._bounds.updateID+=this._boundsID-n,a}toGlobal(t,e,i=!1){return i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)}toLocal(t,e,i,r){return e&&(t=e.toGlobal(t,i,r)),r||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,i)}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,i=1,r=1,n=0,a=0,o=0,h=0,l=0){return this.position.x=t,this.position.y=e,this.scale.x=i||1,this.scale.y=r||1,this.rotation=n,this.skew.x=a,this.skew.y=o,this.pivot.x=h,this.pivot.y=l,this}destroy(t){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.eventMode="auto",this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new Ov),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*Cx}set angle(t){this.transform.rotation=t*Bh}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 Ov extends St{constructor(){super(...arguments),this.sortDirty=null}}St.prototype.displayObjectUpdateTransform=St.prototype.updateTransform;const Fv=new gt;function Lv(s,t){return s.zIndex===t.zIndex?s._lastSortedIndex-t._lastSortedIndex:s.zIndex-t.zIndex}const Uf=class qc extends St{constructor(){super(),this.children=[],this.sortableChildren=qc.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 i=this.getChildIndex(t),r=this.getChildIndex(e);this.children[i]=e,this.children[r]=t,this.onChildrenChange(i<r?i: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 i=this.getChildIndex(t);ir(this.children,i,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],i=this.children.indexOf(e);if(i===-1)return null;e.parent=null,e.transform._parentID=-1,ir(this.children,i,1),this._boundsID++,this.onChildrenChange(i),e.emit("removed",this),this.emit("childRemoved",e,this,i)}return t[0]}removeChildAt(t){const e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,ir(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 i=t,r=e,n=r-i;let a;if(n>0&&n<=r){a=this.children.splice(i,n);for(let o=0;o<a.length;++o)a[o].parent=null,a[o].transform&&(a[o].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let o=0;o<a.length;++o)a[o].emit("removed",this),this.emit("childRemoved",a[o],this,o);return a}else if(n===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let t=!1;for(let e=0,i=this.children.length;e<i;++e){const r=this.children[e];r._lastSortedIndex=e,!t&&r.zIndex!==0&&(t=!0)}t&&this.children.length>1&&this.children.sort(Lv),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 i=this.children[t];i.visible&&i.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 i=e._mask.isMaskData?e._mask.maskObject:e._mask;i?(i.calculateBounds(),this._bounds.addBoundsMask(e._bounds,i._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 i=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 i}_calculateBounds(){}_renderWithCulling(t){const e=t.renderTexture.sourceFrame;if(!(e.width>0&&e.height>0))return;let i,r;this.cullArea?(i=this.cullArea,r=this.worldTransform):this._render!==qc.prototype._render&&(i=this.getBounds(!0));const n=t.projection.transform;if(n&&(r?(r=Fv.copyFrom(r),r.prepend(n)):r=n),i&&e.intersects(i,r))this._render(t);else if(this.cullArea)return;for(let a=0,o=this.children.length;a<o;++a){const h=this.children[a],l=h.cullable;h.cullable=l||!this.cullArea,h.render(t),h.cullable=l}}render(t){var e;if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||(e=this.filters)!=null&&e.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(let i=0,r=this.children.length;i<r;++i)this.children[i].render(t)}}renderAdvanced(t){var n,a,o;const e=this.filters,i=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let h=0;h<e.length;h++)e[h].enabled&&this._enabledFilters.push(e[h])}const r=e&&((n=this._enabledFilters)==null?void 0:n.length)||i&&(!i.isMaskData||i.enabled&&(i.autoDetect||i.type!==Wt.NONE));if(r&&t.batch.flush(),e&&((a=this._enabledFilters)!=null&&a.length)&&t.filter.push(this,this._enabledFilters),i&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let h=0,l=this.children.length;h<l;++h)this.children[h].render(t)}r&&t.batch.flush(),i&&t.mask.pop(this),e&&((o=this._enabledFilters)!=null&&o.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,i=this.removeChildren(0,this.children.length);if(e)for(let r=0;r<i.length;++r)i[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}};Uf.defaultSortableChildren=!1;let bt=Uf;bt.prototype.containerUpdateTransform=bt.prototype.updateTransform,Object.defineProperties(H,{SORTABLE_CHILDREN:{get(){return bt.defaultSortableChildren},set(s){it("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),bt.defaultSortableChildren=s}}});const nn=new tt,kv=new Uint16Array([0,1,2,0,2,3]);class _e extends bt{constructor(t){super(),this._anchor=new ai(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 pt(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=K.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||X.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=kv,this.pluginName="batch",this.isSprite=!0,this._roundPixels=H.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=Vi(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=Vi(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,i=e.a,r=e.b,n=e.c,a=e.d,o=e.tx,h=e.ty,l=this.vertexData,c=t.trim,d=t.orig,u=this._anchor;let f=0,p=0,m=0,_=0;if(c?(p=c.x-u._x*d.width,f=p+c.width,_=c.y-u._y*d.height,m=_+c.height):(p=-u._x*d.width,f=p+d.width,_=-u._y*d.height,m=_+d.height),l[0]=i*p+n*_+o,l[1]=a*_+r*p+h,l[2]=i*f+n*_+o,l[3]=a*_+r*f+h,l[4]=i*f+n*m+o,l[5]=a*m+r*f+h,l[6]=i*p+n*m+o,l[7]=a*m+r*p+h,this._roundPixels){const y=H.RESOLUTION;for(let v=0;v<l.length;++v)l[v]=Math.round(l[v]*y)/y}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const t=this._texture,e=this.vertexTrimmedData,i=t.orig,r=this._anchor,n=this.transform.worldTransform,a=n.a,o=n.b,h=n.c,l=n.d,c=n.tx,d=n.ty,u=-r._x*i.width,f=u+i.width,p=-r._y*i.height,m=p+i.height;if(e[0]=a*u+h*p+c,e[1]=l*p+o*u+d,e[2]=a*f+h*p+c,e[3]=l*p+o*f+d,e[4]=a*f+h*m+c,e[5]=l*m+o*f+d,e[6]=a*u+h*m+c,e[7]=l*m+o*u+d,this._roundPixels){const _=H.RESOLUTION;for(let y=0;y<e.length;++y)e[y]=Math.round(e[y]*_)/_}}_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 wa),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 st),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,nn);const e=this._texture.orig.width,i=this._texture.orig.height,r=-e*this.anchor.x;let n=0;return nn.x>=r&&nn.x<r+e&&(n=-i*this.anchor.y,nn.y>=n&&nn.y<n+i)}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 i=t instanceof X?t:X.from(t,e);return new _e(i)}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=Vi(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=Vi(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||X.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const Gf=new gt;St.prototype._cacheAsBitmap=!1,St.prototype._cacheData=null,St.prototype._cacheAsBitmapResolution=null,St.prototype._cacheAsBitmapMultisample=null;class Nv{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(St.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(s){s!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=s,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(s){s!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=s,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(s){if(this._cacheAsBitmap===s)return;this._cacheAsBitmap=s;let t;s?(this._cacheData||(this._cacheData=new Nv),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)}}}),St.prototype._renderCached=function(s){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(s),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(s))},St.prototype._initCachedDisplayObject=function(s){var u,f;if((u=this._cacheData)!=null&&u.sprite)return;const t=this.alpha;this.alpha=1,s.batch.flush();const e=this.getLocalBounds(new st,!0);if((f=this.filters)!=null&&f.length){const p=this.filters[0].padding;e.pad(p)}const i=this.cacheAsBitmapResolution||s.resolution;e.ceil(i),e.width=Math.max(e.width,1/i),e.height=Math.max(e.height,1/i);const r=s.renderTexture.current,n=s.renderTexture.sourceFrame.clone(),a=s.renderTexture.destinationFrame.clone(),o=s.projection.transform,h=Ts.create({width:e.width,height:e.height,resolution:i,multisample:this.cacheAsBitmapMultisample??s.multisample}),l=`cacheAsBitmap_${_s()}`;this._cacheData.textureCacheId=l,J.addToCache(h.baseTexture,l),X.addToCache(h,l);const c=this.transform.localTransform.copyTo(Gf).invert().translate(-e.x,-e.y);this.render=this._cacheData.originalRender,s.render(this,{renderTexture:h,clear:!0,transform:c,skipUpdateTransform:!1}),s.framebuffer.blit(),s.projection.transform=o,s.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 d=new _e(h);d.transform.worldTransform=this.transform.worldTransform,d.anchor.x=-(e.x/e.width),d.anchor.y=-(e.y/e.height),d.alpha=t,d._bounds=this._bounds,this._cacheData.sprite=d,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=d.containsPoint.bind(d)},St.prototype._renderCachedCanvas=function(s){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(s),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(s))},St.prototype._initCachedDisplayObjectCanvas=function(s){var c;if((c=this._cacheData)!=null&&c.sprite)return;const t=this.getLocalBounds(new st,!0),e=this.alpha;this.alpha=1;const i=s.canvasContext.activeContext,r=s._projTransform,n=this.cacheAsBitmapResolution||s.resolution;t.ceil(n),t.width=Math.max(t.width,1/n),t.height=Math.max(t.height,1/n);const a=Ts.create({width:t.width,height:t.height,resolution:n}),o=`cacheAsBitmap_${_s()}`;this._cacheData.textureCacheId=o,J.addToCache(a.baseTexture,o),X.addToCache(a,o);const h=Gf;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=t.x,h.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,s.render(this,{renderTexture:a,clear:!0,transform:h,skipUpdateTransform:!1}),s.canvasContext.activeContext=i,s._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 _e(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=s._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)},St.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},St.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},St.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,J.removeFromCache(this._cacheData.textureCacheId),X.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},St.prototype._cacheAsBitmapDestroy=function(s){this.cacheAsBitmap=!1,this.destroy(s)},St.prototype.name=null,bt.prototype.getChildByName=function(s,t){for(let e=0,i=this.children.length;e<i;e++)if(this.children[e].name===s)return this.children[e];if(t)for(let e=0,i=this.children.length;e<i;e++){const r=this.children[e];if(!r.getChildByName)continue;const n=r.getChildByName(s,!0);if(n)return n}return null},St.prototype.getGlobalPosition=function(s=new tt,t=!1){return this.parent?this.parent.toGlobal(this.position,s,t):(s.x=this.position.x,s.y=this.position.y),s};var Uv=`varying vec2 vTextureCoord;
|
|
526
|
+
`;const dw=cw,Kp=uw;class Zp{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>=ie.HIGH?this.multisample=ie.HIGH:e>=ie.MEDIUM?this.multisample=ie.MEDIUM:e>=ie.LOW?this.multisample=ie.LOW:this.multisample=ie.NONE}destroy(){}}Zp.extension={type:Y.RendererSystem,name:"_multisample"},Z.add(Zp);class fw{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Qp{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,i=t._glBuffers[s]||this.createGLBuffer(t);e.bindBuffer(t.type,i.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:s,CONTEXT_UID:i}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[i]||this.createGLBuffer(t);this.boundBufferBases[e]=t,s.bindBufferBase(s.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,s){const{gl:i,CONTEXT_UID:n}=this;s=s||0;const o=t._glBuffers[n]||this.createGLBuffer(t);i.bindBufferRange(i.UNIFORM_BUFFER,e||0,o.buffer,s*256,256)}update(t){const{gl:e,CONTEXT_UID:s}=this,i=t._glBuffers[s]||this.createGLBuffer(t);if(t._updateID!==i.updateID)if(i.updateID=t._updateID,e.bindBuffer(t.type,i.buffer),i.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;i.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],i=this.gl;t.disposeRunner.remove(this),s&&(e||i.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 fw(s.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}Qp.extension={type:Y.RendererSystem,name:"buffer"},Z.add(Qp);class Jp{constructor(t){this.renderer=t}render(t,e){const s=this.renderer;let i,n,o,h;if(e&&(i=e.renderTexture,n=e.clear,o=e.transform,h=e.skipUpdateTransform),this.renderingToScreen=!i,s.runners.prerender.emit(),s.emit("prerender"),s.projection.transform=o,!s.context.isLost){if(i||(this.lastObjectRendered=t),!h){const a=t.enableTempParent();t.updateTransform(),t.disableTempParent(a)}s.renderTexture.bind(i),s.batch.currentRenderer.start(),(n??s.background.clearBeforeRender)&&s.renderTexture.clear(),t.render(s),s.batch.currentRenderer.flush(),i&&(e.blit&&s.framebuffer.blit(),i.baseTexture.update()),s.runners.postrender.emit(),s.projection.transform=null,s.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}Jp.extension={type:Y.RendererSystem,name:"objectRenderer"},Z.add(Jp);const Co=class dd extends aw{constructor(t){super(),this.type=yd.WEBGL,t=Object.assign({},z.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new ws({projectionMatrix:new Rt},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:dd.__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&&(at("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=dd.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:N1()}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 at("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return at("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return at("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return at("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){at("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return at("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){at("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return at("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)}};Co.extension={type:Y.Renderer,priority:1},Co.__plugins={},Co.__systems={};let Wl=Co;Z.handleByMap(Y.RendererPlugin,Wl.__plugins),Z.handleByMap(Y.RendererSystem,Wl.__systems),Z.add(Wl);class tm extends sa{constructor(t,e){const{width:s,height:i}=e||{};super(s,i),this.items=[],this.itemDirtyIds=[];for(let n=0;n<t;n++){const o=new et;this.items.push(o),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 sa?this.addResourceAt(t[s],s):this.addResourceAt(op(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 pw extends tm{constructor(t,e){const{width:s,height:i}=e||{};let n,o;Array.isArray(t)?(n=t,o=t.length):o=t,super(o,{width:s,height:i}),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=Hr.TEXTURE_2D_ARRAY}upload(t,e,s){const{length:i,itemDirtyIds:n,items:o}=this,{gl:h}=t;s.dirtyId<0&&h.texImage3D(h.TEXTURE_2D_ARRAY,0,s.internalFormat,this._width,this._height,i,0,e.format,s.type,null);for(let a=0;a<i;a++){const l=o[a];n[a]<l.dirtyId&&(n[a]=l.dirtyId,l.valid&&h.texSubImage3D(h.TEXTURE_2D_ARRAY,0,0,0,a,l.resource.width,l.resource.height,1,e.format,s.type,l.resource.source))}return!0}}class mw extends xi{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const em=class Da extends tm{constructor(t,e){const{width:s,height:i,autoLoad:n,linkBaseTexture:o}=e||{};if(t&&t.length!==Da.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:s,height:i});for(let h=0;h<Da.SIDES;h++)this.items[h].target=Hr.TEXTURE_CUBE_MAP_POSITIVE_X+h;this.linkBaseTexture=o!==!1,t&&this.initFromArray(t,e),n!==!1&&this.load()}bind(t){super.bind(t),t.target=Hr.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=Hr.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 i=this.itemDirtyIds;for(let n=0;n<Da.SIDES;n++){const o=this.items[n];(i[n]<o.dirtyId||s.dirtyId<e.dirtyId)&&(o.valid&&o.resource?(o.resource.upload(t,o,s),i[n]=o.dirtyId):i[n]<-1&&(t.gl.texImage2D(o.target,0,s.internalFormat,e.realWidth,e.realHeight,0,e.format,s.type,null),i[n]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Da.SIDES}};em.SIDES=6;let gw=em;class on extends xi{constructor(t,e){e=e||{};let s,i,n;typeof t=="string"?(s=on.EMPTY,i=t,n=!0):(s=t,i=null,n=!1),super(s),this.url=i,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 i=await s.blob();if(this.destroyed)return;const n=await createImageBitmap(i,{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 on._EMPTY=on._EMPTY??z.ADAPTER.createCanvas(0,0),on._EMPTY}}const zl=class Ah extends xi{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)},Ah.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;xi.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 i=e*this.scale,n=s*this.scale;(this._overrideWidth||this._overrideHeight)&&(i=this._overrideWidth||this._overrideHeight/s*e,n=this._overrideHeight||this._overrideWidth/e*s),i=Math.round(i),n=Math.round(n);const o=this.source;o.width=i,o.height=n,o._pixiId=`canvas_${mr()}`,o.getContext("2d").drawImage(t,0,0,e,s,0,0,i,n),this._resolve(),this._resolve=null}}static getSize(t){const e=Ah.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"&&Ah.SVG_XML.test(t)}};zl.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,zl.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let jl=zl;class _w extends xi{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}}const ql=class fd extends xi{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 i=t[0].src||t[0];xi.crossOrigin(s,i,e.crossorigin);for(let n=0;n<t.length;++n){const o=document.createElement("source");let{src:h,mime:a}=t[n];if(h=h||t[n],h.startsWith("data:"))a=h.slice(5,h.indexOf(";"));else if(!h.startsWith("blob:")){const l=h.split("?").shift().toLowerCase(),c=l.slice(l.lastIndexOf(".")+1);a=a||fd.MIME_TYPES[c]||`video/${c}`}o.src=h,a&&(o.type=a),s.appendChild(o)}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=Tt.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&&(Tt.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||(Tt.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Tt.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||fd.TYPES.includes(e)}};ql.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],ql.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let sm=ql;Rl.push(on,wp,mw,sm,_w,jl,ao,gw,pw);class Io{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?it.EMPTY:(t=t||new it(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:i,c:n,d:o,tx:h,ty:a}=t,l=s*e.x+n*e.y+h,c=i*e.x+o*e.y+a;this.minX=Math.min(this.minX,l),this.maxX=Math.max(this.maxX,l),this.minY=Math.min(this.minY,c),this.maxY=Math.max(this.maxY,c)}addQuad(t){let e=this.minX,s=this.minY,i=this.maxX,n=this.maxY,o=t[0],h=t[1];e=o<e?o:e,s=h<s?h:s,i=o>i?o:i,n=h>n?h:n,o=t[2],h=t[3],e=o<e?o:e,s=h<s?h:s,i=o>i?o:i,n=h>n?h:n,o=t[4],h=t[5],e=o<e?o:e,s=h<s?h:s,i=o>i?o:i,n=h>n?h:n,o=t[6],h=t[7],e=o<e?o:e,s=h<s?h:s,i=o>i?o:i,n=h>n?h:n,this.minX=e,this.minY=s,this.maxX=i,this.maxY=n}addFrame(t,e,s,i,n){this.addFrameMatrix(t.worldTransform,e,s,i,n)}addFrameMatrix(t,e,s,i,n){const o=t.a,h=t.b,a=t.c,l=t.d,c=t.tx,d=t.ty;let u=this.minX,f=this.minY,p=this.maxX,m=this.maxY,g=o*e+a*s+c,y=h*e+l*s+d;u=g<u?g:u,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,g=o*i+a*s+c,y=h*i+l*s+d,u=g<u?g:u,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,g=o*e+a*n+c,y=h*e+l*n+d,u=g<u?g:u,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,g=o*i+a*n+c,y=h*i+l*n+d,u=g<u?g:u,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,this.minX=u,this.minY=f,this.maxX=p,this.maxY=m}addVertexData(t,e,s){let i=this.minX,n=this.minY,o=this.maxX,h=this.maxY;for(let a=e;a<s;a+=2){const l=t[a],c=t[a+1];i=l<i?l:i,n=c<n?c:n,o=l>o?l:o,h=c>h?c:h}this.minX=i,this.minY=n,this.maxX=o,this.maxY=h}addVertices(t,e,s,i){this.addVerticesMatrix(t.worldTransform,e,s,i)}addVerticesMatrix(t,e,s,i,n=0,o=n){const h=t.a,a=t.b,l=t.c,c=t.d,d=t.tx,u=t.ty;let f=this.minX,p=this.minY,m=this.maxX,g=this.maxY;for(let y=s;y<i;y+=2){const x=e[y],_=e[y+1],v=h*x+l*_+d,b=c*_+a*x+u;f=Math.min(f,v-n),m=Math.max(m,v+n),p=Math.min(p,b-o),g=Math.max(g,b+o)}this.minX=f,this.minY=p,this.maxX=m,this.maxY=g}addBounds(t){const e=this.minX,s=this.minY,i=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>i?t.maxX:i,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,e){const s=t.minX>e.minX?t.minX:e.minX,i=t.minY>e.minY?t.minY:e.minY,n=t.maxX<e.maxX?t.maxX:e.maxX,o=t.maxY<e.maxY?t.maxY:e.maxY;if(s<=n&&i<=o){const h=this.minX,a=this.minY,l=this.maxX,c=this.maxY;this.minX=s<h?s:h,this.minY=i<a?i:a,this.maxX=n>l?n:l,this.maxY=o>c?o:c}}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,i=t.minY>e.y?t.minY:e.y,n=t.maxX<e.x+e.width?t.maxX:e.x+e.width,o=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(s<=n&&i<=o){const h=this.minX,a=this.minY,l=this.maxX,c=this.maxY;this.minX=s<h?s:h,this.minY=i<a?i:a,this.maxX=n>l?n:l,this.maxY=o>c?o:c}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,s,i,n,o){t-=n,e-=o,s+=n,i+=o,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>i?this.maxY:i}}class Ut extends Vs{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new mo,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 Io,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 i=e[s];Object.defineProperty(Ut.prototype,i,Object.getOwnPropertyDescriptor(t,i))}}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 it),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new it),t=this._localBoundsRect),this._localBounds||(this._localBounds=new Io);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 i=this._bounds,n=this._boundsID;this._bounds=this._localBounds;const o=this.getBounds(!1,t);return this.parent=s,this.transform=e,this._bounds=i,this._bounds.updateID+=this._boundsID-n,o}toGlobal(t,e,s=!1){return s||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)}toLocal(t,e,s,i){return e&&(t=e.toGlobal(t,s,i)),i||(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,i=1,n=0,o=0,h=0,a=0,l=0){return this.position.x=t,this.position.y=e,this.scale.x=s||1,this.scale.y=i||1,this.rotation=n,this.skew.x=o,this.skew.y=h,this.pivot.x=a,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*ub}set angle(t){this.transform.rotation=t*kl}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 Ut{constructor(){super(...arguments),this.sortDirty=null}}Ut.prototype.displayObjectUpdateTransform=Ut.prototype.updateTransform;const yw=new Rt;function vw(r,t){return r.zIndex===t.zIndex?r._lastSortedIndex-t._lastSortedIndex:r.zIndex-t.zIndex}const im=class pd extends Ut{constructor(){super(),this.children=[],this.sortableChildren=pd.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),i=this.getChildIndex(e);this.children[s]=e,this.children[i]=t,this.onChildrenChange(s<i?s:i)}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);rn(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,rn(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,rn(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,i=e,n=i-s;let o;if(n>0&&n<=i){o=this.children.splice(s,n);for(let h=0;h<o.length;++h)o[h].parent=null,o[h].transform&&(o[h].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let h=0;h<o.length;++h)o[h].emit("removed",this),this.emit("childRemoved",o[h],this,h);return o}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 i=this.children[e];i._lastSortedIndex=e,!t&&i.zIndex!==0&&(t=!0)}t&&this.children.length>1&&this.children.sort(vw),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 i=0,n=this.children.length;i<n;++i){const o=this.children[i];o.visible&&o.updateTransform()}return s}_calculateBounds(){}_renderWithCulling(t){const e=t.renderTexture.sourceFrame;if(!(e.width>0&&e.height>0))return;let s,i;this.cullArea?(s=this.cullArea,i=this.worldTransform):this._render!==pd.prototype._render&&(s=this.getBounds(!0));const n=t.projection.transform;if(n&&(i?(i=yw.copyFrom(i),i.prepend(n)):i=n),s&&e.intersects(s,i))this._render(t);else if(this.cullArea)return;for(let o=0,h=this.children.length;o<h;++o){const a=this.children[o],l=a.cullable;a.cullable=l||!this.cullArea,a.render(t),a.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,i=this.children.length;s<i;++s)this.children[s].render(t)}}renderAdvanced(t){var n,o,h;const e=this.filters,s=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let a=0;a<e.length;a++)e[a].enabled&&this._enabledFilters.push(e[a])}const i=e&&((n=this._enabledFilters)==null?void 0:n.length)||s&&(!s.isMaskData||s.enabled&&(s.autoDetect||s.type!==ce.NONE));if(i&&t.batch.flush(),e&&((o=this._enabledFilters)!=null&&o.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 a=0,l=this.children.length;a<l;++a)this.children[a].render(t)}i&&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 i=0;i<s.length;++i)s[i].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(r){at("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),Bt.defaultSortableChildren=r}}});const oa=new st,bw=new Uint16Array([0,1,2,0,2,3]);class qe extends Bt{constructor(t){super(),this._anchor=new zs(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=bw,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=Bi(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=Bi(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,i=e.b,n=e.c,o=e.d,h=e.tx,a=e.ty,l=this.vertexData,c=t.trim,d=t.orig,u=this._anchor;let f=0,p=0,m=0,g=0;if(c?(p=c.x-u._x*d.width,f=p+c.width,g=c.y-u._y*d.height,m=g+c.height):(p=-u._x*d.width,f=p+d.width,g=-u._y*d.height,m=g+d.height),l[0]=s*p+n*g+h,l[1]=o*g+i*p+a,l[2]=s*f+n*g+h,l[3]=o*g+i*f+a,l[4]=s*f+n*m+h,l[5]=o*m+i*f+a,l[6]=s*p+n*m+h,l[7]=o*m+i*p+a,this._roundPixels){const y=z.RESOLUTION;for(let x=0;x<l.length;++x)l[x]=Math.round(l[x]*y)/y}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const t=this._texture,e=this.vertexTrimmedData,s=t.orig,i=this._anchor,n=this.transform.worldTransform,o=n.a,h=n.b,a=n.c,l=n.d,c=n.tx,d=n.ty,u=-i._x*s.width,f=u+s.width,p=-i._y*s.height,m=p+s.height;if(e[0]=o*u+a*p+c,e[1]=l*p+h*u+d,e[2]=o*f+a*p+c,e[3]=l*p+h*f+d,e[4]=o*f+a*m+c,e[5]=l*m+h*f+d,e[6]=o*u+a*m+c,e[7]=l*m+h*u+d,this._roundPixels){const g=z.RESOLUTION;for(let y=0;y<e.length;++y)e[y]=Math.round(e[y]*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 Io),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 it),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,oa);const e=this._texture.orig.width,s=this._texture.orig.height,i=-e*this.anchor.x;let n=0;return oa.x>=i&&oa.x<i+e&&(n=-s*this.anchor.y,oa.y>=n&&oa.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=Bi(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=Bi(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 rm=new Rt;Ut.prototype._cacheAsBitmap=!1,Ut.prototype._cacheData=null,Ut.prototype._cacheAsBitmapResolution=null,Ut.prototype._cacheAsBitmapMultisample=null;class ww{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(Ut.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(r){r!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(r){r!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(r){if(this._cacheAsBitmap===r)return;this._cacheAsBitmap=r;let t;r?(this._cacheData||(this._cacheData=new ww),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)}}}),Ut.prototype._renderCached=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(r),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(r))},Ut.prototype._initCachedDisplayObject=function(r){var u,f;if((u=this._cacheData)!=null&&u.sprite)return;const t=this.alpha;this.alpha=1,r.batch.flush();const e=this.getLocalBounds(new it,!0);if((f=this.filters)!=null&&f.length){const p=this.filters[0].padding;e.pad(p)}const s=this.cacheAsBitmapResolution||r.resolution;e.ceil(s),e.width=Math.max(e.width,1/s),e.height=Math.max(e.height,1/s);const i=r.renderTexture.current,n=r.renderTexture.sourceFrame.clone(),o=r.renderTexture.destinationFrame.clone(),h=r.projection.transform,a=br.create({width:e.width,height:e.height,resolution:s,multisample:this.cacheAsBitmapMultisample??r.multisample}),l=`cacheAsBitmap_${mr()}`;this._cacheData.textureCacheId=l,et.addToCache(a.baseTexture,l),q.addToCache(a,l);const c=this.transform.localTransform.copyTo(rm).invert().translate(-e.x,-e.y);this.render=this._cacheData.originalRender,r.render(this,{renderTexture:a,clear:!0,transform:c,skipUpdateTransform:!1}),r.framebuffer.blit(),r.projection.transform=h,r.renderTexture.bind(i,n,o),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 d=new qe(a);d.transform.worldTransform=this.transform.worldTransform,d.anchor.x=-(e.x/e.width),d.anchor.y=-(e.y/e.height),d.alpha=t,d._bounds=this._bounds,this._cacheData.sprite=d,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=d.containsPoint.bind(d)},Ut.prototype._renderCachedCanvas=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(r),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(r))},Ut.prototype._initCachedDisplayObjectCanvas=function(r){var c;if((c=this._cacheData)!=null&&c.sprite)return;const t=this.getLocalBounds(new it,!0),e=this.alpha;this.alpha=1;const s=r.canvasContext.activeContext,i=r._projTransform,n=this.cacheAsBitmapResolution||r.resolution;t.ceil(n),t.width=Math.max(t.width,1/n),t.height=Math.max(t.height,1/n);const o=br.create({width:t.width,height:t.height,resolution:n}),h=`cacheAsBitmap_${mr()}`;this._cacheData.textureCacheId=h,et.addToCache(o.baseTexture,h),q.addToCache(o,h);const a=rm;this.transform.localTransform.copyTo(a),a.invert(),a.tx-=t.x,a.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,r.render(this,{renderTexture:o,clear:!0,transform:a,skipUpdateTransform:!1}),r.canvasContext.activeContext=s,r._projTransform=i,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(o);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=r._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)},Ut.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Ut.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Ut.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},Ut.prototype._cacheAsBitmapDestroy=function(r){this.cacheAsBitmap=!1,this.destroy(r)},Ut.prototype.name=null,Bt.prototype.getChildByName=function(r,t){for(let e=0,s=this.children.length;e<s;e++)if(this.children[e].name===r)return this.children[e];if(t)for(let e=0,s=this.children.length;e<s;e++){const i=this.children[e];if(!i.getChildByName)continue;const n=i.getChildByName(r,!0);if(n)return n}return null},Ut.prototype.getGlobalPosition=function(r=new st,t=!1){return this.parent?this.parent.toGlobal(this.position,r,t):(r.x=this.position.x,r.y=this.position.y),r};var Ew=`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
|
|
536
|
-
`);function
|
|
537
|
-
`}return
|
|
535
|
+
`;class Tw extends pe{constructor(t=1){super(dw,Ew,{uAlpha:1}),this.alpha=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}const Aw={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]},Sw=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
|
|
536
|
+
`);function Cw(r){const t=Aw[r],e=t.length;let s=Sw,i="";const n="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;";let o;for(let h=0;h<r;h++){let a=n.replace("%index%",h.toString());o=h,h>=e&&(o=r-h-1),a=a.replace("%value%",t[o].toString()),i+=a,i+=`
|
|
537
|
+
`}return s=s.replace("%blur%",i),s=s.replace("%size%",r.toString()),s}const Iw=`
|
|
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
|
|
568
|
-
`}return
|
|
567
|
+
}`;function Pw(r,t){const e=Math.ceil(r/2);let s=Iw,i="",n;t?n="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":n="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let o=0;o<r;o++){let h=n.replace("%index%",o.toString());h=h.replace("%sampleIndex%",`${o-(e-1)}.0`),i+=h,i+=`
|
|
568
|
+
`}return s=s.replace("%blur%",i),s=s.replace("%size%",r.toString()),s}class Kl extends pe{constructor(t,e=8,s=4,i=pe.defaultResolution,n=5){const o=Pw(n,t),h=Cw(n);super(o,h),this.horizontal=t,this.resolution=i,this._quality=0,this.quality=s,this.blur=e}apply(t,e,s,i){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,i);else{const n=t.getFilterTexture(),o=t.renderer;let h=e,a=n;this.state.blend=!1,t.applyFilter(this,h,a,Ns.CLEAR);for(let l=1;l<this.passes-1;l++){t.bindAndClear(h,Ns.BLIT),this.uniforms.uSampler=a;const c=a;a=h,h=c,o.shader.bind(this),o.geometry.draw(5)}this.state.blend=!0,t.applyFilter(this,a,s,i),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 nm extends pe{constructor(t=8,e=4,s=pe.defaultResolution,i=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new Kl(!0,t,e,s,i),this.blurYFilter=new Kl(!1,t,e,s,i),this.resolution=s,this.quality=e,this.blur=t,this.repeatEdgePixels=!1}apply(t,e,s,i){const n=Math.abs(this.blurXFilter.strength),o=Math.abs(this.blurYFilter.strength);if(n&&o){const h=t.getFilterTexture();this.blurXFilter.apply(t,e,h,Ns.CLEAR),this.blurYFilter.apply(t,h,s,i),t.returnFilterTexture(h)}else o?this.blurYFilter.apply(t,e,s,i):this.blurXFilter.apply(t,e,s,i)}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 Rw=`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
|
|
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,Rw,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,i,n]=Ct.shared.setValue(t).toArray(),o=[s,0,0,0,0,0,i,0,0,0,0,0,n,0,0,0,0,0,1,0];this._loadMatrix(o,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),i=Math.sin(t),n=Math.sqrt,o=1/3,h=n(o),a=s+(1-s)*o,l=o*(1-s)-h*i,c=o*(1-s)+h*i,d=o*(1-s)+h*i,u=s+o*(1-s),f=o*(1-s)-h*i,p=o*(1-s)-h*i,m=o*(1-s)+h*i,g=s+o*(1-s),y=[a,l,c,0,0,d,u,f,0,0,p,m,g,0,0,0,0,0,1,0];this._loadMatrix(y,e)}contrast(t,e){const s=(t||0)+1,i=-.5*(s-1),n=[s,0,0,0,i,0,s,0,0,i,0,0,s,0,i,0,0,0,1,0];this._loadMatrix(n,e)}saturate(t=0,e){const s=t*2/3+1,i=(s-1)*-.5,n=[s,i,i,0,0,i,s,i,0,0,i,i,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,i,n){t=t||.2,e=e||.15,s=s||16770432,i=i||3375104;const o=Ct.shared,[h,a,l]=o.setValue(s).toArray(),[c,d,u]=o.setValue(i).toArray(),f=[.3,.59,.11,0,0,h,a,l,t,0,c,d,u,e,0,h-c,a-d,l-u,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 Mw=`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
|
-
`,
|
|
640
|
+
`,Fw=`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
|
|
669
|
+
`;class kw extends pe{constructor(t,e){const s=new Rt;t.renderable=!1,super(Fw,Mw,{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,i){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,o=Math.sqrt(n.a*n.a+n.b*n.b),h=Math.sqrt(n.c*n.c+n.d*n.d);o!==0&&h!==0&&(this.uniforms.rotation[0]=n.a/o,this.uniforms.rotation[1]=n.b/o,this.uniforms.rotation[2]=n.c/h,this.uniforms.rotation[3]=n.d/h),t.applyFilter(this,e,s,i)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}}var Bw=`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
|
-
`,
|
|
790
|
+
`,Dw=`
|
|
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
|
|
832
|
+
`;class Ow extends pe{constructor(){super(Dw,Bw)}}var Lw=`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 t1 extends Yt{constructor(t=.5,e=Math.random()){super(Df,Jv,{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 Vf={AlphaFilter:Gv,BlurFilter:Hf,BlurFilterPass:Kh,ColorMatrixFilter:ar,DisplacementFilter:qv,FXAAFilter:Qv,NoiseFilter:t1};Object.entries(Vf).forEach(([s,t])=>{Object.defineProperty(Vf,s,{get(){return it("7.1.0",`filters.${s} has moved to ${s}`),t}})});class e1{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||(ft.system.add(this.tickerUpdate,this,zi.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(ft.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 Yi=new e1;class an{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=an.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new tt,this.page=new tt,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,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 Ea extends an{constructor(){super(...arguments),this.client=new tt,this.movement=new tt,this.offset=new tt,this.global=new tt,this.screen=new tt}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,r,n,a,o,h,l,c,d,u,f,p,m){throw new Error("Method not implemented.")}}class We extends Ea{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 or extends Ea{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}or.DOM_DELTA_PIXEL=0,or.DOM_DELTA_LINE=1,or.DOM_DELTA_PAGE=2;const i1=2048,s1=new tt,Zh=new tt;class r1{constructor(t){this.dispatch=new Je,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((i,r)=>i.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 i=0,r=e.length;i<r;i++)e[i].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){Yi.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",r=this[i](this.rootTarget,this.rootTarget.eventMode,s1.set(t,e),this.hitTestFn,this.hitPruneFn);return r&&r[0]}propagate(t,e){if(!t.target)return;const i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let r=0,n=i.length-1;r<n;r++)if(t.currentTarget=i[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=i.length-2;r>=0;r--)if(t.currentTarget=i[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const r=Array.isArray(e)?e:[e];for(let n=i.length-1;n>=0;n--)r.forEach(a=>{t.currentTarget=i[n],this.notifyTarget(t,a)})}propagationPath(t){const e=[t];for(let i=0;i<i1&&t!==this.rootTarget;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,i,r,n,a=!1){let o=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Yi.pauseUpdate=!1),t.interactiveChildren&&t.children){const c=t.children;for(let d=c.length-1;d>=0;d--){const u=c[d],f=this.hitTestMoveRecursive(u,this._isInteractive(e)?e:u.eventMode,i,r,n,a||n(t,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),o=!0}}}const h=this._isInteractive(e),l=t.isInteractive();return h&&l&&this._allInteractiveElements.push(t),a||this._hitElements.length>0?null:o?this._hitElements:h&&!n(t,i)&&r(t,i)?l?[t]:[]:null}hitTestRecursive(t,e,i,r,n){if(this._interactivePrune(t)||n(t,i))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Yi.pauseUpdate=!1),t.interactiveChildren&&t.children){const h=t.children;for(let l=h.length-1;l>=0;l--){const c=h[l],d=this.hitTestRecursive(c,this._isInteractive(e)?e:c.eventMode,i,r,n);if(d){if(d.length>0&&!d[d.length-1].parent)continue;const u=t.isInteractive();return(d.length>0||u)&&d.push(t),d}}}const a=this._isInteractive(e),o=t.isInteractive();return a&&r(t,i)?o?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!!(!t||t.isMask||!t.visible||!t.renderable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren||t.isMask)}hitPruneFn(t,e){var i;if(t.hitArea&&(t.worldTransform.applyInverse(e,Zh),!t.hitArea.contains(Zh.x,Zh.y)))return!0;if(t._mask){const r=t._mask.isMaskData?t._mask.maskObject:t._mask;if(r&&!((i=r.containsPoint)!=null&&i.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 i=`on${e}`;(a=(n=t.currentTarget)[i])==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 We)){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 i=this.trackingData(t.pointerId);i.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var h,l;if(!(t instanceof We)){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 i=e.pointerType==="mouse"||e.pointerType==="pen",r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.overTargets);if(((h=r.overTargets)==null?void 0:h.length)>0&&n!==e.target){const c=t.type==="mousemove"?"mouseout":"pointerout",d=this.createPointerEvent(t,c,n);if(this.dispatchEvent(d,"pointerout"),i&&this.dispatchEvent(d,"mouseout"),!e.composedPath().includes(n)){const u=this.createPointerEvent(t,"pointerleave",n);for(u.eventPhase=u.AT_TARGET;u.target&&!e.composedPath().includes(u.target);)u.currentTarget=u.target,this.notifyTarget(u),i&&this.notifyTarget(u,"mouseleave"),u.target=u.target.parent;this.freeEvent(u)}this.freeEvent(d)}if(n!==e.target){const c=t.type==="mousemove"?"mouseover":"pointerover",d=this.clonePointerEvent(e,c);this.dispatchEvent(d,"pointerover"),i&&this.dispatchEvent(d,"mouseover");let u=n==null?void 0:n.parent;for(;u&&u!==this.rootTarget.parent&&u!==e.target;)u=u.parent;if(!u||u===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),i&&this.notifyTarget(f,"mouseenter"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(d)}const a=[],o=this.enableGlobalMoveEvents??!0;this.moveOnAll?a.push("pointermove"):this.dispatchEvent(e,"pointermove"),o&&a.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?a.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),o&&a.push("globaltouchmove")),i&&(this.moveOnAll?a.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),o&&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 We)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),i=this.createPointerEvent(t),r=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=(a=i.target)==null?void 0:a.cursor);const n=this.clonePointerEvent(i,"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=i.composedPath(),this.freeEvent(i),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof We)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId);if(e.overTargets){const i=t.pointerType==="mouse"||t.pointerType==="pen",r=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",r);this.dispatchEvent(n),i&&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),i&&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 We)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const o=i.button===2;this.dispatchEvent(i,o?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.pressTargetsByButton[t.button]);let a=n;if(n&&!i.composedPath().includes(n)){let o=n;for(;o&&!i.composedPath().includes(o);){if(i.currentTarget=o,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const h=i.button===2;this.notifyTarget(i,h?"rightupoutside":"mouseupoutside")}o=o.parent}delete r.pressTargetsByButton[t.button],a=o}if(a){const o=this.clonePointerEvent(i,"click");o.target=a,o.path=null,r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:o.target,timeStamp:e});const h=r.clicksByButton[t.button];if(h.target===o.target&&e-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=o.target,h.timeStamp=e,o.detail=h.clickCount,o.pointerType==="mouse"){const l=o.button===2;this.dispatchEvent(o,l?"rightclick":"click")}else o.pointerType==="touch"&&this.dispatchEvent(o,"tap");this.dispatchEvent(o,"pointertap"),this.freeEvent(o)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof We)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),r=this.createPointerEvent(t);if(i){let n=i;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 or)){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 i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){const r=this.allocateEvent(We);return this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.nativeEvent=t.nativeEvent,r.originalEvent=t,r.target=i??this.hitTest(r.global.x,r.global.y)??this._hitElements[0],typeof e=="string"&&(r.type=e),r}createWheelEvent(t){const e=this.allocateEvent(or);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){const i=this.allocateEvent(We);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=e??i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof We&&e instanceof We&&(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 Ea&&e instanceof Ea&&(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 i=t.currentTarget._events[e];if(i&&t.currentTarget.isInteractive())if("fn"in i)i.once&&t.currentTarget.removeListener(e,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let r=0,n=i.length;r<n&&!t.propagationImmediatelyStopped;r++)i[r].once&&t.currentTarget.removeListener(e,i[r].fn,void 0,!0),i[r].fn.call(i[r].context,t)}}const n1=1,a1={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Qh=class Kc{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new r1(null),Yi.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new We(null),this.rootWheelEvent=new or(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Kc.defaultEventFeatures},{set:(e,i,r)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=r),e[i]=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:i}=this.renderer;this.setTargetElement(e),this.resolution=i,Kc._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 i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this.rootPointerEvent}onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let i=0,r=e.length;i<r;i++){const n=e[i],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,Yi.pointerMoved();const e=this.normalizeToPointerData(t);for(let i=0,r=e.length;i<r;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);const i=e!==this.domElement?"outside":"",r=this.normalizeToPointerData(t);for(let n=0,a=r.length;n<a;n++){const o=this.bootstrapEvent(this.rootPointerEvent,r[n]);o.type+=i,this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);for(let i=0,r=e.length;i<r;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;const e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this.removeEvents(),this.domElement=t,Yi.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;Yi.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;Yi.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,i){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=(i-r.top)*(this.domElement.height/r.height)*n}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let i=0,r=t.changedTouches.length;i<r;i++){const n=t.changedTouches[i];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 i=t;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=n1),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}else e.push(t);return e}normalizeWheelEvent(t){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=a1[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:[G.RendererSystem,G.CanvasRendererSystem]},Qh.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let Jh=Qh;z.add(Jh);function Wf(s){return s==="dynamic"||s==="static"}const o1={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??Wf(Jh.defaultEventMode)},set interactive(s){it("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=s,this.eventMode=s?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Jh.defaultEventMode},set eventMode(s){this._internalInteractive=Wf(s),this._internalEventMode=s},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(s,t,e){const i=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;s=i?`${s}capture`:s;const o=typeof t=="function"?t:t.handleEvent,h=this;r&&r.addEventListener("abort",()=>{h.off(s,o,a)}),n?h.once(s,o,a):h.on(s,o,a)},removeEventListener(s,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,r=typeof t=="function"?void 0:t;s=i?`${s}capture`:s,t=typeof t=="function"?t:t.handleEvent,this.off(s,t,r)},dispatchEvent(s){if(!(s instanceof an))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return s.defaultPrevented=!1,s.path=null,s.target=this,s.manager.dispatchEvent(s),!s.defaultPrevented}};St.mixin(o1);const h1={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};St.mixin(h1);const l1=9,Aa=100,c1=0,u1=0,Xf=2,$f=1,d1=-1e3,f1=-1e3,p1=2;class zf{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,(Ei.tablet||Ei.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${Aa}px`,e.style.height=`${Aa}px`,e.style.position="absolute",e.style.top=`${c1}px`,e.style.left=`${u1}px`,e.style.zIndex=Xf.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=`${$f}px`,t.style.height=`${$f}px`,t.style.position="absolute",t.style.top=`${d1}px`,t.style.left=`${f1}px`,t.style.zIndex=p1.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 i=0;i<e.length;i++)this.updateAccessibleObjects(e[i])}update(){const t=performance.now();if(Ei.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:i,width:r,height:n}=this.renderer.view.getBoundingClientRect(),{width:a,height:o,resolution:h}=this.renderer,l=r/a*h,c=n/o*h;let d=this.div;d.style.left=`${e}px`,d.style.top=`${i}px`,d.style.width=`${a}px`,d.style.height=`${o}px`;for(let u=0;u<this.children.length;u++){const f=this.children[u];if(f.renderId!==this.renderId)f._accessibleActive=!1,ir(this.children,u,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,u--;else{d=f._accessibleDiv;let p=f.hitArea;const m=f.worldTransform;f.hitArea?(d.style.left=`${(m.tx+p.x*m.a)*l}px`,d.style.top=`${(m.ty+p.y*m.d)*c}px`,d.style.width=`${p.width*m.a*l}px`,d.style.height=`${p.height*m.d*c}px`):(p=f.getBounds(),this.capHitArea(p),d.style.left=`${p.x*l}px`,d.style.top=`${p.y*c}px`,d.style.width=`${p.width*l}px`,d.style.height=`${p.height*c}px`,d.title!==f.accessibleTitle&&f.accessibleTitle!==null&&(d.title=f.accessibleTitle),d.getAttribute("aria-label")!==f.accessibleHint&&f.accessibleHint!==null&&d.setAttribute("aria-label",f.accessibleHint)),(f.accessibleTitle!==d.title||f.tabIndex!==d.tabIndex)&&(d.title=f.accessibleTitle,d.tabIndex=f.tabIndex,this.debug&&this.updateDebugHTML(d))}}this.renderId++}updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);const{width:e,height:i}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width=`${Aa}px`,e.style.height=`${Aa}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=Xf.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:i}=t.target,r=this.renderer.events.rootBoundary,n=Object.assign(new an(r),{target:i});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===l1&&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}}zf.extension={name:"accessibility",type:[G.RendererPlugin,G.CanvasRendererPlugin]},z.add(zf);const Yf=class Zc{constructor(t){this.stage=new bt,t=Object.assign({forceCanvas:!1},t),this.renderer=Av(t),Zc._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 i=Zc._plugins.slice(0);i.reverse(),i.forEach(r=>{r.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};Yf._plugins=[];let m1=Yf;z.handleByList(G.Application,m1._plugins);class jf{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this.cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this.cancelResize();let e,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:r,clientHeight:n}=this._resizeTo;e=r,i=n}this.renderer.resize(e,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}jf.extension=G.Application,z.add(jf);const qf={loader:G.LoadParser,resolver:G.ResolveParser,cache:G.CacheParser,detection:G.DetectionParser};z.handle(G.Asset,s=>{const t=s.ref;Object.entries(qf).filter(([e])=>!!t[e]).forEach(([e,i])=>z.add(Object.assign(t[e],{extension:t[e].extension??i})))},s=>{const t=s.ref;Object.keys(qf).filter(e=>!!t[e]).forEach(e=>z.remove(t[e]))});class _1{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i<e;i++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}}function hr(s,t){if(Array.isArray(t)){for(const e of t)if(s.startsWith(`data:${e}`))return!0;return!1}return s.startsWith(`data:${t}`)}function ji(s,t){const e=s.split("?")[0],i=Ft.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const Xe=(s,t,e=!1)=>(Array.isArray(s)||(s=[s]),t?s.map(i=>typeof i=="string"||e?t(i):i):s),tl=(s,t)=>{const e=t.split("?")[1];return e&&(s+=`?${e}`),s};function Kf(s,t,e,i,r){const n=t[e];for(let a=0;a<n.length;a++){const o=n[a];e<t.length-1?Kf(s.replace(i[e],o),t,e+1,i,r):r.push(s.replace(i[e],o))}}function g1(s){const t=/\{(.*?)\}/g,e=s.match(t),i=[];if(e){const r=[];e.forEach(n=>{const a=n.substring(1,n.length-1).split(",");r.push(a)}),Kf(s,r,0,e,i)}else i.push(s);return i}const Sa=s=>!Array.isArray(s);class y1{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 i=Xe(t);let r;for(let o=0;o<this.parsers.length;o++){const h=this.parsers[o];if(h.test(e)){r=h.getCacheableAssets(i,e);break}}r||(r={},i.forEach(o=>{r[o]=e}));const n=Object.keys(r),a={cacheKeys:n,keys:i};if(i.forEach(o=>{this._cacheMap.set(o,a)}),n.forEach(o=>{this._cache.has(o)&&this._cache.get(o)!==e&&console.warn("[Cache] already has key:",o),this._cache.set(o,r[o])}),e instanceof X){const o=e;i.forEach(h=>{o.baseTexture!==X.EMPTY.baseTexture&&J.addToCache(o.baseTexture,h),X.addToCache(o,h)})}}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(i=>{this._cache.delete(i)}),e.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}}const As=new y1;class x1{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const i={promise:null,parser:null};return i.promise=(async()=>{var a,o;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 h=0;h<this.parsers.length;h++){const l=this.parsers[h];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),i.parser=n;for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];l.parse&&l.parse&&await((o=l.testParse)==null?void 0:o.call(l,r,e,this))&&(r=await l.parse(r,e,this)||r,i.parser=l)}return r})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0;const r={},n=Sa(t),a=Xe(t,l=>({alias:[l],src:l})),o=a.length,h=a.map(async l=>{const c=Ft.toAbsolute(l.src);if(!r[l.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,l)),r[l.src]=await this.promiseCache[c].promise,e&&e(++i/o)}catch(d){throw delete this.promiseCache[c],delete r[l.src],new Error(`[Loader.load] Failed to load ${c}.
|
|
867
|
-
${d}`)}});return await Promise.all(
|
|
866
|
+
`;class Nw extends pe{constructor(t=.5,e=Math.random()){super(Kp,Lw,{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:Tw,BlurFilter:nm,BlurFilterPass:Kl,ColorMatrixFilter:hn,DisplacementFilter:kw,FXAAFilter:Ow,NoiseFilter:Nw};Object.entries(am).forEach(([r,t])=>{Object.defineProperty(am,r,{get(){return at("7.1.0",`filters.${r} has moved to ${r}`),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||(Tt.system.add(this.tickerUpdate,this,Ni.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(Tt.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 Ui=new Uw;class ha{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=ha.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,i,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 Po extends ha{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,i,n,o,h,a,l,c,d,u,f,p,m){throw new Error("Method not implemented.")}}class Es extends Po{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 ln extends Po{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}ln.DOM_DELTA_PIXEL=0,ln.DOM_DELTA_LINE=1,ln.DOM_DELTA_PAGE=2;const Vw=2048,Xw=new st,Zl=new st;class Gw{constructor(t){this.dispatch=new Vs,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,i)=>s.priority-i.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,i=e.length;s<i;s++)e[s].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){Ui.pauseUpdate=!0;const s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",i=this[s](this.rootTarget,this.rootTarget.eventMode,Xw.set(t,e),this.hitTestFn,this.hitPruneFn);return i&&i[0]}propagate(t,e){if(!t.target)return;const s=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let i=0,n=s.length-1;i<n;i++)if(t.currentTarget=s[i],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 i=s.length-2;i>=0;i--)if(t.currentTarget=s[i],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 i=Array.isArray(e)?e:[e];for(let n=s.length-1;n>=0;n--)i.forEach(o=>{t.currentTarget=s[n],this.notifyTarget(t,o)})}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,i,n,o=!1){let h=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ui.pauseUpdate=!1),t.interactiveChildren&&t.children){const c=t.children;for(let d=c.length-1;d>=0;d--){const u=c[d],f=this.hitTestMoveRecursive(u,this._isInteractive(e)?e:u.eventMode,s,i,n,o||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 a=this._isInteractive(e),l=t.isInteractive();return a&&l&&this._allInteractiveElements.push(t),o||this._hitElements.length>0?null:h?this._hitElements:a&&!n(t,s)&&i(t,s)?l?[t]:[]:null}hitTestRecursive(t,e,s,i,n){if(this._interactivePrune(t)||n(t,s))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Ui.pauseUpdate=!1),t.interactiveChildren&&t.children){const a=t.children;for(let l=a.length-1;l>=0;l--){const c=a[l],d=this.hitTestRecursive(c,this._isInteractive(e)?e:c.eventMode,s,i,n);if(d){if(d.length>0&&!d[d.length-1].parent)continue;const u=t.isInteractive();return(d.length>0||u)&&d.push(t),d}}}const o=this._isInteractive(e),h=t.isInteractive();return o&&i(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,Zl),!t.hitArea.contains(Zl.x,Zl.y)))return!0;if(t._mask){const i=t._mask.isMaskData?t._mask.maskObject:t._mask;if(i&&!((s=i.containsPoint)!=null&&s.call(i,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,o;e=e??t.type;const s=`on${e}`;(o=(n=t.currentTarget)[s])==null||o.call(n,t);const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Es)){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 i=e.button===2;this.dispatchEvent(e,i?"rightdown":"mousedown")}const s=this.trackingData(t.pointerId);s.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var a,l;if(!(t instanceof Es)){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",i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.overTargets);if(((a=i.overTargets)==null?void 0:a.length)>0&&n!==e.target){const c=t.type==="mousemove"?"mouseout":"pointerout",d=this.createPointerEvent(t,c,n);if(this.dispatchEvent(d,"pointerout"),s&&this.dispatchEvent(d,"mouseout"),!e.composedPath().includes(n)){const u=this.createPointerEvent(t,"pointerleave",n);for(u.eventPhase=u.AT_TARGET;u.target&&!e.composedPath().includes(u.target);)u.currentTarget=u.target,this.notifyTarget(u),s&&this.notifyTarget(u,"mouseleave"),u.target=u.target.parent;this.freeEvent(u)}this.freeEvent(d)}if(n!==e.target){const c=t.type==="mousemove"?"mouseover":"pointerover",d=this.clonePointerEvent(e,c);this.dispatchEvent(d,"pointerover"),s&&this.dispatchEvent(d,"mouseover");let u=n==null?void 0:n.parent;for(;u&&u!==this.rootTarget.parent&&u!==e.target;)u=u.parent;if(!u||u===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(d)}const o=[],h=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(e,"pointermove"),h&&o.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),h&&o.push("globaltouchmove")),s&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),h&&o.push("globalmousemove"),this.cursor=(l=e.target)==null?void 0:l.cursor),o.length>0&&this.all(e,o),this._allInteractiveElements.length=0,this._hitElements.length=0,i.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){var o;if(!(t instanceof Es)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),s=this.createPointerEvent(t),i=s.pointerType==="mouse"||s.pointerType==="pen";this.dispatchEvent(s,"pointerover"),i&&this.dispatchEvent(s,"mouseover"),s.pointerType==="mouse"&&(this.cursor=(o=s.target)==null?void 0:o.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),i&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=s.composedPath(),this.freeEvent(s),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof Es)){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",i=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",i);this.dispatchEvent(n),s&&this.dispatchEvent(n,"mouseout");const o=this.createPointerEvent(t,"pointerleave",i);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(o)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Es)){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 i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]);let o=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 a=s.button===2;this.notifyTarget(s,a?"rightupoutside":"mouseupoutside")}h=h.parent}delete i.pressTargetsByButton[t.button],o=h}if(o){const h=this.clonePointerEvent(s,"click");h.target=o,h.path=null,i.clicksByButton[t.button]||(i.clicksByButton[t.button]={clickCount:0,target:h.target,timeStamp:e});const a=i.clicksByButton[t.button];if(a.target===h.target&&e-a.timeStamp<200?++a.clickCount:a.clickCount=1,a.target=h.target,a.timeStamp=e,h.detail=a.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 Es)){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]),i=this.createPointerEvent(t);if(s){let n=s;for(;n;)i.currentTarget=n,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch"?this.notifyTarget(i,"touchendoutside"):(i.pointerType==="mouse"||i.pointerType==="pen")&&this.notifyTarget(i,i.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(i)}mapWheel(t){if(!(t instanceof ln)){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 i=this.allocateEvent(Es);return this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.nativeEvent=t.nativeEvent,i.originalEvent=t,i.target=s??this.hitTest(i.global.x,i.global.y)??this._hitElements[0],typeof e=="string"&&(i.type=e),i}createWheelEvent(t){const e=this.allocateEvent(ln);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(Es);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 Es&&e instanceof Es&&(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 Po&&e instanceof Po&&(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 i=0,n=s.length;i<n&&!t.propagationImmediatelyStopped;i++)s[i].once&&t.currentTarget.removeListener(e,s[i].fn,void 0,!0),s[i].fn.call(s[i].context,t)}}const $w=1,Yw={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Ql=class md{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),Ui.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new Es(null),this.rootWheelEvent=new ln(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...md.defaultEventFeatures},{set:(e,s,i)=>(s==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=i),e[s]=i,!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,md._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,i=e.length;s<i;s++){const n=e[s],o=this.bootstrapEvent(this.rootPointerEvent,n);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Ui.pointerMoved();const e=this.normalizeToPointerData(t);for(let s=0,i=e.length;s<i;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":"",i=this.normalizeToPointerData(t);for(let n=0,o=i.length;n<o;n++){const h=this.bootstrapEvent(this.rootPointerEvent,i[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,i=e.length;s<i;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,Ui.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;Ui.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;Ui.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 i=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-i.left)*(this.domElement.width/i.width)*n,t.y=(s-i.top)*(this.domElement.height/i.height)*n}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let s=0,i=t.changedTouches.length;s<i;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=$w),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=Yw[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}};Ql.extension={name:"events",type:[Y.RendererSystem,Y.CanvasRendererSystem]},Ql.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let Jl=Ql;Z.add(Jl);function om(r){return r==="dynamic"||r==="static"}const Hw={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??om(Jl.defaultEventMode)},set interactive(r){at("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=r,this.eventMode=r?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Jl.defaultEventMode},set eventMode(r){this._internalInteractive=om(r),this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,t,e){const s=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,i=typeof e=="object"?e.signal:void 0,n=typeof e=="object"?e.once===!0:!1,o=typeof t=="function"?void 0:t;r=s?`${r}capture`:r;const h=typeof t=="function"?t:t.handleEvent,a=this;i&&i.addEventListener("abort",()=>{a.off(r,h,o)}),n?a.once(r,h,o):a.on(r,h,o)},removeEventListener(r,t,e){const s=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,i=typeof t=="function"?void 0:t;r=s?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.off(r,t,i)},dispatchEvent(r){if(!(r instanceof ha))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}};Ut.mixin(Hw);const Ww={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Ut.mixin(Ww);const zw=9,Ro=100,jw=0,qw=0,hm=2,lm=1,Kw=-1e3,Zw=-1e3,Qw=2;class cm{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,(di.tablet||di.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${Ro}px`,e.style.height=`${Ro}px`,e.style.position="absolute",e.style.top=`${jw}px`,e.style.left=`${qw}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=`${lm}px`,t.style.height=`${lm}px`,t.style.position="absolute",t.style.top=`${Kw}px`,t.style.left=`${Zw}px`,t.style.zIndex=Qw.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(di.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:i,height:n}=this.renderer.view.getBoundingClientRect(),{width:o,height:h,resolution:a}=this.renderer,l=i/o*a,c=n/h*a;let d=this.div;d.style.left=`${e}px`,d.style.top=`${s}px`,d.style.width=`${o}px`,d.style.height=`${h}px`;for(let u=0;u<this.children.length;u++){const f=this.children[u];if(f.renderId!==this.renderId)f._accessibleActive=!1,rn(this.children,u,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,u--;else{d=f._accessibleDiv;let p=f.hitArea;const m=f.worldTransform;f.hitArea?(d.style.left=`${(m.tx+p.x*m.a)*l}px`,d.style.top=`${(m.ty+p.y*m.d)*c}px`,d.style.width=`${p.width*m.a*l}px`,d.style.height=`${p.height*m.d*c}px`):(p=f.getBounds(),this.capHitArea(p),d.style.left=`${p.x*l}px`,d.style.top=`${p.y*c}px`,d.style.width=`${p.width*l}px`,d.style.height=`${p.height*c}px`,d.title!==f.accessibleTitle&&f.accessibleTitle!==null&&(d.title=f.accessibleTitle),d.getAttribute("aria-label")!==f.accessibleHint&&f.accessibleHint!==null&&d.setAttribute("aria-label",f.accessibleHint)),(f.accessibleTitle!==d.title||f.tabIndex!==d.tabIndex)&&(d.title=f.accessibleTitle,d.tabIndex=f.tabIndex,this.debug&&this.updateDebugHTML(d))}}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=`${Ro}px`,e.style.height=`${Ro}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,i=this.renderer.events.rootBoundary,n=Object.assign(new ha(i),{target:s});i.rootTarget=this.renderer.lastObjectRendered,e.forEach(o=>i.dispatchEvent(n,o))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode===zw&&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}}cm.extension={name:"accessibility",type:[Y.RendererPlugin,Y.CanvasRendererPlugin]},Z.add(cm);const um=class gd{constructor(t){this.stage=new Bt,t=Object.assign({forceCanvas:!1},t),this.renderer=lw(t),gd._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=gd._plugins.slice(0);s.reverse(),s.forEach(i=>{i.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};um._plugins=[];let Jw=um;Z.handleByList(Y.Application,Jw._plugins);class dm{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:i,clientHeight:n}=this._resizeTo;e=i,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}}dm.extension=Y.Application,Z.add(dm);const fm={loader:Y.LoadParser,resolver:Y.ResolveParser,cache:Y.CacheParser,detection:Y.DetectionParser};Z.handle(Y.Asset,r=>{const t=r.ref;Object.entries(fm).filter(([e])=>!!t[e]).forEach(([e,s])=>Z.add(Object.assign(t[e],{extension:t[e].extension??s})))},r=>{const t=r.ref;Object.keys(fm).filter(e=>!!t[e]).forEach(e=>Z.remove(t[e]))});class tE{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 cn(r,t){if(Array.isArray(t)){for(const e of t)if(r.startsWith(`data:${e}`))return!0;return!1}return r.startsWith(`data:${t}`)}function Le(r,t){const e=r.split("?")[0],s=vt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(s):s===t}const Ts=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(s=>typeof s=="string"||e?t(s):s):r),tc=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};function pm(r,t,e,s,i){const n=t[e];for(let o=0;o<n.length;o++){const h=n[o];e<t.length-1?pm(r.replace(s[e],h),t,e+1,s,i):i.push(r.replace(s[e],h))}}function eE(r){const t=/\{(.*?)\}/g,e=r.match(t),s=[];if(e){const i=[];e.forEach(n=>{const o=n.substring(1,n.length-1).split(",");i.push(o)}),pm(r,i,0,e,s)}else s.push(r);return s}const Mo=r=>!Array.isArray(r);class sE{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=Ts(t);let i;for(let h=0;h<this.parsers.length;h++){const a=this.parsers[h];if(a.test(e)){i=a.getCacheableAssets(s,e);break}}i||(i={},s.forEach(h=>{i[h]=e}));const n=Object.keys(i),o={cacheKeys:n,keys:s};if(s.forEach(h=>{this._cacheMap.set(h,o)}),n.forEach(h=>{this._cache.has(h)&&this._cache.get(h)!==e&&console.warn("[Cache] already has key:",h),this._cache.set(h,i[h])}),e instanceof q){const h=e;s.forEach(a=>{h.baseTexture!==q.EMPTY.baseTexture&&et.addToCache(h.baseTexture,a),q.addToCache(h,a)})}}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 Tr=new sE;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 o,h;let i=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 a=0;a<this.parsers.length;a++){const l=this.parsers[a];if(l.load&&((o=l.test)!=null&&o.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}i=await n.load(t,e,this),s.parser=n;for(let a=0;a<this.parsers.length;a++){const l=this.parsers[a];l.parse&&l.parse&&await((h=l.testParse)==null?void 0:h.call(l,i,e,this))&&(i=await l.parse(i,e,this)||i,s.parser=l)}return i})(),s}async load(t,e){this._parsersValidated||this._validateParsers();let s=0;const i={},n=Mo(t),o=Ts(t,l=>({alias:[l],src:l})),h=o.length,a=o.map(async l=>{const c=vt.toAbsolute(l.src);if(!i[l.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,l)),i[l.src]=await this.promiseCache[c].promise,e&&e(++s/h)}catch(d){throw delete this.promiseCache[c],delete i[l.src],new Error(`[Loader.load] Failed to load ${c}.
|
|
867
|
+
${d}`)}});return await Promise.all(a),n?i[o[0].src]:i}async unload(t){const e=Ts(t,s=>({alias:[s],src:s})).map(async s=>{var o,h;const i=vt.toAbsolute(s.src),n=this.promiseCache[i];if(n){const a=await n.promise;delete this.promiseCache[i],(h=(o=n.parser)==null?void 0:o.unload)==null||h.call(o,a,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=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(Ne||{});const rE=".json",nE="application/json",aE={extension:{type:Y.LoadParser,priority:Ne.Low},name:"loadJson",test(r){return cn(r,nE)||Le(r,rE)},async load(r){return await(await z.ADAPTER.fetch(r)).json()}};Z.add(aE);const oE=".txt",hE="text/plain",lE={name:"loadTxt",extension:{type:Y.LoadParser,priority:Ne.Low},test(r){return cn(r,hE)||Le(r,oE)},async load(r){return await(await z.ADAPTER.fetch(r)).text()}};Z.add(lE);const cE=["normal","bold","100","200","300","400","500","600","700","800","900"],uE=[".ttf",".otf",".woff",".woff2"],dE=["font/ttf","font/otf","font/woff","font/woff2"],fE=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function pE(r){const t=vt.extname(r),e=vt.basename(r,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(fE)){s=!1;break}let i=e.join(" ");return s||(i=`"${i.replace(/[\\"]/g,"\\$&")}"`),i}const mE=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function gE(r){return mE.test(r)?r:encodeURI(r)}const _E={extension:{type:Y.LoadParser,priority:Ne.Low},name:"loadWebFont",test(r){return cn(r,dE)||Le(r,uE)},async load(r,t){var s,i,n;const e=z.ADAPTER.getFontFaceSet();if(e){const o=[],h=((s=t.data)==null?void 0:s.family)??pE(r),a=((n=(i=t.data)==null?void 0:i.weights)==null?void 0:n.filter(c=>cE.includes(c)))??["normal"],l=t.data??{};for(let c=0;c<a.length;c++){const d=a[c],u=new FontFace(h,`url(${gE(r)})`,{...l,weight:d});await u.load(),e.add(u),o.push(u)}return o.length===1?o[0]:o}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(r){(Array.isArray(r)?r:[r]).forEach(t=>z.ADAPTER.getFontFaceSet().delete(t))}};Z.add(_E);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 @@ ${d}`)}});return await Promise.all(h),n?r[a[0].src]:r}async unload(t){const e=Xe
|
|
|
881
881
|
self.postMessage(result);
|
|
882
882
|
});
|
|
883
883
|
})();
|
|
884
|
-
`;let
|
|
884
|
+
`;let un=null,ec=class{constructor(){un||(un=URL.createObjectURL(new Blob([xE],{type:"application/javascript"}))),this.worker=new Worker(un)}};ec.revokeObjectURL=function(){un&&(URL.revokeObjectURL(un),un=null)};const yE=`(function() {
|
|
885
885
|
"use strict";
|
|
886
886
|
async function loadImageBitmap(url) {
|
|
887
887
|
const response = await fetch(url);
|
|
@@ -907,8 +907,8 @@ ${d}`)}});return await Promise.all(h),n?r[a[0].src]:r}async unload(t){const e=Xe
|
|
|
907
907
|
}
|
|
908
908
|
};
|
|
909
909
|
})();
|
|
910
|
-
`;let
|
|
911
|
-
Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),a.push({alias:t,src:e,data:i,format:r,loadParser:n})):Array.isArray(t)?a.push(...t):a.push(t);let o;o=h=>{this.hasKey(h)&&console.warn(`[Resolver] already has key: ${h} overwriting`)},Xe(a).forEach(h=>{const{src:l,srcs:c}=h;let{data:d,format:u,loadParser:f}=h;const p=Xe(l||c).map(y=>typeof y=="string"?g1(y):Array.isArray(y)?y:[y]),m=this.getAlias(h);Array.isArray(m)?m.forEach(o):o(m);const _=[];p.forEach(y=>{y.forEach(v=>{let g={};if(typeof v!="object"){g.src=v;for(let x=0;x<this._parsers.length;x++){const b=this._parsers[x];if(b.test(v)){g=b.parse(v);break}}}else d=v.data??d,u=v.format??u,f=v.loadParser??f,g={...g,...v};if(!m)throw new Error(`[Resolver] alias is undefined for this asset: ${g.src}`);g=this.buildResolvedAsset(g,{aliases:m,data:d,format:u,loadParser:f}),_.push(g)})}),m.forEach(y=>{this._assetMap[y]=_})})}resolveBundle(t){const e=Sa(t);t=Xe(t);const i={};return t.forEach(r=>{const n=this._bundles[r];if(n){const a=this.resolve(n),o={};for(const h in a){const l=a[h];o[this._extractAssetIdFromBundle(r,h)]=l}i[r]=o}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const r in e)i[r]=e[r].src;return i}return e.src}resolve(t){const e=Sa(t);t=Xe(t);const i={};return t.forEach(r=>{if(!this._resolverHash[r])if(this._assetMap[r]){let n=this._assetMap[r];const a=n[0],o=this._getPreferredOrder(n);o==null||o.priority.forEach(h=>{o.params[h].forEach(l=>{const c=n.filter(d=>d[h]?d[h]===l:!1);c.length&&(n=c)})}),this._resolverHash[r]=n[0]??a}else this._resolverHash[r]=this.buildResolvedAsset({alias:[r],src:r},{});i[r]=this._resolverHash[r]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const i=t[0],r=this._preferredOrder.find(n=>n.params.format.includes(i.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:i,data:r,loadParser:n,format:a}=e;return(this._basePath||this._rootPath)&&(t.src=Ft.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??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??Ft.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class Y1{constructor(){this._detections=[],this._initialized=!1,this.resolver=new z1,this.loader=new x1,this.cache=As,this._backgroundLoader=new _1(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 o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}const e=((n=t.texturePreference)==null?void 0:n.resolution)??1,i=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:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,i,r,n){this.resolver.add(t,e,i,r,n)}async load(t,e){this._initialized||await this.init();const i=Sa(t),r=Xe(t).map(o=>{if(typeof o!="string"){const h=this.resolver.getAlias(o);return h.some(l=>!this.resolver.hasKey(l))&&this.add(o),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(o)||this.add({alias:o,src:o}),o}),n=this.resolver.resolve(r),a=await this._mapLoadToResolve(n,e);return i?a[r[0]]:a}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);const r=this.resolver.resolveBundle(t),n={},a=Object.keys(r);let o=0,h=0;const l=()=>{e==null||e(++o/h)},c=a.map(d=>{const u=r[d];return h+=Object.keys(u).length,this._mapLoadToResolve(u,l).then(f=>{n[d]=f})});return await Promise.all(c),i?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return As.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=As.get(t[i]);return e}async _mapLoadToResolve(t,e){const i=Object.values(t),r=Object.keys(t);this._backgroundLoader.active=!1;const n=await this.loader.load(i,e);this._backgroundLoader.active=!0;const a={};return i.forEach((o,h)=>{const l=n[o.src],c=[o.src];o.alias&&c.push(...o.alias),a[r[h]]=l,As.set(c,l)}),a}async unload(t){this._initialized||await this.init();const e=Xe(t).map(r=>typeof r!="string"?r.src:r),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Xe(t);const e=this.resolver.resolveBundle(t),i=Object.keys(e).map(r=>this._unloadFromResolved(e[r]));await Promise.all(i)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(i=>{As.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,r)=>e.indexOf(i)===r),e}get detections(){return this._detections}get preferWorkers(){return Ca.config.preferWorkers}set preferWorkers(t){it("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(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}}const qi=new Y1;z.handleByList(G.LoadParser,qi.loader.parsers).handleByList(G.ResolveParser,qi.resolver.parsers).handleByList(G.CacheParser,qi.cache.parsers).handleByList(G.DetectionParser,qi.detections);const j1={extension:G.CacheParser,test:s=>Array.isArray(s)&&s.every(t=>t instanceof X),getCacheableAssets:(s,t)=>{const e={};return s.forEach(i=>{t.forEach((r,n)=>{e[i+(n===0?"":n+1)]=r})}),e}};z.add(j1);async function tp(s){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=s});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(s)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const q1={extension:{type:G.DetectionParser,priority:1},test:async()=>tp("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async s=>[...s,"avif"],remove:async s=>s.filter(t=>t!=="avif")};z.add(q1);const K1={extension:{type:G.DetectionParser,priority:0},test:async()=>tp("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async s=>[...s,"webp"],remove:async s=>s.filter(t=>t!=="webp")};z.add(K1);const ep=["png","jpg","jpeg"],Z1={extension:{type:G.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async s=>[...s,...ep],remove:async s=>s.filter(t=>!ep.includes(t))};z.add(Z1);const Q1="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function sl(s){return Q1?!1:document.createElement("video").canPlayType(s)!==""}const J1={extension:{type:G.DetectionParser,priority:0},test:async()=>sl("video/webm"),add:async s=>[...s,"webm"],remove:async s=>s.filter(t=>t!=="webm")};z.add(J1);const tb={extension:{type:G.DetectionParser,priority:0},test:async()=>sl("video/mp4"),add:async s=>[...s,"mp4","m4v"],remove:async s=>s.filter(t=>t!=="mp4"&&t!=="m4v")};z.add(tb);const eb={extension:{type:G.DetectionParser,priority:0},test:async()=>sl("video/ogg"),add:async s=>[...s,"ogv"],remove:async s=>s.filter(t=>t!=="ogv")};z.add(eb);const ib={extension:G.ResolveParser,test:Ca.test,parse:s=>{var t;return{resolution:parseFloat(((t=H.RETINA_PREFIX.exec(s))==null?void 0:t[1])??"1"),format:Ft.extname(s).slice(1),src:s}}};z.add(ib);var Qt=(s=>(s[s.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",s[s.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",s[s.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",s[s.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",s[s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",s[s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",s[s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",s[s.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",s[s.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",s[s.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",s[s.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",s[s.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",s[s.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",s[s.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",s[s.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",s[s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",s[s.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",s[s.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",s[s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",s[s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",s[s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",s[s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",s[s.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",s[s.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",s[s.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",s[s.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",s[s.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",s[s.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",s[s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",s[s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",s[s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",s))(Qt||{});const Pa={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 hi,ur;function ip(){ur={bptc:hi.getExtension("EXT_texture_compression_bptc"),astc:hi.getExtension("WEBGL_compressed_texture_astc"),etc:hi.getExtension("WEBGL_compressed_texture_etc"),s3tc:hi.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:hi.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:hi.getExtension("WEBGL_compressed_texture_pvrtc")||hi.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:hi.getExtension("WEBGL_compressed_texture_etc1"),atc:hi.getExtension("WEBGL_compressed_texture_atc")}}const sb={extension:{type:G.DetectionParser,priority:2},test:async()=>{const s=H.ADAPTER.createCanvas().getContext("webgl");return s?(hi=s,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async s=>{ur||ip();const t=[];for(const e in ur)ur[e]&&t.push(e);return[...t,...s]},remove:async s=>(ur||ip(),s.filter(t=>!(t in ur)))};z.add(sb);class rb extends ia{constructor(t,e={width:1,height:1,autoLoad:!0}){let i,r;typeof t=="string"?(i=t,r=new Uint8Array):(i=null,r=t),super(r,e),this.origin=i,this.buffer=r?new wh(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 wh(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class Ss extends rb{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=Ss._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||Ss._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,i){const r=t.gl;if(!t.context.extensions[this._extension])throw new Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;r.pixelStorei(r.UNPACK_ALIGNMENT,4);for(let n=0,a=this.levels;n<a;n++){const{levelID:o,levelWidth:h,levelHeight:l,levelBuffer:c}=this._levelBuffers[n];r.compressedTexImage2D(r.TEXTURE_2D,o,this.format,h,l,0,c)}return!0}onBlobLoaded(){this._levelBuffers=Ss._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,i,r,n,a,o){const h=new Array(i);let l=t.byteOffset,c=a,d=o,u=c+r-1&~(r-1),f=d+n-1&~(n-1),p=u*f*Pa[e];for(let m=0;m<i;m++)h[m]={levelID:m,levelWidth:i>1?c:u,levelHeight:i>1?d:f,levelBuffer:new Uint8Array(t.buffer,l,p)},l+=p,c=c>>1||1,d=d>>1||1,u=c+r-1&~(r-1),f=d+n-1&~(n-1),p=u*f*Pa[e];return h}}const rl=4,Ra=124,nb=32,sp=20,ab=542327876,Ia={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},ob={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},Ma={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},hb=1,lb=2,cb=4,ub=64,db=512,fb=131072,pb=827611204,mb=861165636,_b=894720068,gb=808540228,yb=4,xb={[pb]:Qt.COMPRESSED_RGBA_S3TC_DXT1_EXT,[mb]:Qt.COMPRESSED_RGBA_S3TC_DXT3_EXT,[_b]:Qt.COMPRESSED_RGBA_S3TC_DXT5_EXT},vb={70:Qt.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Qt.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Qt.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Qt.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Qt.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Qt.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Qt.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Qt.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Qt.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:Qt.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:Qt.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:Qt.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:Qt.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function bb(s){const t=new Uint32Array(s);if(t[0]!==ab)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(s,0,Ra/Uint32Array.BYTES_PER_ELEMENT),i=e[Ia.HEIGHT],r=e[Ia.WIDTH],n=e[Ia.MIPMAP_COUNT],a=new Uint32Array(s,Ia.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,nb/Uint32Array.BYTES_PER_ELEMENT),o=a[hb];if(o&cb){const h=a[ob.FOURCC];if(h!==gb){const v=xb[h],g=rl+Ra,x=new Uint8Array(s,g);return[new Ss(x,{format:v,width:r,height:i,levels:n})]}const l=rl+Ra,c=new Uint32Array(t.buffer,l,sp/Uint32Array.BYTES_PER_ELEMENT),d=c[Ma.DXGI_FORMAT],u=c[Ma.RESOURCE_DIMENSION],f=c[Ma.MISC_FLAG],p=c[Ma.ARRAY_SIZE],m=vb[d];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${d}`);if(f===yb)throw new Error("DDSParser does not support cubemap textures");if(u===6)throw new Error("DDSParser does not supported 3D texture data");const _=new Array,y=rl+Ra+sp;if(p===1)_.push(new Uint8Array(s,y));else{const v=Pa[m];let g=0,x=r,b=i;for(let T=0;T<n;T++){const E=Math.max(1,x+3&-4),A=Math.max(1,b+3&-4),P=E*A*v;g+=P,x=x>>>1,b=b>>>1}let w=y;for(let T=0;T<p;T++)_.push(new Uint8Array(s,w,g)),w+=g}return _.map(v=>new Ss(v,{format:m,width:r,height:i,levels:n}))}throw o&ub?new Error("DDSParser does not support uncompressed texture data."):o&db?new Error("DDSParser does not supported YUV uncompressed texture data."):o&fb?new Error("DDSParser does not support single-channel (lumninance) texture data!"):o&lb?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 rp=[171,75,84,88,32,49,49,187,13,10,26,10],Tb=67305985,$e={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},nl=64,np={[Z.UNSIGNED_BYTE]:1,[Z.UNSIGNED_SHORT]:2,[Z.INT]:4,[Z.UNSIGNED_INT]:4,[Z.FLOAT]:4,[Z.HALF_FLOAT]:8},wb={[O.RGBA]:4,[O.RGB]:3,[O.RG]:2,[O.RED]:1,[O.LUMINANCE]:1,[O.LUMINANCE_ALPHA]:2,[O.ALPHA]:1},Eb={[Z.UNSIGNED_SHORT_4_4_4_4]:2,[Z.UNSIGNED_SHORT_5_5_5_1]:2,[Z.UNSIGNED_SHORT_5_6_5]:2};function Ab(s,t,e=!1){const i=new DataView(t);if(!Sb(s,i))return null;const r=i.getUint32($e.ENDIANNESS,!0)===Tb,n=i.getUint32($e.GL_TYPE,r),a=i.getUint32($e.GL_FORMAT,r),o=i.getUint32($e.GL_INTERNAL_FORMAT,r),h=i.getUint32($e.PIXEL_WIDTH,r),l=i.getUint32($e.PIXEL_HEIGHT,r)||1,c=i.getUint32($e.PIXEL_DEPTH,r)||1,d=i.getUint32($e.NUMBER_OF_ARRAY_ELEMENTS,r)||1,u=i.getUint32($e.NUMBER_OF_FACES,r),f=i.getUint32($e.NUMBER_OF_MIPMAP_LEVELS,r),p=i.getUint32($e.BYTES_OF_KEY_VALUE_DATA,r);if(l===0||c!==1)throw new Error("Only 2D textures are supported");if(u!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(d!==1)throw new Error("WebGL does not support array textures");const m=4,_=4,y=h+3&-4,v=l+3&-4,g=new Array(d);let x=h*l;n===0&&(x=y*v);let b;if(n!==0?np[n]?b=np[n]*wb[a]:b=Eb[n]:b=Pa[o],b===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const w=e?Pb(i,p,r):null;let T=x*b,E=h,A=l,P=y,L=v,M=nl+p;for(let S=0;S<f;S++){const C=i.getUint32(M,r);let R=M+4;for(let N=0;N<d;N++){let F=g[N];F||(F=g[N]=new Array(f)),F[S]={levelID:S,levelWidth:f>1||n!==0?E:P,levelHeight:f>1||n!==0?A:L,levelBuffer:new Uint8Array(t,R,T)},R+=T}M+=C+4,M=M%4!==0?M+4-M%4:M,E=E>>1||1,A=A>>1||1,P=E+m-1&~(m-1),L=A+_-1&~(_-1),T=P*L*b}return n!==0?{uncompressed:g.map(S=>{let C=S[0].levelBuffer,R=!1;return n===Z.FLOAT?C=new Float32Array(S[0].levelBuffer.buffer,S[0].levelBuffer.byteOffset,S[0].levelBuffer.byteLength/4):n===Z.UNSIGNED_INT?(R=!0,C=new Uint32Array(S[0].levelBuffer.buffer,S[0].levelBuffer.byteOffset,S[0].levelBuffer.byteLength/4)):n===Z.INT&&(R=!0,C=new Int32Array(S[0].levelBuffer.buffer,S[0].levelBuffer.byteOffset,S[0].levelBuffer.byteLength/4)),{resource:new ia(C,{width:S[0].levelWidth,height:S[0].levelHeight}),type:n,format:R?Cb(a):a}}),kvData:w}:{compressed:g.map(S=>new Ss(null,{format:o,width:h,height:l,levels:f,levelBuffers:S})),kvData:w}}function Sb(s,t){for(let e=0;e<rp.length;e++)if(t.getUint8(e)!==rp[e])return console.error(`${s} is not a valid *.ktx file!`),!1;return!0}function Cb(s){switch(s){case O.RGBA:return O.RGBA_INTEGER;case O.RGB:return O.RGB_INTEGER;case O.RG:return O.RG_INTEGER;case O.RED:return O.RED_INTEGER;default:return s}}function Pb(s,t,e){const i=new Map;let r=0;for(;r<t;){const n=s.getUint32(nl+r,e),a=nl+r+4,o=3-(n+3)%4;if(n===0||n>t-r){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h<n&&s.getUint8(a+h)!==0;h++);if(h===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const l=new TextDecoder().decode(new Uint8Array(s.buffer,a,h)),c=new DataView(s.buffer,a+h+1,n-h-1);i.set(l,c),r+=4+n+o}return i}const Rb={extension:{type:G.LoadParser,priority:Re.High},name:"loadDDS",test(s){return ji(s,".dds")},async load(s,t,e){const i=await(await H.ADAPTER.fetch(s)).arrayBuffer(),r=bb(i).map(n=>{const a=new J(n,{mipmap:Ke.OFF,alphaMode:he.NO_PREMULTIPLIED_ALPHA,resolution:Pi(s),...t.data});return on(a,e,s)});return r.length===1?r[0]:r},unload(s){Array.isArray(s)?s.forEach(t=>t.destroy(!0)):s.destroy(!0)}};z.add(Rb);const Ib={extension:{type:G.LoadParser,priority:Re.High},name:"loadKTX",test(s){return ji(s,".ktx")},async load(s,t,e){const i=await(await H.ADAPTER.fetch(s)).arrayBuffer(),{compressed:r,uncompressed:n,kvData:a}=Ab(s,i),o=r??n,h={mipmap:Ke.OFF,alphaMode:he.NO_PREMULTIPLIED_ALPHA,resolution:Pi(s),...t.data},l=o.map(c=>{o===n&&Object.assign(h,{type:c.type,format:c.format});const d=c.resource??c,u=new J(d,h);return u.ktxKeyValueData=a,on(u,e,s)});return l.length===1?l[0]:l},unload(s){Array.isArray(s)?s.forEach(t=>t.destroy(!0)):s.destroy(!0)}};z.add(Ib);const Mb=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],Db={extension:G.ResolveParser,test:s=>{const t=Ft.extname(s).slice(1);return["basis","ktx","dds"].includes(t)},parse:s=>{var i,r;const t=s.split("."),e=t.pop();if(["ktx","dds"].includes(e)){const n=t.pop();if(Mb.includes(n))return{resolution:parseFloat(((i=H.RETINA_PREFIX.exec(s))==null?void 0:i[1])??"1"),format:n,src:s}}return{resolution:parseFloat(((r=H.RETINA_PREFIX.exec(s))==null?void 0:r[1])??"1"),format:e,src:s}}};z.add(Db);const Da=new st,Bb=4,ap=class Dn{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,i,r){const n=new Image;return n.src=await this.base64(t,e,i,r),n}async base64(t,e,i,r){const n=this.canvas(t,r);if(n.toBlob!==void 0)return new Promise((a,o)=>{n.toBlob(h=>{if(!h){o(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>a(l.result),l.onerror=o,l.readAsDataURL(h)},e,i)});if(n.toDataURL!==void 0)return n.toDataURL(e,i);if(n.convertToBlob!==void 0){const a=await n.convertToBlob({type:e,quality:i});return new Promise((o,h)=>{const l=new FileReader;l.onload=()=>o(l.result),l.onerror=h,l.readAsDataURL(a)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const{pixels:i,width:r,height:n,flipY:a,premultipliedAlpha:o}=this._rawPixels(t,e);a&&Dn._flipY(i,r,n),o&&Dn._unpremultiplyAlpha(i);const h=new px(r,n,1),l=new ImageData(new Uint8ClampedArray(i.buffer),r,n);return h.context.putImageData(l,0,0),h.canvas}pixels(t,e){const{pixels:i,width:r,height:n,flipY:a,premultipliedAlpha:o}=this._rawPixels(t,e);return a&&Dn._flipY(i,r,n),o&&Dn._unpremultiplyAlpha(i),i}_rawPixels(t,e){const i=this.renderer;if(!i)throw new Error("The Extract has already been destroyed");let r,n=!1,a=!1,o,h=!1;t&&(t instanceof Ts?o=t:(o=i.generateTexture(t,{region:e,resolution:i.resolution,multisample:i.multisample}),h=!0,e&&(Da.width=e.width,Da.height=e.height,e=Da)));const l=i.gl;if(o){if(r=o.baseTexture.resolution,e=e??o.frame,n=!1,a=o.baseTexture.alphaMode>0&&o.baseTexture.format===O.RGBA,!h){i.renderTexture.bind(o);const f=o.framebuffer.glFramebuffers[i.CONTEXT_UID];f.blitFramebuffer&&i.framebuffer.bind(f.blitFramebuffer)}}else r=i.resolution,e||(e=Da,e.width=i.width/r,e.height=i.height/r),n=!0,a=this._rendererPremultipliedAlpha,i.renderTexture.bind();const c=Math.max(Math.round(e.width*r),1),d=Math.max(Math.round(e.height*r),1),u=new Uint8Array(Bb*c*d);return l.readPixels(Math.round(e.x*r),Math.round(e.y*r),c,d,l.RGBA,l.UNSIGNED_BYTE,u),h&&(o==null||o.destroy(!0)),{pixels:u,width:c,height:d,flipY:n,premultipliedAlpha:a}}destroy(){this.renderer=null}static _flipY(t,e,i){const r=e<<2,n=i>>1,a=new Uint8Array(r);for(let o=0;o<n;o++){const h=o*r,l=(i-o-1)*r;a.set(t.subarray(h,h+r)),t.copyWithin(h,l,l+r),t.set(a,l)}}static _unpremultiplyAlpha(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));const e=t.length;for(let i=0;i<e;i+=4){const r=t[i+3];if(r!==0){const n=255.001/r;t[i]=t[i]*n+.5,t[i+1]=t[i+1]*n+.5,t[i+2]=t[i+2]*n+.5}}}};ap.extension={name:"extract",type:G.RendererSystem};let Ob=ap;z.add(Ob);const Ba={build(s){const t=s.points;let e,i,r,n,a,o;if(s.type===Zt.CIRC){const p=s.shape;e=p.x,i=p.y,a=o=p.radius,r=n=0}else if(s.type===Zt.ELIP){const p=s.shape;e=p.x,i=p.y,a=p.width,o=p.height,r=n=0}else{const p=s.shape,m=p.width/2,_=p.height/2;e=p.x+m,i=p.y+_,a=o=Math.max(0,Math.min(p.radius,Math.min(m,_))),r=m-a,n=_-o}if(!(a>=0&&o>=0&&r>=0&&n>=0)){t.length=0;return}const h=Math.ceil(2.3*Math.sqrt(a+o)),l=h*8+(r?4:0)+(n?4:0);if(t.length=l,l===0)return;if(h===0){t.length=8,t[0]=t[6]=e+r,t[1]=t[3]=i+n,t[2]=t[4]=e-r,t[5]=t[7]=i-n;return}let c=0,d=h*4+(r?2:0)+2,u=d,f=l;{const p=r+a,m=n,_=e+p,y=e-p,v=i+m;if(t[c++]=_,t[c++]=v,t[--d]=v,t[--d]=y,n){const g=i-m;t[u++]=y,t[u++]=g,t[--f]=g,t[--f]=_}}for(let p=1;p<h;p++){const m=Math.PI/2*(p/h),_=r+Math.cos(m)*a,y=n+Math.sin(m)*o,v=e+_,g=e-_,x=i+y,b=i-y;t[c++]=v,t[c++]=x,t[--d]=x,t[--d]=g,t[u++]=g,t[u++]=b,t[--f]=b,t[--f]=v}{const p=r,m=n+o,_=e+p,y=e-p,v=i+m,g=i-m;t[c++]=_,t[c++]=v,t[--f]=g,t[--f]=_,r&&(t[c++]=y,t[c++]=v,t[--f]=g,t[--f]=y)}},triangulate(s,t){const e=s.points,i=t.points,r=t.indices;if(e.length===0)return;let n=i.length/2;const a=n;let o,h;if(s.type!==Zt.RREC){const c=s.shape;o=c.x,h=c.y}else{const c=s.shape;o=c.x+c.width/2,h=c.y+c.height/2}const l=s.matrix;i.push(s.matrix?l.a*o+l.c*h+l.tx:o,s.matrix?l.b*o+l.d*h+l.ty:h),n++,i.push(e[0],e[1]);for(let c=2;c<e.length;c+=2)i.push(e[c],e[c+1]),r.push(n++,a,n);r.push(a+1,a,n)}};function op(s,t=!1){const e=s.length;if(e<6)return;let i=0;for(let r=0,n=s[e-2],a=s[e-1];r<e;r+=2){const o=s[r],h=s[r+1];i+=(o-n)*(h+a),n=o,a=h}if(!t&&i>0||t&&i<=0){const r=e/2;for(let n=r+r%2;n<e;n+=2){const a=e-n-2,o=e-n-1,h=n,l=n+1;[s[a],s[h]]=[s[h],s[a]],[s[o],s[l]]=[s[l],s[o]]}}}const hp={build(s){s.points=s.shape.points.slice()},triangulate(s,t){let e=s.points;const i=s.holes,r=t.points,n=t.indices;if(e.length>=6){op(e,!1);const a=[];for(let l=0;l<i.length;l++){const c=i[l];op(c.points,!0),a.push(e.length/2),e=e.concat(c.points)}const o=j_(e,a,2);if(!o)return;const h=r.length/2;for(let l=0;l<o.length;l+=3)n.push(o[l]+h),n.push(o[l+1]+h),n.push(o[l+2]+h);for(let l=0;l<e.length;l++)r.push(e[l])}}},Fb={build(s){const t=s.shape,e=t.x,i=t.y,r=t.width,n=t.height,a=s.points;a.length=0,r>=0&&n>=0&&a.push(e,i,e+r,i,e+r,i+n,e,i+n)},triangulate(s,t){const e=s.points,i=t.points;if(e.length===0)return;const r=i.length/2;i.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)}},Lb={build(s){Ba.build(s)},triangulate(s,t){Ba.triangulate(s,t)}};var Ie=(s=>(s.MITER="miter",s.BEVEL="bevel",s.ROUND="round",s))(Ie||{}),Ki=(s=>(s.BUTT="butt",s.ROUND="round",s.SQUARE="square",s))(Ki||{});const dr={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(s,t=20){if(!this.adaptive||!s||isNaN(s))return t;let e=Math.ceil(s/this.maxLength);return e<this.minSegments?e=this.minSegments:e>this.maxSegments&&(e=this.maxSegments),e}};class lp{static curveTo(t,e,i,r,n,a){const o=a[a.length-2],h=a[a.length-1]-e,l=o-t,c=r-e,d=i-t,u=Math.abs(h*d-l*c);if(u<1e-8||n===0)return(a[a.length-2]!==t||a[a.length-1]!==e)&&a.push(t,e),null;const f=h*h+l*l,p=c*c+d*d,m=h*c+l*d,_=n*Math.sqrt(f)/u,y=n*Math.sqrt(p)/u,v=_*m/f,g=y*m/p,x=_*d+y*l,b=_*c+y*h,w=l*(y+v),T=h*(y+v),E=d*(_+g),A=c*(_+g),P=Math.atan2(T-b,w-x),L=Math.atan2(A-b,E-x);return{cx:x+t,cy:b+e,radius:n,startAngle:P,endAngle:L,anticlockwise:l*c>d*h}}static arc(t,e,i,r,n,a,o,h,l){const c=o-a,d=dr._segmentsCount(Math.abs(c)*n,Math.ceil(Math.abs(c)/ra)*40),u=c/(d*2),f=u*2,p=Math.cos(u),m=Math.sin(u),_=d-1,y=_%1/_;for(let v=0;v<=_;++v){const g=v+y*v,x=u+a+f*g,b=Math.cos(x),w=-Math.sin(x);l.push((p*b+m*w)*n+i,(p*-w+m*b)*n+r)}}}class kb{constructor(){this.reset()}begin(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i}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 al{static curveLength(t,e,i,r,n,a,o,h){let l=0,c=0,d=0,u=0,f=0,p=0,m=0,_=0,y=0,v=0,g=0,x=t,b=e;for(let w=1;w<=10;++w)c=w/10,d=c*c,u=d*c,f=1-c,p=f*f,m=p*f,_=m*t+3*p*c*i+3*f*d*n+u*o,y=m*e+3*p*c*r+3*f*d*a+u*h,v=x-_,g=b-y,x=_,b=y,l+=Math.sqrt(v*v+g*g);return l}static curveTo(t,e,i,r,n,a,o){const h=o[o.length-2],l=o[o.length-1];o.length-=2;const c=dr._segmentsCount(al.curveLength(h,l,t,e,i,r,n,a));let d=0,u=0,f=0,p=0,m=0;o.push(h,l);for(let _=1,y=0;_<=c;++_)y=_/c,d=1-y,u=d*d,f=u*d,p=y*y,m=p*y,o.push(f*h+3*u*y*t+3*d*p*i+m*n,f*l+3*u*y*e+3*d*p*r+m*a)}}function cp(s,t,e,i,r,n,a,o){const h=s-e*r,l=t-i*r,c=s+e*n,d=t+i*n;let u,f;a?(u=i,f=-e):(u=-i,f=e);const p=h+u,m=l+f,_=c+u,y=d+f;return o.push(p,m,_,y),2}function Cs(s,t,e,i,r,n,a,o){const h=e-s,l=i-t;let c=Math.atan2(h,l),d=Math.atan2(r-s,n-t);o&&c<d?c+=Math.PI*2:!o&&c>d&&(d+=Math.PI*2);let u=c;const f=d-c,p=Math.abs(f),m=Math.sqrt(h*h+l*l),_=(15*p*Math.sqrt(m)/Math.PI>>0)+1,y=f/_;if(u+=y,o){a.push(s,t,e,i);for(let v=1,g=u;v<_;v++,g+=y)a.push(s,t,s+Math.sin(g)*m,t+Math.cos(g)*m);a.push(s,t,r,n)}else{a.push(e,i,s,t);for(let v=1,g=u;v<_;v++,g+=y)a.push(s+Math.sin(g)*m,t+Math.cos(g)*m,s,t);a.push(r,n,s,t)}return _*2}function Nb(s,t){const e=s.shape;let i=s.points||e.points.slice();const r=t.closePointEps;if(i.length===0)return;const n=s.lineStyle,a=new tt(i[0],i[1]),o=new tt(i[i.length-2],i[i.length-1]),h=e.type!==Zt.POLY||e.closeStroke,l=Math.abs(a.x-o.x)<r&&Math.abs(a.y-o.y)<r;if(h){i=i.slice(),l&&(i.pop(),i.pop(),o.set(i[i.length-2],i[i.length-1]));const F=(a.x+o.x)*.5,B=(o.y+a.y)*.5;i.unshift(F,B),i.push(F,B)}const c=t.points,d=i.length/2;let u=i.length;const f=c.length/2,p=n.width/2,m=p*p,_=n.miterLimit*n.miterLimit;let y=i[0],v=i[1],g=i[2],x=i[3],b=0,w=0,T=-(v-x),E=y-g,A=0,P=0,L=Math.sqrt(T*T+E*E);T/=L,E/=L,T*=p,E*=p;const M=n.alignment,S=(1-M)*2,C=M*2;h||(n.cap===Ki.ROUND?u+=Cs(y-T*(S-C)*.5,v-E*(S-C)*.5,y-T*S,v-E*S,y+T*C,v+E*C,c,!0)+2:n.cap===Ki.SQUARE&&(u+=cp(y,v,T,E,S,C,!0,c))),c.push(y-T*S,v-E*S,y+T*C,v+E*C);for(let F=1;F<d-1;++F){y=i[(F-1)*2],v=i[(F-1)*2+1],g=i[F*2],x=i[F*2+1],b=i[(F+1)*2],w=i[(F+1)*2+1],T=-(v-x),E=y-g,L=Math.sqrt(T*T+E*E),T/=L,E/=L,T*=p,E*=p,A=-(x-w),P=g-b,L=Math.sqrt(A*A+P*P),A/=L,P/=L,A*=p,P*=p;const B=g-y,W=v-x,I=g-b,D=w-x,$=B*I+W*D,Y=W*I-D*B,U=Y<0;if(Math.abs(Y)<.001*Math.abs($)){c.push(g-T*S,x-E*S,g+T*C,x+E*C),$>=0&&(n.join===Ie.ROUND?u+=Cs(g,x,g-T*S,x-E*S,g-A*S,x-P*S,c,!1)+4:u+=2,c.push(g-A*C,x-P*C,g+A*S,x+P*S));continue}const rt=(-T+y)*(-E+x)-(-T+g)*(-E+v),dt=(-A+b)*(-P+x)-(-A+g)*(-P+w),lt=(B*dt-I*rt)/Y,vt=(D*rt-W*dt)/Y,Dt=(lt-g)*(lt-g)+(vt-x)*(vt-x),kt=g+(lt-g)*S,_t=x+(vt-x)*S,Bt=g-(lt-g)*C,wt=x-(vt-x)*C,me=Math.min(B*B+W*W,I*I+D*D),Ae=U?S:C,cs=me+Ae*Ae*m,Mr=Dt<=cs;let us=n.join;if(us===Ie.MITER&&Dt/m>_&&(us=Ie.BEVEL),Mr)switch(us){case Ie.MITER:{c.push(kt,_t,Bt,wt);break}case Ie.BEVEL:{U?c.push(kt,_t,g+T*C,x+E*C,kt,_t,g+A*C,x+P*C):c.push(g-T*S,x-E*S,Bt,wt,g-A*S,x-P*S,Bt,wt),u+=2;break}case Ie.ROUND:{U?(c.push(kt,_t,g+T*C,x+E*C),u+=Cs(g,x,g+T*C,x+E*C,g+A*C,x+P*C,c,!0)+4,c.push(kt,_t,g+A*C,x+P*C)):(c.push(g-T*S,x-E*S,Bt,wt),u+=Cs(g,x,g-T*S,x-E*S,g-A*S,x-P*S,c,!1)+4,c.push(g-A*S,x-P*S,Bt,wt));break}}else{switch(c.push(g-T*S,x-E*S,g+T*C,x+E*C),us){case Ie.MITER:{U?c.push(Bt,wt,Bt,wt):c.push(kt,_t,kt,_t),u+=2;break}case Ie.ROUND:{U?u+=Cs(g,x,g+T*C,x+E*C,g+A*C,x+P*C,c,!0)+2:u+=Cs(g,x,g-T*S,x-E*S,g-A*S,x-P*S,c,!1)+2;break}}c.push(g-A*S,x-P*S,g+A*C,x+P*C),u+=2}}y=i[(d-2)*2],v=i[(d-2)*2+1],g=i[(d-1)*2],x=i[(d-1)*2+1],T=-(v-x),E=y-g,L=Math.sqrt(T*T+E*E),T/=L,E/=L,T*=p,E*=p,c.push(g-T*S,x-E*S,g+T*C,x+E*C),h||(n.cap===Ki.ROUND?u+=Cs(g-T*(S-C)*.5,x-E*(S-C)*.5,g-T*S,x-E*S,g+T*C,x+E*C,c,!1)+2:n.cap===Ki.SQUARE&&(u+=cp(g,x,T,E,S,C,!1,c)));const R=t.indices,N=dr.epsilon*dr.epsilon;for(let F=f;F<u+f-2;++F)y=c[F*2],v=c[F*2+1],g=c[(F+1)*2],x=c[(F+1)*2+1],b=c[(F+2)*2],w=c[(F+2)*2+1],!(Math.abs(y*(x-w)+g*(w-v)+b*(v-x))<N)&&R.push(F,F+1,F+2)}function Ub(s,t){let e=0;const i=s.shape,r=s.points||i.points,n=i.type!==Zt.POLY||i.closeStroke;if(r.length===0)return;const a=t.points,o=t.indices,h=r.length/2,l=a.length/2;let c=l;for(a.push(r[0],r[1]),e=1;e<h;e++)a.push(r[e*2],r[e*2+1]),o.push(c,c+1),c++;n&&o.push(c,l)}function up(s,t){s.lineStyle.native?Ub(s,t):Nb(s,t)}class ol{static curveLength(t,e,i,r,n,a){const o=t-2*i+n,h=e-2*r+a,l=2*i-2*t,c=2*r-2*e,d=4*(o*o+h*h),u=4*(o*l+h*c),f=l*l+c*c,p=2*Math.sqrt(d+u+f),m=Math.sqrt(d),_=2*d*m,y=2*Math.sqrt(f),v=u/m;return(_*p+m*u*(p-y)+(4*f*d-u*u)*Math.log((2*m+v+p)/(v+y)))/(4*_)}static curveTo(t,e,i,r,n){const a=n[n.length-2],o=n[n.length-1],h=dr._segmentsCount(ol.curveLength(a,o,t,e,i,r));let l=0,c=0;for(let d=1;d<=h;++d){const u=d/h;l=a+(t-a)*u,c=o+(e-o)*u,n.push(l+(t+(i-t)*u-l)*u,c+(e+(r-e)*u-c)*u)}}}const hl={[Zt.POLY]:hp,[Zt.CIRC]:Ba,[Zt.ELIP]:Ba,[Zt.RECT]:Fb,[Zt.RREC]:Lb},dp=[],Oa=[];class Fa{constructor(t,e=null,i=null,r=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type}clone(){return new Fa(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 fr=new tt,fp=class E_ extends Xd{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 wa,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(),Oa.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),dp.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,i=null,r=null){const n=new Fa(t,e,i,r);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const i=new Fa(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),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 i=0;i<e.length;++i){const r=e[i];if(r.fillStyle.visible&&r.shape&&(r.matrix?r.matrix.applyInverse(t,fr):fr.copyFrom(t),r.shape.contains(fr.x,fr.y))){let n=!1;if(r.holes){for(let a=0;a<r.holes.length;a++)if(r.holes[a].shape.contains(fr.x,fr.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 i=null,r=null;this.batches.length>0&&(i=this.batches[this.batches.length-1],r=i.style);for(let h=this.shapeIndex;h<e.length;h++){this.shapeIndex++;const l=e[h],c=l.fillStyle,d=l.lineStyle;hl[l.type].build(l),l.matrix&&this.transformPoints(l.points,l.matrix),(c.visible||d.visible)&&this.processHoles(l.holes);for(let u=0;u<2;u++){const f=u===0?c:d;if(!f.visible)continue;const p=f.texture.baseTexture,m=this.indices.length,_=this.points.length/2;p.wrapMode=Ui.REPEAT,u===0?this.processFill(l):this.processLine(l);const y=this.points.length/2-_;y!==0&&(i&&!this._compareStyles(r,f)&&(i.end(m,_),i=null),i||(i=dp.pop()||new kb,i.begin(f,m,_),this.batches.push(i),r=f),this.addUvs(this.points,t,f.texture,_,y,f.matrix))}}const n=this.indices.length,a=this.points.length/2;if(i&&i.end(n,a),this.batches.length===0){this.batchable=!0;return}const o=a>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&o===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=o?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(t,e){return!(!t||!e||t.texture.baseTexture!==e.texture.baseTexture||t.color+t.alpha!==e.color+e.alpha||!!t.native!=!!e.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let t=0,e=this.graphicsData.length;t<e;t++){const i=this.graphicsData[t],r=i.fillStyle,n=i.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,i=t.length;e<i;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<E_.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++J._globalBatch;for(let d=0;d<this.drawCalls.length;d++)this.drawCalls[d].texArray.clear(),Oa.push(this.drawCalls[d]);this.drawCalls.length=0;const e=this.colors,i=this.textureIds;let r=Oa.pop();r||(r=new Dh,r.texArray=new Nh),r.texArray.count=0,r.start=0,r.size=0,r.type=Ue.TRIANGLES;let n=0,a=null,o=0,h=!1,l=Ue.TRIANGLES,c=0;this.drawCalls.push(r);for(let d=0;d<this.batches.length;d++){const u=this.batches[d],f=8,p=u.style,m=p.texture.baseTexture;h!==!!p.native&&(h=!!p.native,l=h?Ue.LINES:Ue.TRIANGLES,a=null,n=f,t++),a!==m&&(a=m,m._batchEnabled!==t&&(n===f&&(t++,n=0,r.size>0&&(r=Oa.pop(),r||(r=new Dh,r.texArray=new Nh),this.drawCalls.push(r)),r.start=c,r.size=0,r.texArray.count=0,r.type=l),m.touched=1,m._batchEnabled=t,m._batchLocation=n,m.wrapMode=Ui.REPEAT,r.texArray.elements[r.texArray.count++]=m,n++)),r.size+=u.size,c+=u.size,o=m._batchLocation,this.addColors(e,p.color,p.alpha,u.attribSize,u.attribStart),this.addTextureIds(i,o,u.attribSize,u.attribStart)}J._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,i=this.colors,r=this.textureIds,n=new ArrayBuffer(t.length*3*4),a=new Float32Array(n),o=new Uint32Array(n);let h=0;for(let l=0;l<t.length/2;l++)a[h++]=t[l*2],a[h++]=t[l*2+1],a[h++]=e[l*2],a[h++]=e[l*2+1],o[h++]=i[l],a[h++]=r[l];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?hp.triangulate(t,this):hl[t.type].triangulate(t,this)}processLine(t){up(t,this);for(let e=0;e<t.holes.length;e++)up(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const i=t[e];hl[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.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 i=0;i<t.length/2;i++){const r=t[i*2],n=t[i*2+1];t[i*2]=e.a*r+e.c*n+e.tx,t[i*2+1]=e.b*r+e.d*n+e.ty}}addColors(t,e,i,r,n=0){const a=pt.shared.setValue(e).toLittleEndianNumber(),o=pt.shared.setValue(a).toPremultiplied(i);t.length=Math.max(t.length,n+r);for(let h=0;h<r;h++)t[n+h]=o}addTextureIds(t,e,i,r=0){t.length=Math.max(t.length,r+i);for(let n=0;n<i;n++)t[r+n]=e}addUvs(t,e,i,r,n,a=null){let o=0;const h=e.length,l=i.frame;for(;o<n;){let d=t[(r+o)*2],u=t[(r+o)*2+1];if(a){const f=a.a*d+a.c*u+a.tx;u=a.b*d+a.d*u+a.ty,d=f}o++,e.push(d/l.width,u/l.height)}const c=i.baseTexture;(l.width<c.width||l.height<c.height)&&this.adjustUvs(e,i,h,n)}adjustUvs(t,e,i,r){const n=e.baseTexture,a=1e-6,o=i+r*2,h=e.frame,l=h.width/n.width,c=h.height/n.height;let d=h.x/h.width,u=h.y/h.height,f=Math.floor(t[i]+a),p=Math.floor(t[i+1]+a);for(let m=i+2;m<o;m+=2)f=Math.min(f,Math.floor(t[m]+a)),p=Math.min(p,Math.floor(t[m+1]+a));d-=f,u-=p;for(let m=i;m<o;m+=2)t[m]=(t[m]+d)*l,t[m+1]=(t[m+1]+u)*c}};fp.BATCHABLE_SIZE=100;let Gb=fp;class La{constructor(){this.color=16777215,this.alpha=1,this.texture=X.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new La;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=X.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class ll extends La{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=Ki.BUTT,this.join=Ie.MITER,this.miterLimit=10}clone(){const t=new ll;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=Ki.BUTT,this.join=Ie.MITER,this.miterLimit=10}}const cl={},ul=class wo 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 La,this._lineStyle=new ll,this._matrix=null,this._holeMode=!1,this.state=ni.for2d(),this._geometry=t||new Gb,this._geometry.refCount++,this._transformID=-1,this._tintColor=new pt(16777215),this.blendMode=K.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new wo(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,i,r=.5,n=!1){return typeof t=="number"&&(t={width:t,color:e,alpha:i,alignment:r,native:n}),this.lineTextureStyle(t)}lineTextureStyle(t){const e={width:0,texture:X.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:Ki.BUTT,join:Ie.MITER,miterLimit:10};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const i=t.width>0&&t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:i},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 $i,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new $i,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 i=this.currentPath.points,r=i[i.length-2],n=i[i.length-1];return(r!==t||n!==e)&&i.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,i,r){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),ol.curveTo(t,e,i,r,n),this}bezierCurveTo(t,e,i,r,n,a){return this._initCurve(),al.curveTo(t,e,i,r,n,a,this.currentPath.points),this}arcTo(t,e,i,r,n){this._initCurve(t,e);const a=this.currentPath.points,o=lp.curveTo(t,e,i,r,n,a);if(o){const{cx:h,cy:l,radius:c,startAngle:d,endAngle:u,anticlockwise:f}=o;this.arc(h,l,c,d,u,f)}return this}arc(t,e,i,r,n,a=!1){if(r===n)return this;if(!a&&n<=r?n+=ra:a&&r<=n&&(r+=ra),n-r===0)return this;const o=t+Math.cos(r)*i,h=e+Math.sin(r)*i,l=this._geometry.closePointEps;let c=this.currentPath?this.currentPath.points:null;if(c){const d=Math.abs(c[c.length-2]-o),u=Math.abs(c[c.length-1]-h);d<l&&u<l||c.push(o,h)}else this.moveTo(o,h),c=this.currentPath.points;return lp.arc(o,h,t,e,i,r,n,a,c),this}beginFill(t=0,e){return this.beginTextureFill({texture:X.WHITE,color:t,alpha:e})}normalizeColor(t){const e=pt.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:X.WHITE,color:16777215,matrix:null};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const i=t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:i},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,i,r){return this.drawShape(new st(t,e,i,r))}drawRoundedRect(t,e,i,r,n){return this.drawShape(new ha(t,e,i,r,n))}drawCircle(t,e,i){return this.drawShape(new aa(t,e,i))}drawEllipse(t,e,i,r){return this.drawShape(new oa(t,e,i,r))}drawPolygon(...t){let e,i=!0;const r=t[0];r.points?(i=r.closeStroke,e=r.points):Array.isArray(t[0])?e=t[0]:e=t;const n=new $i(e);return n.closeStroke=i,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===Zt.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,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(let r=0;r<i;r++){const n=t.batches[r],a=n.style.color,o=new Float32Array(this.vertexData.buffer,n.attribStart*4*2,n.attribSize*2),h=new Float32Array(t.uvsFloat32.buffer,n.attribStart*4*2,n.attribSize*2),l=new Uint16Array(t.indicesUint16.buffer,n.start*2,n.size),c={vertexData:o,blendMode:e,indices:l,uvs:h,_batchRGB:pt.shared.setValue(a).toRgbArray(),_tintRGB:a,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[r]=c}}_renderBatched(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let e=0,i=this.batches.length;e<i;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),i=this._geometry,r=this.worldAlpha,n=e.uniforms,a=i.drawCalls;n.translationMatrix=this.transform.worldTransform,pt.shared.setValue(this._tintColor).premultiply(r).toArray(n.tint),t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(let o=0,h=a.length;o<h;o++)this._renderDrawCallDirect(t,i.drawCalls[o])}_renderDrawCallDirect(t,e){const{texArray:i,type:r,size:n,start:a}=e,o=i.count;for(let h=0;h<o;h++)t.texture.bind(i.elements[h],h);t.geometry.draw(r,n,a)}_resolveDirectShader(t){let e=this.shader;const i=this.pluginName;if(!e){if(!cl[i]){const{maxTextures:r}=t.plugins[i],n=new Int32Array(r);for(let h=0;h<r;h++)n[h]=h;const a={tint:new Float32Array([1,1,1,1]),translationMatrix:new gt,default:Ve.from({uSamplers:n},!0)},o=t.plugins[i]._shader.program;cl[i]=new oi(o,a)}e=cl[i]}return e}_calculateBounds(){this.finishPoly();const t=this._geometry;if(!t.graphicsData.length)return;const{minX:e,minY:i,maxX:r,maxY:n}=t.bounds;this._bounds.addFrame(this.transform,e,i,r,n)}containsPoint(t){return this.worldTransform.applyInverse(t,wo._TEMP_POINT),this._geometry.containsPoint(wo._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=pt.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,i=e.a,r=e.b,n=e.c,a=e.d,o=e.tx,h=e.ty,l=this._geometry.points,c=this.vertexData;let d=0;for(let u=0;u<l.length;u+=2){const f=l[u],p=l[u+1];c[d++]=i*f+n*p+o,c[d++]=a*p+r*f+h}}closePath(){const t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this}setMatrix(t){return this._matrix=t,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(t){this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,super.destroy(t)}};ul.curves=dr,ul._TEMP_POINT=new tt;let li=ul;class Hb{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 dl=new tt,pp=new $i,mp=class A_ extends bt{constructor(t,e,i,r=Ue.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=i||ni.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=H.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===Ue.TRIANGLES&&e.length<A_.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,i=this.shader;i.uvMatrix&&(i.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=i._tintRGB,this._texture=i.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,i=t._updateID;if(i===this.vertexDirty&&this._transformID===this.transform._worldID)return;this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));const r=this.transform.worldTransform,n=r.a,a=r.b,o=r.c,h=r.d,l=r.tx,c=r.ty,d=this.vertexData;for(let u=0;u<d.length/2;u++){const f=e[u*2],p=e[u*2+1];d[u*2]=n*f+o*p+l,d[u*2+1]=a*f+h*p+c}if(this._roundPixels){const u=H.RESOLUTION;for(let f=0;f<d.length;++f)d[f]=Math.round(d[f]*u)/u}this.vertexDirty=i}calculateUvs(){const t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new Hb(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,dl);const e=this.geometry.getBuffer("aVertexPosition").data,i=pp.points,r=this.geometry.getIndex().data,n=r.length,a=this.drawMode===4?3:1;for(let o=0;o+2<n;o+=a){const h=r[o]*2,l=r[o+1]*2,c=r[o+2]*2;if(i[0]=e[h],i[1]=e[h+1],i[2]=e[l],i[3]=e[l+1],i[4]=e[c],i[5]=e[c+1],pp.contains(dl.x,dl.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}};mp.BATCHABLE_SIZE=100;let ka=mp;class fl extends Xi{constructor(t,e,i){super();const r=new Nt(t),n=new Nt(e,!0),a=new Nt(i,!0,!0);this.addAttribute("aVertexPosition",r,2,!1,Z.FLOAT).addAttribute("aTextureCoord",n,2,!1,Z.FLOAT).addIndex(a),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var Vb=`varying vec2 vTextureCoord;
|
|
910
|
+
`;let dn=null;class mm{constructor(){dn||(dn=URL.createObjectURL(new Blob([yE],{type:"application/javascript"}))),this.worker=new Worker(dn)}}mm.revokeObjectURL=function(){dn&&(URL.revokeObjectURL(dn),dn=null)};let gm=0,sc;class vE{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 mm().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((i,n)=>{this.queue.push({id:t,arguments:e,resolve:i,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[gm]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:gm++,id:s})}}const _m=new vE;function la(r,t,e){r.resource.internal=!0;const s=new q(r),i=()=>{delete t.promiseCache[e],Tr.has(e)&&Tr.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."),i())}),s.once("destroyed",()=>{r.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),i())}),s}const bE=[".jpeg",".jpg",".png",".webp",".avif"],wE=["image/jpeg","image/png","image/webp","image/avif"];async function EE(r){const t=await z.ADAPTER.fetch(r);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${t.status} ${t.statusText}`);const e=await t.blob();return await createImageBitmap(e)}const Fo={name:"loadTextures",extension:{type:Y.LoadParser,priority:Ne.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return cn(r,wE)||Le(r,bE)},async load(r,t,e){var h;const s=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let i;s?this.config.preferWorkers&&await _m.isImageBitmapSupported()?i=await _m.loadImageBitmap(r):i=await EE(r):i=await new Promise((a,l)=>{const c=new Image;c.crossOrigin=this.config.crossOrigin,c.src=r,c.complete?a(c):(c.onload=()=>a(c),c.onerror=d=>l(d))});const n={...t.data};n.resolution??(n.resolution=gi(r)),s&&((h=n.resourceOptions)==null?void 0:h.ownsImageBitmap)===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const o=new et(i,n);return o.resource.src=r,la(o,e,r)},unload(r){r.destroy(!0)}};Z.add(Fo);const TE=".svg",AE="image/svg+xml",SE={extension:{type:Y.LoadParser,priority:Ne.High},name:"loadSVG",test(r){return cn(r,AE)||Le(r,TE)},async testParse(r){return jl.test(r)},async parse(r,t,e){var n;const s=new jl(r,(n=t==null?void 0:t.data)==null?void 0:n.resourceOptions);await s.load();const i=new et(s,{resolution:gi(r),...t==null?void 0:t.data});return i.resource.src=t.src,la(i,e,t.src)},async load(r,t){return(await z.ADAPTER.fetch(r)).text()},unload:Fo.unload};Z.add(SE);const CE=[".mp4",".m4v",".webm",".ogv"],IE=["video/mp4","video/webm","video/ogg"],PE={name:"loadVideo",extension:{type:Y.LoadParser,priority:Ne.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test(r){return cn(r,IE)||Le(r,CE)},async load(r,t,e){var o;let s;const i=await(await z.ADAPTER.fetch(r)).blob(),n=URL.createObjectURL(i);try{const h={autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline,...(o=t==null?void 0:t.data)==null?void 0:o.resourceOptions,autoLoad:!0},a=new sm(n,h);await a.load();const l=new et(a,{alphaMode:await L1(),resolution:gi(r),...t==null?void 0:t.data});l.resource.src=r,s=la(l,e,r),s.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(h){throw URL.revokeObjectURL(n),h}return s},unload(r){r.destroy(!0)}};Z.add(PE);class RE{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:i,srcs:n}=t;return Ts(e||s||i||n,o=>typeof o=="string"?o:Array.isArray(o)?o.map(h=>(h==null?void 0:h.src)??(h==null?void 0:h.srcs)??h):o!=null&&o.src||o!=null&&o.srcs?o.src??o.srcs:o,!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(i=>{const n=i.src??i.srcs,o=i.alias??i.name;let h;if(typeof o=="string"){const a=this._createBundleAssetId(t,o);s.push(a),h=[o,a]}else{const a=o.map(l=>this._createBundleAssetId(t,l));s.push(...a),h=[...o,...a]}this.add({...i,alias:h,src:n})}):Object.keys(e).forEach(i=>{const n=[i,this._createBundleAssetId(t,i)];if(typeof e[i]=="string")this.add({alias:n,src:e[i]});else if(Array.isArray(e[i]))this.add({alias:n,src:e[i]});else{const o=e[i],h=o.src??o.srcs;this.add({...o,alias:n,src:Array.isArray(h)?h:[h]})}s.push(...n)}),this._bundles[t]=s}add(t,e,s,i,n){const o=[];typeof t=="string"||Array.isArray(t)&&typeof t[0]=="string"?(at("7.2.0",`Assets.add now uses an object instead of individual parameters.
|
|
911
|
+
Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),o.push({alias:t,src:e,data:s,format:i,loadParser:n})):Array.isArray(t)?o.push(...t):o.push(t);let h;h=a=>{this.hasKey(a)&&console.warn(`[Resolver] already has key: ${a} overwriting`)},Ts(o).forEach(a=>{const{src:l,srcs:c}=a;let{data:d,format:u,loadParser:f}=a;const p=Ts(l||c).map(y=>typeof y=="string"?eE(y):Array.isArray(y)?y:[y]),m=this.getAlias(a);Array.isArray(m)?m.forEach(h):h(m);const g=[];p.forEach(y=>{y.forEach(x=>{let _={};if(typeof x!="object"){_.src=x;for(let v=0;v<this._parsers.length;v++){const b=this._parsers[v];if(b.test(x)){_=b.parse(x);break}}}else d=x.data??d,u=x.format??u,f=x.loadParser??f,_={..._,...x};if(!m)throw new Error(`[Resolver] alias is undefined for this asset: ${_.src}`);_=this.buildResolvedAsset(_,{aliases:m,data:d,format:u,loadParser:f}),g.push(_)})}),m.forEach(y=>{this._assetMap[y]=g})})}resolveBundle(t){const e=Mo(t);t=Ts(t);const s={};return t.forEach(i=>{const n=this._bundles[i];if(n){const o=this.resolve(n),h={};for(const a in o){const l=o[a];h[this._extractAssetIdFromBundle(i,a)]=l}s[i]=h}}),e?s[t[0]]:s}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const s={};for(const i in e)s[i]=e[i].src;return s}return e.src}resolve(t){const e=Mo(t);t=Ts(t);const s={};return t.forEach(i=>{if(!this._resolverHash[i])if(this._assetMap[i]){let n=this._assetMap[i];const o=n[0],h=this._getPreferredOrder(n);h==null||h.priority.forEach(a=>{h.params[a].forEach(l=>{const c=n.filter(d=>d[a]?d[a]===l:!1);c.length&&(n=c)})}),this._resolverHash[i]=n[0]??o}else this._resolverHash[i]=this.buildResolvedAsset({alias:[i],src:i},{});s[i]=this._resolverHash[i]}),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],i=this._preferredOrder.find(n=>n.params.format.includes(s.format));if(i)return i}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:i,loadParser:n,format:o}=e;return(this._basePath||this._rootPath)&&(t.src=vt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=s??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...i||{},...t.data},t.loadParser=n??t.loadParser,t.format=o??t.format??vt.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class ME{constructor(){this._detections=[],this._initialized=!1,this.resolver=new RE,this.loader=new iE,this.cache=Tr,this._backgroundLoader=new tE(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var n,o;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,i=await this._detectFormats({preferredFormats:(o=t.texturePreference)==null?void 0:o.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:i,resolution:s}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,s,i,n){this.resolver.add(t,e,s,i,n)}async load(t,e){this._initialized||await this.init();const s=Mo(t),i=Ts(t).map(h=>{if(typeof h!="string"){const a=this.resolver.getAlias(h);return a.some(l=>!this.resolver.hasKey(l))&&this.add(h),Array.isArray(a)?a[0]:a}return this.resolver.hasKey(h)||this.add({alias:h,src:h}),h}),n=this.resolver.resolve(i),o=await this._mapLoadToResolve(n,e);return s?o[i[0]]:o}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 i=this.resolver.resolveBundle(t),n={},o=Object.keys(i);let h=0,a=0;const l=()=>{e==null||e(++h/a)},c=o.map(d=>{const u=i[d];return a+=Object.keys(u).length,this._mapLoadToResolve(u,l).then(f=>{n[d]=f})});return await Promise.all(c),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 Tr.get(t);const e={};for(let s=0;s<t.length;s++)e[s]=Tr.get(t[s]);return e}async _mapLoadToResolve(t,e){const s=Object.values(t),i=Object.keys(t);this._backgroundLoader.active=!1;const n=await this.loader.load(s,e);this._backgroundLoader.active=!0;const o={};return s.forEach((h,a)=>{const l=n[h.src],c=[h.src];h.alias&&c.push(...h.alias),o[i[a]]=l,Tr.set(c,l)}),o}async unload(t){this._initialized||await this.init();const e=Ts(t).map(i=>typeof i!="string"?i.src:i),s=this.resolver.resolve(e);await this._unloadFromResolved(s)}async unloadBundle(t){this._initialized||await this.init(),t=Ts(t);const e=this.resolver.resolveBundle(t),s=Object.keys(e).map(i=>this._unloadFromResolved(e[i]));await Promise.all(s)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(s=>{Tr.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,i)=>e.indexOf(s)===i),e}get detections(){return this._detections}get preferWorkers(){return Fo.config.preferWorkers}set preferWorkers(t){at("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 Vi=new ME;Z.handleByList(Y.LoadParser,Vi.loader.parsers).handleByList(Y.ResolveParser,Vi.resolver.parsers).handleByList(Y.CacheParser,Vi.cache.parsers).handleByList(Y.DetectionParser,Vi.detections);const FE={extension:Y.CacheParser,test:r=>Array.isArray(r)&&r.every(t=>t instanceof q),getCacheableAssets:(r,t)=>{const e={};return r.forEach(s=>{t.forEach((i,n)=>{e[s+(n===0?"":n+1)]=i})}),e}};Z.add(FE);async function xm(r){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(r)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const kE={extension:{type:Y.DetectionParser,priority:1},test:async()=>xm("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};Z.add(kE);const BE={extension:{type:Y.DetectionParser,priority:0},test:async()=>xm("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};Z.add(BE);const ym=["png","jpg","jpeg"],DE={extension:{type:Y.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...ym],remove:async r=>r.filter(t=>!ym.includes(t))};Z.add(DE);const OE="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function ic(r){return OE?!1:document.createElement("video").canPlayType(r)!==""}const LE={extension:{type:Y.DetectionParser,priority:0},test:async()=>ic("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};Z.add(LE);const NE={extension:{type:Y.DetectionParser,priority:0},test:async()=>ic("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};Z.add(NE);const UE={extension:{type:Y.DetectionParser,priority:0},test:async()=>ic("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};Z.add(UE);const VE={extension:Y.ResolveParser,test:Fo.test,parse:r=>{var t;return{resolution:parseFloat(((t=z.RETINA_PREFIX.exec(r))==null?void 0:t[1])??"1"),format:vt.extname(r).slice(1),src:r}}};Z.add(VE);var ve=(r=>(r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",r[r.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",r[r.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",r[r.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",r[r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",r[r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",r[r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",r))(ve||{});const ko={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 qs,fn;function vm(){fn={bptc:qs.getExtension("EXT_texture_compression_bptc"),astc:qs.getExtension("WEBGL_compressed_texture_astc"),etc:qs.getExtension("WEBGL_compressed_texture_etc"),s3tc:qs.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:qs.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:qs.getExtension("WEBGL_compressed_texture_pvrtc")||qs.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:qs.getExtension("WEBGL_compressed_texture_etc1"),atc:qs.getExtension("WEBGL_compressed_texture_atc")}}const XE={extension:{type:Y.DetectionParser,priority:2},test:async()=>{const r=z.ADAPTER.createCanvas().getContext("webgl");return r?(qs=r,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async r=>{fn||vm();const t=[];for(const e in fn)fn[e]&&t.push(e);return[...t,...r]},remove:async r=>(fn||vm(),r.filter(t=>!(t in fn)))};Z.add(XE);class GE extends ao{constructor(t,e={width:1,height:1,autoLoad:!0}){let s,i;typeof t=="string"?(s=t,i=new Uint8Array):(s=null,i=t),super(i,e),this.origin=s,this.buffer=i?new El(i):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 El(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class Ar 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=Ar._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||Ar._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,s){const i=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;i.pixelStorei(i.UNPACK_ALIGNMENT,4);for(let n=0,o=this.levels;n<o;n++){const{levelID:h,levelWidth:a,levelHeight:l,levelBuffer:c}=this._levelBuffers[n];i.compressedTexImage2D(i.TEXTURE_2D,h,this.format,a,l,0,c)}return!0}onBlobLoaded(){this._levelBuffers=Ar._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,i,n,o,h){const a=new Array(s);let l=t.byteOffset,c=o,d=h,u=c+i-1&~(i-1),f=d+n-1&~(n-1),p=u*f*ko[e];for(let m=0;m<s;m++)a[m]={levelID:m,levelWidth:s>1?c:u,levelHeight:s>1?d:f,levelBuffer:new Uint8Array(t.buffer,l,p)},l+=p,c=c>>1||1,d=d>>1||1,u=c+i-1&~(i-1),f=d+n-1&~(n-1),p=u*f*ko[e];return a}}const rc=4,Bo=124,$E=32,bm=20,YE=542327876,Do={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},HE={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},Oo={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},WE=1,zE=2,jE=4,qE=64,KE=512,ZE=131072,QE=827611204,JE=861165636,tT=894720068,eT=808540228,sT=4,iT={[QE]:ve.COMPRESSED_RGBA_S3TC_DXT1_EXT,[JE]:ve.COMPRESSED_RGBA_S3TC_DXT3_EXT,[tT]: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 nT(r){const t=new Uint32Array(r);if(t[0]!==YE)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(r,0,Bo/Uint32Array.BYTES_PER_ELEMENT),s=e[Do.HEIGHT],i=e[Do.WIDTH],n=e[Do.MIPMAP_COUNT],o=new Uint32Array(r,Do.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,$E/Uint32Array.BYTES_PER_ELEMENT),h=o[WE];if(h&jE){const a=o[HE.FOURCC];if(a!==eT){const x=iT[a],_=rc+Bo,v=new Uint8Array(r,_);return[new Ar(v,{format:x,width:i,height:s,levels:n})]}const l=rc+Bo,c=new Uint32Array(t.buffer,l,bm/Uint32Array.BYTES_PER_ELEMENT),d=c[Oo.DXGI_FORMAT],u=c[Oo.RESOURCE_DIMENSION],f=c[Oo.MISC_FLAG],p=c[Oo.ARRAY_SIZE],m=rT[d];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${d}`);if(f===sT)throw new Error("DDSParser does not support cubemap textures");if(u===6)throw new Error("DDSParser does not supported 3D texture data");const g=new Array,y=rc+Bo+bm;if(p===1)g.push(new Uint8Array(r,y));else{const x=ko[m];let _=0,v=i,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;_+=I,v=v>>>1,b=b>>>1}let w=y;for(let E=0;E<p;E++)g.push(new Uint8Array(r,w,_)),w+=_}return g.map(x=>new Ar(x,{format:m,width:i,height:s,levels:n}))}throw h&qE?new Error("DDSParser does not support uncompressed texture data."):h&KE?new Error("DDSParser does not supported YUV uncompressed texture data."):h&ZE?new Error("DDSParser does not support single-channel (lumninance) texture data!"):h&zE?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 wm=[171,75,84,88,32,49,49,187,13,10,26,10],aT=67305985,As={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,Em={[tt.UNSIGNED_BYTE]:1,[tt.UNSIGNED_SHORT]:2,[tt.INT]:4,[tt.UNSIGNED_INT]:4,[tt.FLOAT]:4,[tt.HALF_FLOAT]:8},oT={[X.RGBA]:4,[X.RGB]:3,[X.RG]:2,[X.RED]:1,[X.LUMINANCE]:1,[X.LUMINANCE_ALPHA]:2,[X.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 lT(r,t,e=!1){const s=new DataView(t);if(!cT(r,s))return null;const i=s.getUint32(As.ENDIANNESS,!0)===aT,n=s.getUint32(As.GL_TYPE,i),o=s.getUint32(As.GL_FORMAT,i),h=s.getUint32(As.GL_INTERNAL_FORMAT,i),a=s.getUint32(As.PIXEL_WIDTH,i),l=s.getUint32(As.PIXEL_HEIGHT,i)||1,c=s.getUint32(As.PIXEL_DEPTH,i)||1,d=s.getUint32(As.NUMBER_OF_ARRAY_ELEMENTS,i)||1,u=s.getUint32(As.NUMBER_OF_FACES,i),f=s.getUint32(As.NUMBER_OF_MIPMAP_LEVELS,i),p=s.getUint32(As.BYTES_OF_KEY_VALUE_DATA,i);if(l===0||c!==1)throw new Error("Only 2D textures are supported");if(u!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(d!==1)throw new Error("WebGL does not support array textures");const m=4,g=4,y=a+3&-4,x=l+3&-4,_=new Array(d);let v=a*l;n===0&&(v=y*x);let b;if(n!==0?Em[n]?b=Em[n]*oT[o]:b=hT[n]:b=ko[h],b===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const w=e?dT(s,p,i):null;let E=v*b,T=a,A=l,I=y,M=x,R=nc+p;for(let C=0;C<f;C++){const P=s.getUint32(R,i);let k=R+4;for(let V=0;V<d;V++){let U=_[V];U||(U=_[V]=new Array(f)),U[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:_.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 ao(P,{width:C[0].levelWidth,height:C[0].levelHeight}),type:n,format:k?uT(o):o}}),kvData:w}:{compressed:_.map(C=>new Ar(null,{format:h,width:a,height:l,levels:f,levelBuffers:C})),kvData:w}}function cT(r,t){for(let e=0;e<wm.length;e++)if(t.getUint8(e)!==wm[e])return console.error(`${r} is not a valid *.ktx file!`),!1;return!0}function uT(r){switch(r){case X.RGBA:return X.RGBA_INTEGER;case X.RGB:return X.RGB_INTEGER;case X.RG:return X.RG_INTEGER;case X.RED:return X.RED_INTEGER;default:return r}}function dT(r,t,e){const s=new Map;let i=0;for(;i<t;){const n=r.getUint32(nc+i,e),o=nc+i+4,h=3-(n+3)%4;if(n===0||n>t-i){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let a=0;for(;a<n&&r.getUint8(o+a)!==0;a++);if(a===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const l=new TextDecoder().decode(new Uint8Array(r.buffer,o,a)),c=new DataView(r.buffer,o+a+1,n-a-1);s.set(l,c),i+=4+n+h}return s}const fT={extension:{type:Y.LoadParser,priority:Ne.High},name:"loadDDS",test(r){return Le(r,".dds")},async load(r,t,e){const s=await(await z.ADAPTER.fetch(r)).arrayBuffer(),i=nT(s).map(n=>{const o=new et(n,{mipmap:ys.OFF,alphaMode:Re.NO_PREMULTIPLIED_ALPHA,resolution:gi(r),...t.data});return la(o,e,r)});return i.length===1?i[0]:i},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};Z.add(fT);const pT={extension:{type:Y.LoadParser,priority:Ne.High},name:"loadKTX",test(r){return Le(r,".ktx")},async load(r,t,e){const s=await(await z.ADAPTER.fetch(r)).arrayBuffer(),{compressed:i,uncompressed:n,kvData:o}=lT(r,s),h=i??n,a={mipmap:ys.OFF,alphaMode:Re.NO_PREMULTIPLIED_ALPHA,resolution:gi(r),...t.data},l=h.map(c=>{h===n&&Object.assign(a,{type:c.type,format:c.format});const d=c.resource??c,u=new et(d,a);return u.ktxKeyValueData=o,la(u,e,r)});return l.length===1?l[0]:l},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};Z.add(pT);const mT=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],gT={extension:Y.ResolveParser,test:r=>{const t=vt.extname(r).slice(1);return["basis","ktx","dds"].includes(t)},parse:r=>{var s,i;const t=r.split("."),e=t.pop();if(["ktx","dds"].includes(e)){const n=t.pop();if(mT.includes(n))return{resolution:parseFloat(((s=z.RETINA_PREFIX.exec(r))==null?void 0:s[1])??"1"),format:n,src:r}}return{resolution:parseFloat(((i=z.RETINA_PREFIX.exec(r))==null?void 0:i[1])??"1"),format:e,src:r}}};Z.add(gT);const Lo=new it,_T=4,Tm=class Oa{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,i){const n=new Image;return n.src=await this.base64(t,e,s,i),n}async base64(t,e,s,i){const n=this.canvas(t,i);if(n.toBlob!==void 0)return new Promise((o,h)=>{n.toBlob(a=>{if(!a){h(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>o(l.result),l.onerror=h,l.readAsDataURL(a)},e,s)});if(n.toDataURL!==void 0)return n.toDataURL(e,s);if(n.convertToBlob!==void 0){const o=await n.convertToBlob({type:e,quality:s});return new Promise((h,a)=>{const l=new FileReader;l.onload=()=>h(l.result),l.onerror=a,l.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const{pixels:s,width:i,height:n,flipY:o,premultipliedAlpha:h}=this._rawPixels(t,e);o&&Oa._flipY(s,i,n),h&&Oa._unpremultiplyAlpha(s);const a=new Q1(i,n,1),l=new ImageData(new Uint8ClampedArray(s.buffer),i,n);return a.context.putImageData(l,0,0),a.canvas}pixels(t,e){const{pixels:s,width:i,height:n,flipY:o,premultipliedAlpha:h}=this._rawPixels(t,e);return o&&Oa._flipY(s,i,n),h&&Oa._unpremultiplyAlpha(s),s}_rawPixels(t,e){const s=this.renderer;if(!s)throw new Error("The Extract has already been destroyed");let i,n=!1,o=!1,h,a=!1;t&&(t instanceof br?h=t:(h=s.generateTexture(t,{region:e,resolution:s.resolution,multisample:s.multisample}),a=!0,e&&(Lo.width=e.width,Lo.height=e.height,e=Lo)));const l=s.gl;if(h){if(i=h.baseTexture.resolution,e=e??h.frame,n=!1,o=h.baseTexture.alphaMode>0&&h.baseTexture.format===X.RGBA,!a){s.renderTexture.bind(h);const f=h.framebuffer.glFramebuffers[s.CONTEXT_UID];f.blitFramebuffer&&s.framebuffer.bind(f.blitFramebuffer)}}else i=s.resolution,e||(e=Lo,e.width=s.width/i,e.height=s.height/i),n=!0,o=this._rendererPremultipliedAlpha,s.renderTexture.bind();const c=Math.max(Math.round(e.width*i),1),d=Math.max(Math.round(e.height*i),1),u=new Uint8Array(_T*c*d);return l.readPixels(Math.round(e.x*i),Math.round(e.y*i),c,d,l.RGBA,l.UNSIGNED_BYTE,u),a&&(h==null||h.destroy(!0)),{pixels:u,width:c,height:d,flipY:n,premultipliedAlpha:o}}destroy(){this.renderer=null}static _flipY(t,e,s){const i=e<<2,n=s>>1,o=new Uint8Array(i);for(let h=0;h<n;h++){const a=h*i,l=(s-h-1)*i;o.set(t.subarray(a,a+i)),t.copyWithin(a,l,l+i),t.set(o,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 i=t[s+3];if(i!==0){const n=255.001/i;t[s]=t[s]*n+.5,t[s+1]=t[s+1]*n+.5,t[s+2]=t[s+2]*n+.5}}}};Tm.extension={name:"extract",type:Y.RendererSystem};let xT=Tm;Z.add(xT);const No={build(r){const t=r.points;let e,s,i,n,o,h;if(r.type===ye.CIRC){const p=r.shape;e=p.x,s=p.y,o=h=p.radius,i=n=0}else if(r.type===ye.ELIP){const p=r.shape;e=p.x,s=p.y,o=p.width,h=p.height,i=n=0}else{const p=r.shape,m=p.width/2,g=p.height/2;e=p.x+m,s=p.y+g,o=h=Math.max(0,Math.min(p.radius,Math.min(m,g))),i=m-o,n=g-h}if(!(o>=0&&h>=0&&i>=0&&n>=0)){t.length=0;return}const a=Math.ceil(2.3*Math.sqrt(o+h)),l=a*8+(i?4:0)+(n?4:0);if(t.length=l,l===0)return;if(a===0){t.length=8,t[0]=t[6]=e+i,t[1]=t[3]=s+n,t[2]=t[4]=e-i,t[5]=t[7]=s-n;return}let c=0,d=a*4+(i?2:0)+2,u=d,f=l;{const p=i+o,m=n,g=e+p,y=e-p,x=s+m;if(t[c++]=g,t[c++]=x,t[--d]=x,t[--d]=y,n){const _=s-m;t[u++]=y,t[u++]=_,t[--f]=_,t[--f]=g}}for(let p=1;p<a;p++){const m=Math.PI/2*(p/a),g=i+Math.cos(m)*o,y=n+Math.sin(m)*h,x=e+g,_=e-g,v=s+y,b=s-y;t[c++]=x,t[c++]=v,t[--d]=v,t[--d]=_,t[u++]=_,t[u++]=b,t[--f]=b,t[--f]=x}{const p=i,m=n+h,g=e+p,y=e-p,x=s+m,_=s-m;t[c++]=g,t[c++]=x,t[--f]=_,t[--f]=g,i&&(t[c++]=y,t[c++]=x,t[--f]=_,t[--f]=y)}},triangulate(r,t){const e=r.points,s=t.points,i=t.indices;if(e.length===0)return;let n=s.length/2;const o=n;let h,a;if(r.type!==ye.RREC){const c=r.shape;h=c.x,a=c.y}else{const c=r.shape;h=c.x+c.width/2,a=c.y+c.height/2}const l=r.matrix;s.push(r.matrix?l.a*h+l.c*a+l.tx:h,r.matrix?l.b*h+l.d*a+l.ty:a),n++,s.push(e[0],e[1]);for(let c=2;c<e.length;c+=2)s.push(e[c],e[c+1]),i.push(n++,o,n);i.push(o+1,o,n)}};function Am(r,t=!1){const e=r.length;if(e<6)return;let s=0;for(let i=0,n=r[e-2],o=r[e-1];i<e;i+=2){const h=r[i],a=r[i+1];s+=(h-n)*(a+o),n=h,o=a}if(!t&&s>0||t&&s<=0){const i=e/2;for(let n=i+i%2;n<e;n+=2){const o=e-n-2,h=e-n-1,a=n,l=n+1;[r[o],r[a]]=[r[a],r[o]],[r[h],r[l]]=[r[l],r[h]]}}}const Sm={build(r){r.points=r.shape.points.slice()},triangulate(r,t){let e=r.points;const s=r.holes,i=t.points,n=t.indices;if(e.length>=6){Am(e,!1);const o=[];for(let l=0;l<s.length;l++){const c=s[l];Am(c.points,!0),o.push(e.length/2),e=e.concat(c.points)}const h=Ax(e,o,2);if(!h)return;const a=i.length/2;for(let l=0;l<h.length;l+=3)n.push(h[l]+a),n.push(h[l+1]+a),n.push(h[l+2]+a);for(let l=0;l<e.length;l++)i.push(e[l])}}},yT={build(r){const t=r.shape,e=t.x,s=t.y,i=t.width,n=t.height,o=r.points;o.length=0,i>=0&&n>=0&&o.push(e,s,e+i,s,e+i,s+n,e,s+n)},triangulate(r,t){const e=r.points,s=t.points;if(e.length===0)return;const i=s.length/2;s.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(i,i+1,i+2,i+1,i+2,i+3)}},vT={build(r){No.build(r)},triangulate(r,t){No.triangulate(r,t)}};var hs=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(hs||{}),Xi=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))(Xi||{});const pn={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(r,t=20){if(!this.adaptive||!r||isNaN(r))return t;let e=Math.ceil(r/this.maxLength);return e<this.minSegments?e=this.minSegments:e>this.maxSegments&&(e=this.maxSegments),e}};class Cm{static curveTo(t,e,s,i,n,o){const h=o[o.length-2],a=o[o.length-1]-e,l=h-t,c=i-e,d=s-t,u=Math.abs(a*d-l*c);if(u<1e-8||n===0)return(o[o.length-2]!==t||o[o.length-1]!==e)&&o.push(t,e),null;const f=a*a+l*l,p=c*c+d*d,m=a*c+l*d,g=n*Math.sqrt(f)/u,y=n*Math.sqrt(p)/u,x=g*m/f,_=y*m/p,v=g*d+y*l,b=g*c+y*a,w=l*(y+x),E=a*(y+x),T=d*(g+_),A=c*(g+_),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*c>d*a}}static arc(t,e,s,i,n,o,h,a,l){const c=h-o,d=pn._segmentsCount(Math.abs(c)*n,Math.ceil(Math.abs(c)/ho)*40),u=c/(d*2),f=u*2,p=Math.cos(u),m=Math.sin(u),g=d-1,y=g%1/g;for(let x=0;x<=g;++x){const _=x+y*x,v=u+o+f*_,b=Math.cos(v),w=-Math.sin(v);l.push((p*b+m*w)*n+s,(p*-w+m*b)*n+i)}}}class bT{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 ac{static curveLength(t,e,s,i,n,o,h,a){let l=0,c=0,d=0,u=0,f=0,p=0,m=0,g=0,y=0,x=0,_=0,v=t,b=e;for(let w=1;w<=10;++w)c=w/10,d=c*c,u=d*c,f=1-c,p=f*f,m=p*f,g=m*t+3*p*c*s+3*f*d*n+u*h,y=m*e+3*p*c*i+3*f*d*o+u*a,x=v-g,_=b-y,v=g,b=y,l+=Math.sqrt(x*x+_*_);return l}static curveTo(t,e,s,i,n,o,h){const a=h[h.length-2],l=h[h.length-1];h.length-=2;const c=pn._segmentsCount(ac.curveLength(a,l,t,e,s,i,n,o));let d=0,u=0,f=0,p=0,m=0;h.push(a,l);for(let g=1,y=0;g<=c;++g)y=g/c,d=1-y,u=d*d,f=u*d,p=y*y,m=p*y,h.push(f*a+3*u*y*t+3*d*p*s+m*n,f*l+3*u*y*e+3*d*p*i+m*o)}}function Im(r,t,e,s,i,n,o,h){const a=r-e*i,l=t-s*i,c=r+e*n,d=t+s*n;let u,f;o?(u=s,f=-e):(u=-s,f=e);const p=a+u,m=l+f,g=c+u,y=d+f;return h.push(p,m,g,y),2}function Sr(r,t,e,s,i,n,o,h){const a=e-r,l=s-t;let c=Math.atan2(a,l),d=Math.atan2(i-r,n-t);h&&c<d?c+=Math.PI*2:!h&&c>d&&(d+=Math.PI*2);let u=c;const f=d-c,p=Math.abs(f),m=Math.sqrt(a*a+l*l),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,y=f/g;if(u+=y,h){o.push(r,t,e,s);for(let x=1,_=u;x<g;x++,_+=y)o.push(r,t,r+Math.sin(_)*m,t+Math.cos(_)*m);o.push(r,t,i,n)}else{o.push(e,s,r,t);for(let x=1,_=u;x<g;x++,_+=y)o.push(r+Math.sin(_)*m,t+Math.cos(_)*m,r,t);o.push(i,n,r,t)}return g*2}function wT(r,t){const e=r.shape;let s=r.points||e.points.slice();const i=t.closePointEps;if(s.length===0)return;const n=r.lineStyle,o=new st(s[0],s[1]),h=new st(s[s.length-2],s[s.length-1]),a=e.type!==ye.POLY||e.closeStroke,l=Math.abs(o.x-h.x)<i&&Math.abs(o.y-h.y)<i;if(a){s=s.slice(),l&&(s.pop(),s.pop(),h.set(s[s.length-2],s[s.length-1]));const U=(o.x+h.x)*.5,L=(h.y+o.y)*.5;s.unshift(U,L),s.push(U,L)}const c=t.points,d=s.length/2;let u=s.length;const f=c.length/2,p=n.width/2,m=p*p,g=n.miterLimit*n.miterLimit;let y=s[0],x=s[1],_=s[2],v=s[3],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;a||(n.cap===Xi.ROUND?u+=Sr(y-E*(C-P)*.5,x-T*(C-P)*.5,y-E*C,x-T*C,y+E*P,x+T*P,c,!0)+2:n.cap===Xi.SQUARE&&(u+=Im(y,x,E,T,C,P,!0,c))),c.push(y-E*C,x-T*C,y+E*P,x+T*P);for(let U=1;U<d-1;++U){y=s[(U-1)*2],x=s[(U-1)*2+1],_=s[U*2],v=s[U*2+1],b=s[(U+1)*2],w=s[(U+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=_-b,M=Math.sqrt(A*A+I*I),A/=M,I/=M,A*=p,I*=p;const L=_-y,$=x-v,O=_-b,N=w-v,K=L*O+$*N,Q=$*O-N*L,H=Q<0;if(Math.abs(Q)<.001*Math.abs(K)){c.push(_-E*C,v-T*C,_+E*P,v+T*P),K>=0&&(n.join===hs.ROUND?u+=Sr(_,v,_-E*C,v-T*C,_-A*C,v-I*C,c,!1)+4:u+=2,c.push(_-A*P,v-I*P,_+A*C,v+I*C));continue}const ht=(-E+y)*(-T+v)-(-E+_)*(-T+x),Et=(-A+b)*(-I+v)-(-A+_)*(-I+w),_t=(L*Et-O*ht)/Q,kt=(N*ht-$*Et)/Q,zt=(_t-_)*(_t-_)+(kt-v)*(kt-v),Qt=_+(_t-_)*C,Pt=v+(kt-v)*C,jt=_-(_t-_)*P,Ot=v-(kt-v)*P,ze=Math.min(L*L+$*$,O*O+N*N),rs=H?C:P,or=ze+rs*rs*m,Fn=zt<=or;let hr=n.join;if(hr===hs.MITER&&zt/m>g&&(hr=hs.BEVEL),Fn)switch(hr){case hs.MITER:{c.push(Qt,Pt,jt,Ot);break}case hs.BEVEL:{H?c.push(Qt,Pt,_+E*P,v+T*P,Qt,Pt,_+A*P,v+I*P):c.push(_-E*C,v-T*C,jt,Ot,_-A*C,v-I*C,jt,Ot),u+=2;break}case hs.ROUND:{H?(c.push(Qt,Pt,_+E*P,v+T*P),u+=Sr(_,v,_+E*P,v+T*P,_+A*P,v+I*P,c,!0)+4,c.push(Qt,Pt,_+A*P,v+I*P)):(c.push(_-E*C,v-T*C,jt,Ot),u+=Sr(_,v,_-E*C,v-T*C,_-A*C,v-I*C,c,!1)+4,c.push(_-A*C,v-I*C,jt,Ot));break}}else{switch(c.push(_-E*C,v-T*C,_+E*P,v+T*P),hr){case hs.MITER:{H?c.push(jt,Ot,jt,Ot):c.push(Qt,Pt,Qt,Pt),u+=2;break}case hs.ROUND:{H?u+=Sr(_,v,_+E*P,v+T*P,_+A*P,v+I*P,c,!0)+2:u+=Sr(_,v,_-E*C,v-T*C,_-A*C,v-I*C,c,!1)+2;break}}c.push(_-A*C,v-I*C,_+A*P,v+I*P),u+=2}}y=s[(d-2)*2],x=s[(d-2)*2+1],_=s[(d-1)*2],v=s[(d-1)*2+1],E=-(x-v),T=y-_,M=Math.sqrt(E*E+T*T),E/=M,T/=M,E*=p,T*=p,c.push(_-E*C,v-T*C,_+E*P,v+T*P),a||(n.cap===Xi.ROUND?u+=Sr(_-E*(C-P)*.5,v-T*(C-P)*.5,_-E*C,v-T*C,_+E*P,v+T*P,c,!1)+2:n.cap===Xi.SQUARE&&(u+=Im(_,v,E,T,C,P,!1,c)));const k=t.indices,V=pn.epsilon*pn.epsilon;for(let U=f;U<u+f-2;++U)y=c[U*2],x=c[U*2+1],_=c[(U+1)*2],v=c[(U+1)*2+1],b=c[(U+2)*2],w=c[(U+2)*2+1],!(Math.abs(y*(v-w)+_*(w-x)+b*(x-v))<V)&&k.push(U,U+1,U+2)}function ET(r,t){let e=0;const s=r.shape,i=r.points||s.points,n=s.type!==ye.POLY||s.closeStroke;if(i.length===0)return;const o=t.points,h=t.indices,a=i.length/2,l=o.length/2;let c=l;for(o.push(i[0],i[1]),e=1;e<a;e++)o.push(i[e*2],i[e*2+1]),h.push(c,c+1),c++;n&&h.push(c,l)}function Pm(r,t){r.lineStyle.native?ET(r,t):wT(r,t)}class oc{static curveLength(t,e,s,i,n,o){const h=t-2*s+n,a=e-2*i+o,l=2*s-2*t,c=2*i-2*e,d=4*(h*h+a*a),u=4*(h*l+a*c),f=l*l+c*c,p=2*Math.sqrt(d+u+f),m=Math.sqrt(d),g=2*d*m,y=2*Math.sqrt(f),x=u/m;return(g*p+m*u*(p-y)+(4*f*d-u*u)*Math.log((2*m+x+p)/(x+y)))/(4*g)}static curveTo(t,e,s,i,n){const o=n[n.length-2],h=n[n.length-1],a=pn._segmentsCount(oc.curveLength(o,h,t,e,s,i));let l=0,c=0;for(let d=1;d<=a;++d){const u=d/a;l=o+(t-o)*u,c=h+(e-h)*u,n.push(l+(t+(s-t)*u-l)*u,c+(e+(i-e)*u-c)*u)}}}const hc={[ye.POLY]:Sm,[ye.CIRC]:No,[ye.ELIP]:No,[ye.RECT]:yT,[ye.RREC]:vT},Rm=[],Uo=[];class Vo{constructor(t,e=null,s=null,i=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=s,this.fillStyle=e,this.matrix=i,this.type=t.type}clone(){return new Vo(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 mn=new st,Mm=class Z_ extends lp{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 Io,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(),Uo.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),Rm.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,i=null){const n=new Vo(t,e,s,i);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const s=new Vo(t,null,null,e),i=this.graphicsData[this.graphicsData.length-1];return s.lineStyle=i.lineStyle,i.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 i=e[s];if(i.fillStyle.visible&&i.shape&&(i.matrix?i.matrix.applyInverse(t,mn):mn.copyFrom(t),i.shape.contains(mn.x,mn.y))){let n=!1;if(i.holes){for(let o=0;o<i.holes.length;o++)if(i.holes[o].shape.contains(mn.x,mn.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,i=null;this.batches.length>0&&(s=this.batches[this.batches.length-1],i=s.style);for(let a=this.shapeIndex;a<e.length;a++){this.shapeIndex++;const l=e[a],c=l.fillStyle,d=l.lineStyle;hc[l.type].build(l),l.matrix&&this.transformPoints(l.points,l.matrix),(c.visible||d.visible)&&this.processHoles(l.holes);for(let u=0;u<2;u++){const f=u===0?c:d;if(!f.visible)continue;const p=f.texture.baseTexture,m=this.indices.length,g=this.points.length/2;p.wrapMode=Mi.REPEAT,u===0?this.processFill(l):this.processLine(l);const y=this.points.length/2-g;y!==0&&(s&&!this._compareStyles(i,f)&&(s.end(m,g),s=null),s||(s=Rm.pop()||new bT,s.begin(f,m,g),this.batches.push(s),i=f),this.addUvs(this.points,t,f.texture,g,y,f.matrix))}}const n=this.indices.length,o=this.points.length/2;if(s&&s.end(n,o),this.batches.length===0){this.batchable=!0;return}const h=o>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],i=s.fillStyle,n=s.lineStyle;if(i&&!i.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 i=t[e];for(let n=0;n<i.size;n++){const o=i.start+n;this.indicesUint16[o]=this.indicesUint16[o]-i.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<Z_.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++et._globalBatch;for(let d=0;d<this.drawCalls.length;d++)this.drawCalls[d].texArray.clear(),Uo.push(this.drawCalls[d]);this.drawCalls.length=0;const e=this.colors,s=this.textureIds;let i=Uo.pop();i||(i=new Fl,i.texArray=new Nl),i.texArray.count=0,i.start=0,i.size=0,i.type=xs.TRIANGLES;let n=0,o=null,h=0,a=!1,l=xs.TRIANGLES,c=0;this.drawCalls.push(i);for(let d=0;d<this.batches.length;d++){const u=this.batches[d],f=8,p=u.style,m=p.texture.baseTexture;a!==!!p.native&&(a=!!p.native,l=a?xs.LINES:xs.TRIANGLES,o=null,n=f,t++),o!==m&&(o=m,m._batchEnabled!==t&&(n===f&&(t++,n=0,i.size>0&&(i=Uo.pop(),i||(i=new Fl,i.texArray=new Nl),this.drawCalls.push(i)),i.start=c,i.size=0,i.texArray.count=0,i.type=l),m.touched=1,m._batchEnabled=t,m._batchLocation=n,m.wrapMode=Mi.REPEAT,i.texArray.elements[i.texArray.count++]=m,n++)),i.size+=u.size,c+=u.size,h=m._batchLocation,this.addColors(e,p.color,p.alpha,u.attribSize,u.attribStart),this.addTextureIds(s,h,u.attribSize,u.attribStart)}et._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,s=this.colors,i=this.textureIds,n=new ArrayBuffer(t.length*3*4),o=new Float32Array(n),h=new Uint32Array(n);let a=0;for(let l=0;l<t.length/2;l++)o[a++]=t[l*2],o[a++]=t[l*2+1],o[a++]=e[l*2],o[a++]=e[l*2+1],h[a++]=s[l],o[a++]=i[l];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?Sm.triangulate(t,this):hc[t.type].triangulate(t,this)}processLine(t){Pm(t,this);for(let e=0;e<t.holes.length;e++)Pm(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const s=t[e];hc[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 i=t[s*2],n=t[s*2+1];t[s*2]=e.a*i+e.c*n+e.tx,t[s*2+1]=e.b*i+e.d*n+e.ty}}addColors(t,e,s,i,n=0){const o=Ct.shared.setValue(e).toLittleEndianNumber(),h=Ct.shared.setValue(o).toPremultiplied(s);t.length=Math.max(t.length,n+i);for(let a=0;a<i;a++)t[n+a]=h}addTextureIds(t,e,s,i=0){t.length=Math.max(t.length,i+s);for(let n=0;n<s;n++)t[i+n]=e}addUvs(t,e,s,i,n,o=null){let h=0;const a=e.length,l=s.frame;for(;h<n;){let d=t[(i+h)*2],u=t[(i+h)*2+1];if(o){const f=o.a*d+o.c*u+o.tx;u=o.b*d+o.d*u+o.ty,d=f}h++,e.push(d/l.width,u/l.height)}const c=s.baseTexture;(l.width<c.width||l.height<c.height)&&this.adjustUvs(e,s,a,n)}adjustUvs(t,e,s,i){const n=e.baseTexture,o=1e-6,h=s+i*2,a=e.frame,l=a.width/n.width,c=a.height/n.height;let d=a.x/a.width,u=a.y/a.height,f=Math.floor(t[s]+o),p=Math.floor(t[s+1]+o);for(let m=s+2;m<h;m+=2)f=Math.min(f,Math.floor(t[m]+o)),p=Math.min(p,Math.floor(t[m+1]+o));d-=f,u-=p;for(let m=s;m<h;m+=2)t[m]=(t[m]+d)*l,t[m+1]=(t[m+1]+u)*c}};Mm.BATCHABLE_SIZE=100;let TT=Mm;class Xo{constructor(){this.color=16777215,this.alpha=1,this.texture=q.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new Xo;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 lc extends Xo{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=Xi.BUTT,this.join=hs.MITER,this.miterLimit=10}clone(){const t=new lc;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=Xi.BUTT,this.join=hs.MITER,this.miterLimit=10}}const cc={},uc=class Sh 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 Xo,this._lineStyle=new lc,this._matrix=null,this._holeMode=!1,this.state=Ws.for2d(),this._geometry=t||new TT,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 Sh(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,i=.5,n=!1){return typeof t=="number"&&(t={width:t,color:e,alpha:s,alignment:i,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:Xi.BUTT,join:hs.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 Li,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Li,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,i=s[s.length-2],n=s[s.length-1];return(i!==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,i){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),oc.curveTo(t,e,s,i,n),this}bezierCurveTo(t,e,s,i,n,o){return this._initCurve(),ac.curveTo(t,e,s,i,n,o,this.currentPath.points),this}arcTo(t,e,s,i,n){this._initCurve(t,e);const o=this.currentPath.points,h=Cm.curveTo(t,e,s,i,n,o);if(h){const{cx:a,cy:l,radius:c,startAngle:d,endAngle:u,anticlockwise:f}=h;this.arc(a,l,c,d,u,f)}return this}arc(t,e,s,i,n,o=!1){if(i===n)return this;if(!o&&n<=i?n+=ho:o&&i<=n&&(i+=ho),n-i===0)return this;const h=t+Math.cos(i)*s,a=e+Math.sin(i)*s,l=this._geometry.closePointEps;let c=this.currentPath?this.currentPath.points:null;if(c){const d=Math.abs(c[c.length-2]-h),u=Math.abs(c[c.length-1]-a);d<l&&u<l||c.push(h,a)}else this.moveTo(h,a),c=this.currentPath.points;return Cm.arc(h,a,t,e,s,i,n,o,c),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,i){return this.drawShape(new it(t,e,s,i))}drawRoundedRect(t,e,s,i,n){return this.drawShape(new fo(t,e,s,i,n))}drawCircle(t,e,s){return this.drawShape(new co(t,e,s))}drawEllipse(t,e,s,i){return this.drawShape(new uo(t,e,s,i))}drawPolygon(...t){let e,s=!0;const i=t[0];i.points?(s=i.closeStroke,e=i.points):Array.isArray(t[0])?e=t[0]:e=t;const n=new Li(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===ye.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 i=0;i<s;i++){const n=t.batches[i],o=n.style.color,h=new Float32Array(this.vertexData.buffer,n.attribStart*4*2,n.attribSize*2),a=new Float32Array(t.uvsFloat32.buffer,n.attribStart*4*2,n.attribSize*2),l=new Uint16Array(t.indicesUint16.buffer,n.start*2,n.size),c={vertexData:h,blendMode:e,indices:l,uvs:a,_batchRGB:Ct.shared.setValue(o).toRgbArray(),_tintRGB:o,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[i]=c}}_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 i=this.batches[e];i.worldAlpha=this.worldAlpha*i.alpha,t.plugins[this.pluginName].render(i)}}}_renderDirect(t){const e=this._resolveDirectShader(t),s=this._geometry,i=this.worldAlpha,n=e.uniforms,o=s.drawCalls;n.translationMatrix=this.transform.worldTransform,Ct.shared.setValue(this._tintColor).premultiply(i).toArray(n.tint),t.shader.bind(e),t.geometry.bind(s,e),t.state.set(this.state);for(let h=0,a=o.length;h<a;h++)this._renderDrawCallDirect(t,s.drawCalls[h])}_renderDrawCallDirect(t,e){const{texArray:s,type:i,size:n,start:o}=e,h=s.count;for(let a=0;a<h;a++)t.texture.bind(s.elements[a],a);t.geometry.draw(i,n,o)}_resolveDirectShader(t){let e=this.shader;const s=this.pluginName;if(!e){if(!cc[s]){const{maxTextures:i}=t.plugins[s],n=new Int32Array(i);for(let a=0;a<i;a++)n[a]=a;const o={tint:new Float32Array([1,1,1,1]),translationMatrix:new Rt,default:ws.from({uSamplers:n},!0)},h=t.plugins[s]._shader.program;cc[s]=new js(h,o)}e=cc[s]}return e}_calculateBounds(){this.finishPoly();const t=this._geometry;if(!t.graphicsData.length)return;const{minX:e,minY:s,maxX:i,maxY:n}=t.bounds;this._bounds.addFrame(this.transform,e,s,i,n)}containsPoint(t){return this.worldTransform.applyInverse(t,Sh._TEMP_POINT),this._geometry.containsPoint(Sh._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,i=e.b,n=e.c,o=e.d,h=e.tx,a=e.ty,l=this._geometry.points,c=this.vertexData;let d=0;for(let u=0;u<l.length;u+=2){const f=l[u],p=l[u+1];c[d++]=s*f+n*p+h,c[d++]=o*p+i*f+a}}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=pn,uc._TEMP_POINT=new st;let Ks=uc;class AT{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,Fm=new Li,km=class Q_ extends Bt{constructor(t,e,s,i=xs.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=s||Ws.for2d(),this.drawMode=i,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<Q_.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 i=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[i]),t.plugins[i].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 i=this.transform.worldTransform,n=i.a,o=i.b,h=i.c,a=i.d,l=i.tx,c=i.ty,d=this.vertexData;for(let u=0;u<d.length/2;u++){const f=e[u*2],p=e[u*2+1];d[u*2]=n*f+h*p+l,d[u*2+1]=o*f+a*p+c}if(this._roundPixels){const u=z.RESOLUTION;for(let f=0;f<d.length;++f)d[f]=Math.round(d[f]*u)/u}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 AT(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=Fm.points,i=this.geometry.getIndex().data,n=i.length,o=this.drawMode===4?3:1;for(let h=0;h+2<n;h+=o){const a=i[h]*2,l=i[h+1]*2,c=i[h+2]*2;if(s[0]=e[a],s[1]=e[a+1],s[2]=e[l],s[3]=e[l+1],s[4]=e[c],s[5]=e[c+1],Fm.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}};km.BATCHABLE_SIZE=100;let Go=km;class fc extends Oi{constructor(t,e,s){super();const i=new Jt(t),n=new Jt(e,!0),o=new Jt(s,!0,!0);this.addAttribute("aVertexPosition",i,2,!1,tt.FLOAT).addAttribute("aTextureCoord",n,2,!1,tt.FLOAT).addIndex(o),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var ST=`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
|
-
`,
|
|
920
|
+
`,CT=`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
|
|
935
|
+
`;class $o extends js{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||_i.from(CT,ST),s),this._colorDirty=!1,this.uvMatrix=new Rp(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 IT extends fc{constructor(t=100,e=100,s=10,i=10){super(),this.segWidth=s,this.segHeight=i,this.width=t,this.height=e,this.build()}build(){const t=this.segWidth*this.segHeight,e=[],s=[],i=[],n=this.segWidth-1,o=this.segHeight-1,h=this.width/n,a=this.height/o;for(let c=0;c<t;c++){const d=c%this.segWidth,u=c/this.segWidth|0;e.push(d*h,u*a),s.push(d/n,u/o)}const l=n*o;for(let c=0;c<l;c++){const d=c%n,u=c/n|0,f=u*this.segWidth+d,p=u*this.segWidth+d+1,m=(u+1)*this.segWidth+d,g=(u+1)*this.segWidth+d+1;i.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(i),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}}class PT extends Go{constructor(t,e,s){const i=new IT(t.width,t.height,e,s),n=new $o(q.WHITE);super(i,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 Yo=10;class RT extends PT{constructor(t,e,s,i,n){var o,h,a,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??((o=t.defaultBorders)==null?void 0:o.left)??Yo,this._rightWidth=i??((h=t.defaultBorders)==null?void 0:h.right)??Yo,this._topHeight=s??((a=t.defaultBorders)==null?void 0:a.top)??Yo,this._bottomHeight=n??((l=t.defaultBorders)==null?void 0:l.bottom)??Yo,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,i=this._height>s?1:this._height/s;return Math.min(e,i)}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,i=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]=i*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-i*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()}}class MT extends Go{constructor(t=q.EMPTY,e,s,i,n){const o=new fc(e,s,i);o.getBuffer("aVertexPosition").static=!1;const h=new $o(t);super(o,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 FT extends Bt{constructor(t=1500,e,s=16384,i=!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=i,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 Bm{constructor(t,e,s){this.geometry=new Oi,this.indexBuffer=null,this.size=s,this.dynamicProperties=[],this.staticProperties=[];for(let i=0;i<t.length;++i){let n=t[i];n={attributeName:n.attributeName,size:n.size,uploadFunction:n.uploadFunction,type:n.type||tt.FLOAT,offset:n.offset},e[i]?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(K1(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(let o=0;o<this.dynamicProperties.length;++o){const h=this.dynamicProperties[o];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 i=0;this.staticStride=0;for(let o=0;o<this.staticProperties.length;++o){const h=this.staticProperties[o];h.offset=i,i+=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 o=0;o<this.dynamicProperties.length;++o){const h=this.dynamicProperties[o];t.addAttribute(h.attributeName,this.dynamicBuffer,0,h.type===tt.UNSIGNED_BYTE,h.type,this.dynamicStride*4,h.offset*4)}for(let o=0;o<this.staticProperties.length;++o){const h=this.staticProperties[o];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 i=0;i<this.dynamicProperties.length;i++){const n=this.dynamicProperties[i];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 i=0;i<this.staticProperties.length;i++){const n=this.staticProperties[i];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 kT=`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
|
-
}`,
|
|
943
|
+
}`,BT=`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
|
|
969
|
-
`:t,t}static getFromCache(t,e,i,r){let n=i[t];return typeof n!="number"&&(n=q._measureText(t,e,r)+e,i[t]=n),n}static collapseSpaces(t){return t==="normal"||t==="pre-line"}static collapseNewlines(t){return t==="normal"}static trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const i=t[e];if(!q.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:q._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:q._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let i="";if(typeof t!="string")return e;for(let r=0;r<t.length;r++){const n=t[r],a=t[r+1];if(q.isBreakingSpace(n,a)||q.isNewline(n)){i!==""&&(e.push(i),i=""),e.push(n);continue}i+=n}return i!==""&&e.push(i),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,r,n){return!0}static wordWrapSplit(t){return q.graphemeSegmenter(t)}static measureFont(t){if(q._fonts[t])return q._fonts[t];const e={ascent:0,descent:0,fontSize:0},i=q._canvas,r=q._context;r.font=t;const n=q.METRICS_STRING+q.BASELINE_SYMBOL,a=Math.ceil(r.measureText(n).width);let o=Math.ceil(r.measureText(q.BASELINE_SYMBOL).width);const h=Math.ceil(q.HEIGHT_MULTIPLIER*o);if(o=o*q.BASELINE_MULTIPLIER|0,a===0||h===0)return q._fonts[t]=e,e;i.width=a,i.height=h,r.fillStyle="#f00",r.fillRect(0,0,a,h),r.font=t,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(n,0,o);const l=r.getImageData(0,0,a,h).data,c=l.length,d=a*4;let u=0,f=0,p=!1;for(u=0;u<o;++u){for(let m=0;m<d;m+=4)if(l[f+m]!==255){p=!0;break}if(!p)f+=d;else break}for(e.ascent=o-u,f=c-d,p=!1,u=h;u>o;--u){for(let m=0;m<d;m+=4)if(l[f+m]!==255){p=!0;break}if(!p)f-=d;else break}return e.descent=u-o,e.fontSize=e.ascent+e.descent,q._fonts[t]=e,e}static clearMetrics(t=""){t?delete q._fonts[t]:q._fonts={}}static get _canvas(){var t;if(!q.__canvas){let e;try{const i=new OffscreenCanvas(0,0);if((t=i.getContext("2d",Ha))!=null&&t.measureText)return q.__canvas=i,i;e=H.ADAPTER.createCanvas()}catch{e=H.ADAPTER.createCanvas()}e.width=e.height=10,q.__canvas=e}return q.__canvas}static get _context(){return q.__context||(q.__context=q._canvas.getContext("2d",Ha)),q.__context}};ci.METRICS_STRING="|ÉqÅ",ci.BASELINE_SYMBOL="M",ci.BASELINE_MULTIPLIER=1.4,ci.HEIGHT_MULTIPLIER=2,ci.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const s=new Intl.Segmenter;return t=>[...s.segment(t)].map(e=>e.segment)}return s=>[...s]})(),ci.experimentalLetterSpacing=!1,ci._fonts={},ci._newlines=[10,13],ci._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let Zi=ci;const Zb=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],yp=class Bn{constructor(t){this.styleID=0,this.reset(),ml(this,t,t)}clone(){const t={};return ml(t,this,Bn.defaultStyle),new Bn(t)}reset(){ml(this,Bn.defaultStyle,Bn.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=pl(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=pl(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){Qb(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=pl(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 i=e.length-1;i>=0;i--){let r=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(r)&&!Zb.includes(r)&&(r=`"${r}"`),e[i]=r}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};yp.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Ga.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 Mi=yp;function pl(s){const t=pt.shared,e=i=>{const r=t.setValue(i);return r.alpha===1?r.toHex():r.toRgbaString()};return Array.isArray(s)?s.map(e):e(s)}function Qb(s,t){if(!Array.isArray(s)||!Array.isArray(t)||s.length!==t.length)return!1;for(let e=0;e<s.length;++e)if(s[e]!==t[e])return!1;return!0}function ml(s,t,e){for(const i in e)Array.isArray(t[i])?s[i]=t[i].slice():s[i]=t[i]}const Jb={texture:!0,children:!1,baseTexture:!0},xp=class Qc extends _e{constructor(t,e,i){let r=!1;i||(i=H.ADAPTER.createCanvas(),r=!0),i.width=3,i.height=3;const n=X.from(i);n.orig=new st,n.trim=new st,super(n),this._ownCanvas=r,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=Qc.defaultResolution??H.RESOLUTION,this._autoResolution=Qc.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 Zi.experimentalLetterSpacing}static set experimentalLetterSpacing(t){it("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),Zi.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 i=this.context,r=Zi.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=r.width,a=r.height,o=r.lines,h=r.lineHeight,l=r.lineWidths,c=r.maxLineWidth,d=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),i.scale(this._resolution,this._resolution),i.clearRect(0,0,this.canvas.width,this.canvas.height),i.font=this._font,i.lineWidth=e.strokeThickness,i.textBaseline=e.textBaseline,i.lineJoin=e.lineJoin,i.miterLimit=e.miterLimit;let u,f;const p=e.dropShadow?2:1;for(let m=0;m<p;++m){const _=e.dropShadow&&m===0,y=_?Math.ceil(Math.max(1,a)+e.padding*2):0,v=y*this._resolution;if(_){i.fillStyle="black",i.strokeStyle="black";const x=e.dropShadowColor,b=e.dropShadowBlur*this._resolution,w=e.dropShadowDistance*this._resolution;i.shadowColor=pt.shared.setValue(x).setAlpha(e.dropShadowAlpha).toRgbaString(),i.shadowBlur=b,i.shadowOffsetX=Math.cos(e.dropShadowAngle)*w,i.shadowOffsetY=Math.sin(e.dropShadowAngle)*w+v}else i.fillStyle=this._generateFillStyle(e,o,r),i.strokeStyle=e.stroke,i.shadowColor="black",i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0;let g=(h-d.fontSize)/2;h-d.fontSize<0&&(g=0);for(let x=0;x<o.length;x++)u=e.strokeThickness/2,f=e.strokeThickness/2+x*h+d.ascent+g,e.align==="right"?u+=c-l[x]:e.align==="center"&&(u+=(c-l[x])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(o[x],u+e.padding,f+e.padding-y,!0),e.fill&&this.drawLetterSpacing(o[x],u+e.padding,f+e.padding-y)}this.updateTexture()}drawLetterSpacing(t,e,i,r=!1){const n=this._style.letterSpacing;let a=!1;if(Zi.experimentalLetterSpacingSupported&&(Zi.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,i):this.context.fillText(t,e,i);return}let o=e;const h=Zi.graphemeSegmenter(t);let l=this.context.measureText(t).width,c=0;for(let d=0;d<h.length;++d){const u=h[d];r?this.context.strokeText(u,o,i):this.context.fillText(u,o,i);let f="";for(let p=d+1;p<h.length;++p)f+=h[p];c=this.context.measureText(f).width,o+=l-c+n,l=c}}updateTexture(){const t=this.canvas;if(this._style.trim){const a=_x(t);a.data&&(t.width=a.width,t.height=a.height,this.context.putImageData(a.data,0,0))}const e=this._texture,i=this._style,r=i.trim?0:i.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,i){const r=t.fill;if(Array.isArray(r)){if(r.length===1)return r[0]}else return r;let n;const a=t.dropShadow?t.dropShadowDistance:0,o=t.padding||0,h=this.canvas.width/this._resolution-a-o*2,l=this.canvas.height/this._resolution-a-o*2,c=r.slice(),d=t.fillGradientStops.slice();if(!d.length){const u=c.length+1;for(let f=1;f<u;++f)d.push(f/u)}if(c.unshift(r[0]),d.unshift(0),c.push(r[r.length-1]),d.push(1),t.fillGradientType===Ga.LINEAR_VERTICAL){n=this.context.createLinearGradient(h/2,o,h/2,l+o);const u=i.fontProperties.fontSize+t.strokeThickness;for(let f=0;f<e.length;f++){const p=i.lineHeight*(f-1)+u,m=i.lineHeight*f;let _=m;f>0&&p>m&&(_=(m+p)/2);const y=m+u,v=i.lineHeight*(f+1);let g=y;f+1<e.length&&v<y&&(g=(y+v)/2);const x=(g-_)/l;for(let b=0;b<c.length;b++){let w=0;typeof d[b]=="number"?w=d[b]:w=b/c.length;let T=Math.min(1,Math.max(0,_/l+w*x));T=Number(T.toFixed(5)),n.addColorStop(T,c[b])}}}else{n=this.context.createLinearGradient(o,l/2,h+o,l/2);const u=c.length+1;let f=1;for(let p=0;p<c.length;p++){let m;typeof d[p]=="number"?m=d[p]:m=f/u,n.addColorStop(m,c[p]),f++}}return n}destroy(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},Jb,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=Vi(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=Vi(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 Mi?this._style=t:this._style=new Mi(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)}};xp.defaultAutoResolution=!0;let Va=xp;class tT{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function eT(s,t){var i;let e=!1;if((i=s==null?void 0:s._textures)!=null&&i.length){for(let r=0;r<s._textures.length;r++)if(s._textures[r]instanceof X){const n=s._textures[r].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function iT(s,t){if(s.baseTexture instanceof J){const e=s.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function sT(s,t){if(s._texture&&s._texture instanceof X){const e=s._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function rT(s,t){return t instanceof Va?(t.updateText(!0),!0):!1}function nT(s,t){if(t instanceof Mi){const e=t.toFontString();return Zi.measureFont(e),!0}return!1}function aT(s,t){if(s instanceof Va){t.includes(s.style)||t.push(s.style),t.includes(s)||t.push(s);const e=s._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function oT(s,t){return s instanceof Mi?(t.includes(s)||t.push(s),!0):!1}const vp=class S_{constructor(t){this.limiter=new tT(S_.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(aT),this.registerFindHook(oT),this.registerFindHook(eT),this.registerFindHook(iT),this.registerFindHook(sT),this.registerUploadHook(rT),this.registerUploadHook(nT)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,ft.system.addOnce(this.tick,this,zi.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 i=0,r=this.uploadHooks.length;i<r;i++)if(this.uploadHooks[i](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}}e||this.queue.shift()}if(this.queue.length)ft.system.addOnce(this.tick,this,zi.UTILITY);else{this.ticking=!1;const t=this.completes.slice(0);this.completes.length=0;for(let e=0,i=t.length;e<i;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,i=this.addHooks.length;e<i&&!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&&ft.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}};vp.uploadsPerFrame=4;let _l=vp;Object.defineProperties(H,{UPLOADS_PER_FRAME:{get(){return _l.uploadsPerFrame},set(s){it("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),_l.uploadsPerFrame=s}}});function bp(s,t){return t instanceof J?(t._glTextures[s.CONTEXT_UID]||s.texture.bind(t),!0):!1}function hT(s,t){if(!(t instanceof li))return!1;const{geometry:e}=t;t.finishPoly(),e.updateBatches();const{batches:i}=e;for(let r=0;r<i.length;r++){const{texture:n}=i[r].style;n&&bp(s,n.baseTexture)}return e.batchable||s.geometry.bind(e,t._resolveDirectShader(s)),!0}function lT(s,t){return s instanceof li?(t.push(s),!0):!1}class Tp extends _l{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(lT),this.registerUploadHook(bp),this.registerUploadHook(hT)}}Tp.extension={name:"prepare",type:G.RendererSystem},z.add(Tp);var cT=`#version 300 es
|
|
968
|
+
`;class Dm extends yo{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=js.from(BT,kT,{}),this.state=Ws.for2d()}render(t){const e=t.children,s=t._maxSize,i=t._batchSize,n=this.renderer;let o=e.length;if(o===0)return;o>s&&!t.autoResize&&(o=s);let h=t._buffers;h||(h=t._buffers=this.generateBuffers(t));const a=e[0]._texture.baseTexture,l=a.alphaMode>0;this.state.blendMode=Qf(t.blendMode,l),n.state.set(this.state);const c=n.gl,d=t.worldTransform.copyTo(this.tempMatrix);d.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=d.toArray(!0),this.shader.uniforms.uColor=Ct.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,l).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=a,this.renderer.shader.bind(this.shader);let u=!1;for(let f=0,p=0;f<o;f+=i,p+=1){let m=o-f;m>i&&(m=i),p>=h.length&&h.push(this._generateOneMoreBuffer(t));const g=h[p];g.uploadDynamic(e,f,m);const y=t._bufferUpdateIDs[p]||0;u=u||g._updateID<y,u&&(g._updateID=t._updateID,g.uploadStatic(e,f,m)),n.geometry.bind(g.geometry),c.drawElements(c.TRIANGLES,m*6,c.UNSIGNED_SHORT,0)}}generateBuffers(t){const e=[],s=t._maxSize,i=t._batchSize,n=t._properties;for(let o=0;o<s;o+=i)e.push(new Bm(this.properties,n,i));return e}_generateOneMoreBuffer(t){const e=t._batchSize,s=t._properties;return new Bm(this.properties,s,e)}uploadVertices(t,e,s,i,n,o){let h=0,a=0,l=0,c=0;for(let d=0;d<s;++d){const u=t[e+d],f=u._texture,p=u.scale.x,m=u.scale.y,g=f.trim,y=f.orig;g?(a=g.x-u.anchor.x*y.width,h=a+g.width,c=g.y-u.anchor.y*y.height,l=c+g.height):(h=y.width*(1-u.anchor.x),a=y.width*-u.anchor.x,l=y.height*(1-u.anchor.y),c=y.height*-u.anchor.y),i[o]=a*p,i[o+1]=c*m,i[o+n]=h*p,i[o+n+1]=c*m,i[o+n*2]=h*p,i[o+n*2+1]=l*m,i[o+n*3]=a*p,i[o+n*3+1]=l*m,o+=n*4}}uploadPosition(t,e,s,i,n,o){for(let h=0;h<s;h++){const a=t[e+h].position;i[o]=a.x,i[o+1]=a.y,i[o+n]=a.x,i[o+n+1]=a.y,i[o+n*2]=a.x,i[o+n*2+1]=a.y,i[o+n*3]=a.x,i[o+n*3+1]=a.y,o+=n*4}}uploadRotation(t,e,s,i,n,o){for(let h=0;h<s;h++){const a=t[e+h].rotation;i[o]=a,i[o+n]=a,i[o+n*2]=a,i[o+n*3]=a,o+=n*4}}uploadUvs(t,e,s,i,n,o){for(let h=0;h<s;++h){const a=t[e+h]._texture._uvs;a?(i[o]=a.x0,i[o+1]=a.y0,i[o+n]=a.x1,i[o+n+1]=a.y1,i[o+n*2]=a.x2,i[o+n*2+1]=a.y2,i[o+n*3]=a.x3,i[o+n*3+1]=a.y3,o+=n*4):(i[o]=0,i[o+1]=0,i[o+n]=0,i[o+n+1]=0,i[o+n*2]=0,i[o+n*2+1]=0,i[o+n*3]=0,i[o+n*3+1]=0,o+=n*4)}}uploadTint(t,e,s,i,n,o){for(let h=0;h<s;++h){const a=t[e+h],l=Ct.shared.setValue(a._tintRGB).toPremultiplied(a.alpha,a.texture.baseTexture.alphaMode>0);i[o]=l,i[o+n]=l,i[o+n*2]=l,i[o+n*3]=l,o+=n*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}Dm.extension={name:"particle",type:Y.RendererPlugin},Z.add(Dm);var Ho=(r=>(r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",r))(Ho||{});const Wo={willReadFrequently:!0},Zs=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,i,n,o,h,a,l){this.text=t,this.style=e,this.width=s,this.height=i,this.lines=n,this.lineWidths=o,this.lineHeight=h,this.maxLineWidth=a,this.fontProperties=l}static measureText(t,e,s,i=J._canvas){s=s??e.wordWrap;const n=e.toFontString(),o=J.measureFont(n);o.fontSize===0&&(o.fontSize=e.fontSize,o.ascent=e.fontSize);const h=i.getContext("2d",Wo);h.font=n;const a=(s?J.wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),l=new Array(a.length);let c=0;for(let p=0;p<a.length;p++){const m=J._measureText(a[p],e.letterSpacing,h);l[p]=m,c=Math.max(c,m)}let d=c+e.strokeThickness;e.dropShadow&&(d+=e.dropShadowDistance);const u=e.lineHeight||o.fontSize+e.strokeThickness;let f=Math.max(u,o.fontSize+e.strokeThickness*2)+e.leading+(a.length-1)*(u+e.leading);return e.dropShadow&&(f+=e.dropShadowDistance),new J(t,e,d,f,a,l,u+e.leading,c,o)}static _measureText(t,e,s){let i=!1;J.experimentalLetterSpacingSupported&&(J.experimentalLetterSpacing?(s.letterSpacing=`${e}px`,s.textLetterSpacing=`${e}px`,i=!0):(s.letterSpacing="0px",s.textLetterSpacing="0px"));let n=s.measureText(t).width;return n>0&&(i?n-=e:n+=(J.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,s=J._canvas){const i=s.getContext("2d",Wo);let n=0,o="",h="";const a=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,d=J.collapseSpaces(c),u=J.collapseNewlines(c);let f=!d;const p=e.wordWrapWidth+l,m=J.tokenize(t);for(let g=0;g<m.length;g++){let y=m[g];if(J.isNewline(y)){if(!u){h+=J.addLine(o),f=!d,o="",n=0;continue}y=" "}if(d){const _=J.isBreakingSpace(y),v=J.isBreakingSpace(o[o.length-1]);if(_&&v)continue}const x=J.getFromCache(y,l,a,i);if(x>p)if(o!==""&&(h+=J.addLine(o),o="",n=0),J.canBreakWords(y,e.breakWords)){const _=J.wordWrapSplit(y);for(let v=0;v<_.length;v++){let b=_[v],w=b,E=1;for(;_[v+E];){const A=_[v+E];if(!J.canBreakChars(w,A,y,v,e.breakWords))b+=A;else break;w=A,E++}v+=E-1;const T=J.getFromCache(b,l,a,i);T+n>p&&(h+=J.addLine(o),f=!1,o="",n=0),o+=b,n+=T}}else{o.length>0&&(h+=J.addLine(o),o="",n=0);const _=g===m.length-1;h+=J.addLine(y,!_),f=!1,o="",n=0}else x+n>p&&(f=!1,h+=J.addLine(o),o="",n=0),(o.length>0||!J.isBreakingSpace(y)||f)&&(o+=y,n+=x)}return h+=J.addLine(o,!1),h}static addLine(t,e=!0){return t=J.trimRight(t),t=e?`${t}
|
|
969
|
+
`:t,t}static getFromCache(t,e,s,i){let n=s[t];return typeof n!="number"&&(n=J._measureText(t,e,i)+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 i=0;i<t.length;i++){const n=t[i],o=t[i+1];if(J.isBreakingSpace(n,o)||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,i,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,i=J._context;i.font=t;const n=J.METRICS_STRING+J.BASELINE_SYMBOL,o=Math.ceil(i.measureText(n).width);let h=Math.ceil(i.measureText(J.BASELINE_SYMBOL).width);const a=Math.ceil(J.HEIGHT_MULTIPLIER*h);if(h=h*J.BASELINE_MULTIPLIER|0,o===0||a===0)return J._fonts[t]=e,e;s.width=o,s.height=a,i.fillStyle="#f00",i.fillRect(0,0,o,a),i.font=t,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(n,0,h);const l=i.getImageData(0,0,o,a).data,c=l.length,d=o*4;let u=0,f=0,p=!1;for(u=0;u<h;++u){for(let m=0;m<d;m+=4)if(l[f+m]!==255){p=!0;break}if(!p)f+=d;else break}for(e.ascent=h-u,f=c-d,p=!1,u=a;u>h;--u){for(let m=0;m<d;m+=4)if(l[f+m]!==255){p=!0;break}if(!p)f-=d;else break}return e.descent=u-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",Wo))!=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",Wo)),J.__context}};Zs.METRICS_STRING="|ÉqÅ",Zs.BASELINE_SYMBOL="M",Zs.BASELINE_MULTIPLIER=1.4,Zs.HEIGHT_MULTIPLIER=2,Zs.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})(),Zs.experimentalLetterSpacing=!1,Zs._fonts={},Zs._newlines=[10,13],Zs._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let Gi=Zs;const DT=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Om=class La{constructor(t){this.styleID=0,this.reset(),mc(this,t,t)}clone(){const t={};return mc(t,this,La.defaultStyle),new La(t)}reset(){mc(this,La.defaultStyle,La.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){OT(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 i=e[s].trim();!/([\"\'])[^\'\"]+\1/.test(i)&&!DT.includes(i)&&(i=`"${i}"`),e[s]=i}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};Om.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Ho.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 yi=Om;function pc(r){const t=Ct.shared,e=s=>{const i=t.setValue(s);return i.alpha===1?i.toHex():i.toRgbaString()};return Array.isArray(r)?r.map(e):e(r)}function OT(r,t){if(!Array.isArray(r)||!Array.isArray(t)||r.length!==t.length)return!1;for(let e=0;e<r.length;++e)if(r[e]!==t[e])return!1;return!0}function mc(r,t,e){for(const s in e)Array.isArray(t[s])?r[s]=t[s].slice():r[s]=t[s]}const LT={texture:!0,children:!1,baseTexture:!0},Lm=class _d extends qe{constructor(t,e,s){let i=!1;s||(s=z.ADAPTER.createCanvas(),i=!0),s.width=3,s.height=3;const n=q.from(s);n.orig=new it,n.trim=new it,super(n),this._ownCanvas=i,this.canvas=s,this.context=s.getContext("2d",{willReadFrequently:!0}),this._resolution=_d.defaultResolution??z.RESOLUTION,this._autoResolution=_d.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 Gi.experimentalLetterSpacing}static set experimentalLetterSpacing(t){at("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),Gi.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,i=Gi.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=i.width,o=i.height,h=i.lines,a=i.lineHeight,l=i.lineWidths,c=i.maxLineWidth,d=i.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,o)+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 u,f;const p=e.dropShadow?2:1;for(let m=0;m<p;++m){const g=e.dropShadow&&m===0,y=g?Math.ceil(Math.max(1,o)+e.padding*2):0,x=y*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,i),s.strokeStyle=e.stroke,s.shadowColor="black",s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0;let _=(a-d.fontSize)/2;a-d.fontSize<0&&(_=0);for(let v=0;v<h.length;v++)u=e.strokeThickness/2,f=e.strokeThickness/2+v*a+d.ascent+_,e.align==="right"?u+=c-l[v]:e.align==="center"&&(u+=(c-l[v])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(h[v],u+e.padding,f+e.padding-y,!0),e.fill&&this.drawLetterSpacing(h[v],u+e.padding,f+e.padding-y)}this.updateTexture()}drawLetterSpacing(t,e,s,i=!1){const n=this._style.letterSpacing;let o=!1;if(Gi.experimentalLetterSpacingSupported&&(Gi.experimentalLetterSpacing?(this.context.letterSpacing=`${n}px`,this.context.textLetterSpacing=`${n}px`,o=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),n===0||o){i?this.context.strokeText(t,e,s):this.context.fillText(t,e,s);return}let h=e;const a=Gi.graphemeSegmenter(t);let l=this.context.measureText(t).width,c=0;for(let d=0;d<a.length;++d){const u=a[d];i?this.context.strokeText(u,h,s):this.context.fillText(u,h,s);let f="";for(let p=d+1;p<a.length;++p)f+=a[p];c=this.context.measureText(f).width,h+=l-c+n,l=c}}updateTexture(){const t=this.canvas;if(this._style.trim){const o=tb(t);o.data&&(t.width=o.width,t.height=o.height,this.context.putImageData(o.data,0,0))}const e=this._texture,s=this._style,i=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=-i,e.trim.y=-i,e.orig.width=e._frame.width-i*2,e.orig.height=e._frame.height-i*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 i=t.fill;if(Array.isArray(i)){if(i.length===1)return i[0]}else return i;let n;const o=t.dropShadow?t.dropShadowDistance:0,h=t.padding||0,a=this.canvas.width/this._resolution-o-h*2,l=this.canvas.height/this._resolution-o-h*2,c=i.slice(),d=t.fillGradientStops.slice();if(!d.length){const u=c.length+1;for(let f=1;f<u;++f)d.push(f/u)}if(c.unshift(i[0]),d.unshift(0),c.push(i[i.length-1]),d.push(1),t.fillGradientType===Ho.LINEAR_VERTICAL){n=this.context.createLinearGradient(a/2,h,a/2,l+h);const u=s.fontProperties.fontSize+t.strokeThickness;for(let f=0;f<e.length;f++){const p=s.lineHeight*(f-1)+u,m=s.lineHeight*f;let g=m;f>0&&p>m&&(g=(m+p)/2);const y=m+u,x=s.lineHeight*(f+1);let _=y;f+1<e.length&&x<y&&(_=(y+x)/2);const v=(_-g)/l;for(let b=0;b<c.length;b++){let w=0;typeof d[b]=="number"?w=d[b]:w=b/c.length;let E=Math.min(1,Math.max(0,g/l+w*v));E=Number(E.toFixed(5)),n.addColorStop(E,c[b])}}}else{n=this.context.createLinearGradient(h,l/2,a+h,l/2);const u=c.length+1;let f=1;for(let p=0;p<c.length;p++){let m;typeof d[p]=="number"?m=d[p]:m=f/u,n.addColorStop(m,c[p]),f++}}return n}destroy(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},LT,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=Bi(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=Bi(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 yi?this._style=t:this._style=new yi(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)}};Lm.defaultAutoResolution=!0;let zo=Lm;class NT{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function UT(r,t){var s;let e=!1;if((s=r==null?void 0:r._textures)!=null&&s.length){for(let i=0;i<r._textures.length;i++)if(r._textures[i]instanceof q){const n=r._textures[i].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function VT(r,t){if(r.baseTexture instanceof et){const e=r.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function XT(r,t){if(r._texture&&r._texture instanceof q){const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function GT(r,t){return t instanceof zo?(t.updateText(!0),!0):!1}function $T(r,t){if(t instanceof yi){const e=t.toFontString();return Gi.measureFont(e),!0}return!1}function YT(r,t){if(r instanceof zo){t.includes(r.style)||t.push(r.style),t.includes(r)||t.push(r);const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function HT(r,t){return r instanceof yi?(t.includes(r)||t.push(r),!0):!1}const Nm=class J_{constructor(t){this.limiter=new NT(J_.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(YT),this.registerFindHook(HT),this.registerFindHook(UT),this.registerFindHook(VT),this.registerFindHook(XT),this.registerUploadHook(GT),this.registerUploadHook($T)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,Tt.system.addOnce(this.tick,this,Ni.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,i=this.uploadHooks.length;s<i;s++)if(this.uploadHooks[s](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}}e||this.queue.shift()}if(this.queue.length)Tt.system.addOnce(this.tick,this,Ni.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&&Tt.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}};Nm.uploadsPerFrame=4;let gc=Nm;Object.defineProperties(z,{UPLOADS_PER_FRAME:{get(){return gc.uploadsPerFrame},set(r){at("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),gc.uploadsPerFrame=r}}});function Um(r,t){return t instanceof et?(t._glTextures[r.CONTEXT_UID]||r.texture.bind(t),!0):!1}function WT(r,t){if(!(t instanceof Ks))return!1;const{geometry:e}=t;t.finishPoly(),e.updateBatches();const{batches:s}=e;for(let i=0;i<s.length;i++){const{texture:n}=s[i].style;n&&Um(r,n.baseTexture)}return e.batchable||r.geometry.bind(e,t._resolveDirectShader(r)),!0}function zT(r,t){return r instanceof Ks?(t.push(r),!0):!1}class Vm extends gc{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(zT),this.registerUploadHook(Um),this.registerUploadHook(WT)}}Vm.extension={name:"prepare",type:Y.RendererSystem},Z.add(Vm);var jT=`#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
|
-
`,
|
|
995
|
+
`,qT=`#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
|
-
`,
|
|
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
|
-
`,
|
|
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
|
-
`,
|
|
1068
|
+
`,ZT=`#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 Wa=new gt;class Ep extends pa{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new of,this.state=ni.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=oi.from(wp,fT,e),this.shader=t.context.webGLVersion>1?oi.from(uT,cT,e):oi.from(wp,dT,e)}render(t){const e=this.renderer,i=this.quad;let r=i.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=i.uvs,r[0]=r[6]=-n,r[1]=r[3]=-a,r[2]=r[4]=1-n,r[5]=r[7]=1-a,i.invalidate();const o=t._texture,h=o.baseTexture,l=h.alphaMode>0,c=t.tileTransform.localTransform,d=t.uvMatrix;let u=h.isPowerOfTwo&&o.frame.width===h.width&&o.frame.height===h.height;u&&(h._glTextures[e.CONTEXT_UID]?u=h.wrapMode!==Ui.CLAMP:h.wrapMode===Ui.CLAMP&&(h.wrapMode=Ui.REPEAT));const f=u?this.simpleShader:this.shader,p=o.width,m=o.height,_=t._width,y=t._height;Wa.set(c.a*p/_,c.b*p/y,c.c*m/_,c.d*m/y,c.tx/_,c.ty/y),Wa.invert(),u?Wa.prepend(d.mapCoord):(f.uniforms.uMapCoord=d.mapCoord.toArray(!0),f.uniforms.uClampFrame=d.uClampFrame,f.uniforms.uClampOffset=d.uClampOffset),f.uniforms.uTransform=Wa.toArray(!0),f.uniforms.uColor=pt.shared.setValue(t.tint).premultiply(t.worldAlpha,l).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=o,e.shader.bind(f),e.geometry.bind(i),this.state.blendMode=Bd(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}Ep.extension={name:"tilingSprite",type:G.RendererPlugin},z.add(Ep);const Ap=class On{constructor(t,e,i){this.linkedSheets=[],(t instanceof J||t instanceof X)&&(t={texture:t,data:e,resolutionFilename:i});const{texture:r,data:n,resolutionFilename:a=null,cachePrefix:o=""}=t;this.cachePrefix=o,this._texture=r instanceof X?r:null,this.baseTexture=r instanceof J?r:this._texture.baseTexture,this.textures={},this.animations={},this.data=n;const h=this.baseTexture.resource;this.resolution=this._updateResolution(a||(h?h.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 i=Pi(t,null);return i===null&&(i=typeof e=="number"?e:parseFloat(e??"1")),i!==1&&this.baseTexture.setResolution(i),i}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=On.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=On.BATCH_SIZE;for(;e-t<i&&e<this._frameKeys.length;){const r=this._frameKeys[e],n=this._frames[r],a=n.frame;if(a){let o=null,h=null;const l=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,c=new st(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?o=new st(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):o=new st(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(h=new st(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 X(this.baseTexture,o,c,h,n.rotated?2:0,n.anchor,n.borders),X.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 i=0;i<t[e].length;i++){const r=t[e][i];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*On.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*On.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const i in this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&((e=this._texture)==null||e.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};Ap.BATCH_SIZE=1e3;let Sp=Ap;const pT=["jpg","png","jpeg","avif","webp","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"];function Cp(s,t,e){const i={};if(s.forEach(r=>{i[r]=t}),Object.keys(t.textures).forEach(r=>{i[`${t.cachePrefix}${r}`]=t.textures[r]}),!e){const r=Ft.dirname(s[0]);t.linkedSheets.forEach((n,a)=>{Object.assign(i,Cp([`${r}/${t.data.meta.related_multi_packs[a]}`],n,!0))})}return i}const mT={extension:G.Asset,cache:{test:s=>s instanceof Sp,getCacheableAssets:(s,t)=>Cp(s,t,!1)},resolver:{test:s=>{const t=s.split("?")[0].split("."),e=t.pop(),i=t.pop();return e==="json"&&pT.includes(i)},parse:s=>{var e;const t=s.split(".");return{resolution:parseFloat(((e=H.RETINA_PREFIX.exec(s))==null?void 0:e[1])??"1"),format:t[t.length-2],src:s}}},loader:{name:"spritesheetLoader",extension:{type:G.LoadParser,priority:Re.Normal},async testParse(s,t){return Ft.extname(t.src).toLowerCase()===".json"&&!!s.frames},async parse(s,t,e){var c,d;const{texture:i,imageFilename:r,cachePrefix:n}=(t==null?void 0:t.data)??{};let a=Ft.dirname(t.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let o;if(i&&i.baseTexture)o=i;else{const u=tl(a+(r??s.meta.image),t.src);o=(await e.load([u]))[u]}const h=new Sp({texture:o.baseTexture,data:s,resolutionFilename:t.src,cachePrefix:n});await h.parse();const l=(c=s==null?void 0:s.meta)==null?void 0:c.related_multi_packs;if(Array.isArray(l)){const u=[];for(const p of l){if(typeof p!="string")continue;let m=a+p;(d=t.data)!=null&&d.ignoreMultiPack||(m=tl(m,t.src),u.push(e.load({src:m,data:{ignoreMultiPack:!0}})))}const f=await Promise.all(u);h.linkedSheets=f,f.forEach(p=>{p.linkedSheets=[h].concat(h.linkedSheets.filter(m=>m!==p))})}return h},unload(s){s.destroy(!0)}}};z.add(mT);class Xa{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class $a{static test(t){return typeof t=="string"&&t.startsWith("info face=")}static parse(t){const e=t.match(/^[a-z]+\s+.+$/gm),i={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const n in e){const a=e[n].match(/^[a-z]+/gm)[0],o=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),h={};for(const l in o){const c=o[l].split("="),d=c[0],u=c[1].replace(/"/gm,""),f=parseFloat(u),p=isNaN(f)?u:f;h[d]=p}i[a].push(h)}const r=new Xa;return i.info.forEach(n=>r.info.push({face:n.face,size:parseInt(n.size,10)})),i.common.forEach(n=>r.common.push({lineHeight:parseInt(n.lineHeight,10)})),i.page.forEach(n=>r.page.push({id:parseInt(n.id,10),file:n.file})),i.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)})),i.kerning.forEach(n=>r.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),i.distanceField.forEach(n=>r.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),r}}class gl{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 Xa,i=t.getElementsByTagName("info"),r=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),a=t.getElementsByTagName("char"),o=t.getElementsByTagName("kerning"),h=t.getElementsByTagName("distanceField");for(let l=0;l<i.length;l++)e.info.push({face:i[l].getAttribute("face"),size:parseInt(i[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 c=a[l];e.char.push({id:parseInt(c.getAttribute("id"),10),page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xoffset:parseInt(c.getAttribute("xoffset"),10),yoffset:parseInt(c.getAttribute("yoffset"),10),xadvance:parseInt(c.getAttribute("xadvance"),10)})}for(let l=0;l<o.length;l++)e.kerning.push({first:parseInt(o[l].getAttribute("first"),10),second:parseInt(o[l].getAttribute("second"),10),amount:parseInt(o[l].getAttribute("amount"),10)});for(let l=0;l<h.length;l++)e.distanceField.push({fieldType:h[l].getAttribute("fieldType"),distanceRange:parseInt(h[l].getAttribute("distanceRange"),10)});return e}}class yl{static test(t){return typeof t=="string"&&t.includes("<font>")?gl.test(H.ADAPTER.parseXML(t)):!1}static parse(t){return gl.parse(H.ADAPTER.parseXML(t))}}const xl=[$a,gl,yl];function _T(s){for(let t=0;t<xl.length;t++)if(xl[t].test(s))return xl[t];return null}function gT(s,t,e,i,r,n){const a=e.fill;if(Array.isArray(a)){if(a.length===1)return a[0]}else return a;let o;const h=e.dropShadow?e.dropShadowDistance:0,l=e.padding||0,c=s.width/i-h-l*2,d=s.height/i-h-l*2,u=a.slice(),f=e.fillGradientStops.slice();if(!f.length){const p=u.length+1;for(let m=1;m<p;++m)f.push(m/p)}if(u.unshift(a[0]),f.unshift(0),u.push(a[a.length-1]),f.push(1),e.fillGradientType===Ga.LINEAR_VERTICAL){o=t.createLinearGradient(c/2,l,c/2,d+l);let p=0;const m=(n.fontProperties.fontSize+e.strokeThickness)/d;for(let _=0;_<r.length;_++){const y=n.lineHeight*_;for(let v=0;v<u.length;v++){let g=0;typeof f[v]=="number"?g=f[v]:g=v/u.length;const x=y/d+g*m;let b=Math.max(p,x);b=Math.min(b,1),o.addColorStop(b,u[v]),p=b}}}else{o=t.createLinearGradient(l,d/2,c+l,d/2);const p=u.length+1;let m=1;for(let _=0;_<u.length;_++){let y;typeof f[_]=="number"?y=f[_]:y=m/p,o.addColorStop(y,u[_]),m++}}return o}function yT(s,t,e,i,r,n,a){const o=e.text,h=e.fontProperties;t.translate(i,r),t.scale(n,n);const l=a.strokeThickness/2,c=-(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=gT(s,t,a,n,[o],e),t.strokeStyle=a.stroke,a.dropShadow){const d=a.dropShadowColor,u=a.dropShadowBlur*n,f=a.dropShadowDistance*n;t.shadowColor=pt.shared.setValue(d).setAlpha(a.dropShadowAlpha).toRgbaString(),t.shadowBlur=u,t.shadowOffsetX=Math.cos(a.dropShadowAngle)*f,t.shadowOffsetY=Math.sin(a.dropShadowAngle)*f}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;a.stroke&&a.strokeThickness&&t.strokeText(o,l,c+e.lineHeight-h.descent),a.fill&&t.fillText(o,l,c+e.lineHeight-h.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function za(s){return s.codePointAt?s.codePointAt(0):s.charCodeAt(0)}function Pp(s){return Array.from?Array.from(s):s.split("")}function xT(s){typeof s=="string"&&(s=[s]);const t=[];for(let e=0,i=s.length;e<i;e++){const r=s[e];if(Array.isArray(r)){if(r.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${r.length}.`);const n=r[0].charCodeAt(0),a=r[1].charCodeAt(0);if(a<n)throw new Error("[BitmapFont]: Invalid character range.");for(let o=n,h=a;o<=h;o++)t.push(String.fromCharCode(o))}else t.push(...Pp(r))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const Qi=class bi{constructor(t,e,i){var c;const[r]=t.info,[n]=t.common,[a]=t.page,[o]=t.distanceField,h=Pi(a.file),l={};this._ownsTextures=i,this.font=r.face,this.size=r.size,this.lineHeight=n.lineHeight/h,this.chars={},this.pageTextures=l;for(let d=0;d<t.page.length;d++){const{id:u,file:f}=t.page[d];l[u]=e instanceof Array?e[d]:e[f],o!=null&&o.fieldType&&o.fieldType!=="none"&&(l[u].baseTexture.alphaMode=he.NO_PREMULTIPLIED_ALPHA,l[u].baseTexture.mipmap=Ke.OFF)}for(let d=0;d<t.char.length;d++){const{id:u,page:f}=t.char[d];let{x:p,y:m,width:_,height:y,xoffset:v,yoffset:g,xadvance:x}=t.char[d];p/=h,m/=h,_/=h,y/=h,v/=h,g/=h,x/=h;const b=new st(p+l[f].frame.x/h,m+l[f].frame.y/h,_,y);this.chars[u]={xOffset:v,yOffset:g,xAdvance:x,kerning:{},texture:new X(l[f].baseTexture,b),page:f}}for(let d=0;d<t.kerning.length;d++){let{first:u,second:f,amount:p}=t.kerning[d];u/=h,f/=h,p/=h,this.chars[f]&&(this.chars[f].kerning[u]=p)}this.distanceFieldRange=o==null?void 0:o.distanceRange,this.distanceFieldType=((c=o==null?void 0:o.fieldType)==null?void 0:c.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,i){let r;if(t instanceof Xa)r=t;else{const a=_T(t);if(!a)throw new Error("Unrecognized data format for font.");r=a.parse(t)}e instanceof X&&(e=[e]);const n=new bi(r,e,i);return bi.available[n.font]=n,n}static uninstall(t){const e=bi.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete bi.available[t]}static from(t,e,i){if(!t)throw new Error("[BitmapFont] Property `name` is required.");const{chars:r,padding:n,resolution:a,textureWidth:o,textureHeight:h,...l}=Object.assign({},bi.defaultOptions,i),c=xT(r),d=e instanceof Mi?e:new Mi(e),u=o,f=new Xa;f.info[0]={face:d.fontFamily,size:d.fontSize},f.common[0]={lineHeight:d.fontSize};let p=0,m=0,_,y,v,g=0;const x=[];for(let w=0;w<c.length;w++){_||(_=H.ADAPTER.createCanvas(),_.width=o,_.height=h,y=_.getContext("2d"),v=new J(_,{resolution:a,...l}),x.push(new X(v)),f.page.push({id:x.length-1,file:""}));const T=c[w],E=Zi.measureText(T,d,!1,_),A=E.width,P=Math.ceil(E.height),L=Math.ceil((d.fontStyle==="italic"?2:1)*A);if(m>=h-P*a){if(m===0)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${d.fontFamily}', fontSize: ${d.fontSize}px, char: '${T}')`);--w,_=null,y=null,v=null,m=0,p=0,g=0;continue}if(g=Math.max(P+E.fontProperties.descent,g),L*a+p>=u){if(p===0)throw new Error(`[BitmapFont] textureWidth ${o}px is too small (fontFamily: '${d.fontFamily}', fontSize: ${d.fontSize}px, char: '${T}')`);--w,m+=g*a,m=Math.ceil(m),p=0,g=0;continue}yT(_,y,E,p,m,a,d);const M=za(E.text);f.char.push({id:M,page:x.length-1,x:p/a,y:m/a,width:L,height:P,xoffset:0,yoffset:0,xadvance:A-(d.dropShadow?d.dropShadowDistance:0)-(d.stroke?d.strokeThickness:0)}),p+=(L+2*n)*a,p=Math.ceil(p)}if(!(i!=null&&i.skipKerning))for(let w=0,T=c.length;w<T;w++){const E=c[w];for(let A=0;A<T;A++){const P=c[A],L=y.measureText(E).width,M=y.measureText(P).width,S=y.measureText(E+P).width-(L+M);S&&f.kerning.push({first:za(E),second:za(P),amount:S})}}const b=new bi(f,x,!0);return bi.available[t]!==void 0&&bi.uninstall(t),bi.available[t]=b,b}};Qi.ALPHA=[["a","z"],["A","Z"]," "],Qi.NUMERIC=[["0","9"]],Qi.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Qi.ASCII=[[" ","~"]],Qi.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Qi.ALPHANUMERIC},Qi.available={};let Ji=Qi;var vT=`// Pixi texture info\r
|
|
1083
|
+
`;const jo=new Rt;class Gm extends yo{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new Ap,this.state=Ws.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=js.from(Xm,ZT,e),this.shader=t.context.webGLVersion>1?js.from(qT,jT,e):js.from(Xm,KT,e)}render(t){const e=this.renderer,s=this.quad;let i=s.vertices;i[0]=i[6]=t._width*-t.anchor.x,i[1]=i[3]=t._height*-t.anchor.y,i[2]=i[4]=t._width*(1-t.anchor.x),i[5]=i[7]=t._height*(1-t.anchor.y);const n=t.uvRespectAnchor?t.anchor.x:0,o=t.uvRespectAnchor?t.anchor.y:0;i=s.uvs,i[0]=i[6]=-n,i[1]=i[3]=-o,i[2]=i[4]=1-n,i[5]=i[7]=1-o,s.invalidate();const h=t._texture,a=h.baseTexture,l=a.alphaMode>0,c=t.tileTransform.localTransform,d=t.uvMatrix;let u=a.isPowerOfTwo&&h.frame.width===a.width&&h.frame.height===a.height;u&&(a._glTextures[e.CONTEXT_UID]?u=a.wrapMode!==Mi.CLAMP:a.wrapMode===Mi.CLAMP&&(a.wrapMode=Mi.REPEAT));const f=u?this.simpleShader:this.shader,p=h.width,m=h.height,g=t._width,y=t._height;jo.set(c.a*p/g,c.b*p/y,c.c*m/g,c.d*m/y,c.tx/g,c.ty/y),jo.invert(),u?jo.prepend(d.mapCoord):(f.uniforms.uMapCoord=d.mapCoord.toArray(!0),f.uniforms.uClampFrame=d.uClampFrame,f.uniforms.uClampOffset=d.uClampOffset),f.uniforms.uTransform=jo.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=Qf(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}Gm.extension={name:"tilingSprite",type:Y.RendererPlugin},Z.add(Gm);const $m=class Na{constructor(t,e,s){this.linkedSheets=[],(t instanceof et||t instanceof q)&&(t={texture:t,data:e,resolutionFilename:s});const{texture:i,data:n,resolutionFilename:o=null,cachePrefix:h=""}=t;this.cachePrefix=h,this._texture=i instanceof q?i:null,this.baseTexture=i instanceof et?i:this._texture.baseTexture,this.textures={},this.animations={},this.data=n;const a=this.baseTexture.resource;this.resolution=this._updateResolution(o||(a?a.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=gi(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<=Na.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const s=Na.BATCH_SIZE;for(;e-t<s&&e<this._frameKeys.length;){const i=this._frameKeys[e],n=this._frames[i],o=n.frame;if(o){let h=null,a=null;const l=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,c=new it(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?h=new it(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):h=new it(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(a=new it(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[i]=new q(this.baseTexture,h,c,a,n.rotated?2:0,n.anchor,n.borders),q.addToCache(this.textures[i],this.cachePrefix+i.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 i=t[e][s];this.animations[e].push(this.textures[i])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Na.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Na.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=[]}};$m.BATCH_SIZE=1e3;let Ym=$m;const QT=["jpg","png","jpeg","avif","webp","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"];function Hm(r,t,e){const s={};if(r.forEach(i=>{s[i]=t}),Object.keys(t.textures).forEach(i=>{s[`${t.cachePrefix}${i}`]=t.textures[i]}),!e){const i=vt.dirname(r[0]);t.linkedSheets.forEach((n,o)=>{Object.assign(s,Hm([`${i}/${t.data.meta.related_multi_packs[o]}`],n,!0))})}return s}const JT={extension:Y.Asset,cache:{test:r=>r instanceof Ym,getCacheableAssets:(r,t)=>Hm(r,t,!1)},resolver:{test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),s=t.pop();return e==="json"&&QT.includes(s)},parse:r=>{var e;const t=r.split(".");return{resolution:parseFloat(((e=z.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:Y.LoadParser,priority:Ne.Normal},async testParse(r,t){return vt.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var c,d;const{texture:s,imageFilename:i,cachePrefix:n}=(t==null?void 0:t.data)??{};let o=vt.dirname(t.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");let h;if(s&&s.baseTexture)h=s;else{const u=tc(o+(i??r.meta.image),t.src);h=(await e.load([u]))[u]}const a=new Ym({texture:h.baseTexture,data:r,resolutionFilename:t.src,cachePrefix:n});await a.parse();const l=(c=r==null?void 0:r.meta)==null?void 0:c.related_multi_packs;if(Array.isArray(l)){const u=[];for(const p of l){if(typeof p!="string")continue;let m=o+p;(d=t.data)!=null&&d.ignoreMultiPack||(m=tc(m,t.src),u.push(e.load({src:m,data:{ignoreMultiPack:!0}})))}const f=await Promise.all(u);a.linkedSheets=f,f.forEach(p=>{p.linkedSheets=[a].concat(a.linkedSheets.filter(m=>m!==p))})}return a},unload(r){r.destroy(!0)}}};Z.add(JT);class qo{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Ko{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 o=e[n].match(/^[a-z]+/gm)[0],h=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),a={};for(const l in h){const c=h[l].split("="),d=c[0],u=c[1].replace(/"/gm,""),f=parseFloat(u),p=isNaN(f)?u:f;a[d]=p}s[o].push(a)}const i=new qo;return s.info.forEach(n=>i.info.push({face:n.face,size:parseInt(n.size,10)})),s.common.forEach(n=>i.common.push({lineHeight:parseInt(n.lineHeight,10)})),s.page.forEach(n=>i.page.push({id:parseInt(n.id,10),file:n.file})),s.char.forEach(n=>i.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=>i.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),s.distanceField.forEach(n=>i.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),i}}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 qo,s=t.getElementsByTagName("info"),i=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),o=t.getElementsByTagName("char"),h=t.getElementsByTagName("kerning"),a=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<i.length;l++)e.common.push({lineHeight:parseInt(i[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<o.length;l++){const c=o[l];e.char.push({id:parseInt(c.getAttribute("id"),10),page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xoffset:parseInt(c.getAttribute("xoffset"),10),yoffset:parseInt(c.getAttribute("yoffset"),10),xadvance:parseInt(c.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<a.length;l++)e.distanceField.push({fieldType:a[l].getAttribute("fieldType"),distanceRange:parseInt(a[l].getAttribute("distanceRange"),10)});return e}}class xc{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 yc=[Ko,_c,xc];function tA(r){for(let t=0;t<yc.length;t++)if(yc[t].test(r))return yc[t];return null}function eA(r,t,e,s,i,n){const o=e.fill;if(Array.isArray(o)){if(o.length===1)return o[0]}else return o;let h;const a=e.dropShadow?e.dropShadowDistance:0,l=e.padding||0,c=r.width/s-a-l*2,d=r.height/s-a-l*2,u=o.slice(),f=e.fillGradientStops.slice();if(!f.length){const p=u.length+1;for(let m=1;m<p;++m)f.push(m/p)}if(u.unshift(o[0]),f.unshift(0),u.push(o[o.length-1]),f.push(1),e.fillGradientType===Ho.LINEAR_VERTICAL){h=t.createLinearGradient(c/2,l,c/2,d+l);let p=0;const m=(n.fontProperties.fontSize+e.strokeThickness)/d;for(let g=0;g<i.length;g++){const y=n.lineHeight*g;for(let x=0;x<u.length;x++){let _=0;typeof f[x]=="number"?_=f[x]:_=x/u.length;const v=y/d+_*m;let b=Math.max(p,v);b=Math.min(b,1),h.addColorStop(b,u[x]),p=b}}}else{h=t.createLinearGradient(l,d/2,c+l,d/2);const p=u.length+1;let m=1;for(let g=0;g<u.length;g++){let y;typeof f[g]=="number"?y=f[g]:y=m/p,h.addColorStop(y,u[g]),m++}}return h}function sA(r,t,e,s,i,n,o){const h=e.text,a=e.fontProperties;t.translate(s,i),t.scale(n,n);const l=o.strokeThickness/2,c=-(o.strokeThickness/2);if(t.font=o.toFontString(),t.lineWidth=o.strokeThickness,t.textBaseline=o.textBaseline,t.lineJoin=o.lineJoin,t.miterLimit=o.miterLimit,t.fillStyle=eA(r,t,o,n,[h],e),t.strokeStyle=o.stroke,o.dropShadow){const d=o.dropShadowColor,u=o.dropShadowBlur*n,f=o.dropShadowDistance*n;t.shadowColor=Ct.shared.setValue(d).setAlpha(o.dropShadowAlpha).toRgbaString(),t.shadowBlur=u,t.shadowOffsetX=Math.cos(o.dropShadowAngle)*f,t.shadowOffsetY=Math.sin(o.dropShadowAngle)*f}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;o.stroke&&o.strokeThickness&&t.strokeText(h,l,c+e.lineHeight-a.descent),o.fill&&t.fillText(h,l,c+e.lineHeight-a.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function Zo(r){return r.codePointAt?r.codePointAt(0):r.charCodeAt(0)}function Wm(r){return Array.from?Array.from(r):r.split("")}function iA(r){typeof r=="string"&&(r=[r]);const t=[];for(let e=0,s=r.length;e<s;e++){const i=r[e];if(Array.isArray(i)){if(i.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${i.length}.`);const n=i[0].charCodeAt(0),o=i[1].charCodeAt(0);if(o<n)throw new Error("[BitmapFont]: Invalid character range.");for(let h=n,a=o;h<=a;h++)t.push(String.fromCharCode(h))}else t.push(...Wm(i))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const $i=class ci{constructor(t,e,s){var c;const[i]=t.info,[n]=t.common,[o]=t.page,[h]=t.distanceField,a=gi(o.file),l={};this._ownsTextures=s,this.font=i.face,this.size=i.size,this.lineHeight=n.lineHeight/a,this.chars={},this.pageTextures=l;for(let d=0;d<t.page.length;d++){const{id:u,file:f}=t.page[d];l[u]=e instanceof Array?e[d]:e[f],h!=null&&h.fieldType&&h.fieldType!=="none"&&(l[u].baseTexture.alphaMode=Re.NO_PREMULTIPLIED_ALPHA,l[u].baseTexture.mipmap=ys.OFF)}for(let d=0;d<t.char.length;d++){const{id:u,page:f}=t.char[d];let{x:p,y:m,width:g,height:y,xoffset:x,yoffset:_,xadvance:v}=t.char[d];p/=a,m/=a,g/=a,y/=a,x/=a,_/=a,v/=a;const b=new it(p+l[f].frame.x/a,m+l[f].frame.y/a,g,y);this.chars[u]={xOffset:x,yOffset:_,xAdvance:v,kerning:{},texture:new q(l[f].baseTexture,b),page:f}}for(let d=0;d<t.kerning.length;d++){let{first:u,second:f,amount:p}=t.kerning[d];u/=a,f/=a,p/=a,this.chars[f]&&(this.chars[f].kerning[u]=p)}this.distanceFieldRange=h==null?void 0:h.distanceRange,this.distanceFieldType=((c=h==null?void 0:h.fieldType)==null?void 0:c.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 i;if(t instanceof qo)i=t;else{const o=tA(t);if(!o)throw new Error("Unrecognized data format for font.");i=o.parse(t)}e instanceof q&&(e=[e]);const n=new ci(i,e,s);return ci.available[n.font]=n,n}static uninstall(t){const e=ci.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete ci.available[t]}static from(t,e,s){if(!t)throw new Error("[BitmapFont] Property `name` is required.");const{chars:i,padding:n,resolution:o,textureWidth:h,textureHeight:a,...l}=Object.assign({},ci.defaultOptions,s),c=iA(i),d=e instanceof yi?e:new yi(e),u=h,f=new qo;f.info[0]={face:d.fontFamily,size:d.fontSize},f.common[0]={lineHeight:d.fontSize};let p=0,m=0,g,y,x,_=0;const v=[];for(let w=0;w<c.length;w++){g||(g=z.ADAPTER.createCanvas(),g.width=h,g.height=a,y=g.getContext("2d"),x=new et(g,{resolution:o,...l}),v.push(new q(x)),f.page.push({id:v.length-1,file:""}));const E=c[w],T=Gi.measureText(E,d,!1,g),A=T.width,I=Math.ceil(T.height),M=Math.ceil((d.fontStyle==="italic"?2:1)*A);if(m>=a-I*o){if(m===0)throw new Error(`[BitmapFont] textureHeight ${a}px is too small (fontFamily: '${d.fontFamily}', fontSize: ${d.fontSize}px, char: '${E}')`);--w,g=null,y=null,x=null,m=0,p=0,_=0;continue}if(_=Math.max(I+T.fontProperties.descent,_),M*o+p>=u){if(p===0)throw new Error(`[BitmapFont] textureWidth ${h}px is too small (fontFamily: '${d.fontFamily}', fontSize: ${d.fontSize}px, char: '${E}')`);--w,m+=_*o,m=Math.ceil(m),p=0,_=0;continue}sA(g,y,T,p,m,o,d);const R=Zo(T.text);f.char.push({id:R,page:v.length-1,x:p/o,y:m/o,width:M,height:I,xoffset:0,yoffset:0,xadvance:A-(d.dropShadow?d.dropShadowDistance:0)-(d.stroke?d.strokeThickness:0)}),p+=(M+2*n)*o,p=Math.ceil(p)}if(!(s!=null&&s.skipKerning))for(let w=0,E=c.length;w<E;w++){const T=c[w];for(let A=0;A<E;A++){const I=c[A],M=y.measureText(T).width,R=y.measureText(I).width,C=y.measureText(T+I).width-(M+R);C&&f.kerning.push({first:Zo(T),second:Zo(I),amount:C})}}const b=new ci(f,v,!0);return ci.available[t]!==void 0&&ci.uninstall(t),ci.available[t]=b,b}};$i.ALPHA=[["a","z"],["A","Z"]," "],$i.NUMERIC=[["0","9"]],$i.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],$i.ASCII=[[" ","~"]],$i.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:$i.ALPHANUMERIC},$i.available={};let Yi=$i;var rA=`// 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
|
-
`,
|
|
1121
|
+
`,nA=`// 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
|
|
1138
|
-
`)||" ",l=
|
|
1139
|
-
`){
|
|
1140
|
-
`&&(/(?:\s)/.test(b)&&(f=y),
|
|
1137
|
+
`;const zm=[],jm=[],qm=[],Km=class tx extends Bt{constructor(t,e={}){super();const{align:s,tint:i,maxWidth:n,letterSpacing:o,fontName:h,fontSize:a}=Object.assign({},tx.styleDefaults,e);if(!Yi.available[h])throw new Error(`Missing BitmapFont "${h}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=s,this._tintColor=new Ct(i),this._font=void 0,this._fontName=h,this._fontSize=a,this.text=t,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=o,this._anchor=new zs(()=>{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=Yi.available[this._fontName],e=this.fontSize,s=e/t.size,i=new st,n=[],o=[],h=[],a=this._text.replace(/(?:\r\n|\r)/g,`
|
|
1138
|
+
`)||" ",l=Wm(a),c=this._maxWidth*t.size/e,d=t.distanceFieldType==="none"?zm:jm;let u=null,f=0,p=0,m=0,g=-1,y=0,x=0,_=0,v=0;for(let R=0;R<l.length;R++){const C=l[R],P=Zo(C);if(/(?:\s)/.test(C)&&(g=R,y=f,v++),C==="\r"||C===`
|
|
1139
|
+
`){o.push(f),h.push(-1),p=Math.max(p,f),++m,++x,i.x=0,i.y+=t.lineHeight,u=null,v=0;continue}const k=t.chars[P];if(!k)continue;u&&k.kerning[u]&&(i.x+=k.kerning[u]);const V=qm.pop()||{texture:q.EMPTY,line:0,charCode:0,prevSpaces:0,position:new st};V.texture=k.texture,V.line=m,V.charCode=P,V.position.x=Math.round(i.x+k.xOffset+this._letterSpacing/2),V.position.y=Math.round(i.y+k.yOffset),V.prevSpaces=v,n.push(V),f=V.position.x+Math.max(k.xAdvance-k.xOffset,k.texture.orig.width),i.x+=k.xAdvance+this._letterSpacing,_=Math.max(_,k.yOffset+k.texture.height),u=P,g!==-1&&c>0&&i.x>c&&(++x,rn(n,1+g-x,1+R-g),R=g,g=-1,o.push(y),h.push(n.length>0?n[n.length-1].prevSpaces:0),p=Math.max(p,y),m++,i.x=0,i.y+=t.lineHeight,u=null,v=0)}const b=l[l.length-1];b!=="\r"&&b!==`
|
|
1140
|
+
`&&(/(?:\s)/.test(b)&&(f=y),o.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-o[R]:this._align==="center"?C=(p-o[R])/2:this._align==="justify"&&(C=h[R]<0?0:(p-o[R])/h[R]),w.push(C)}const E=n.length,T={},A=[],I=this._activePagesMeshData;d.push(...I);for(let R=0;R<E;R++){const C=n[R].texture,P=C.baseTexture.uid;if(!T[P]){let k=d.pop();if(!k){const U=new fc;let L,$;t.distanceFieldType==="none"?(L=new $o(q.EMPTY),$=W.NORMAL):(L=new $o(q.EMPTY,{program:_i.from(nA,rA),uniforms:{uFWidth:0}}),$=W.NORMAL_NPM);const O=new Go(U,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:V}=this;V[P]=V[P]||new q(C.baseTexture),k.mesh.texture=V[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<Go.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,V=C.vertices;for(let U=k*4*2;U<V.length;U++)V[U]=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,V=C.position.y*s,U=C.texture,L=T[U.baseTexture.uid],$=U.frame,O=U._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]=V,L.vertices[N*8+2]=k+$.width*s,L.vertices[N*8+3]=V,L.vertices[N*8+4]=k+$.width*s,L.vertices[N*8+5]=V+$.height*s,L.vertices[N*8+6]=k,L.vertices[N*8+7]=V+$.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=(i.y+t.lineHeight)*s;for(const R in T){const C=T[R];if(this.anchor.x!==0||this.anchor.y!==0){let U=0;const L=this._textWidth*this.anchor.x,$=this._textHeight*this.anchor.y;for(let O=0;O<C.total;O++)C.vertices[U++]-=L,C.vertices[U++]-=$,C.vertices[U++]-=L,C.vertices[U++]-=$,C.vertices[U++]-=L,C.vertices[U++]-=$,C.vertices[U++]-=L,C.vertices[U++]-=$}this._maxLineHeight=_*s;const P=C.mesh.geometry.getBuffer("aVertexPosition"),k=C.mesh.geometry.getBuffer("aTextureCoord"),V=C.mesh.geometry.getIndex();P.data=C.vertices,k.data=C.uvs,V.data=C.indices,P.update(),k.update(),V.update()}for(let R=0;R<n.length;R++)qm.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:i}=Yi.available[this._fontName];if(s!=="none"){const{a:n,b:o,c:h,d:a}=this.worldTransform,l=Math.sqrt(n*n+o*o),c=Math.sqrt(h*h+a*a),d=(Math.abs(l)+Math.abs(c))/2,u=this.fontSize/i,f=t._view.resolution;for(const p of this._activePagesMeshData)p.mesh.shader.uniforms.uFWidth=d*e*u*f}super._render(t)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const t=Yi.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(!Yi.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??Yi.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=Yi.available[this._fontName].distanceFieldType==="none"?zm:jm;s.push(...this._activePagesMeshData);for(const i of this._activePagesMeshData)this.removeChild(i.mesh);this._activePagesMeshData=[],s.filter(i=>e[i.mesh.texture.baseTexture.uid]).forEach(i=>{i.mesh.texture=q.EMPTY});for(const i in e)e[i].destroy(),delete e[i];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 oA=[".xml",".fnt"],hA={extension:{type:Y.LoadParser,priority:Ne.Normal},name:"loadBitmapFont",test(r){return oA.includes(vt.extname(r).toLowerCase())},async testParse(r){return Ko.test(r)||xc.test(r)},async parse(r,t,e){const s=Ko.test(r)?Ko.parse(r):xc.parse(r),{src:i}=t,{page:n}=s,o=[];for(let l=0;l<n.length;++l){const c=n[l].file;let d=vt.join(vt.dirname(i),c);d=tc(d,i),o.push(d)}const h=await e.load(o),a=o.map(l=>h[l]);return Yi.install(s,a,!0)},async load(r,t){return(await z.ADAPTER.fetch(r)).text()},unload(r){r.destroy()}};Z.add(hA);const vc=class Ln extends yi{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new Ln(Object.keys(Ln.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 Ln.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:s}=Ln;if(s[t]){const i=s[t];return this._fonts.push(i),i.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return z.ADAPTER.fetch(t).then(i=>i.blob()).then(async i=>new Promise((n,o)=>{const h=URL.createObjectURL(i),a=new FileReader;a.onload=()=>n([h,a.result]),a.onerror=o,a.readAsDataURL(i)})).then(async([i,n])=>{const o=Object.assign({family:vt.basename(t,vt.extname(t)),weight:"normal",style:"normal",display:"auto",src:i,dataSrc:n,refs:1,originalUrl:t,fontFace:null},e);s[t]=o,this._fonts.push(o),this.styleID++;const h=new FontFace(o.family,`url(${o.src})`,{weight:o.weight,style:o.style,display:o.display});o.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=
|
|
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=ea(t)),typeof t=="number"?j1(t):t}dropShadowToCSS(){let t=this.normalizeColor(this.dropShadowColor);const e=this.dropShadowAlpha,s=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),i=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 ${i}px`;return this.dropShadowBlur>0?`text-shadow: ${n} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${n} ${t}`}reset(){Object.assign(this,Ln.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 Qo=class Nn 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,i=q.from(s,{scaleMode:z.SCALE_MODE,resourceOptions:{autoLoad:!1}});i.orig=new it,i.trim=new it,this.texture=i;const n="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",h=document.createElementNS(n,"svg"),a=document.createElementNS(n,"foreignObject"),l=document.createElementNS(o,"div"),c=document.createElementNS(o,"style");a.setAttribute("width","10000"),a.setAttribute("height","10000"),a.style.overflow="hidden",h.appendChild(a),this.maxWidth=Nn.defaultMaxWidth,this.maxHeight=Nn.defaultMaxHeight,this._domElement=l,this._styleElement=c,this._svgRoot=h,this._foreignObject=a,this._foreignObject.appendChild(c),this._foreignObject.appendChild(l),this._image=s,this._loadImage=new Image,this._autoResolution=Nn.defaultAutoResolution,this._resolution=Nn.defaultResolution??z.RESOLUTION,this.text=t,this.style=e}measureText(t){var c,d;const{text:e,style:s,resolution:i}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:e,style:s.toCSS(i)}),this._styleElement.textContent=s.toGlobalCSS(),document.body.appendChild(this._svgRoot);const n=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:o,height:h}=n;(o>this.maxWidth||h>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");const a=Math.min(this.maxWidth,Math.ceil(o)),l=Math.min(this.maxHeight,Math.ceil(h));return this._svgRoot.setAttribute("width",a.toString()),this._svgRoot.setAttribute("height",l.toString()),e!==this._text&&(this._domElement.innerHTML=this._text),s!==this._style&&(Object.assign(this._domElement,{style:(c=this._style)==null?void 0:c.toCSS(i)}),this._styleElement.textContent=(d=this._style)==null?void 0:d.toGlobalCSS()),{width:a+s.padding*2,height:l+s.padding*2}}async updateText(t=!0){const{style:e,_image:s,_loadImage:i}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;const{width:n,height:o}=this.measureText();s.width=i.width=Math.ceil(Math.max(1,n)),s.height=i.height=Math.ceil(Math.max(1,o)),this._updateID++;const h=this._updateID;await new Promise(a=>{i.onload=async()=>{if(h<this._updateID){a();return}await e.onBeforeDraw(),s.src=i.src,i.onload=null,i.src="",this.updateTexture(),a()};const l=new XMLSerializer().serializeToString(this._svgRoot);i.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(l)}`})}get source(){return this._image}updateTexture(){const{style:t,texture:e,_image:s,resolution:i}=this,{padding:n}=t,{baseTexture:o}=e;e.trim.width=e._frame.width=s.width/i,e.trim.height=e._frame.height=s.height/i,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(),o.setRealSize(s.width,s.height,i),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,i,n,o,h;typeof t=="boolean"&&(t={children:t}),t=Object.assign({},Nn.defaultDestroyOptions,t),super.destroy(t);const e=null;this.ownsStyle&&((s=this._style)==null||s.cleanFonts()),this._style=e,(i=this._svgRoot)==null||i.remove(),this._svgRoot=e,(n=this._domElement)==null||n.remove(),this._domElement=e,(o=this._foreignObject)==null||o.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=Bi(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=Bi(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 yi?(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(/ /gi," ")}};Qo.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Qo.defaultMaxWidth=2024,Qo.defaultMaxHeight=2024,Qo.defaultAutoResolution=!0;class lA{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 vi(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Zm(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,r.__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 ge={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},pr={duration:.5,overwrite:!1,delay:0},Tl,te,Tt,Me=1e8,yt=1/Me,wl=Math.PI*2,ST=wl/4,CT=0,Op=Math.sqrt,PT=Math.cos,RT=Math.sin,jt=function(t){return typeof t=="string"},Lt=function(t){return typeof t=="function"},Bi=function(t){return typeof t=="number"},El=function(t){return typeof t>"u"},ui=function(t){return typeof t=="object"},le=function(t){return t!==!1},Al=function(){return typeof window<"u"},ja=function(t){return Lt(t)||jt(t)},Fp=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},ee=Array.isArray,Sl=/(?:-?\.?\d|\.)+/gi,Lp=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,mr=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Cl=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,kp=/[+-]=-?[.\d]+/,Np=/[^,'"\[\]\s]+/gi,IT=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Ct,di,Pl,Rl,ye={},qa={},Up,Gp=function(t){return(qa=Rs(t,ye))&&de},Il=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},hn=function(t,e){return!e&&console.warn(t)},Hp=function(t,e){return t&&(ye[t]=e)&&qa&&(qa[t]=e)||ye},ln=function(){return 0},MT={suppressEvents:!0,isStart:!0,kill:!1},Ka={suppressEvents:!0,kill:!1},DT={suppressEvents:!0},Ml={},ts=[],Dl={},Vp,xe={},Bl={},Wp=30,Za=[],Ol="",Fl=function(t){var e=t[0],i,r;if(ui(e)||Lt(e)||(t=[t]),!(i=(e._gsap||{}).harness)){for(r=Za.length;r--&&!Za[r].targetTest(e););i=Za[r]}for(r=t.length;r--;)t[r]&&(t[r]._gsap||(t[r]._gsap=new ym(t[r],i)))||t.splice(r,1);return t},Ps=function(t){return t._gsap||Fl(Oe(t))[0]._gsap},Xp=function(t,e,i){return(i=t[e])&&Lt(i)?t[e]():El(i)&&t.getAttribute&&t.getAttribute(e)||i},ce=function(t,e){return(t=t.split(",")).forEach(e)||t},Ut=function(t){return Math.round(t*1e5)/1e5||0},qt=function(t){return Math.round(t*1e7)/1e7||0},_r=function(t,e){var i=e.charAt(0),r=parseFloat(e.substr(2));return t=parseFloat(t),i==="+"?t+r:i==="-"?t-r:i==="*"?t*r:t/r},BT=function(t,e){for(var i=e.length,r=0;t.indexOf(e[r])<0&&++r<i;);return r<i},Qa=function(){var t=ts.length,e=ts.slice(0),i,r;for(Dl={},ts.length=0,i=0;i<t;i++)r=e[i],r&&r._lazy&&(r.render(r._lazy[0],r._lazy[1],!0)._lazy=0)},$p=function(t,e,i,r){ts.length&&!te&&Qa(),t.render(e,i,r||te&&e<0&&(t._initted||t._startAt)),ts.length&&!te&&Qa()},zp=function(t){var e=parseFloat(t);return(e||e===0)&&(t+"").match(Np).length<2?e:jt(t)?t.trim():t},Yp=function(t){return t},De=function(t,e){for(var i in e)i in t||(t[i]=e[i]);return t},OT=function(t){return function(e,i){for(var r in i)r in e||r==="duration"&&t||r==="ease"||(e[r]=i[r])}},Rs=function(t,e){for(var i in e)t[i]=e[i];return t},jp=function s(t,e){for(var i in e)i!=="__proto__"&&i!=="constructor"&&i!=="prototype"&&(t[i]=ui(e[i])?s(t[i]||(t[i]={}),e[i]):e[i]);return t},Ja=function(t,e){var i={},r;for(r in t)r in e||(i[r]=t[r]);return i},cn=function(t){var e=t.parent||Ct,i=t.keyframes?OT(ee(t.keyframes)):De;if(le(t.inherit))for(;e;)i(t,e.vars.defaults),e=e.parent||e._dp;return t},FT=function(t,e){for(var i=t.length,r=i===e.length;r&&i--&&t[i]===e[i];);return i<0},qp=function(t,e,i,r,n){i===void 0&&(i="_first"),r===void 0&&(r="_last");var a=t[r],o;if(n)for(o=e[n];a&&a[n]>o;)a=a._prev;return a?(e._next=a._next,a._next=e):(e._next=t[i],t[i]=e),e._next?e._next._prev=e:t[r]=e,e._prev=a,e.parent=e._dp=t,e},to=function(t,e,i,r){i===void 0&&(i="_first"),r===void 0&&(r="_last");var n=e._prev,a=e._next;n?n._next=a:t[i]===e&&(t[i]=a),a?a._prev=n:t[r]===e&&(t[r]=n),e._next=e._prev=e.parent=null},es=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},Is=function(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var i=t;i;)i._dirty=1,i=i.parent;return t},LT=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},Ll=function(t,e,i,r){return t._startAt&&(te?t._startAt.revert(Ka):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,r))},kT=function s(t){return!t||t._ts&&s(t.parent)},Kp=function(t){return t._repeat?gr(t._tTime,t=t.duration()+t._rDelay)*t:0},gr=function(t,e){var i=Math.floor(t/=e);return t&&i===t?i-1:i},eo=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},io=function(t){return t._end=qt(t._start+(t._tDur/Math.abs(t._ts||t._rts||yt)||0))},so=function(t,e){var i=t._dp;return i&&i.smoothChildTiming&&t._ts&&(t._start=qt(i._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),io(t),i._dirty||Is(i,t)),t},Zp=function(t,e){var i;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(i=eo(t.rawTime(),e),(!e._dur||dn(0,e.totalDuration(),i)-e._tTime>yt)&&e.render(i,!0)),Is(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(i=t;i._dp;)i.rawTime()>=0&&i.totalTime(i._tTime),i=i._dp;t._zTime=-yt}},fi=function(t,e,i,r){return e.parent&&es(e),e._start=qt((Bi(i)?i:i||t!==Ct?Be(t,i,e):t._time)+e._delay),e._end=qt(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),qp(t,e,"_first","_last",t._sort?"_start":0),kl(e)||(t._recent=e),r||Zp(t,e),t._ts<0&&so(t,t._tTime),t},Qp=function(t,e){return(ye.ScrollTrigger||Il("scrollTrigger",e))&&ye.ScrollTrigger.create(e,t)},Jp=function(t,e,i,r,n){if(zl(t,e,n),!t._initted)return 1;if(!i&&t._pt&&!te&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&Vp!==be.frame)return ts.push(t),t._lazy=[n,r],1},NT=function s(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||s(e))},kl=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},UT=function(t,e,i,r){var n=t.ratio,a=e<0||!e&&(!t._start&&NT(t)&&!(!t._initted&&kl(t))||(t._ts<0||t._dp._ts<0)&&!kl(t))?0:1,o=t._rDelay,h=0,l,c,d;if(o&&t._repeat&&(h=dn(0,t._tDur,e),c=gr(h,o),t._yoyo&&c&1&&(a=1-a),c!==gr(t._tTime,o)&&(n=1-a,t.vars.repeatRefresh&&t._initted&&t.invalidate())),a!==n||te||r||t._zTime===yt||!e&&t._zTime){if(!t._initted&&Jp(t,e,r,i,h))return;for(d=t._zTime,t._zTime=e||(i?yt:0),i||(i=e&&!d),t.ratio=a,t._from&&(a=1-a),t._time=0,t._tTime=h,l=t._pt;l;)l.r(a,l.d),l=l._next;e<0&&Ll(t,e,i,!0),t._onUpdate&&!i&&ve(t,"onUpdate"),h&&t._repeat&&!i&&t.parent&&ve(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===a&&(a&&es(t,1),!i&&!te&&(ve(t,a?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},GT=function(t,e,i){var r;if(i>e)for(r=t._first;r&&r._start<=i;){if(r.data==="isPause"&&r._start>e)return r;r=r._next}else for(r=t._last;r&&r._start>=i;){if(r.data==="isPause"&&r._start<e)return r;r=r._prev}},yr=function(t,e,i,r){var n=t._repeat,a=qt(e)||0,o=t._tTime/t._tDur;return o&&!r&&(t._time*=a/t._dur),t._dur=a,t._tDur=n?n<0?1e10:qt(a*(n+1)+t._rDelay*n):a,o>0&&!r&&so(t,t._tTime=t._tDur*o),t.parent&&io(t),i||Is(t.parent,t),t},tm=function(t){return t instanceof ne?Is(t):yr(t,t._dur)},HT={_start:0,endTime:ln,totalDuration:ln},Be=function s(t,e,i){var r=t.labels,n=t._recent||HT,a=t.duration()>=Me?n.endTime(!1):t._dur,o,h,l;return jt(e)&&(isNaN(e)||e in r)?(h=e.charAt(0),l=e.substr(-1)==="%",o=e.indexOf("="),h==="<"||h===">"?(o>=0&&(e=e.replace(/=/,"")),(h==="<"?n._start:n.endTime(n._repeat>=0))+(parseFloat(e.substr(1))||0)*(l?(o<0?n:i).totalDuration()/100:1)):o<0?(e in r||(r[e]=a),r[e]):(h=parseFloat(e.charAt(o-1)+e.substr(o+1)),l&&i&&(h=h/100*(ee(i)?i[0]:i).totalDuration()),o>1?s(t,e.substr(0,o-1),i)+h:a+h)):e==null?a:+e},un=function(t,e,i){var r=Bi(e[1]),n=(r?2:1)+(t<2?0:1),a=e[n],o,h;if(r&&(a.duration=e[1]),a.parent=i,t){for(o=a,h=i;h&&!("immediateRender"in o);)o=h.vars.defaults||{},h=le(h.vars.inherit)&&h.parent;a.immediateRender=le(o.immediateRender),t<2?a.runBackwards=1:a.startAt=e[n-1]}return new Vt(e[0],a,e[n+1])},is=function(t,e){return t||t===0?e(t):e},dn=function(t,e,i){return i<t?t:i>e?e:i},ie=function(t,e){return!jt(t)||!(e=IT.exec(t))?"":e[1]},VT=function(t,e,i){return is(i,function(r){return dn(t,e,r)})},Nl=[].slice,em=function(t,e){return t&&ui(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&ui(t[0]))&&!t.nodeType&&t!==di},WT=function(t,e,i){return i===void 0&&(i=[]),t.forEach(function(r){var n;return jt(r)&&!e||em(r,1)?(n=i).push.apply(n,Oe(r)):i.push(r)})||i},Oe=function(t,e,i){return Tt&&!e&&Tt.selector?Tt.selector(t):jt(t)&&!i&&(Pl||!vr())?Nl.call((e||Rl).querySelectorAll(t),0):ee(t)?WT(t,i):em(t)?Nl.call(t,0):t?[t]:[]},Ul=function(t){return t=Oe(t)[0]||hn("Invalid scope")||{},function(e){var i=t.current||t.nativeElement||t;return Oe(e,i.querySelectorAll?i:i===t?hn("Invalid scope")||Rl.createElement("div"):t)}},im=function(t){return t.sort(function(){return .5-Math.random()})},sm=function(t){if(Lt(t))return t;var e=ui(t)?t:{each:t},i=Ms(e.ease),r=e.from||0,n=parseFloat(e.base)||0,a={},o=r>0&&r<1,h=isNaN(r)||o,l=e.axis,c=r,d=r;return jt(r)?c=d={center:.5,edges:.5,end:1}[r]||0:!o&&h&&(c=r[0],d=r[1]),function(u,f,p){var m=(p||e).length,_=a[m],y,v,g,x,b,w,T,E,A;if(!_){if(A=e.grid==="auto"?0:(e.grid||[1,Me])[1],!A){for(T=-Me;T<(T=p[A++].getBoundingClientRect().left)&&A<m;);A<m&&A--}for(_=a[m]=[],y=h?Math.min(A,m)*c-.5:r%A,v=A===Me?0:h?m*d/A-.5:r/A|0,T=0,E=Me,w=0;w<m;w++)g=w%A-y,x=v-(w/A|0),_[w]=b=l?Math.abs(l==="y"?x:g):Op(g*g+x*x),b>T&&(T=b),b<E&&(E=b);r==="random"&&im(_),_.max=T-E,_.min=E,_.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),_.b=m<0?n-m:n,_.u=ie(e.amount||e.each)||0,i=i&&m<0?mm(i):i}return m=(_[u]-_.min)/_.max||0,qt(_.b+(i?i(m):m)*_.v)+_.u}},Gl=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(i){var r=qt(Math.round(parseFloat(i)/t)*t*e);return(r-r%1)/e+(Bi(i)?0:ie(i))}},rm=function(t,e){var i=ee(t),r,n;return!i&&ui(t)&&(r=i=t.radius||Me,t.values?(t=Oe(t.values),(n=!Bi(t[0]))&&(r*=r)):t=Gl(t.increment)),is(e,i?Lt(t)?function(a){return n=t(a),Math.abs(n-a)<=r?n:a}:function(a){for(var o=parseFloat(n?a.x:a),h=parseFloat(n?a.y:0),l=Me,c=0,d=t.length,u,f;d--;)n?(u=t[d].x-o,f=t[d].y-h,u=u*u+f*f):u=Math.abs(t[d]-o),u<l&&(l=u,c=d);return c=!r||l<=r?t[c]:a,n||c===a||Bi(a)?c:c+ie(a)}:Gl(t))},nm=function(t,e,i,r){return is(ee(t)?!e:i===!0?!!(i=0):!r,function(){return ee(t)?t[~~(Math.random()*t.length)]:(i=i||1e-5)&&(r=i<1?Math.pow(10,(i+"").length-2):1)&&Math.floor(Math.round((t-i/2+Math.random()*(e-t+i*.99))/i)*i*r)/r})},XT=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return function(r){return e.reduce(function(n,a){return a(n)},r)}},$T=function(t,e){return function(i){return t(parseFloat(i))+(e||ie(i))}},zT=function(t,e,i){return om(t,e,0,1,i)},am=function(t,e,i){return is(i,function(r){return t[~~e(r)]})},YT=function s(t,e,i){var r=e-t;return ee(t)?am(t,s(0,t.length),e):is(i,function(n){return(r+(n-t)%r)%r+t})},jT=function s(t,e,i){var r=e-t,n=r*2;return ee(t)?am(t,s(0,t.length-1),e):is(i,function(a){return a=(n+(a-t)%n)%n||0,t+(a>r?n-a:a)})},fn=function(t){for(var e=0,i="",r,n,a,o;~(r=t.indexOf("random(",e));)a=t.indexOf(")",r),o=t.charAt(r+7)==="[",n=t.substr(r+7,a-r-7).match(o?Np:Sl),i+=t.substr(e,r-e)+nm(o?n:+n[0],o?0:+n[1],+n[2]||1e-5),e=a+1;return i+t.substr(e,t.length-e)},om=function(t,e,i,r,n){var a=e-t,o=r-i;return is(n,function(h){return i+((h-t)/a*o||0)})},qT=function s(t,e,i,r){var n=isNaN(t+e)?0:function(f){return(1-f)*t+f*e};if(!n){var a=jt(t),o={},h,l,c,d,u;if(i===!0&&(r=1)&&(i=null),a)t={p:t},e={p:e};else if(ee(t)&&!ee(e)){for(c=[],d=t.length,u=d-2,l=1;l<d;l++)c.push(s(t[l-1],t[l]));d--,n=function(p){p*=d;var m=Math.min(u,~~p);return c[m](p-m)},i=e}else r||(t=Rs(ee(t)?[]:{},t));if(!c){for(h in e)Xl.call(o,t,h,"get",e[h]);n=function(p){return ql(p,o)||(a?t.p:t)}}}return is(i,n)},hm=function(t,e,i){var r=t.labels,n=Me,a,o,h;for(a in r)o=r[a]-e,o<0==!!i&&o&&n>(o=Math.abs(o))&&(h=a,n=o);return h},ve=function(t,e,i){var r=t.vars,n=r[e],a=Tt,o=t._ctx,h,l,c;if(n)return h=r[e+"Params"],l=r.callbackScope||t,i&&ts.length&&Qa(),o&&(Tt=o),c=h?n.apply(l,h):n.call(l),Tt=a,c},pn=function(t){return es(t),t.scrollTrigger&&t.scrollTrigger.kill(!!te),t.progress()<1&&ve(t,"onInterrupt"),t},xr,lm=[],cm=function(t){if(t)if(t=!t.name&&t.default||t,Al()||t.headless){var e=t.name,i=Lt(t),r=e&&!i&&t.init?function(){this._props=[]}:t,n={init:ln,render:ql,add:Xl,kill:uw,modifier:cw,rawVars:0},a={targetTest:0,get:0,getSetter:jl,aliases:{},register:0};if(vr(),t!==r){if(xe[e])return;De(r,De(Ja(t,n),a)),Rs(r.prototype,Rs(n,Ja(t,a))),xe[r.prop=e]=r,t.targetTest&&(Za.push(r),Ml[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}Hp(e,r),t.register&&t.register(de,r,ue)}else lm.push(t)},mt=255,mn={aqua:[0,mt,mt],lime:[0,mt,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,mt],navy:[0,0,128],white:[mt,mt,mt],olive:[128,128,0],yellow:[mt,mt,0],orange:[mt,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[mt,0,0],pink:[mt,192,203],cyan:[0,mt,mt],transparent:[mt,mt,mt,0]},Hl=function(t,e,i){return t+=t<0?1:t>1?-1:0,(t*6<1?e+(i-e)*t*6:t<.5?i:t*3<2?e+(i-e)*(2/3-t)*6:e)*mt+.5|0},um=function(t,e,i){var r=t?Bi(t)?[t>>16,t>>8&mt,t&mt]:0:mn.black,n,a,o,h,l,c,d,u,f,p;if(!r){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),mn[t])r=mn[t];else if(t.charAt(0)==="#"){if(t.length<6&&(n=t.charAt(1),a=t.charAt(2),o=t.charAt(3),t="#"+n+n+a+a+o+o+(t.length===5?t.charAt(4)+t.charAt(4):"")),t.length===9)return r=parseInt(t.substr(1,6),16),[r>>16,r>>8&mt,r&mt,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),r=[t>>16,t>>8&mt,t&mt]}else if(t.substr(0,3)==="hsl"){if(r=p=t.match(Sl),!e)h=+r[0]%360/360,l=+r[1]/100,c=+r[2]/100,a=c<=.5?c*(l+1):c+l-c*l,n=c*2-a,r.length>3&&(r[3]*=1),r[0]=Hl(h+1/3,n,a),r[1]=Hl(h,n,a),r[2]=Hl(h-1/3,n,a);else if(~t.indexOf("="))return r=t.match(Lp),i&&r.length<4&&(r[3]=1),r}else r=t.match(Sl)||mn.transparent;r=r.map(Number)}return e&&!p&&(n=r[0]/mt,a=r[1]/mt,o=r[2]/mt,d=Math.max(n,a,o),u=Math.min(n,a,o),c=(d+u)/2,d===u?h=l=0:(f=d-u,l=c>.5?f/(2-d-u):f/(d+u),h=d===n?(a-o)/f+(a<o?6:0):d===a?(o-n)/f+2:(n-a)/f+4,h*=60),r[0]=~~(h+.5),r[1]=~~(l*100+.5),r[2]=~~(c*100+.5)),i&&r.length<4&&(r[3]=1),r},dm=function(t){var e=[],i=[],r=-1;return t.split(ss).forEach(function(n){var a=n.match(mr)||[];e.push.apply(e,a),i.push(r+=a.length+1)}),e.c=i,e},fm=function(t,e,i){var r="",n=(t+r).match(ss),a=e?"hsla(":"rgba(",o=0,h,l,c,d;if(!n)return t;if(n=n.map(function(u){return(u=um(u,e,1))&&a+(e?u[0]+","+u[1]+"%,"+u[2]+"%,"+u[3]:u.join(","))+")"}),i&&(c=dm(t),h=i.c,h.join(r)!==c.c.join(r)))for(l=t.replace(ss,"1").split(mr),d=l.length-1;o<d;o++)r+=l[o]+(~h.indexOf(o)?n.shift()||a+"0,0,0,0)":(c.length?c:n.length?n:i).shift());if(!l)for(l=t.split(ss),d=l.length-1;o<d;o++)r+=l[o]+n[o];return r+l[d]},ss=function(){var s="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in mn)s+="|"+t+"\\b";return new RegExp(s+")","gi")}(),KT=/hsl[a]?\(/,pm=function(t){var e=t.join(" "),i;if(ss.lastIndex=0,ss.test(e))return i=KT.test(e),t[1]=fm(t[1],i),t[0]=fm(t[0],i,dm(t[1])),!0},_n,be=function(){var s=Date.now,t=500,e=33,i=s(),r=i,n=1e3/240,a=n,o=[],h,l,c,d,u,f,p=function m(_){var y=s()-r,v=_===!0,g,x,b,w;if((y>t||y<0)&&(i+=y-e),r+=y,b=r-i,g=b-a,(g>0||v)&&(w=++d.frame,u=b-d.time*1e3,d.time=b=b/1e3,a+=g+(g>=n?4:n-g),x=1),v||(h=l(m)),x)for(f=0;f<o.length;f++)o[f](b,u,w,_)};return d={time:0,frame:0,tick:function(){p(!0)},deltaRatio:function(_){return u/(1e3/(_||60))},wake:function(){Up&&(!Pl&&Al()&&(di=Pl=window,Rl=di.document||{},ye.gsap=de,(di.gsapVersions||(di.gsapVersions=[])).push(de.version),Gp(qa||di.GreenSockGlobals||!di.gsap&&di||{}),lm.forEach(cm)),c=typeof requestAnimationFrame<"u"&&requestAnimationFrame,h&&d.sleep(),l=c||function(_){return setTimeout(_,a-d.time*1e3+1|0)},_n=1,p(2))},sleep:function(){(c?cancelAnimationFrame:clearTimeout)(h),_n=0,l=ln},lagSmoothing:function(_,y){t=_||1/0,e=Math.min(y||33,t)},fps:function(_){n=1e3/(_||240),a=d.time*1e3+n},add:function(_,y,v){var g=y?function(x,b,w,T){_(x,b,w,T),d.remove(g)}:_;return d.remove(_),o[v?"unshift":"push"](g),vr(),g},remove:function(_,y){~(y=o.indexOf(_))&&o.splice(y,1)&&f>=y&&f--},_listeners:o},d}(),vr=function(){return!_n&&be.wake()},at={},ZT=/^[\d.\-M][\d.\-,\s]/,QT=/["']/g,JT=function(t){for(var e={},i=t.substr(1,t.length-3).split(":"),r=i[0],n=1,a=i.length,o,h,l;n<a;n++)h=i[n],o=n!==a-1?h.lastIndexOf(","):h.length,l=h.substr(0,o),e[r]=isNaN(l)?l.replace(QT,"").trim():+l,r=h.substr(o+1).trim();return e},tw=function(t){var e=t.indexOf("(")+1,i=t.indexOf(")"),r=t.indexOf("(",e);return t.substring(e,~r&&r<i?t.indexOf(")",i+1):i)},ew=function(t){var e=(t+"").split("("),i=at[e[0]];return i&&e.length>1&&i.config?i.config.apply(null,~t.indexOf("{")?[JT(e[1])]:tw(t).split(",").map(zp)):at._CE&&ZT.test(t)?at._CE("",t):i},mm=function(t){return function(e){return 1-t(1-e)}},_m=function s(t,e){for(var i=t._first,r;i;)i instanceof ne?s(i,e):i.vars.yoyoEase&&(!i._yoyo||!i._repeat)&&i._yoyo!==e&&(i.timeline?s(i.timeline,e):(r=i._ease,i._ease=i._yEase,i._yEase=r,i._yoyo=e)),i=i._next},Ms=function(t,e){return t&&(Lt(t)?t:at[t]||ew(t))||e},Ds=function(t,e,i,r){i===void 0&&(i=function(h){return 1-e(1-h)}),r===void 0&&(r=function(h){return h<.5?e(h*2)/2:1-e((1-h)*2)/2});var n={easeIn:e,easeOut:i,easeInOut:r},a;return ce(t,function(o){at[o]=ye[o]=n,at[a=o.toLowerCase()]=i;for(var h in n)at[a+(h==="easeIn"?".in":h==="easeOut"?".out":".inOut")]=at[o+"."+h]=n[h]}),n},gm=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},Vl=function s(t,e,i){var r=e>=1?e:1,n=(i||(t?.3:.45))/(e<1?e:1),a=n/wl*(Math.asin(1/r)||0),o=function(c){return c===1?1:r*Math.pow(2,-10*c)*RT((c-a)*n)+1},h=t==="out"?o:t==="in"?function(l){return 1-o(1-l)}:gm(o);return n=wl/n,h.config=function(l,c){return s(t,l,c)},h},Wl=function s(t,e){e===void 0&&(e=1.70158);var i=function(a){return a?--a*a*((e+1)*a+e)+1:0},r=t==="out"?i:t==="in"?function(n){return 1-i(1-n)}:gm(i);return r.config=function(n){return s(t,n)},r};ce("Linear,Quad,Cubic,Quart,Quint,Strong",function(s,t){var e=t<5?t+1:t;Ds(s+",Power"+(e-1),t?function(i){return Math.pow(i,e)}:function(i){return i},function(i){return 1-Math.pow(1-i,e)},function(i){return i<.5?Math.pow(i*2,e)/2:1-Math.pow((1-i)*2,e)/2})}),at.Linear.easeNone=at.none=at.Linear.easeIn,Ds("Elastic",Vl("in"),Vl("out"),Vl()),function(s,t){var e=1/t,i=2*e,r=2.5*e,n=function(o){return o<e?s*o*o:o<i?s*Math.pow(o-1.5/t,2)+.75:o<r?s*(o-=2.25/t)*o+.9375:s*Math.pow(o-2.625/t,2)+.984375};Ds("Bounce",function(a){return 1-n(1-a)},n)}(7.5625,2.75),Ds("Expo",function(s){return s?Math.pow(2,10*(s-1)):0}),Ds("Circ",function(s){return-(Op(1-s*s)-1)}),Ds("Sine",function(s){return s===1?1:-PT(s*ST)+1}),Ds("Back",Wl("in"),Wl("out"),Wl()),at.SteppedEase=at.steps=ye.SteppedEase={config:function(t,e){t===void 0&&(t=1);var i=1/t,r=t+(e?0:1),n=e?1:0,a=1-yt;return function(o){return((r*dn(0,a,o)|0)+n)*i}}},pr.ease=at["quad.out"],ce("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(s){return Ol+=s+","+s+"Params,"});var ym=function(t,e){this.id=CT++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:Xp,this.set=e?e.getSetter:jl},gn=function(){function s(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,yr(this,+e.duration,1,1),this.data=e.data,Tt&&(this._ctx=Tt,Tt.data.push(this)),_n||be.wake()}var t=s.prototype;return t.delay=function(i){return i||i===0?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+i-this._delay),this._delay=i,this):this._delay},t.duration=function(i){return arguments.length?this.totalDuration(this._repeat>0?i+(i+this._rDelay)*this._repeat:i):this.totalDuration()&&this._dur},t.totalDuration=function(i){return arguments.length?(this._dirty=0,yr(this,this._repeat<0?i:(i-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(i,r){if(vr(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(so(this,i),!n._dp||n.parent||Zp(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&&i<this._tDur||this._ts<0&&i>0||!this._tDur&&!i)&&fi(this._dp,this,this._start-this._delay)}return(this._tTime!==i||!this._dur&&!r||this._initted&&Math.abs(this._zTime)===yt||!i&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=i),$p(this,i,r)),this},t.time=function(i,r){return arguments.length?this.totalTime(Math.min(this.totalDuration(),i+Kp(this))%(this._dur+this._rDelay)||(i?this._dur:0),r):this._time},t.totalProgress=function(i,r){return arguments.length?this.totalTime(this.totalDuration()*i,r):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>0?1:0},t.progress=function(i,r){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-i:i)+Kp(this),r):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},t.iteration=function(i,r){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(i-1)*n,r):this._repeat?gr(this._tTime,n)+1:1},t.timeScale=function(i,r){if(!arguments.length)return this._rts===-yt?0:this._rts;if(this._rts===i)return this;var n=this.parent&&this._ts?eo(this.parent._time,this):this._tTime;return this._rts=+i||0,this._ts=this._ps||i===-yt?0:this._rts,this.totalTime(dn(-Math.abs(this._delay),this._tDur,n),r!==!1),io(this),LT(this)},t.paused=function(i){return arguments.length?(this._ps!==i&&(this._ps=i,i?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(vr(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==yt&&(this._tTime-=yt)))),this):this._ps},t.startTime=function(i){if(arguments.length){this._start=i;var r=this.parent||this._dp;return r&&(r._sort||!this.parent)&&fi(r,this,i-this._delay),this}return this._start},t.endTime=function(i){return this._start+(le(i)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},t.rawTime=function(i){var r=this.parent||this._dp;return r?i&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?eo(r.rawTime(i),this):this._tTime:this._tTime},t.revert=function(i){i===void 0&&(i=DT);var r=te;return te=i,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(i),this.totalTime(-.01,i.suppressEvents)),this.data!=="nested"&&i.kill!==!1&&this.kill(),te=r,this},t.globalTime=function(i){for(var r=this,n=arguments.length?i:r.rawTime();r;)n=r._start+n/(Math.abs(r._ts)||1),r=r._dp;return!this.parent&&this._sat?this._sat.globalTime(i):n},t.repeat=function(i){return arguments.length?(this._repeat=i===1/0?-2:i,tm(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(i){if(arguments.length){var r=this._time;return this._rDelay=i,tm(this),r?this.time(r):this}return this._rDelay},t.yoyo=function(i){return arguments.length?(this._yoyo=i,this):this._yoyo},t.seek=function(i,r){return this.totalTime(Be(this,i),le(r))},t.restart=function(i,r){return this.play().totalTime(i?-this._delay:0,le(r))},t.play=function(i,r){return i!=null&&this.seek(i,r),this.reversed(!1).paused(!1)},t.reverse=function(i,r){return i!=null&&this.seek(i||this.totalDuration(),r),this.reversed(!0).paused(!1)},t.pause=function(i,r){return i!=null&&this.seek(i,r),this.paused(!0)},t.resume=function(){return this.paused(!1)},t.reversed=function(i){return arguments.length?(!!i!==this.reversed()&&this.timeScale(-this._rts||(i?-yt:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-yt,this},t.isActive=function(){var i=this.parent||this._dp,r=this._start,n;return!!(!i||this._ts&&this._initted&&i.isActive()&&(n=i.rawTime(!0))>=r&&n<this.endTime(!0)-yt)},t.eventCallback=function(i,r,n){var a=this.vars;return arguments.length>1?(r?(a[i]=r,n&&(a[i+"Params"]=n),i==="onUpdate"&&(this._onUpdate=r)):delete a[i],this):a[i]},t.then=function(i){var r=this;return new Promise(function(n){var a=Lt(i)?i:Yp,o=function(){var l=r.then;r.then=null,Lt(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?o():r._prom=o})},t.kill=function(){pn(this)},s}();De(gn.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:-yt,_prom:0,_ps:!1,_rts:1});var ne=function(s){Bp(t,s);function t(i,r){var n;return i===void 0&&(i={}),n=s.call(this,i)||this,n.labels={},n.smoothChildTiming=!!i.smoothChildTiming,n.autoRemoveChildren=!!i.autoRemoveChildren,n._sort=le(i.sortChildren),Ct&&fi(i.parent||Ct,Di(n),r),i.reversed&&n.reverse(),i.paused&&n.paused(!0),i.scrollTrigger&&Qp(Di(n),i.scrollTrigger),n}var e=t.prototype;return e.to=function(r,n,a){return un(0,arguments,this),this},e.from=function(r,n,a){return un(1,arguments,this),this},e.fromTo=function(r,n,a,o){return un(2,arguments,this),this},e.set=function(r,n,a){return n.duration=0,n.parent=this,cn(n).repeatDelay||(n.repeat=0),n.immediateRender=!!n.immediateRender,new Vt(r,n,Be(this,a),1),this},e.call=function(r,n,a){return fi(this,Vt.delayedCall(0,r,n),a)},e.staggerTo=function(r,n,a,o,h,l,c){return a.duration=n,a.stagger=a.stagger||o,a.onComplete=l,a.onCompleteParams=c,a.parent=this,new Vt(r,a,Be(this,h)),this},e.staggerFrom=function(r,n,a,o,h,l,c){return a.runBackwards=1,cn(a).immediateRender=le(a.immediateRender),this.staggerTo(r,n,a,o,h,l,c)},e.staggerFromTo=function(r,n,a,o,h,l,c,d){return o.startAt=a,cn(o).immediateRender=le(o.immediateRender),this.staggerTo(r,n,o,h,l,c,d)},e.render=function(r,n,a){var o=this._time,h=this._dirty?this.totalDuration():this._tDur,l=this._dur,c=r<=0?0:qt(r),d=this._zTime<0!=r<0&&(this._initted||!l),u,f,p,m,_,y,v,g,x,b,w,T;if(this!==Ct&&c>h&&r>=0&&(c=h),c!==this._tTime||a||d){if(o!==this._time&&l&&(c+=this._time-o,r+=this._time-o),u=c,x=this._start,g=this._ts,y=!g,d&&(l||(o=this._zTime),(r||!n)&&(this._zTime=r)),this._repeat){if(w=this._yoyo,_=l+this._rDelay,this._repeat<-1&&r<0)return this.totalTime(_*100+r,n,a);if(u=qt(c%_),c===h?(m=this._repeat,u=l):(m=~~(c/_),m&&m===c/_&&(u=l,m--),u>l&&(u=l)),b=gr(this._tTime,_),!o&&this._tTime&&b!==m&&this._tTime-b*_-this._dur<=0&&(b=m),w&&m&1&&(u=l-u,T=1),m!==b&&!this._lock){var E=w&&b&1,A=E===(w&&m&1);if(m<b&&(E=!E),o=E?0:c%l?l:c,this._lock=1,this.render(o||(T?0:qt(m*_)),n,!l)._lock=0,this._tTime=c,!n&&this.parent&&ve(this,"onRepeat"),this.vars.repeatRefresh&&!T&&(this.invalidate()._lock=1),o&&o!==this._time||y!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(l=this._dur,h=this._tDur,A&&(this._lock=2,o=E?l:-1e-4,this.render(o,!0),this.vars.repeatRefresh&&!T&&this.invalidate()),this._lock=0,!this._ts&&!y)return this;_m(this,T)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(v=GT(this,qt(o),qt(u)),v&&(c-=u-(u=v._start))),this._tTime=c,this._time=u,this._act=!g,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=r,o=0),!o&&u&&!n&&!m&&(ve(this,"onStart"),this._tTime!==c))return this;if(u>=o&&r>=0)for(f=this._first;f;){if(p=f._next,(f._act||u>=f._start)&&f._ts&&v!==f){if(f.parent!==this)return this.render(r,n,a);if(f.render(f._ts>0?(u-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(u-f._start)*f._ts,n,a),u!==this._time||!this._ts&&!y){v=0,p&&(c+=this._zTime=-yt);break}}f=p}else{f=this._last;for(var P=r<0?r:u;f;){if(p=f._prev,(f._act||P<=f._end)&&f._ts&&v!==f){if(f.parent!==this)return this.render(r,n,a);if(f.render(f._ts>0?(P-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(P-f._start)*f._ts,n,a||te&&(f._initted||f._startAt)),u!==this._time||!this._ts&&!y){v=0,p&&(c+=this._zTime=P?-yt:yt);break}}f=p}}if(v&&!n&&(this.pause(),v.render(u>=o?0:-yt)._zTime=u>=o?1:-1,this._ts))return this._start=x,io(this),this.render(r,n,a);this._onUpdate&&!n&&ve(this,"onUpdate",!0),(c===h&&this._tTime>=this.totalDuration()||!c&&o)&&(x===this._start||Math.abs(g)!==Math.abs(this._ts))&&(this._lock||((r||!l)&&(c===h&&this._ts>0||!c&&this._ts<0)&&es(this,1),!n&&!(r<0&&!o)&&(c||o||!h)&&(ve(this,c===h&&r>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(c<h&&this.timeScale()>0)&&this._prom())))}return this},e.add=function(r,n){var a=this;if(Bi(n)||(n=Be(this,n,r)),!(r instanceof gn)){if(ee(r))return r.forEach(function(o){return a.add(o,n)}),this;if(jt(r))return this.addLabel(r,n);if(Lt(r))r=Vt.delayedCall(0,r);else return this}return this!==r?fi(this,r,n):this},e.getChildren=function(r,n,a,o){r===void 0&&(r=!0),n===void 0&&(n=!0),a===void 0&&(a=!0),o===void 0&&(o=-Me);for(var h=[],l=this._first;l;)l._start>=o&&(l instanceof Vt?n&&h.push(l):(a&&h.push(l),r&&h.push.apply(h,l.getChildren(!0,n,a)))),l=l._next;return h},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 jt(r)?this.removeLabel(r):Lt(r)?this.killTweensOf(r):(to(this,r),r===this._recent&&(this._recent=this._last),Is(this))},e.totalTime=function(r,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=qt(be.time-(this._ts>0?r/this._ts:(this.totalDuration()-r)/-this._ts))),s.prototype.totalTime.call(this,r,n),this._forcing=0,this):this._tTime},e.addLabel=function(r,n){return this.labels[r]=Be(this,n),this},e.removeLabel=function(r){return delete this.labels[r],this},e.addPause=function(r,n,a){var o=Vt.delayedCall(0,n||ln,a);return o.data="isPause",this._hasPause=1,fi(this,o,Be(this,r))},e.removePause=function(r){var n=this._first;for(r=Be(this,r);n;)n._start===r&&n.data==="isPause"&&es(n),n=n._next},e.killTweensOf=function(r,n,a){for(var o=this.getTweensOf(r,a),h=o.length;h--;)rs!==o[h]&&o[h].kill(r,n);return this},e.getTweensOf=function(r,n){for(var a=[],o=Oe(r),h=this._first,l=Bi(n),c;h;)h instanceof Vt?BT(h._targets,o)&&(l?(!rs||h._initted&&h._ts)&&h.globalTime(0)<=n&&h.globalTime(h.totalDuration())>n:!n||h.isActive())&&a.push(h):(c=h.getTweensOf(o,n)).length&&a.push.apply(a,c),h=h._next;return a},e.tweenTo=function(r,n){n=n||{};var a=this,o=Be(a,r),h=n,l=h.startAt,c=h.onStart,d=h.onStartParams,u=h.immediateRender,f,p=Vt.to(a,De({ease:n.ease||"none",lazy:!1,immediateRender:!1,time:o,overwrite:"auto",duration:n.duration||Math.abs((o-(l&&"time"in l?l.time:a._time))/a.timeScale())||yt,onStart:function(){if(a.pause(),!f){var _=n.duration||Math.abs((o-(l&&"time"in l?l.time:a._time))/a.timeScale());p._dur!==_&&yr(p,_,0,1).render(p._time,!0,!0),f=1}c&&c.apply(p,d||[])}},n));return u?p.render(0):p},e.tweenFromTo=function(r,n,a){return this.tweenTo(n,De({startAt:{time:Be(this,r)}},a))},e.recent=function(){return this._recent},e.nextLabel=function(r){return r===void 0&&(r=this._time),hm(this,Be(this,r))},e.previousLabel=function(r){return r===void 0&&(r=this._time),hm(this,Be(this,r),1)},e.currentLabel=function(r){return arguments.length?this.seek(r,!0):this.previousLabel(this._time+yt)},e.shiftChildren=function(r,n,a){a===void 0&&(a=0);for(var o=this._first,h=this.labels,l;o;)o._start>=a&&(o._start+=r,o._end+=r),o=o._next;if(n)for(l in h)h[l]>=a&&(h[l]+=r);return Is(this)},e.invalidate=function(r){var n=this._first;for(this._lock=0;n;)n.invalidate(r),n=n._next;return s.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={}),Is(this)},e.totalDuration=function(r){var n=0,a=this,o=a._last,h=Me,l,c,d;if(arguments.length)return a.timeScale((a._repeat<0?a.duration():a.totalDuration())/(a.reversed()?-r:r));if(a._dirty){for(d=a.parent;o;)l=o._prev,o._dirty&&o.totalDuration(),c=o._start,c>h&&a._sort&&o._ts&&!a._lock?(a._lock=1,fi(a,o,c-o._delay,1)._lock=0):h=c,c<0&&o._ts&&(n-=c,(!d&&!a._dp||d&&d.smoothChildTiming)&&(a._start+=c/a._ts,a._time-=c,a._tTime-=c),a.shiftChildren(-c,!1,-1/0),h=0),o._end>n&&o._ts&&(n=o._end),o=l;yr(a,a===Ct&&a._time>n?a._time:n,1,1),a._dirty=0}return a._tDur},t.updateRoot=function(r){if(Ct._ts&&($p(Ct,eo(r,Ct)),Vp=be.frame),be.frame>=Wp){Wp+=ge.autoSleep||120;var n=Ct._first;if((!n||!n._ts)&&ge.autoSleep&&be._listeners.length<2){for(;n&&!n._ts;)n=n._next;n||be.sleep()}}},t}(gn);De(ne.prototype,{_lock:0,_hasPause:0,_forcing:0});var iw=function(t,e,i,r,n,a,o){var h=new ue(this._pt,t,e,0,1,Em,null,n),l=0,c=0,d,u,f,p,m,_,y,v;for(h.b=i,h.e=r,i+="",r+="",(y=~r.indexOf("random("))&&(r=fn(r)),a&&(v=[i,r],a(v,t,e),i=v[0],r=v[1]),u=i.match(Cl)||[];d=Cl.exec(r);)p=d[0],m=r.substring(l,d.index),f?f=(f+1)%5:m.substr(-5)==="rgba("&&(f=1),p!==u[c++]&&(_=parseFloat(u[c-1])||0,h._pt={_next:h._pt,p:m||c===1?m:",",s:_,c:p.charAt(1)==="="?_r(_,p)-_:parseFloat(p)-_,m:f&&f<4?Math.round:0},l=Cl.lastIndex);return h.c=l<r.length?r.substring(l,r.length):"",h.fp=o,(kp.test(r)||y)&&(h.e=0),this._pt=h,h},Xl=function(t,e,i,r,n,a,o,h,l,c){Lt(r)&&(r=r(n||0,t,a));var d=t[e],u=i!=="get"?i:Lt(d)?l?t[e.indexOf("set")||!Lt(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():d,f=Lt(d)?l?ow:Tm:Yl,p;if(jt(r)&&(~r.indexOf("random(")&&(r=fn(r)),r.charAt(1)==="="&&(p=_r(u,r)+(ie(u)||0),(p||p===0)&&(r=p))),!c||u!==r||$l)return!isNaN(u*r)&&r!==""?(p=new ue(this._pt,t,e,+u||0,r-(u||0),typeof d=="boolean"?lw:wm,0,f),l&&(p.fp=l),o&&p.modifier(o,this,t),this._pt=p):(!d&&!(e in t)&&Il(e,r),iw.call(this,t,e,u,r,f,h||ge.stringFilter,l))},sw=function(t,e,i,r,n){if(Lt(t)&&(t=yn(t,n,e,i,r)),!ui(t)||t.style&&t.nodeType||ee(t)||Fp(t))return jt(t)?yn(t,n,e,i,r):t;var a={},o;for(o in t)a[o]=yn(t[o],n,e,i,r);return a},xm=function(t,e,i,r,n,a){var o,h,l,c;if(xe[t]&&(o=new xe[t]).init(n,o.rawVars?e[t]:sw(e[t],r,n,a,i),i,r,a)!==!1&&(i._pt=h=new ue(i._pt,n,t,0,1,o.render,o,0,o.priority),i!==xr))for(l=i._ptLookup[i._targets.indexOf(n)],c=o._props.length;c--;)l[o._props[c]]=h;return o},rs,$l,zl=function s(t,e,i){var r=t.vars,n=r.ease,a=r.startAt,o=r.immediateRender,h=r.lazy,l=r.onUpdate,c=r.runBackwards,d=r.yoyoEase,u=r.keyframes,f=r.autoRevert,p=t._dur,m=t._startAt,_=t._targets,y=t.parent,v=y&&y.data==="nested"?y.vars.targets:_,g=t._overwrite==="auto"&&!Tl,x=t.timeline,b,w,T,E,A,P,L,M,S,C,R,N,F;if(x&&(!u||!n)&&(n="none"),t._ease=Ms(n,pr.ease),t._yEase=d?mm(Ms(d===!0?n:d,pr.ease)):0,d&&t._yoyo&&!t._repeat&&(d=t._yEase,t._yEase=t._ease,t._ease=d),t._from=!x&&!!r.runBackwards,!x||u&&!r.stagger){if(M=_[0]?Ps(_[0]).harness:0,N=M&&r[M.prop],b=Ja(r,Ml),m&&(m._zTime<0&&m.progress(1),e<0&&c&&o&&!f?m.render(-1,!0):m.revert(c&&p?Ka:MT),m._lazy=0),a){if(es(t._startAt=Vt.set(_,De({data:"isStart",overwrite:!1,parent:y,immediateRender:!0,lazy:!m&&le(h),startAt:null,delay:0,onUpdate:l&&function(){return ve(t,"onUpdate")},stagger:0},a))),t._startAt._dp=0,t._startAt._sat=t,e<0&&(te||!o&&!f)&&t._startAt.revert(Ka),o&&p&&e<=0&&i<=0){e&&(t._zTime=e);return}}else if(c&&p&&!m){if(e&&(o=!1),T=De({overwrite:!1,data:"isFromStart",lazy:o&&!m&&le(h),immediateRender:o,stagger:0,parent:y},b),N&&(T[M.prop]=N),es(t._startAt=Vt.set(_,T)),t._startAt._dp=0,t._startAt._sat=t,e<0&&(te?t._startAt.revert(Ka):t._startAt.render(-1,!0)),t._zTime=e,!o)s(t._startAt,yt,yt);else if(!e)return}for(t._pt=t._ptCache=0,h=p&&le(h)||h&&!p,w=0;w<_.length;w++){if(A=_[w],L=A._gsap||Fl(_)[w]._gsap,t._ptLookup[w]=C={},Dl[L.id]&&ts.length&&Qa(),R=v===_?w:v.indexOf(A),M&&(S=new M).init(A,N||b,t,R,v)!==!1&&(t._pt=E=new ue(t._pt,A,S.name,0,1,S.render,S,0,S.priority),S._props.forEach(function(B){C[B]=E}),S.priority&&(P=1)),!M||N)for(T in b)xe[T]&&(S=xm(T,b,t,R,A,v))?S.priority&&(P=1):C[T]=E=Xl.call(t,A,T,"get",b[T],R,v,0,r.stringFilter);t._op&&t._op[w]&&t.kill(A,t._op[w]),g&&t._pt&&(rs=t,Ct.killTweensOf(A,C,t.globalTime(e)),F=!t.parent,rs=0),t._pt&&h&&(Dl[L.id]=1)}P&&Am(t),t._onInit&&t._onInit(t)}t._onUpdate=l,t._initted=(!t._op||t._pt)&&!F,u&&e<=0&&x.render(Me,!0,!0)},rw=function(t,e,i,r,n,a,o,h){var l=(t._pt&&t._ptCache||(t._ptCache={}))[e],c,d,u,f;if(!l)for(l=t._ptCache[e]=[],u=t._ptLookup,f=t._targets.length;f--;){if(c=u[f][e],c&&c.d&&c.d._pt)for(c=c.d._pt;c&&c.p!==e&&c.fp!==e;)c=c._next;if(!c)return $l=1,t.vars[e]="+=0",zl(t,o),$l=0,h?hn(e+" not eligible for reset"):1;l.push(c)}for(f=l.length;f--;)d=l[f],c=d._pt||d,c.s=(r||r===0)&&!n?r:c.s+(r||0)+a*c.c,c.c=i-c.s,d.e&&(d.e=Ut(i)+ie(d.e)),d.b&&(d.b=c.s+ie(d.b))},nw=function(t,e){var i=t[0]?Ps(t[0]).harness:0,r=i&&i.aliases,n,a,o,h;if(!r)return e;n=Rs({},e);for(a in r)if(a in n)for(h=r[a].split(","),o=h.length;o--;)n[h[o]]=n[a];return n},aw=function(t,e,i,r){var n=e.ease||r||"power1.inOut",a,o;if(ee(e))o=i[t]||(i[t]=[]),e.forEach(function(h,l){return o.push({t:l/(e.length-1)*100,v:h,e:n})});else for(a in e)o=i[a]||(i[a]=[]),a==="ease"||o.push({t:parseFloat(t),v:e[a],e:n})},yn=function(t,e,i,r,n){return Lt(t)?t.call(e,i,r,n):jt(t)&&~t.indexOf("random(")?fn(t):t},vm=Ol+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",bm={};ce(vm+",id,stagger,delay,duration,paused,scrollTrigger",function(s){return bm[s]=1});var Vt=function(s){Bp(t,s);function t(i,r,n,a){var o;typeof r=="number"&&(n.duration=r,r=n,n=null),o=s.call(this,a?r:cn(r))||this;var h=o.vars,l=h.duration,c=h.delay,d=h.immediateRender,u=h.stagger,f=h.overwrite,p=h.keyframes,m=h.defaults,_=h.scrollTrigger,y=h.yoyoEase,v=r.parent||Ct,g=(ee(i)||Fp(i)?Bi(i[0]):"length"in r)?[i]:Oe(i),x,b,w,T,E,A,P,L;if(o._targets=g.length?Fl(g):hn("GSAP target "+i+" not found. https://gsap.com",!ge.nullTargetWarn)||[],o._ptLookup=[],o._overwrite=f,p||u||ja(l)||ja(c)){if(r=o.vars,x=o.timeline=new ne({data:"nested",defaults:m||{},targets:v&&v.data==="nested"?v.vars.targets:g}),x.kill(),x.parent=x._dp=Di(o),x._start=0,u||ja(l)||ja(c)){if(T=g.length,P=u&&sm(u),ui(u))for(E in u)~vm.indexOf(E)&&(L||(L={}),L[E]=u[E]);for(b=0;b<T;b++)w=Ja(r,bm),w.stagger=0,y&&(w.yoyoEase=y),L&&Rs(w,L),A=g[b],w.duration=+yn(l,Di(o),b,A,g),w.delay=(+yn(c,Di(o),b,A,g)||0)-o._delay,!u&&T===1&&w.delay&&(o._delay=c=w.delay,o._start+=c,w.delay=0),x.to(A,w,P?P(b,A,g):0),x._ease=at.none;x.duration()?l=c=0:o.timeline=0}else if(p){cn(De(x.vars.defaults,{ease:"none"})),x._ease=Ms(p.ease||r.ease||"none");var M=0,S,C,R;if(ee(p))p.forEach(function(N){return x.to(g,N,">")}),x.duration();else{w={};for(E in p)E==="ease"||E==="easeEach"||aw(E,p[E],w,p.easeEach);for(E in w)for(S=w[E].sort(function(N,F){return N.t-F.t}),M=0,b=0;b<S.length;b++)C=S[b],R={ease:C.e,duration:(C.t-(b?S[b-1].t:0))/100*l},R[E]=C.v,x.to(g,R,M),M+=R.duration;x.duration()<l&&x.to({},{duration:l-x.duration()})}}l||o.duration(l=x.duration())}else o.timeline=0;return f===!0&&!Tl&&(rs=Di(o),Ct.killTweensOf(g),rs=0),fi(v,Di(o),n),r.reversed&&o.reverse(),r.paused&&o.paused(!0),(d||!l&&!p&&o._start===qt(v._time)&&le(d)&&kT(Di(o))&&v.data!=="nested")&&(o._tTime=-yt,o.render(Math.max(0,-c)||0)),_&&Qp(Di(o),_),o}var e=t.prototype;return e.render=function(r,n,a){var o=this._time,h=this._tDur,l=this._dur,c=r<0,d=r>h-yt&&!c?h:r<yt?0:r,u,f,p,m,_,y,v,g,x;if(!l)UT(this,r,n,a);else if(d!==this._tTime||!r||a||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==c){if(u=d,g=this.timeline,this._repeat){if(m=l+this._rDelay,this._repeat<-1&&c)return this.totalTime(m*100+r,n,a);if(u=qt(d%m),d===h?(p=this._repeat,u=l):(p=~~(d/m),p&&p===qt(d/m)&&(u=l,p--),u>l&&(u=l)),y=this._yoyo&&p&1,y&&(x=this._yEase,u=l-u),_=gr(this._tTime,m),u===o&&!a&&this._initted&&p===_)return this._tTime=d,this;p!==_&&(g&&this._yEase&&_m(g,y),this.vars.repeatRefresh&&!y&&!this._lock&&this._time!==m&&this._initted&&(this._lock=a=1,this.render(qt(m*p),!0).invalidate()._lock=0))}if(!this._initted){if(Jp(this,c?r:u,a,n,d))return this._tTime=0,this;if(o!==this._time&&!(a&&this.vars.repeatRefresh&&p!==_))return this;if(l!==this._dur)return this.render(r,n,a)}if(this._tTime=d,this._time=u,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=v=(x||this._ease)(u/l),this._from&&(this.ratio=v=1-v),u&&!o&&!n&&!p&&(ve(this,"onStart"),this._tTime!==d))return this;for(f=this._pt;f;)f.r(v,f.d),f=f._next;g&&g.render(r<0?r:g._dur*g._ease(u/this._dur),n,a)||this._startAt&&(this._zTime=r),this._onUpdate&&!n&&(c&&Ll(this,r,n,a),ve(this,"onUpdate")),this._repeat&&p!==_&&this.vars.onRepeat&&!n&&this.parent&&ve(this,"onRepeat"),(d===this._tDur||!d)&&this._tTime===d&&(c&&!this._onUpdate&&Ll(this,r,!0,!0),(r||!l)&&(d===this._tDur&&this._ts>0||!d&&this._ts<0)&&es(this,1),!n&&!(c&&!o)&&(d||o||y)&&(ve(this,d===h?"onComplete":"onReverseComplete",!0),this._prom&&!(d<h&&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),s.prototype.invalidate.call(this,r)},e.resetTo=function(r,n,a,o,h){_n||be.wake(),this._ts||this.play();var l=Math.min(this._dur,(this._dp._time-this._start)*this._ts),c;return this._initted||zl(this,l),c=this._ease(l/this._dur),rw(this,r,n,a,o,c,l,h)?this.resetTo(r,n,a,o,1):(so(this,0),this.parent||qp(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?pn(this):this;if(this.timeline){var a=this.timeline.totalDuration();return this.timeline.killTweensOf(r,n,rs&&rs.vars.overwrite!==!0)._first||pn(this),this.parent&&a!==this.timeline.totalDuration()&&yr(this,this._dur*this.timeline._tDur/a,0,1),this}var o=this._targets,h=r?Oe(r):o,l=this._ptLookup,c=this._pt,d,u,f,p,m,_,y;if((!n||n==="all")&&FT(o,h))return n==="all"&&(this._pt=0),pn(this);for(d=this._op=this._op||[],n!=="all"&&(jt(n)&&(m={},ce(n,function(v){return m[v]=1}),n=m),n=nw(o,n)),y=o.length;y--;)if(~h.indexOf(o[y])){u=l[y],n==="all"?(d[y]=n,p=u,f={}):(f=d[y]=d[y]||{},p=n);for(m in p)_=u&&u[m],_&&((!("kill"in _.d)||_.d.kill(m)===!0)&&to(this,_,"_pt"),delete u[m]),f!=="all"&&(f[m]=1)}return this._initted&&!this._pt&&c&&pn(this),this},t.to=function(r,n){return new t(r,n,arguments[2])},t.from=function(r,n){return un(1,arguments)},t.delayedCall=function(r,n,a,o){return new t(n,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:r,onComplete:n,onReverseComplete:n,onCompleteParams:a,onReverseCompleteParams:a,callbackScope:o})},t.fromTo=function(r,n,a){return un(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 Ct.killTweensOf(r,n,a)},t}(gn);De(Vt.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),ce("staggerTo,staggerFrom,staggerFromTo",function(s){Vt[s]=function(){var t=new ne,e=Nl.call(arguments,0);return e.splice(s==="staggerFromTo"?5:4,0,0),t[s].apply(t,e)}});var Yl=function(t,e,i){return t[e]=i},Tm=function(t,e,i){return t[e](i)},ow=function(t,e,i,r){return t[e](r.fp,i)},hw=function(t,e,i){return t.setAttribute(e,i)},jl=function(t,e){return Lt(t[e])?Tm:El(t[e])&&t.setAttribute?hw:Yl},wm=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},lw=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},Em=function(t,e){var i=e._pt,r="";if(!t&&e.b)r=e.b;else if(t===1&&e.e)r=e.e;else{for(;i;)r=i.p+(i.m?i.m(i.s+i.c*t):Math.round((i.s+i.c*t)*1e4)/1e4)+r,i=i._next;r+=e.c}e.set(e.t,e.p,r,e)},ql=function(t,e){for(var i=e._pt;i;)i.r(t,i.d),i=i._next},cw=function(t,e,i,r){for(var n=this._pt,a;n;)a=n._next,n.p===r&&n.modifier(t,e,i),n=a},uw=function(t){for(var e=this._pt,i,r;e;)r=e._next,e.p===t&&!e.op||e.op===t?to(this,e,"_pt"):e.dep||(i=1),e=r;return!i},dw=function(t,e,i,r){r.mSet(t,e,r.m.call(r.tween,i,r.mt),r)},Am=function(t){for(var e=t._pt,i,r,n,a;e;){for(i=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=i}t._pt=n},ue=function(){function s(e,i,r,n,a,o,h,l,c){this.t=i,this.s=n,this.c=a,this.p=r,this.r=o||wm,this.d=h||this,this.set=l||Yl,this.pr=c||0,this._next=e,e&&(e._prev=this)}var t=s.prototype;return t.modifier=function(i,r,n){this.mSet=this.mSet||this.set,this.set=dw,this.m=i,this.mt=n,this.tween=r},s}();ce(Ol+"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(s){return Ml[s]=1}),ye.TweenMax=ye.TweenLite=Vt,ye.TimelineLite=ye.TimelineMax=ne,Ct=new ne({sortChildren:!1,defaults:pr,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),ge.stringFilter=pm;var Bs=[],ro={},fw=[],Sm=0,pw=0,Kl=function(t){return(ro[t]||fw).map(function(e){return e()})},Zl=function(){var t=Date.now(),e=[];t-Sm>2&&(Kl("matchMediaInit"),Bs.forEach(function(i){var r=i.queries,n=i.conditions,a,o,h,l;for(o in r)a=di.matchMedia(r[o]).matches,a&&(h=1),a!==n[o]&&(n[o]=a,l=1);l&&(i.revert(),h&&e.push(i))}),Kl("matchMediaRevert"),e.forEach(function(i){return i.onMatch(i,function(r){return i.add(null,r)})}),Sm=t,Kl("matchMedia"))},Cm=function(){function s(e,i){this.selector=i&&Ul(i),this.data=[],this._r=[],this.isReverted=!1,this.id=pw++,e&&this.add(e)}var t=s.prototype;return t.add=function(i,r,n){Lt(i)&&(n=r,r=i,i=Lt);var a=this,o=function(){var l=Tt,c=a.selector,d;return l&&l!==a&&l.data.push(a),n&&(a.selector=Ul(n)),Tt=a,d=r.apply(a,arguments),Lt(d)&&a._r.push(d),Tt=l,a.selector=c,a.isReverted=!1,d};return a.last=o,i===Lt?o(a,function(h){return a.add(null,h)}):i?a[i]=o:o},t.ignore=function(i){var r=Tt;Tt=null,i(this),Tt=r},t.getTweens=function(){var i=[];return this.data.forEach(function(r){return r instanceof s?i.push.apply(i,r.getTweens()):r instanceof Vt&&!(r.parent&&r.parent.data==="nested")&&i.push(r)}),i},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(i,r){var n=this;if(i?function(){for(var o=n.getTweens(),h=n.data.length,l;h--;)l=n.data[h],l.data==="isFlip"&&(l.revert(),l.getChildren(!0,!0,!1).forEach(function(c){return o.splice(o.indexOf(c),1)}));for(o.map(function(c){return{g:c._dur||c._delay||c._sat&&!c._sat.vars.immediateRender?c.globalTime(0):-1/0,t:c}}).sort(function(c,d){return d.g-c.g||-1/0}).forEach(function(c){return c.t.revert(i)}),h=n.data.length;h--;)l=n.data[h],l instanceof ne?l.data!=="nested"&&(l.scrollTrigger&&l.scrollTrigger.revert(),l.kill()):!(l instanceof Vt)&&l.revert&&l.revert(i);n._r.forEach(function(c){return c(i,n)}),n.isReverted=!0}():this.data.forEach(function(o){return o.kill&&o.kill()}),this.clear(),r)for(var a=Bs.length;a--;)Bs[a].id===this.id&&Bs.splice(a,1)},t.revert=function(i){this.kill(i||{})},s}(),mw=function(){function s(e){this.contexts=[],this.scope=e,Tt&&Tt.data.push(this)}var t=s.prototype;return t.add=function(i,r,n){ui(i)||(i={matches:i});var a=new Cm(0,n||this.scope),o=a.conditions={},h,l,c;Tt&&!a.selector&&(a.selector=Tt.selector),this.contexts.push(a),r=a.add("onMatch",r),a.queries=i;for(l in i)l==="all"?c=1:(h=di.matchMedia(i[l]),h&&(Bs.indexOf(a)<0&&Bs.push(a),(o[l]=h.matches)&&(c=1),h.addListener?h.addListener(Zl):h.addEventListener("change",Zl)));return c&&r(a,function(d){return a.add(null,d)}),this},t.revert=function(i){this.kill(i||{})},t.kill=function(i){this.contexts.forEach(function(r){return r.kill(i,!0)})},s}(),no={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];e.forEach(function(r){return cm(r)})},timeline:function(t){return new ne(t)},getTweensOf:function(t,e){return Ct.getTweensOf(t,e)},getProperty:function(t,e,i,r){jt(t)&&(t=Oe(t)[0]);var n=Ps(t||{}).get,a=i?Yp:zp;return i==="native"&&(i=""),t&&(e?a((xe[e]&&xe[e].get||n)(t,e,i,r)):function(o,h,l){return a((xe[o]&&xe[o].get||n)(t,o,h,l))})},quickSetter:function(t,e,i){if(t=Oe(t),t.length>1){var r=t.map(function(c){return de.quickSetter(c,e,i)}),n=r.length;return function(c){for(var d=n;d--;)r[d](c)}}t=t[0]||{};var a=xe[e],o=Ps(t),h=o.harness&&(o.harness.aliases||{})[e]||e,l=a?function(c){var d=new a;xr._pt=0,d.init(t,i?c+i:c,xr,0,[t]),d.render(1,d),xr._pt&&ql(1,xr)}:o.set(t,h);return a?l:function(c){return l(t,h,i?c+i:c,o,1)}},quickTo:function(t,e,i){var r,n=de.to(t,Rs((r={},r[e]="+=0.1",r.paused=!0,r),i||{})),a=function(h,l,c){return n.resetTo(e,h,l,c)};return a.tween=n,a},isTweening:function(t){return Ct.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=Ms(t.ease,pr.ease)),jp(pr,t||{})},config:function(t){return jp(ge,t||{})},registerEffect:function(t){var e=t.name,i=t.effect,r=t.plugins,n=t.defaults,a=t.extendTimeline;(r||"").split(",").forEach(function(o){return o&&!xe[o]&&!ye[o]&&hn(e+" effect requires "+o+" plugin.")}),Bl[e]=function(o,h,l){return i(Oe(o),De(h||{},n),l)},a&&(ne.prototype[e]=function(o,h,l){return this.add(Bl[e](o,ui(h)?h:(l=h)&&{},this),l)})},registerEase:function(t,e){at[t]=Ms(e)},parseEase:function(t,e){return arguments.length?Ms(t,e):at},getById:function(t){return Ct.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var i=new ne(t),r,n;for(i.smoothChildTiming=le(t.smoothChildTiming),Ct.remove(i),i._dp=0,i._time=i._tTime=Ct._time,r=Ct._first;r;)n=r._next,(e||!(!r._dur&&r instanceof Vt&&r.vars.onComplete===r._targets[0]))&&fi(i,r,r._start-r._delay),r=n;return fi(Ct,i,0),i},context:function(t,e){return t?new Cm(t,e):Tt},matchMedia:function(t){return new mw(t)},matchMediaRefresh:function(){return Bs.forEach(function(t){var e=t.conditions,i,r;for(r in e)e[r]&&(e[r]=!1,i=1);i&&t.revert()})||Zl()},addEventListener:function(t,e){var i=ro[t]||(ro[t]=[]);~i.indexOf(e)||i.push(e)},removeEventListener:function(t,e){var i=ro[t],r=i&&i.indexOf(e);r>=0&&i.splice(r,1)},utils:{wrap:YT,wrapYoyo:jT,distribute:sm,random:nm,snap:rm,normalize:zT,getUnit:ie,clamp:VT,splitColor:um,toArray:Oe,selector:Ul,mapRange:om,pipe:XT,unitize:$T,interpolate:qT,shuffle:im},install:Gp,effects:Bl,ticker:be,updateRoot:ne.updateRoot,plugins:xe,globalTimeline:Ct,core:{PropTween:ue,globals:Hp,Tween:Vt,Timeline:ne,Animation:gn,getCache:Ps,_removeLinkedListItem:to,reverting:function(){return te},context:function(t){return t&&Tt&&(Tt.data.push(t),t._ctx=Tt),Tt},suppressOverwrites:function(t){return Tl=t}}};ce("to,from,fromTo,delayedCall,set,killTweensOf",function(s){return no[s]=Vt[s]}),be.add(ne.updateRoot),xr=no.to({},{duration:0});var _w=function(t,e){for(var i=t._pt;i&&i.p!==e&&i.op!==e&&i.fp!==e;)i=i._next;return i},gw=function(t,e){var i=t._targets,r,n,a;for(r in e)for(n=i.length;n--;)a=t._ptLookup[n][r],a&&(a=a.d)&&(a._pt&&(a=_w(a,r)),a&&a.modifier&&a.modifier(e[r],t,i[n],r))},Ql=function(t,e){return{name:t,rawVars:1,init:function(r,n,a){a._onInit=function(o){var h,l;if(jt(n)&&(h={},ce(n,function(c){return h[c]=1}),n=h),e){h={};for(l in n)h[l]=e(n[l]);n=h}gw(o,n)}}}},de=no.registerPlugin({name:"attr",init:function(t,e,i,r,n){var a,o,h;this.tween=i;for(a in e)h=t.getAttribute(a)||"",o=this.add(t,"setAttribute",(h||0)+"",e[a],r,n,0,0,a),o.op=a,o.b=h,this._props.push(a)},render:function(t,e){for(var i=e._pt;i;)te?i.set(i.t,i.p,i.b,i):i.r(t,i.d),i=i._next}},{name:"endArray",init:function(t,e){for(var i=e.length;i--;)this.add(t,i,t[i]||0,e[i],0,0,0,0,0,1)}},Ql("roundProps",Gl),Ql("modifiers"),Ql("snap",rm))||no;Vt.version=ne.version=de.version="3.12.5",Up=1,Al()&&vr(),at.Power0,at.Power1,at.Power2,at.Power3,at.Power4,at.Linear,at.Quad,at.Cubic,at.Quart,at.Quint,at.Strong,at.Elastic,at.Back,at.SteppedEase,at.Bounce,at.Sine,at.Expo,at.Circ;/*!
|
|
1155
|
+
*/var Ke={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},gn={duration:.5,overwrite:!1,delay:0},wc,Ae,Dt,ls=1e8,Mt=1/ls,Ec=Math.PI*2,cA=Ec/4,uA=0,Qm=Math.sqrt,dA=Math.cos,fA=Math.sin,me=function(t){return typeof t=="string"},Kt=function(t){return typeof t=="function"},bi=function(t){return typeof t=="number"},Tc=function(t){return typeof t>"u"},Qs=function(t){return typeof t=="object"},Ue=function(t){return t!==!1},Ac=function(){return typeof window<"u"},Jo=function(t){return Kt(t)||me(t)},Jm=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},Se=Array.isArray,Sc=/(?:-?\.?\d|\.)+/gi,tg=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,_n=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Cc=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,eg=/[+-]=-?[.\d]+/,sg=/[^,'"\[\]\s]+/gi,pA=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Vt,Js,Ic,Pc,Ze={},th={},ig,rg=function(t){return(th=Ir(t,Ze))&&Ge},Rc=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},ca=function(t,e){return!e&&console.warn(t)},ng=function(t,e){return t&&(Ze[t]=e)&&th&&(th[t]=e)||Ze},ua=function(){return 0},mA={suppressEvents:!0,isStart:!0,kill:!1},eh={suppressEvents:!0,kill:!1},gA={suppressEvents:!0},Mc={},Hi=[],Fc={},ag,Qe={},kc={},og=30,sh=[],Bc="",Dc=function(t){var e=t[0],s,i;if(Qs(e)||Kt(e)||(t=[t]),!(s=(e._gsap||{}).harness)){for(i=sh.length;i--&&!sh[i].targetTest(e););s=sh[i]}for(i=t.length;i--;)t[i]&&(t[i]._gsap||(t[i]._gsap=new Og(t[i],s)))||t.splice(i,1);return t},Cr=function(t){return t._gsap||Dc(ds(t))[0]._gsap},hg=function(t,e,s){return(s=t[e])&&Kt(s)?t[e]():Tc(s)&&t.getAttribute&&t.getAttribute(e)||s},Ve=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),i=parseFloat(e.substr(2));return t=parseFloat(t),s==="+"?t+i:s==="-"?t-i:s==="*"?t*i:t/i},_A=function(t,e){for(var s=e.length,i=0;t.indexOf(e[i])<0&&++i<s;);return i<s},ih=function(){var t=Hi.length,e=Hi.slice(0),s,i;for(Fc={},Hi.length=0,s=0;s<t;s++)i=e[s],i&&i._lazy&&(i.render(i._lazy[0],i._lazy[1],!0)._lazy=0)},lg=function(t,e,s,i){Hi.length&&!Ae&&ih(),t.render(e,s,i||Ae&&e<0&&(t._initted||t._startAt)),Hi.length&&!Ae&&ih()},cg=function(t){var e=parseFloat(t);return(e||e===0)&&(t+"").match(sg).length<2?e:me(t)?t.trim():t},ug=function(t){return t},cs=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 i in s)i in e||i==="duration"&&t||i==="ease"||(e[i]=s[i])}},Ir=function(t,e){for(var s in e)t[s]=e[s];return t},dg=function r(t,e){for(var s in e)s!=="__proto__"&&s!=="constructor"&&s!=="prototype"&&(t[s]=Qs(e[s])?r(t[s]||(t[s]={}),e[s]):e[s]);return t},rh=function(t,e){var s={},i;for(i in t)i in e||(s[i]=t[i]);return s},da=function(t){var e=t.parent||Vt,s=t.keyframes?xA(Se(t.keyframes)):cs;if(Ue(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,i=s===e.length;i&&s--&&t[s]===e[s];);return s<0},fg=function(t,e,s,i,n){s===void 0&&(s="_first"),i===void 0&&(i="_last");var o=t[i],h;if(n)for(h=e[n];o&&o[n]>h;)o=o._prev;return o?(e._next=o._next,o._next=e):(e._next=t[s],t[s]=e),e._next?e._next._prev=e:t[i]=e,e._prev=o,e.parent=e._dp=t,e},nh=function(t,e,s,i){s===void 0&&(s="_first"),i===void 0&&(i="_last");var n=e._prev,o=e._next;n?n._next=o:t[s]===e&&(t[s]=o),o?o._prev=n:t[i]===e&&(t[i]=n),e._next=e._prev=e.parent=null},Wi=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},Pr=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},vA=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,i){return t._startAt&&(Ae?t._startAt.revert(eh):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,i))},bA=function r(t){return!t||t._ts&&r(t.parent)},pg=function(t){return t._repeat?yn(t._tTime,t=t.duration()+t._rDelay)*t:0},yn=function(t,e){var s=Math.floor(t/=e);return t&&s===t?s-1:s},ah=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},oh=function(t){return t._end=ge(t._start+(t._tDur/Math.abs(t._ts||t._rts||Mt)||0))},hh=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)),oh(t),s._dirty||Pr(s,t)),t},mg=function(t,e){var s;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(s=ah(t.rawTime(),e),(!e._dur||pa(0,e.totalDuration(),s)-e._tTime>Mt)&&e.render(s,!0)),Pr(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}},ti=function(t,e,s,i){return e.parent&&Wi(e),e._start=ge((bi(s)?s:s||t!==Vt?us(t,s,e):t._time)+e._delay),e._end=ge(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),fg(t,e,"_first","_last",t._sort?"_start":0),Lc(e)||(t._recent=e),i||mg(t,e),t._ts<0&&hh(t,t._tTime),t},gg=function(t,e){return(Ze.ScrollTrigger||Rc("scrollTrigger",e))&&Ze.ScrollTrigger.create(e,t)},_g=function(t,e,s,i,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 Hi.push(t),t._lazy=[n,i],1},wA=function r(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||r(e))},Lc=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},EA=function(t,e,s,i){var n=t.ratio,o=e<0||!e&&(!t._start&&wA(t)&&!(!t._initted&&Lc(t))||(t._ts<0||t._dp._ts<0)&&!Lc(t))?0:1,h=t._rDelay,a=0,l,c,d;if(h&&t._repeat&&(a=pa(0,t._tDur,e),c=yn(a,h),t._yoyo&&c&1&&(o=1-o),c!==yn(t._tTime,h)&&(n=1-o,t.vars.repeatRefresh&&t._initted&&t.invalidate())),o!==n||Ae||i||t._zTime===Mt||!e&&t._zTime){if(!t._initted&&_g(t,e,i,s,a))return;for(d=t._zTime,t._zTime=e||(s?Mt:0),s||(s=e&&!d),t.ratio=o,t._from&&(o=1-o),t._time=0,t._tTime=a,l=t._pt;l;)l.r(o,l.d),l=l._next;e<0&&Oc(t,e,s,!0),t._onUpdate&&!s&&Je(t,"onUpdate"),a&&t._repeat&&!s&&t.parent&&Je(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===o&&(o&&Wi(t,1),!s&&!Ae&&(Je(t,o?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},TA=function(t,e,s){var i;if(s>e)for(i=t._first;i&&i._start<=s;){if(i.data==="isPause"&&i._start>e)return i;i=i._next}else for(i=t._last;i&&i._start>=s;){if(i.data==="isPause"&&i._start<e)return i;i=i._prev}},vn=function(t,e,s,i){var n=t._repeat,o=ge(e)||0,h=t._tTime/t._tDur;return h&&!i&&(t._time*=o/t._dur),t._dur=o,t._tDur=n?n<0?1e10:ge(o*(n+1)+t._rDelay*n):o,h>0&&!i&&hh(t,t._tTime=t._tDur*h),t.parent&&oh(t),s||Pr(t.parent,t),t},xg=function(t){return t instanceof Me?Pr(t):vn(t,t._dur)},AA={_start:0,endTime:ua,totalDuration:ua},us=function r(t,e,s){var i=t.labels,n=t._recent||AA,o=t.duration()>=ls?n.endTime(!1):t._dur,h,a,l;return me(e)&&(isNaN(e)||e in i)?(a=e.charAt(0),l=e.substr(-1)==="%",h=e.indexOf("="),a==="<"||a===">"?(h>=0&&(e=e.replace(/=/,"")),(a==="<"?n._start:n.endTime(n._repeat>=0))+(parseFloat(e.substr(1))||0)*(l?(h<0?n:s).totalDuration()/100:1)):h<0?(e in i||(i[e]=o),i[e]):(a=parseFloat(e.charAt(h-1)+e.substr(h+1)),l&&s&&(a=a/100*(Se(s)?s[0]:s).totalDuration()),h>1?r(t,e.substr(0,h-1),s)+a:o+a)):e==null?o:+e},fa=function(t,e,s){var i=bi(e[1]),n=(i?2:1)+(t<2?0:1),o=e[n],h,a;if(i&&(o.duration=e[1]),o.parent=s,t){for(h=o,a=s;a&&!("immediateRender"in h);)h=a.vars.defaults||{},a=Ue(a.vars.inherit)&&a.parent;o.immediateRender=Ue(h.immediateRender),t<2?o.runBackwards=1:o.startAt=e[n-1]}return new re(e[0],o,e[n+1])},zi=function(t,e){return t||t===0?e(t):e},pa=function(t,e,s){return s<t?t:s>e?e:s},Ce=function(t,e){return!me(t)||!(e=pA.exec(t))?"":e[1]},SA=function(t,e,s){return zi(s,function(i){return pa(t,e,i)})},Nc=[].slice,yg=function(t,e){return t&&Qs(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&Qs(t[0]))&&!t.nodeType&&t!==Js},CA=function(t,e,s){return s===void 0&&(s=[]),t.forEach(function(i){var n;return me(i)&&!e||yg(i,1)?(n=s).push.apply(n,ds(i)):s.push(i)})||s},ds=function(t,e,s){return Dt&&!e&&Dt.selector?Dt.selector(t):me(t)&&!s&&(Ic||!wn())?Nc.call((e||Pc).querySelectorAll(t),0):Se(t)?CA(t,s):yg(t)?Nc.call(t,0):t?[t]:[]},Uc=function(t){return t=ds(t)[0]||ca("Invalid scope")||{},function(e){var s=t.current||t.nativeElement||t;return ds(e,s.querySelectorAll?s:s===t?ca("Invalid scope")||Pc.createElement("div"):t)}},vg=function(t){return t.sort(function(){return .5-Math.random()})},bg=function(t){if(Kt(t))return t;var e=Qs(t)?t:{each:t},s=Rr(e.ease),i=e.from||0,n=parseFloat(e.base)||0,o={},h=i>0&&i<1,a=isNaN(i)||h,l=e.axis,c=i,d=i;return me(i)?c=d={center:.5,edges:.5,end:1}[i]||0:!h&&a&&(c=i[0],d=i[1]),function(u,f,p){var m=(p||e).length,g=o[m],y,x,_,v,b,w,E,T,A;if(!g){if(A=e.grid==="auto"?0:(e.grid||[1,ls])[1],!A){for(E=-ls;E<(E=p[A++].getBoundingClientRect().left)&&A<m;);A<m&&A--}for(g=o[m]=[],y=a?Math.min(A,m)*c-.5:i%A,x=A===ls?0:a?m*d/A-.5:i/A|0,E=0,T=ls,w=0;w<m;w++)_=w%A-y,v=x-(w/A|0),g[w]=b=l?Math.abs(l==="y"?v:_):Qm(_*_+v*v),b>E&&(E=b),b<T&&(T=b);i==="random"&&vg(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)*(i==="edges"?-1:1),g.b=m<0?n-m:n,g.u=Ce(e.amount||e.each)||0,s=s&&m<0?kg(s):s}return m=(g[u]-g.min)/g.max||0,ge(g.b+(s?s(m):m)*g.v)+g.u}},Vc=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(s){var i=ge(Math.round(parseFloat(s)/t)*t*e);return(i-i%1)/e+(bi(s)?0:Ce(s))}},wg=function(t,e){var s=Se(t),i,n;return!s&&Qs(t)&&(i=s=t.radius||ls,t.values?(t=ds(t.values),(n=!bi(t[0]))&&(i*=i)):t=Vc(t.increment)),zi(e,s?Kt(t)?function(o){return n=t(o),Math.abs(n-o)<=i?n:o}:function(o){for(var h=parseFloat(n?o.x:o),a=parseFloat(n?o.y:0),l=ls,c=0,d=t.length,u,f;d--;)n?(u=t[d].x-h,f=t[d].y-a,u=u*u+f*f):u=Math.abs(t[d]-h),u<l&&(l=u,c=d);return c=!i||l<=i?t[c]:o,n||c===o||bi(o)?c:c+Ce(o)}:Vc(t))},Eg=function(t,e,s,i){return zi(Se(t)?!e:s===!0?!!(s=0):!i,function(){return Se(t)?t[~~(Math.random()*t.length)]:(s=s||1e-5)&&(i=s<1?Math.pow(10,(s+"").length-2):1)&&Math.floor(Math.round((t-s/2+Math.random()*(e-t+s*.99))/s)*s*i)/i})},IA=function(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];return function(i){return e.reduce(function(n,o){return o(n)},i)}},PA=function(t,e){return function(s){return t(parseFloat(s))+(e||Ce(s))}},RA=function(t,e,s){return Ag(t,e,0,1,s)},Tg=function(t,e,s){return zi(s,function(i){return t[~~e(i)]})},MA=function r(t,e,s){var i=e-t;return Se(t)?Tg(t,r(0,t.length),e):zi(s,function(n){return(i+(n-t)%i)%i+t})},FA=function r(t,e,s){var i=e-t,n=i*2;return Se(t)?Tg(t,r(0,t.length-1),e):zi(s,function(o){return o=(n+(o-t)%n)%n||0,t+(o>i?n-o:o)})},ma=function(t){for(var e=0,s="",i,n,o,h;~(i=t.indexOf("random(",e));)o=t.indexOf(")",i),h=t.charAt(i+7)==="[",n=t.substr(i+7,o-i-7).match(h?sg:Sc),s+=t.substr(e,i-e)+Eg(h?n:+n[0],h?0:+n[1],+n[2]||1e-5),e=o+1;return s+t.substr(e,t.length-e)},Ag=function(t,e,s,i,n){var o=e-t,h=i-s;return zi(n,function(a){return s+((a-t)/o*h||0)})},kA=function r(t,e,s,i){var n=isNaN(t+e)?0:function(f){return(1-f)*t+f*e};if(!n){var o=me(t),h={},a,l,c,d,u;if(s===!0&&(i=1)&&(s=null),o)t={p:t},e={p:e};else if(Se(t)&&!Se(e)){for(c=[],d=t.length,u=d-2,l=1;l<d;l++)c.push(r(t[l-1],t[l]));d--,n=function(p){p*=d;var m=Math.min(u,~~p);return c[m](p-m)},s=e}else i||(t=Ir(Se(t)?[]:{},t));if(!c){for(a in e)Yc.call(h,t,a,"get",e[a]);n=function(p){return qc(p,h)||(o?t.p:t)}}}return zi(s,n)},Sg=function(t,e,s){var i=t.labels,n=ls,o,h,a;for(o in i)h=i[o]-e,h<0==!!s&&h&&n>(h=Math.abs(h))&&(a=o,n=h);return a},Je=function(t,e,s){var i=t.vars,n=i[e],o=Dt,h=t._ctx,a,l,c;if(n)return a=i[e+"Params"],l=i.callbackScope||t,s&&Hi.length&&ih(),h&&(Dt=h),c=a?n.apply(l,a):n.call(l),Dt=o,c},ga=function(t){return Wi(t),t.scrollTrigger&&t.scrollTrigger.kill(!!Ae),t.progress()<1&&Je(t,"onInterrupt"),t},bn,Cg=[],Ig=function(t){if(t)if(t=!t.name&&t.default||t,Ac()||t.headless){var e=t.name,s=Kt(t),i=e&&!s&&t.init?function(){this._props=[]}:t,n={init:ua,render:qc,add:Yc,kill:qA,modifier:jA,rawVars:0},o={targetTest:0,get:0,getSetter:jc,aliases:{},register:0};if(wn(),t!==i){if(Qe[e])return;cs(i,cs(rh(t,n),o)),Ir(i.prototype,Ir(n,rh(t,o))),Qe[i.prop=e]=i,t.targetTest&&(sh.push(i),Mc[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}ng(e,i),t.register&&t.register(Ge,i,Xe)}else Cg.push(t)},It=255,_a={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]},Xc=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},Pg=function(t,e,s){var i=t?bi(t)?[t>>16,t>>8&It,t&It]:0:_a.black,n,o,h,a,l,c,d,u,f,p;if(!i){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),_a[t])i=_a[t];else if(t.charAt(0)==="#"){if(t.length<6&&(n=t.charAt(1),o=t.charAt(2),h=t.charAt(3),t="#"+n+n+o+o+h+h+(t.length===5?t.charAt(4)+t.charAt(4):"")),t.length===9)return i=parseInt(t.substr(1,6),16),[i>>16,i>>8&It,i&It,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),i=[t>>16,t>>8&It,t&It]}else if(t.substr(0,3)==="hsl"){if(i=p=t.match(Sc),!e)a=+i[0]%360/360,l=+i[1]/100,c=+i[2]/100,o=c<=.5?c*(l+1):c+l-c*l,n=c*2-o,i.length>3&&(i[3]*=1),i[0]=Xc(a+1/3,n,o),i[1]=Xc(a,n,o),i[2]=Xc(a-1/3,n,o);else if(~t.indexOf("="))return i=t.match(tg),s&&i.length<4&&(i[3]=1),i}else i=t.match(Sc)||_a.transparent;i=i.map(Number)}return e&&!p&&(n=i[0]/It,o=i[1]/It,h=i[2]/It,d=Math.max(n,o,h),u=Math.min(n,o,h),c=(d+u)/2,d===u?a=l=0:(f=d-u,l=c>.5?f/(2-d-u):f/(d+u),a=d===n?(o-h)/f+(o<h?6:0):d===o?(h-n)/f+2:(n-o)/f+4,a*=60),i[0]=~~(a+.5),i[1]=~~(l*100+.5),i[2]=~~(c*100+.5)),s&&i.length<4&&(i[3]=1),i},Rg=function(t){var e=[],s=[],i=-1;return t.split(ji).forEach(function(n){var o=n.match(_n)||[];e.push.apply(e,o),s.push(i+=o.length+1)}),e.c=s,e},Mg=function(t,e,s){var i="",n=(t+i).match(ji),o=e?"hsla(":"rgba(",h=0,a,l,c,d;if(!n)return t;if(n=n.map(function(u){return(u=Pg(u,e,1))&&o+(e?u[0]+","+u[1]+"%,"+u[2]+"%,"+u[3]:u.join(","))+")"}),s&&(c=Rg(t),a=s.c,a.join(i)!==c.c.join(i)))for(l=t.replace(ji,"1").split(_n),d=l.length-1;h<d;h++)i+=l[h]+(~a.indexOf(h)?n.shift()||o+"0,0,0,0)":(c.length?c:n.length?n:s).shift());if(!l)for(l=t.split(ji),d=l.length-1;h<d;h++)i+=l[h]+n[h];return i+l[d]},ji=function(){var r="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in _a)r+="|"+t+"\\b";return new RegExp(r+")","gi")}(),BA=/hsl[a]?\(/,Fg=function(t){var e=t.join(" "),s;if(ji.lastIndex=0,ji.test(e))return s=BA.test(e),t[1]=Mg(t[1],s),t[0]=Mg(t[0],s,Rg(t[1])),!0},xa,ts=function(){var r=Date.now,t=500,e=33,s=r(),i=s,n=1e3/240,o=n,h=[],a,l,c,d,u,f,p=function m(g){var y=r()-i,x=g===!0,_,v,b,w;if((y>t||y<0)&&(s+=y-e),i+=y,b=i-s,_=b-o,(_>0||x)&&(w=++d.frame,u=b-d.time*1e3,d.time=b=b/1e3,o+=_+(_>=n?4:n-_),v=1),x||(a=l(m)),v)for(f=0;f<h.length;f++)h[f](b,u,w,g)};return d={time:0,frame:0,tick:function(){p(!0)},deltaRatio:function(g){return u/(1e3/(g||60))},wake:function(){ig&&(!Ic&&Ac()&&(Js=Ic=window,Pc=Js.document||{},Ze.gsap=Ge,(Js.gsapVersions||(Js.gsapVersions=[])).push(Ge.version),rg(th||Js.GreenSockGlobals||!Js.gsap&&Js||{}),Cg.forEach(Ig)),c=typeof requestAnimationFrame<"u"&&requestAnimationFrame,a&&d.sleep(),l=c||function(g){return setTimeout(g,o-d.time*1e3+1|0)},xa=1,p(2))},sleep:function(){(c?cancelAnimationFrame:clearTimeout)(a),xa=0,l=ua},lagSmoothing:function(g,y){t=g||1/0,e=Math.min(y||33,t)},fps:function(g){n=1e3/(g||240),o=d.time*1e3+n},add:function(g,y,x){var _=y?function(v,b,w,E){g(v,b,w,E),d.remove(_)}:g;return d.remove(g),h[x?"unshift":"push"](_),wn(),_},remove:function(g,y){~(y=h.indexOf(g))&&h.splice(y,1)&&f>=y&&f--},_listeners:h},d}(),wn=function(){return!xa&&ts.wake()},ut={},DA=/^[\d.\-M][\d.\-,\s]/,OA=/["']/g,LA=function(t){for(var e={},s=t.substr(1,t.length-3).split(":"),i=s[0],n=1,o=s.length,h,a,l;n<o;n++)a=s[n],h=n!==o-1?a.lastIndexOf(","):a.length,l=a.substr(0,h),e[i]=isNaN(l)?l.replace(OA,"").trim():+l,i=a.substr(h+1).trim();return e},NA=function(t){var e=t.indexOf("(")+1,s=t.indexOf(")"),i=t.indexOf("(",e);return t.substring(e,~i&&i<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("{")?[LA(e[1])]:NA(t).split(",").map(cg)):ut._CE&&DA.test(t)?ut._CE("",t):s},kg=function(t){return function(e){return 1-t(1-e)}},Bg=function r(t,e){for(var s=t._first,i;s;)s instanceof Me?r(s,e):s.vars.yoyoEase&&(!s._yoyo||!s._repeat)&&s._yoyo!==e&&(s.timeline?r(s.timeline,e):(i=s._ease,s._ease=s._yEase,s._yEase=i,s._yoyo=e)),s=s._next},Rr=function(t,e){return t&&(Kt(t)?t:ut[t]||UA(t))||e},Mr=function(t,e,s,i){s===void 0&&(s=function(a){return 1-e(1-a)}),i===void 0&&(i=function(a){return a<.5?e(a*2)/2:1-e((1-a)*2)/2});var n={easeIn:e,easeOut:s,easeInOut:i},o;return Ve(t,function(h){ut[h]=Ze[h]=n,ut[o=h.toLowerCase()]=s;for(var a in n)ut[o+(a==="easeIn"?".in":a==="easeOut"?".out":".inOut")]=ut[h+"."+a]=n[a]}),n},Dg=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},Gc=function r(t,e,s){var i=e>=1?e:1,n=(s||(t?.3:.45))/(e<1?e:1),o=n/Ec*(Math.asin(1/i)||0),h=function(c){return c===1?1:i*Math.pow(2,-10*c)*fA((c-o)*n)+1},a=t==="out"?h:t==="in"?function(l){return 1-h(1-l)}:Dg(h);return n=Ec/n,a.config=function(l,c){return r(t,l,c)},a},$c=function r(t,e){e===void 0&&(e=1.70158);var s=function(o){return o?--o*o*((e+1)*o+e)+1:0},i=t==="out"?s:t==="in"?function(n){return 1-s(1-n)}:Dg(s);return i.config=function(n){return r(t,n)},i};Ve("Linear,Quad,Cubic,Quart,Quint,Strong",function(r,t){var e=t<5?t+1:t;Mr(r+",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,Mr("Elastic",Gc("in"),Gc("out"),Gc()),function(r,t){var e=1/t,s=2*e,i=2.5*e,n=function(h){return h<e?r*h*h:h<s?r*Math.pow(h-1.5/t,2)+.75:h<i?r*(h-=2.25/t)*h+.9375:r*Math.pow(h-2.625/t,2)+.984375};Mr("Bounce",function(o){return 1-n(1-o)},n)}(7.5625,2.75),Mr("Expo",function(r){return r?Math.pow(2,10*(r-1)):0}),Mr("Circ",function(r){return-(Qm(1-r*r)-1)}),Mr("Sine",function(r){return r===1?1:-dA(r*cA)+1}),Mr("Back",$c("in"),$c("out"),$c()),ut.SteppedEase=ut.steps=Ze.SteppedEase={config:function(t,e){t===void 0&&(t=1);var s=1/t,i=t+(e?0:1),n=e?1:0,o=1-Mt;return function(h){return((i*pa(0,o,h)|0)+n)*s}}},gn.ease=ut["quad.out"],Ve("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(r){return Bc+=r+","+r+"Params,"});var Og=function(t,e){this.id=uA++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:hg,this.set=e?e.getSetter:jc},ya=function(){function r(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,vn(this,+e.duration,1,1),this.data=e.data,Dt&&(this._ctx=Dt,Dt.data.push(this)),xa||ts.wake()}var t=r.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,vn(this,this._repeat<0?s:(s-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(s,i){if(wn(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(hh(this,s),!n._dp||n.parent||mg(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)&&ti(this._dp,this,this._start-this._delay)}return(this._tTime!==s||!this._dur&&!i||this._initted&&Math.abs(this._zTime)===Mt||!s&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=s),lg(this,s,i)),this},t.time=function(s,i){return arguments.length?this.totalTime(Math.min(this.totalDuration(),s+pg(this))%(this._dur+this._rDelay)||(s?this._dur:0),i):this._time},t.totalProgress=function(s,i){return arguments.length?this.totalTime(this.totalDuration()*s,i):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>0?1:0},t.progress=function(s,i){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-s:s)+pg(this),i):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},t.iteration=function(s,i){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(s-1)*n,i):this._repeat?yn(this._tTime,n)+1:1},t.timeScale=function(s,i){if(!arguments.length)return this._rts===-Mt?0:this._rts;if(this._rts===s)return this;var n=this.parent&&this._ts?ah(this.parent._time,this):this._tTime;return this._rts=+s||0,this._ts=this._ps||s===-Mt?0:this._rts,this.totalTime(pa(-Math.abs(this._delay),this._tDur,n),i!==!1),oh(this),vA(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):(wn(),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 i=this.parent||this._dp;return i&&(i._sort||!this.parent)&&ti(i,this,s-this._delay),this}return this._start},t.endTime=function(s){return this._start+(Ue(s)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},t.rawTime=function(s){var i=this.parent||this._dp;return i?s&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?ah(i.rawTime(s),this):this._tTime:this._tTime},t.revert=function(s){s===void 0&&(s=gA);var i=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=i,this},t.globalTime=function(s){for(var i=this,n=arguments.length?s:i.rawTime();i;)n=i._start+n/(Math.abs(i._ts)||1),i=i._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 i=this._time;return this._rDelay=s,xg(this),i?this.time(i):this}return this._rDelay},t.yoyo=function(s){return arguments.length?(this._yoyo=s,this):this._yoyo},t.seek=function(s,i){return this.totalTime(us(this,s),Ue(i))},t.restart=function(s,i){return this.play().totalTime(s?-this._delay:0,Ue(i))},t.play=function(s,i){return s!=null&&this.seek(s,i),this.reversed(!1).paused(!1)},t.reverse=function(s,i){return s!=null&&this.seek(s||this.totalDuration(),i),this.reversed(!0).paused(!1)},t.pause=function(s,i){return s!=null&&this.seek(s,i),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,i=this._start,n;return!!(!s||this._ts&&this._initted&&s.isActive()&&(n=s.rawTime(!0))>=i&&n<this.endTime(!0)-Mt)},t.eventCallback=function(s,i,n){var o=this.vars;return arguments.length>1?(i?(o[s]=i,n&&(o[s+"Params"]=n),s==="onUpdate"&&(this._onUpdate=i)):delete o[s],this):o[s]},t.then=function(s){var i=this;return new Promise(function(n){var o=Kt(s)?s:ug,h=function(){var l=i.then;i.then=null,Kt(o)&&(o=o(i))&&(o.then||o===i)&&(i.then=l),n(o),i.then=l};i._initted&&i.totalProgress()===1&&i._ts>=0||!i._tTime&&i._ts<0?h():i._prom=h})},t.kill=function(){ga(this)},r}();cs(ya.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(r){Zm(t,r);function t(s,i){var n;return s===void 0&&(s={}),n=r.call(this,s)||this,n.labels={},n.smoothChildTiming=!!s.smoothChildTiming,n.autoRemoveChildren=!!s.autoRemoveChildren,n._sort=Ue(s.sortChildren),Vt&&ti(s.parent||Vt,vi(n),i),s.reversed&&n.reverse(),s.paused&&n.paused(!0),s.scrollTrigger&&gg(vi(n),s.scrollTrigger),n}var e=t.prototype;return e.to=function(i,n,o){return fa(0,arguments,this),this},e.from=function(i,n,o){return fa(1,arguments,this),this},e.fromTo=function(i,n,o,h){return fa(2,arguments,this),this},e.set=function(i,n,o){return n.duration=0,n.parent=this,da(n).repeatDelay||(n.repeat=0),n.immediateRender=!!n.immediateRender,new re(i,n,us(this,o),1),this},e.call=function(i,n,o){return ti(this,re.delayedCall(0,i,n),o)},e.staggerTo=function(i,n,o,h,a,l,c){return o.duration=n,o.stagger=o.stagger||h,o.onComplete=l,o.onCompleteParams=c,o.parent=this,new re(i,o,us(this,a)),this},e.staggerFrom=function(i,n,o,h,a,l,c){return o.runBackwards=1,da(o).immediateRender=Ue(o.immediateRender),this.staggerTo(i,n,o,h,a,l,c)},e.staggerFromTo=function(i,n,o,h,a,l,c,d){return h.startAt=o,da(h).immediateRender=Ue(h.immediateRender),this.staggerTo(i,n,h,a,l,c,d)},e.render=function(i,n,o){var h=this._time,a=this._dirty?this.totalDuration():this._tDur,l=this._dur,c=i<=0?0:ge(i),d=this._zTime<0!=i<0&&(this._initted||!l),u,f,p,m,g,y,x,_,v,b,w,E;if(this!==Vt&&c>a&&i>=0&&(c=a),c!==this._tTime||o||d){if(h!==this._time&&l&&(c+=this._time-h,i+=this._time-h),u=c,v=this._start,_=this._ts,y=!_,d&&(l||(h=this._zTime),(i||!n)&&(this._zTime=i)),this._repeat){if(w=this._yoyo,g=l+this._rDelay,this._repeat<-1&&i<0)return this.totalTime(g*100+i,n,o);if(u=ge(c%g),c===a?(m=this._repeat,u=l):(m=~~(c/g),m&&m===c/g&&(u=l,m--),u>l&&(u=l)),b=yn(this._tTime,g),!h&&this._tTime&&b!==m&&this._tTime-b*g-this._dur<=0&&(b=m),w&&m&1&&(u=l-u,E=1),m!==b&&!this._lock){var T=w&&b&1,A=T===(w&&m&1);if(m<b&&(T=!T),h=T?0:c%l?l:c,this._lock=1,this.render(h||(E?0:ge(m*g)),n,!l)._lock=0,this._tTime=c,!n&&this.parent&&Je(this,"onRepeat"),this.vars.repeatRefresh&&!E&&(this.invalidate()._lock=1),h&&h!==this._time||y!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(l=this._dur,a=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&&!y)return this;Bg(this,E)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(x=TA(this,ge(h),ge(u)),x&&(c-=u-(u=x._start))),this._tTime=c,this._time=u,this._act=!_,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=i,h=0),!h&&u&&!n&&!m&&(Je(this,"onStart"),this._tTime!==c))return this;if(u>=h&&i>=0)for(f=this._first;f;){if(p=f._next,(f._act||u>=f._start)&&f._ts&&x!==f){if(f.parent!==this)return this.render(i,n,o);if(f.render(f._ts>0?(u-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(u-f._start)*f._ts,n,o),u!==this._time||!this._ts&&!y){x=0,p&&(c+=this._zTime=-Mt);break}}f=p}else{f=this._last;for(var I=i<0?i:u;f;){if(p=f._prev,(f._act||I<=f._end)&&f._ts&&x!==f){if(f.parent!==this)return this.render(i,n,o);if(f.render(f._ts>0?(I-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(I-f._start)*f._ts,n,o||Ae&&(f._initted||f._startAt)),u!==this._time||!this._ts&&!y){x=0,p&&(c+=this._zTime=I?-Mt:Mt);break}}f=p}}if(x&&!n&&(this.pause(),x.render(u>=h?0:-Mt)._zTime=u>=h?1:-1,this._ts))return this._start=v,oh(this),this.render(i,n,o);this._onUpdate&&!n&&Je(this,"onUpdate",!0),(c===a&&this._tTime>=this.totalDuration()||!c&&h)&&(v===this._start||Math.abs(_)!==Math.abs(this._ts))&&(this._lock||((i||!l)&&(c===a&&this._ts>0||!c&&this._ts<0)&&Wi(this,1),!n&&!(i<0&&!h)&&(c||h||!a)&&(Je(this,c===a&&i>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(c<a&&this.timeScale()>0)&&this._prom())))}return this},e.add=function(i,n){var o=this;if(bi(n)||(n=us(this,n,i)),!(i instanceof ya)){if(Se(i))return i.forEach(function(h){return o.add(h,n)}),this;if(me(i))return this.addLabel(i,n);if(Kt(i))i=re.delayedCall(0,i);else return this}return this!==i?ti(this,i,n):this},e.getChildren=function(i,n,o,h){i===void 0&&(i=!0),n===void 0&&(n=!0),o===void 0&&(o=!0),h===void 0&&(h=-ls);for(var a=[],l=this._first;l;)l._start>=h&&(l instanceof re?n&&a.push(l):(o&&a.push(l),i&&a.push.apply(a,l.getChildren(!0,n,o)))),l=l._next;return a},e.getById=function(i){for(var n=this.getChildren(1,1,1),o=n.length;o--;)if(n[o].vars.id===i)return n[o]},e.remove=function(i){return me(i)?this.removeLabel(i):Kt(i)?this.killTweensOf(i):(nh(this,i),i===this._recent&&(this._recent=this._last),Pr(this))},e.totalTime=function(i,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=ge(ts.time-(this._ts>0?i/this._ts:(this.totalDuration()-i)/-this._ts))),r.prototype.totalTime.call(this,i,n),this._forcing=0,this):this._tTime},e.addLabel=function(i,n){return this.labels[i]=us(this,n),this},e.removeLabel=function(i){return delete this.labels[i],this},e.addPause=function(i,n,o){var h=re.delayedCall(0,n||ua,o);return h.data="isPause",this._hasPause=1,ti(this,h,us(this,i))},e.removePause=function(i){var n=this._first;for(i=us(this,i);n;)n._start===i&&n.data==="isPause"&&Wi(n),n=n._next},e.killTweensOf=function(i,n,o){for(var h=this.getTweensOf(i,o),a=h.length;a--;)qi!==h[a]&&h[a].kill(i,n);return this},e.getTweensOf=function(i,n){for(var o=[],h=ds(i),a=this._first,l=bi(n),c;a;)a instanceof re?_A(a._targets,h)&&(l?(!qi||a._initted&&a._ts)&&a.globalTime(0)<=n&&a.globalTime(a.totalDuration())>n:!n||a.isActive())&&o.push(a):(c=a.getTweensOf(h,n)).length&&o.push.apply(o,c),a=a._next;return o},e.tweenTo=function(i,n){n=n||{};var o=this,h=us(o,i),a=n,l=a.startAt,c=a.onStart,d=a.onStartParams,u=a.immediateRender,f,p=re.to(o,cs({ease:n.ease||"none",lazy:!1,immediateRender:!1,time:h,overwrite:"auto",duration:n.duration||Math.abs((h-(l&&"time"in l?l.time:o._time))/o.timeScale())||Mt,onStart:function(){if(o.pause(),!f){var g=n.duration||Math.abs((h-(l&&"time"in l?l.time:o._time))/o.timeScale());p._dur!==g&&vn(p,g,0,1).render(p._time,!0,!0),f=1}c&&c.apply(p,d||[])}},n));return u?p.render(0):p},e.tweenFromTo=function(i,n,o){return this.tweenTo(n,cs({startAt:{time:us(this,i)}},o))},e.recent=function(){return this._recent},e.nextLabel=function(i){return i===void 0&&(i=this._time),Sg(this,us(this,i))},e.previousLabel=function(i){return i===void 0&&(i=this._time),Sg(this,us(this,i),1)},e.currentLabel=function(i){return arguments.length?this.seek(i,!0):this.previousLabel(this._time+Mt)},e.shiftChildren=function(i,n,o){o===void 0&&(o=0);for(var h=this._first,a=this.labels,l;h;)h._start>=o&&(h._start+=i,h._end+=i),h=h._next;if(n)for(l in a)a[l]>=o&&(a[l]+=i);return Pr(this)},e.invalidate=function(i){var n=this._first;for(this._lock=0;n;)n.invalidate(i),n=n._next;return r.prototype.invalidate.call(this,i)},e.clear=function(i){i===void 0&&(i=!0);for(var n=this._first,o;n;)o=n._next,this.remove(n),n=o;return this._dp&&(this._time=this._tTime=this._pTime=0),i&&(this.labels={}),Pr(this)},e.totalDuration=function(i){var n=0,o=this,h=o._last,a=ls,l,c,d;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-i:i));if(o._dirty){for(d=o.parent;h;)l=h._prev,h._dirty&&h.totalDuration(),c=h._start,c>a&&o._sort&&h._ts&&!o._lock?(o._lock=1,ti(o,h,c-h._delay,1)._lock=0):a=c,c<0&&h._ts&&(n-=c,(!d&&!o._dp||d&&d.smoothChildTiming)&&(o._start+=c/o._ts,o._time-=c,o._tTime-=c),o.shiftChildren(-c,!1,-1/0),a=0),h._end>n&&h._ts&&(n=h._end),h=l;vn(o,o===Vt&&o._time>n?o._time:n,1,1),o._dirty=0}return o._tDur},t.updateRoot=function(i){if(Vt._ts&&(lg(Vt,ah(i,Vt)),ag=ts.frame),ts.frame>=og){og+=Ke.autoSleep||120;var n=Vt._first;if((!n||!n._ts)&&Ke.autoSleep&&ts._listeners.length<2){for(;n&&!n._ts;)n=n._next;n||ts.sleep()}}},t}(ya);cs(Me.prototype,{_lock:0,_hasPause:0,_forcing:0});var VA=function(t,e,s,i,n,o,h){var a=new Xe(this._pt,t,e,0,1,Gg,null,n),l=0,c=0,d,u,f,p,m,g,y,x;for(a.b=s,a.e=i,s+="",i+="",(y=~i.indexOf("random("))&&(i=ma(i)),o&&(x=[s,i],o(x,t,e),s=x[0],i=x[1]),u=s.match(Cc)||[];d=Cc.exec(i);)p=d[0],m=i.substring(l,d.index),f?f=(f+1)%5:m.substr(-5)==="rgba("&&(f=1),p!==u[c++]&&(g=parseFloat(u[c-1])||0,a._pt={_next:a._pt,p:m||c===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 a.c=l<i.length?i.substring(l,i.length):"",a.fp=h,(eg.test(i)||y)&&(a.e=0),this._pt=a,a},Yc=function(t,e,s,i,n,o,h,a,l,c){Kt(i)&&(i=i(n||0,t,o));var d=t[e],u=s!=="get"?s:Kt(d)?l?t[e.indexOf("set")||!Kt(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():d,f=Kt(d)?l?HA:Vg:zc,p;if(me(i)&&(~i.indexOf("random(")&&(i=ma(i)),i.charAt(1)==="="&&(p=xn(u,i)+(Ce(u)||0),(p||p===0)&&(i=p))),!c||u!==i||Hc)return!isNaN(u*i)&&i!==""?(p=new Xe(this._pt,t,e,+u||0,i-(u||0),typeof d=="boolean"?zA:Xg,0,f),l&&(p.fp=l),h&&p.modifier(h,this,t),this._pt=p):(!d&&!(e in t)&&Rc(e,i),VA.call(this,t,e,u,i,f,a||Ke.stringFilter,l))},XA=function(t,e,s,i,n){if(Kt(t)&&(t=va(t,n,e,s,i)),!Qs(t)||t.style&&t.nodeType||Se(t)||Jm(t))return me(t)?va(t,n,e,s,i):t;var o={},h;for(h in t)o[h]=va(t[h],n,e,s,i);return o},Lg=function(t,e,s,i,n,o){var h,a,l,c;if(Qe[t]&&(h=new Qe[t]).init(n,h.rawVars?e[t]:XA(e[t],i,n,o,s),s,i,o)!==!1&&(s._pt=a=new Xe(s._pt,n,t,0,1,h.render,h,0,h.priority),s!==bn))for(l=s._ptLookup[s._targets.indexOf(n)],c=h._props.length;c--;)l[h._props[c]]=a;return h},qi,Hc,Wc=function r(t,e,s){var i=t.vars,n=i.ease,o=i.startAt,h=i.immediateRender,a=i.lazy,l=i.onUpdate,c=i.runBackwards,d=i.yoyoEase,u=i.keyframes,f=i.autoRevert,p=t._dur,m=t._startAt,g=t._targets,y=t.parent,x=y&&y.data==="nested"?y.vars.targets:g,_=t._overwrite==="auto"&&!wc,v=t.timeline,b,w,E,T,A,I,M,R,C,P,k,V,U;if(v&&(!u||!n)&&(n="none"),t._ease=Rr(n,gn.ease),t._yEase=d?kg(Rr(d===!0?n:d,gn.ease)):0,d&&t._yoyo&&!t._repeat&&(d=t._yEase,t._yEase=t._ease,t._ease=d),t._from=!v&&!!i.runBackwards,!v||u&&!i.stagger){if(R=g[0]?Cr(g[0]).harness:0,V=R&&i[R.prop],b=rh(i,Mc),m&&(m._zTime<0&&m.progress(1),e<0&&c&&h&&!f?m.render(-1,!0):m.revert(c&&p?eh:mA),m._lazy=0),o){if(Wi(t._startAt=re.set(g,cs({data:"isStart",overwrite:!1,parent:y,immediateRender:!0,lazy:!m&&Ue(a),startAt:null,delay:0,onUpdate:l&&function(){return Je(t,"onUpdate")},stagger:0},o))),t._startAt._dp=0,t._startAt._sat=t,e<0&&(Ae||!h&&!f)&&t._startAt.revert(eh),h&&p&&e<=0&&s<=0){e&&(t._zTime=e);return}}else if(c&&p&&!m){if(e&&(h=!1),E=cs({overwrite:!1,data:"isFromStart",lazy:h&&!m&&Ue(a),immediateRender:h,stagger:0,parent:y},b),V&&(E[R.prop]=V),Wi(t._startAt=re.set(g,E)),t._startAt._dp=0,t._startAt._sat=t,e<0&&(Ae?t._startAt.revert(eh):t._startAt.render(-1,!0)),t._zTime=e,!h)r(t._startAt,Mt,Mt);else if(!e)return}for(t._pt=t._ptCache=0,a=p&&Ue(a)||a&&!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]&&Hi.length&&ih(),k=x===g?w:x.indexOf(A),R&&(C=new R).init(A,V||b,t,k,x)!==!1&&(t._pt=T=new Xe(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||V)for(E in b)Qe[E]&&(C=Lg(E,b,t,k,A,x))?C.priority&&(I=1):P[E]=T=Yc.call(t,A,E,"get",b[E],k,x,0,i.stringFilter);t._op&&t._op[w]&&t.kill(A,t._op[w]),_&&t._pt&&(qi=t,Vt.killTweensOf(A,P,t.globalTime(e)),U=!t.parent,qi=0),t._pt&&a&&(Fc[M.id]=1)}I&&$g(t),t._onInit&&t._onInit(t)}t._onUpdate=l,t._initted=(!t._op||t._pt)&&!U,u&&e<=0&&v.render(ls,!0,!0)},GA=function(t,e,s,i,n,o,h,a){var l=(t._pt&&t._ptCache||(t._ptCache={}))[e],c,d,u,f;if(!l)for(l=t._ptCache[e]=[],u=t._ptLookup,f=t._targets.length;f--;){if(c=u[f][e],c&&c.d&&c.d._pt)for(c=c.d._pt;c&&c.p!==e&&c.fp!==e;)c=c._next;if(!c)return Hc=1,t.vars[e]="+=0",Wc(t,h),Hc=0,a?ca(e+" not eligible for reset"):1;l.push(c)}for(f=l.length;f--;)d=l[f],c=d._pt||d,c.s=(i||i===0)&&!n?i:c.s+(i||0)+o*c.c,c.c=s-c.s,d.e&&(d.e=te(s)+Ce(d.e)),d.b&&(d.b=c.s+Ce(d.b))},$A=function(t,e){var s=t[0]?Cr(t[0]).harness:0,i=s&&s.aliases,n,o,h,a;if(!i)return e;n=Ir({},e);for(o in i)if(o in n)for(a=i[o].split(","),h=a.length;h--;)n[a[h]]=n[o];return n},YA=function(t,e,s,i){var n=e.ease||i||"power1.inOut",o,h;if(Se(e))h=s[t]||(s[t]=[]),e.forEach(function(a,l){return h.push({t:l/(e.length-1)*100,v:a,e:n})});else for(o in e)h=s[o]||(s[o]=[]),o==="ease"||h.push({t:parseFloat(t),v:e[o],e:n})},va=function(t,e,s,i,n){return Kt(t)?t.call(e,s,i,n):me(t)&&~t.indexOf("random(")?ma(t):t},Ng=Bc+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",Ug={};Ve(Ng+",id,stagger,delay,duration,paused,scrollTrigger",function(r){return Ug[r]=1});var re=function(r){Zm(t,r);function t(s,i,n,o){var h;typeof i=="number"&&(n.duration=i,i=n,n=null),h=r.call(this,o?i:da(i))||this;var a=h.vars,l=a.duration,c=a.delay,d=a.immediateRender,u=a.stagger,f=a.overwrite,p=a.keyframes,m=a.defaults,g=a.scrollTrigger,y=a.yoyoEase,x=i.parent||Vt,_=(Se(s)||Jm(s)?bi(s[0]):"length"in i)?[s]:ds(s),v,b,w,E,T,A,I,M;if(h._targets=_.length?Dc(_):ca("GSAP target "+s+" not found. https://gsap.com",!Ke.nullTargetWarn)||[],h._ptLookup=[],h._overwrite=f,p||u||Jo(l)||Jo(c)){if(i=h.vars,v=h.timeline=new Me({data:"nested",defaults:m||{},targets:x&&x.data==="nested"?x.vars.targets:_}),v.kill(),v.parent=v._dp=vi(h),v._start=0,u||Jo(l)||Jo(c)){if(E=_.length,I=u&&bg(u),Qs(u))for(T in u)~Ng.indexOf(T)&&(M||(M={}),M[T]=u[T]);for(b=0;b<E;b++)w=rh(i,Ug),w.stagger=0,y&&(w.yoyoEase=y),M&&Ir(w,M),A=_[b],w.duration=+va(l,vi(h),b,A,_),w.delay=(+va(c,vi(h),b,A,_)||0)-h._delay,!u&&E===1&&w.delay&&(h._delay=c=w.delay,h._start+=c,w.delay=0),v.to(A,w,I?I(b,A,_):0),v._ease=ut.none;v.duration()?l=c=0:h.timeline=0}else if(p){da(cs(v.vars.defaults,{ease:"none"})),v._ease=Rr(p.ease||i.ease||"none");var R=0,C,P,k;if(Se(p))p.forEach(function(V){return v.to(_,V,">")}),v.duration();else{w={};for(T in p)T==="ease"||T==="easeEach"||YA(T,p[T],w,p.easeEach);for(T in w)for(C=w[T].sort(function(V,U){return V.t-U.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(_,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&&(qi=vi(h),Vt.killTweensOf(_),qi=0),ti(x,vi(h),n),i.reversed&&h.reverse(),i.paused&&h.paused(!0),(d||!l&&!p&&h._start===ge(x._time)&&Ue(d)&&bA(vi(h))&&x.data!=="nested")&&(h._tTime=-Mt,h.render(Math.max(0,-c)||0)),g&&gg(vi(h),g),h}var e=t.prototype;return e.render=function(i,n,o){var h=this._time,a=this._tDur,l=this._dur,c=i<0,d=i>a-Mt&&!c?a:i<Mt?0:i,u,f,p,m,g,y,x,_,v;if(!l)EA(this,i,n,o);else if(d!==this._tTime||!i||o||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==c){if(u=d,_=this.timeline,this._repeat){if(m=l+this._rDelay,this._repeat<-1&&c)return this.totalTime(m*100+i,n,o);if(u=ge(d%m),d===a?(p=this._repeat,u=l):(p=~~(d/m),p&&p===ge(d/m)&&(u=l,p--),u>l&&(u=l)),y=this._yoyo&&p&1,y&&(v=this._yEase,u=l-u),g=yn(this._tTime,m),u===h&&!o&&this._initted&&p===g)return this._tTime=d,this;p!==g&&(_&&this._yEase&&Bg(_,y),this.vars.repeatRefresh&&!y&&!this._lock&&this._time!==m&&this._initted&&(this._lock=o=1,this.render(ge(m*p),!0).invalidate()._lock=0))}if(!this._initted){if(_g(this,c?i:u,o,n,d))return this._tTime=0,this;if(h!==this._time&&!(o&&this.vars.repeatRefresh&&p!==g))return this;if(l!==this._dur)return this.render(i,n,o)}if(this._tTime=d,this._time=u,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=x=(v||this._ease)(u/l),this._from&&(this.ratio=x=1-x),u&&!h&&!n&&!p&&(Je(this,"onStart"),this._tTime!==d))return this;for(f=this._pt;f;)f.r(x,f.d),f=f._next;_&&_.render(i<0?i:_._dur*_._ease(u/this._dur),n,o)||this._startAt&&(this._zTime=i),this._onUpdate&&!n&&(c&&Oc(this,i,n,o),Je(this,"onUpdate")),this._repeat&&p!==g&&this.vars.onRepeat&&!n&&this.parent&&Je(this,"onRepeat"),(d===this._tDur||!d)&&this._tTime===d&&(c&&!this._onUpdate&&Oc(this,i,!0,!0),(i||!l)&&(d===this._tDur&&this._ts>0||!d&&this._ts<0)&&Wi(this,1),!n&&!(c&&!h)&&(d||h||y)&&(Je(this,d===a?"onComplete":"onReverseComplete",!0),this._prom&&!(d<a&&this.timeScale()>0)&&this._prom()))}return this},e.targets=function(){return this._targets},e.invalidate=function(i){return(!i||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(i),r.prototype.invalidate.call(this,i)},e.resetTo=function(i,n,o,h,a){xa||ts.wake(),this._ts||this.play();var l=Math.min(this._dur,(this._dp._time-this._start)*this._ts),c;return this._initted||Wc(this,l),c=this._ease(l/this._dur),GA(this,i,n,o,h,c,l,a)?this.resetTo(i,n,o,h,1):(hh(this,0),this.parent||fg(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},e.kill=function(i,n){if(n===void 0&&(n="all"),!i&&(!n||n==="all"))return this._lazy=this._pt=0,this.parent?ga(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(i,n,qi&&qi.vars.overwrite!==!0)._first||ga(this),this.parent&&o!==this.timeline.totalDuration()&&vn(this,this._dur*this.timeline._tDur/o,0,1),this}var h=this._targets,a=i?ds(i):h,l=this._ptLookup,c=this._pt,d,u,f,p,m,g,y;if((!n||n==="all")&&yA(h,a))return n==="all"&&(this._pt=0),ga(this);for(d=this._op=this._op||[],n!=="all"&&(me(n)&&(m={},Ve(n,function(x){return m[x]=1}),n=m),n=$A(h,n)),y=h.length;y--;)if(~a.indexOf(h[y])){u=l[y],n==="all"?(d[y]=n,p=u,f={}):(f=d[y]=d[y]||{},p=n);for(m in p)g=u&&u[m],g&&((!("kill"in g.d)||g.d.kill(m)===!0)&&nh(this,g,"_pt"),delete u[m]),f!=="all"&&(f[m]=1)}return this._initted&&!this._pt&&c&&ga(this),this},t.to=function(i,n){return new t(i,n,arguments[2])},t.from=function(i,n){return fa(1,arguments)},t.delayedCall=function(i,n,o,h){return new t(n,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:i,onComplete:n,onReverseComplete:n,onCompleteParams:o,onReverseCompleteParams:o,callbackScope:h})},t.fromTo=function(i,n,o){return fa(2,arguments)},t.set=function(i,n){return n.duration=0,n.repeatDelay||(n.repeat=0),new t(i,n)},t.killTweensOf=function(i,n,o){return Vt.killTweensOf(i,n,o)},t}(ya);cs(re.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),Ve("staggerTo,staggerFrom,staggerFromTo",function(r){re[r]=function(){var t=new Me,e=Nc.call(arguments,0);return e.splice(r==="staggerFromTo"?5:4,0,0),t[r].apply(t,e)}});var zc=function(t,e,s){return t[e]=s},Vg=function(t,e,s){return t[e](s)},HA=function(t,e,s,i){return t[e](i.fp,s)},WA=function(t,e,s){return t.setAttribute(e,s)},jc=function(t,e){return Kt(t[e])?Vg:Tc(t[e])&&t.setAttribute?WA:zc},Xg=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},zA=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},Gg=function(t,e){var s=e._pt,i="";if(!t&&e.b)i=e.b;else if(t===1&&e.e)i=e.e;else{for(;s;)i=s.p+(s.m?s.m(s.s+s.c*t):Math.round((s.s+s.c*t)*1e4)/1e4)+i,s=s._next;i+=e.c}e.set(e.t,e.p,i,e)},qc=function(t,e){for(var s=e._pt;s;)s.r(t,s.d),s=s._next},jA=function(t,e,s,i){for(var n=this._pt,o;n;)o=n._next,n.p===i&&n.modifier(t,e,s),n=o},qA=function(t){for(var e=this._pt,s,i;e;)i=e._next,e.p===t&&!e.op||e.op===t?nh(this,e,"_pt"):e.dep||(s=1),e=i;return!s},KA=function(t,e,s,i){i.mSet(t,e,i.m.call(i.tween,s,i.mt),i)},$g=function(t){for(var e=t._pt,s,i,n,o;e;){for(s=e._next,i=n;i&&i.pr>e.pr;)i=i._next;(e._prev=i?i._prev:o)?e._prev._next=e:n=e,(e._next=i)?i._prev=e:o=e,e=s}t._pt=n},Xe=function(){function r(e,s,i,n,o,h,a,l,c){this.t=s,this.s=n,this.c=o,this.p=i,this.r=h||Xg,this.d=a||this,this.set=l||zc,this.pr=c||0,this._next=e,e&&(e._prev=this)}var t=r.prototype;return t.modifier=function(s,i,n){this.mSet=this.mSet||this.set,this.set=KA,this.m=s,this.mt=n,this.tween=i},r}();Ve(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(r){return Mc[r]=1}),Ze.TweenMax=Ze.TweenLite=re,Ze.TimelineLite=Ze.TimelineMax=Me,Vt=new Me({sortChildren:!1,defaults:gn,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Ke.stringFilter=Fg;var Fr=[],lh={},ZA=[],Yg=0,QA=0,Kc=function(t){return(lh[t]||ZA).map(function(e){return e()})},Zc=function(){var t=Date.now(),e=[];t-Yg>2&&(Kc("matchMediaInit"),Fr.forEach(function(s){var i=s.queries,n=s.conditions,o,h,a,l;for(h in i)o=Js.matchMedia(i[h]).matches,o&&(a=1),o!==n[h]&&(n[h]=o,l=1);l&&(s.revert(),a&&e.push(s))}),Kc("matchMediaRevert"),e.forEach(function(s){return s.onMatch(s,function(i){return s.add(null,i)})}),Yg=t,Kc("matchMedia"))},Hg=function(){function r(e,s){this.selector=s&&Uc(s),this.data=[],this._r=[],this.isReverted=!1,this.id=QA++,e&&this.add(e)}var t=r.prototype;return t.add=function(s,i,n){Kt(s)&&(n=i,i=s,s=Kt);var o=this,h=function(){var l=Dt,c=o.selector,d;return l&&l!==o&&l.data.push(o),n&&(o.selector=Uc(n)),Dt=o,d=i.apply(o,arguments),Kt(d)&&o._r.push(d),Dt=l,o.selector=c,o.isReverted=!1,d};return o.last=h,s===Kt?h(o,function(a){return o.add(null,a)}):s?o[s]=h:h},t.ignore=function(s){var i=Dt;Dt=null,s(this),Dt=i},t.getTweens=function(){var s=[];return this.data.forEach(function(i){return i instanceof r?s.push.apply(s,i.getTweens()):i instanceof re&&!(i.parent&&i.parent.data==="nested")&&s.push(i)}),s},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(s,i){var n=this;if(s?function(){for(var h=n.getTweens(),a=n.data.length,l;a--;)l=n.data[a],l.data==="isFlip"&&(l.revert(),l.getChildren(!0,!0,!1).forEach(function(c){return h.splice(h.indexOf(c),1)}));for(h.map(function(c){return{g:c._dur||c._delay||c._sat&&!c._sat.vars.immediateRender?c.globalTime(0):-1/0,t:c}}).sort(function(c,d){return d.g-c.g||-1/0}).forEach(function(c){return c.t.revert(s)}),a=n.data.length;a--;)l=n.data[a],l instanceof Me?l.data!=="nested"&&(l.scrollTrigger&&l.scrollTrigger.revert(),l.kill()):!(l instanceof re)&&l.revert&&l.revert(s);n._r.forEach(function(c){return c(s,n)}),n.isReverted=!0}():this.data.forEach(function(h){return h.kill&&h.kill()}),this.clear(),i)for(var o=Fr.length;o--;)Fr[o].id===this.id&&Fr.splice(o,1)},t.revert=function(s){this.kill(s||{})},r}(),JA=function(){function r(e){this.contexts=[],this.scope=e,Dt&&Dt.data.push(this)}var t=r.prototype;return t.add=function(s,i,n){Qs(s)||(s={matches:s});var o=new Hg(0,n||this.scope),h=o.conditions={},a,l,c;Dt&&!o.selector&&(o.selector=Dt.selector),this.contexts.push(o),i=o.add("onMatch",i),o.queries=s;for(l in s)l==="all"?c=1:(a=Js.matchMedia(s[l]),a&&(Fr.indexOf(o)<0&&Fr.push(o),(h[l]=a.matches)&&(c=1),a.addListener?a.addListener(Zc):a.addEventListener("change",Zc)));return c&&i(o,function(d){return o.add(null,d)}),this},t.revert=function(s){this.kill(s||{})},t.kill=function(s){this.contexts.forEach(function(i){return i.kill(s,!0)})},r}(),ch={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];e.forEach(function(i){return Ig(i)})},timeline:function(t){return new Me(t)},getTweensOf:function(t,e){return Vt.getTweensOf(t,e)},getProperty:function(t,e,s,i){me(t)&&(t=ds(t)[0]);var n=Cr(t||{}).get,o=s?ug:cg;return s==="native"&&(s=""),t&&(e?o((Qe[e]&&Qe[e].get||n)(t,e,s,i)):function(h,a,l){return o((Qe[h]&&Qe[h].get||n)(t,h,a,l))})},quickSetter:function(t,e,s){if(t=ds(t),t.length>1){var i=t.map(function(c){return Ge.quickSetter(c,e,s)}),n=i.length;return function(c){for(var d=n;d--;)i[d](c)}}t=t[0]||{};var o=Qe[e],h=Cr(t),a=h.harness&&(h.harness.aliases||{})[e]||e,l=o?function(c){var d=new o;bn._pt=0,d.init(t,s?c+s:c,bn,0,[t]),d.render(1,d),bn._pt&&qc(1,bn)}:h.set(t,a);return o?l:function(c){return l(t,a,s?c+s:c,h,1)}},quickTo:function(t,e,s){var i,n=Ge.to(t,Ir((i={},i[e]="+=0.1",i.paused=!0,i),s||{})),o=function(a,l,c){return n.resetTo(e,a,l,c)};return o.tween=n,o},isTweening:function(t){return Vt.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=Rr(t.ease,gn.ease)),dg(gn,t||{})},config:function(t){return dg(Ke,t||{})},registerEffect:function(t){var e=t.name,s=t.effect,i=t.plugins,n=t.defaults,o=t.extendTimeline;(i||"").split(",").forEach(function(h){return h&&!Qe[h]&&!Ze[h]&&ca(e+" effect requires "+h+" plugin.")}),kc[e]=function(h,a,l){return s(ds(h),cs(a||{},n),l)},o&&(Me.prototype[e]=function(h,a,l){return this.add(kc[e](h,Qs(a)?a:(l=a)&&{},this),l)})},registerEase:function(t,e){ut[t]=Rr(e)},parseEase:function(t,e){return arguments.length?Rr(t,e):ut},getById:function(t){return Vt.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var s=new Me(t),i,n;for(s.smoothChildTiming=Ue(t.smoothChildTiming),Vt.remove(s),s._dp=0,s._time=s._tTime=Vt._time,i=Vt._first;i;)n=i._next,(e||!(!i._dur&&i instanceof re&&i.vars.onComplete===i._targets[0]))&&ti(s,i,i._start-i._delay),i=n;return ti(Vt,s,0),s},context:function(t,e){return t?new Hg(t,e):Dt},matchMedia:function(t){return new JA(t)},matchMediaRefresh:function(){return Fr.forEach(function(t){var e=t.conditions,s,i;for(i in e)e[i]&&(e[i]=!1,s=1);s&&t.revert()})||Zc()},addEventListener:function(t,e){var s=lh[t]||(lh[t]=[]);~s.indexOf(e)||s.push(e)},removeEventListener:function(t,e){var s=lh[t],i=s&&s.indexOf(e);i>=0&&s.splice(i,1)},utils:{wrap:MA,wrapYoyo:FA,distribute:bg,random:Eg,snap:wg,normalize:RA,getUnit:Ce,clamp:SA,splitColor:Pg,toArray:ds,selector:Uc,mapRange:Ag,pipe:IA,unitize:PA,interpolate:kA,shuffle:vg},install:rg,effects:kc,ticker:ts,updateRoot:Me.updateRoot,plugins:Qe,globalTimeline:Vt,core:{PropTween:Xe,globals:ng,Tween:re,Timeline:Me,Animation:ya,getCache:Cr,_removeLinkedListItem:nh,reverting:function(){return Ae},context:function(t){return t&&Dt&&(Dt.data.push(t),t._ctx=Dt),Dt},suppressOverwrites:function(t){return wc=t}}};Ve("to,from,fromTo,delayedCall,set,killTweensOf",function(r){return ch[r]=re[r]}),ts.add(Me.updateRoot),bn=ch.to({},{duration:0});var tS=function(t,e){for(var s=t._pt;s&&s.p!==e&&s.op!==e&&s.fp!==e;)s=s._next;return s},eS=function(t,e){var s=t._targets,i,n,o;for(i in e)for(n=s.length;n--;)o=t._ptLookup[n][i],o&&(o=o.d)&&(o._pt&&(o=tS(o,i)),o&&o.modifier&&o.modifier(e[i],t,s[n],i))},Qc=function(t,e){return{name:t,rawVars:1,init:function(i,n,o){o._onInit=function(h){var a,l;if(me(n)&&(a={},Ve(n,function(c){return a[c]=1}),n=a),e){a={};for(l in n)a[l]=e(n[l]);n=a}eS(h,n)}}}},Ge=ch.registerPlugin({name:"attr",init:function(t,e,s,i,n){var o,h,a;this.tween=s;for(o in e)a=t.getAttribute(o)||"",h=this.add(t,"setAttribute",(a||0)+"",e[o],i,n,0,0,o),h.op=o,h.b=a,this._props.push(o)},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",Vc),Qc("modifiers"),Qc("snap",wg))||ch;re.version=Me.version=Ge.version="3.12.5",ig=1,Ac()&&wn(),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,13 +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 Pm,ns,br,Jl,Os,Rm,tc,yw=function(){return typeof window<"u"},Oi={},Fs=180/Math.PI,Tr=Math.PI/180,wr=Math.atan2,Im=1e8,ec=/([A-Z])/g,xw=/(left|right|width|margin|padding|x)/i,vw=/[\s,\(]\S/,pi={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},ic=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},bw=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)},Tw=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)},ww=function(t,e){var i=e.s+e.c*t;e.set(e.t,e.p,~~(i+(i<0?-.5:.5))+e.u,e)},Mm=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},Dm=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},Ew=function(t,e,i){return t.style[e]=i},Aw=function(t,e,i){return t.style.setProperty(e,i)},Sw=function(t,e,i){return t._gsap[e]=i},Cw=function(t,e,i){return t._gsap.scaleX=t._gsap.scaleY=i},Pw=function(t,e,i,r,n){var a=t._gsap;a.scaleX=a.scaleY=i,a.renderTransform(n,a)},Rw=function(t,e,i,r,n){var a=t._gsap;a[e]=i,a.renderTransform(n,a)},Pt="transform",fe=Pt+"Origin",Iw=function s(t,e){var i=this,r=this.target,n=r.style,a=r._gsap;if(t in Oi&&n){if(this.tfm=this.tfm||{},t!=="transform")t=pi[t]||t,~t.indexOf(",")?t.split(",").forEach(function(o){return i.tfm[o]=Fi(r,o)}):this.tfm[t]=a.x?a[t]:Fi(r,t),t===fe&&(this.tfm.zOrigin=a.zOrigin);else return pi.transform.split(",").forEach(function(o){return s.call(i,o,e)});if(this.props.indexOf(Pt)>=0)return;a.svg&&(this.svgo=r.getAttribute("data-svg-origin"),this.props.push(fe,e,"")),t=Pt}(n||e)&&this.props.push(t,e,n[t])},Bm=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},Mw=function(){var t=this.props,e=this.target,i=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]?i[t[n]]=t[n+2]:i.removeProperty(t[n].substr(0,2)==="--"?t[n]:t[n].replace(ec,"-$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=tc(),(!n||!n.isStart)&&!i[Pt]&&(Bm(i),r.zOrigin&&i[fe]&&(i[fe]+=" "+r.zOrigin+"px",r.zOrigin=0,r.renderTransform()),r.uncache=1)}},Om=function(t,e){var i={target:t,props:[],revert:Mw,save:Iw};return t._gsap||de.core.getCache(t),e&&e.split(",").forEach(function(r){return i.save(r)}),i},Fm,sc=function(t,e){var i=ns.createElementNS?ns.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):ns.createElement(t);return i&&i.style?i:ns.createElement(t)},mi=function s(t,e,i){var r=getComputedStyle(t);return r[e]||r.getPropertyValue(e.replace(ec,"-$1").toLowerCase())||r.getPropertyValue(e)||!i&&s(t,Er(e)||e,1)||""},Lm="O,Moz,ms,Ms,Webkit".split(","),Er=function(t,e,i){var r=e||Os,n=r.style,a=5;if(t in n&&!i)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);a--&&!(Lm[a]+t in n););return a<0?null:(a===3?"ms":a>=0?Lm[a]:"")+t},rc=function(){yw()&&window.document&&(Pm=window,ns=Pm.document,br=ns.documentElement,Os=sc("div")||{style:{}},sc("div"),Pt=Er(Pt),fe=Pt+"Origin",Os.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",Fm=!!Er("perspective"),tc=de.core.reverting,Jl=1)},nc=function s(t){var e=sc("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=this.parentNode,r=this.nextSibling,n=this.style.cssText,a;if(br.appendChild(e),e.appendChild(this),this.style.display="block",t)try{a=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=s}catch{}else this._gsapBBox&&(a=this._gsapBBox());return i&&(r?i.insertBefore(this,r):i.appendChild(this)),br.removeChild(e),this.style.cssText=n,a},km=function(t,e){for(var i=e.length;i--;)if(t.hasAttribute(e[i]))return t.getAttribute(e[i])},Nm=function(t){var e;try{e=t.getBBox()}catch{e=nc.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===nc||(e=nc.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+km(t,["x","cx","x1"])||0,y:+km(t,["y","cy","y1"])||0,width:0,height:0}:e},Um=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&Nm(t))},Ls=function(t,e){if(e){var i=t.style,r;e in Oi&&e!==fe&&(e=Pt),i.removeProperty?(r=e.substr(0,2),(r==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),i.removeProperty(r==="--"?e:e.replace(ec,"-$1").toLowerCase())):i.removeAttribute(e)}},as=function(t,e,i,r,n,a){var o=new ue(t._pt,e,i,0,1,a?Dm:Mm);return t._pt=o,o.b=r,o.e=n,t._props.push(i),o},Gm={deg:1,rad:1,turn:1},Dw={grid:1,flex:1},os=function s(t,e,i,r){var n=parseFloat(i)||0,a=(i+"").trim().substr((n+"").length)||"px",o=Os.style,h=xw.test(e),l=t.tagName.toLowerCase()==="svg",c=(l?"client":"offset")+(h?"Width":"Height"),d=100,u=r==="px",f=r==="%",p,m,_,y;if(r===a||!n||Gm[r]||Gm[a])return n;if(a!=="px"&&!u&&(n=s(t,e,i,"px")),y=t.getCTM&&Um(t),(f||a==="%")&&(Oi[e]||~e.indexOf("adius")))return p=y?t.getBBox()[h?"width":"height"]:t[c],Ut(f?n/p*d:n/100*p);if(o[h?"width":"height"]=d+(u?a:r),m=~e.indexOf("adius")||r==="em"&&t.appendChild&&!l?t:t.parentNode,y&&(m=(t.ownerSVGElement||{}).parentNode),(!m||m===ns||!m.appendChild)&&(m=ns.body),_=m._gsap,_&&f&&_.width&&h&&_.time===be.time&&!_.uncache)return Ut(n/_.width*d);if(f&&(e==="height"||e==="width")){var v=t.style[e];t.style[e]=d+r,p=t[c],v?t.style[e]=v:Ls(t,e)}else(f||a==="%")&&!Dw[mi(m,"display")]&&(o.position=mi(t,"position")),m===t&&(o.position="static"),m.appendChild(Os),p=Os[c],m.removeChild(Os),o.position="absolute";return h&&f&&(_=Ps(m),_.time=be.time,_.width=m[c]),Ut(u?p*n/d:p&&n?d/p*n:0)},Fi=function(t,e,i,r){var n;return Jl||rc(),e in pi&&e!=="transform"&&(e=pi[e],~e.indexOf(",")&&(e=e.split(",")[0])),Oi[e]&&e!=="transform"?(n=vn(t,r),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:oo(mi(t,fe))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||r||~(n+"").indexOf("calc("))&&(n=ao[e]&&ao[e](t,e,i)||mi(t,e)||Xp(t,e)||(e==="opacity"?1:0))),i&&!~(n+"").trim().indexOf(" ")?os(t,e,n,i)+i:n},Bw=function(t,e,i,r){if(!i||i==="none"){var n=Er(e,t,1),a=n&&mi(t,n,1);a&&a!==i?(e=n,i=a):e==="borderColor"&&(i=mi(t,"borderTopColor"))}var o=new ue(this._pt,t.style,e,0,1,Em),h=0,l=0,c,d,u,f,p,m,_,y,v,g,x,b;if(o.b=i,o.e=r,i+="",r+="",r==="auto"&&(m=t.style[e],t.style[e]=r,r=mi(t,e)||r,m?t.style[e]=m:Ls(t,e)),c=[i,r],pm(c),i=c[0],r=c[1],u=i.match(mr)||[],b=r.match(mr)||[],b.length){for(;d=mr.exec(r);)_=d[0],v=r.substring(h,d.index),p?p=(p+1)%5:(v.substr(-5)==="rgba("||v.substr(-5)==="hsla(")&&(p=1),_!==(m=u[l++]||"")&&(f=parseFloat(m)||0,x=m.substr((f+"").length),_.charAt(1)==="="&&(_=_r(f,_)+x),y=parseFloat(_),g=_.substr((y+"").length),h=mr.lastIndex-g.length,g||(g=g||ge.units[e]||x,h===r.length&&(r+=g,o.e+=g)),x!==g&&(f=os(t,e,m,g)||0),o._pt={_next:o._pt,p:v||l===1?v:",",s:f,c:y-f,m:p&&p<4||e==="zIndex"?Math.round:0});o.c=h<r.length?r.substring(h,r.length):""}else o.r=e==="display"&&r==="none"?Dm:Mm;return kp.test(r)&&(o.e=0),this._pt=o,o},Hm={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},Ow=function(t){var e=t.split(" "),i=e[0],r=e[1]||"50%";return(i==="top"||i==="bottom"||r==="left"||r==="right")&&(t=i,i=r,r=t),e[0]=Hm[i]||i,e[1]=Hm[r]||r,e.join(" ")},Fw=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var i=e.t,r=i.style,n=e.u,a=i._gsap,o,h,l;if(n==="all"||n===!0)r.cssText="",h=1;else for(n=n.split(","),l=n.length;--l>-1;)o=n[l],Oi[o]&&(h=1,o=o==="transformOrigin"?fe:Pt),Ls(i,o);h&&(Ls(i,Pt),a&&(a.svg&&i.removeAttribute("transform"),vn(i,1),a.uncache=1,Bm(r)))}},ao={clearProps:function(t,e,i,r,n){if(n.data!=="isFromStart"){var a=t._pt=new ue(t._pt,e,i,0,0,Fw);return a.u=r,a.pr=-10,a.tween=n,t._props.push(i),1}}},xn=[1,0,0,1,0,0],Vm={},Wm=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},Xm=function(t){var e=mi(t,Pt);return Wm(e)?xn:e.substr(7).match(Lp).map(Ut)},ac=function(t,e){var i=t._gsap||Ps(t),r=t.style,n=Xm(t),a,o,h,l;return i.svg&&t.getAttribute("transform")?(h=t.transform.baseVal.consolidate().matrix,n=[h.a,h.b,h.c,h.d,h.e,h.f],n.join(",")==="1,0,0,1,0,0"?xn:n):(n===xn&&!t.offsetParent&&t!==br&&!i.svg&&(h=r.display,r.display="block",a=t.parentNode,(!a||!t.offsetParent)&&(l=1,o=t.nextElementSibling,br.appendChild(t)),n=Xm(t),h?r.display=h:Ls(t,"display"),l&&(o?a.insertBefore(t,o):a?a.appendChild(t):br.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},oc=function(t,e,i,r,n,a){var o=t._gsap,h=n||ac(t,!0),l=o.xOrigin||0,c=o.yOrigin||0,d=o.xOffset||0,u=o.yOffset||0,f=h[0],p=h[1],m=h[2],_=h[3],y=h[4],v=h[5],g=e.split(" "),x=parseFloat(g[0])||0,b=parseFloat(g[1])||0,w,T,E,A;i?h!==xn&&(T=f*_-p*m)&&(E=x*(_/T)+b*(-m/T)+(m*v-_*y)/T,A=x*(-p/T)+b*(f/T)-(f*v-p*y)/T,x=E,b=A):(w=Nm(t),x=w.x+(~g[0].indexOf("%")?x/100*w.width:x),b=w.y+(~(g[1]||g[0]).indexOf("%")?b/100*w.height:b)),r||r!==!1&&o.smooth?(y=x-l,v=b-c,o.xOffset=d+(y*f+v*m)-y,o.yOffset=u+(y*p+v*_)-v):o.xOffset=o.yOffset=0,o.xOrigin=x,o.yOrigin=b,o.smooth=!!r,o.origin=e,o.originIsAbsolute=!!i,t.style[fe]="0px 0px",a&&(as(a,o,"xOrigin",l,x),as(a,o,"yOrigin",c,b),as(a,o,"xOffset",d,o.xOffset),as(a,o,"yOffset",u,o.yOffset)),t.setAttribute("data-svg-origin",x+" "+b)},vn=function(t,e){var i=t._gsap||new ym(t);if("x"in i&&!e&&!i.uncache)return i;var r=t.style,n=i.scaleX<0,a="px",o="deg",h=getComputedStyle(t),l=mi(t,fe)||"0",c,d,u,f,p,m,_,y,v,g,x,b,w,T,E,A,P,L,M,S,C,R,N,F,B,W,I,D,$,Y,U,rt;return c=d=u=m=_=y=v=g=x=0,f=p=1,i.svg=!!(t.getCTM&&Um(t)),h.translate&&((h.translate!=="none"||h.scale!=="none"||h.rotate!=="none")&&(r[Pt]=(h.translate!=="none"?"translate3d("+(h.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(h.rotate!=="none"?"rotate("+h.rotate+") ":"")+(h.scale!=="none"?"scale("+h.scale.split(" ").join(",")+") ":"")+(h[Pt]!=="none"?h[Pt]:"")),r.scale=r.rotate=r.translate="none"),T=ac(t,i.svg),i.svg&&(i.uncache?(B=t.getBBox(),l=i.xOrigin-B.x+"px "+(i.yOrigin-B.y)+"px",F=""):F=!e&&t.getAttribute("data-svg-origin"),oc(t,F||l,!!F||i.originIsAbsolute,i.smooth!==!1,T)),b=i.xOrigin||0,w=i.yOrigin||0,T!==xn&&(L=T[0],M=T[1],S=T[2],C=T[3],c=R=T[4],d=N=T[5],T.length===6?(f=Math.sqrt(L*L+M*M),p=Math.sqrt(C*C+S*S),m=L||M?wr(M,L)*Fs:0,v=S||C?wr(S,C)*Fs+m:0,v&&(p*=Math.abs(Math.cos(v*Tr))),i.svg&&(c-=b-(b*L+w*S),d-=w-(b*M+w*C))):(rt=T[6],Y=T[7],I=T[8],D=T[9],$=T[10],U=T[11],c=T[12],d=T[13],u=T[14],E=wr(rt,$),_=E*Fs,E&&(A=Math.cos(-E),P=Math.sin(-E),F=R*A+I*P,B=N*A+D*P,W=rt*A+$*P,I=R*-P+I*A,D=N*-P+D*A,$=rt*-P+$*A,U=Y*-P+U*A,R=F,N=B,rt=W),E=wr(-S,$),y=E*Fs,E&&(A=Math.cos(-E),P=Math.sin(-E),F=L*A-I*P,B=M*A-D*P,W=S*A-$*P,U=C*P+U*A,L=F,M=B,S=W),E=wr(M,L),m=E*Fs,E&&(A=Math.cos(E),P=Math.sin(E),F=L*A+M*P,B=R*A+N*P,M=M*A-L*P,N=N*A-R*P,L=F,R=B),_&&Math.abs(_)+Math.abs(m)>359.9&&(_=m=0,y=180-y),f=Ut(Math.sqrt(L*L+M*M+S*S)),p=Ut(Math.sqrt(N*N+rt*rt)),E=wr(R,N),v=Math.abs(E)>2e-4?E*Fs:0,x=U?1/(U<0?-U:U):0),i.svg&&(F=t.getAttribute("transform"),i.forceCSS=t.setAttribute("transform","")||!Wm(mi(t,Pt)),F&&t.setAttribute("transform",F))),Math.abs(v)>90&&Math.abs(v)<270&&(n?(f*=-1,v+=m<=0?180:-180,m+=m<=0?180:-180):(p*=-1,v+=v<=0?180:-180)),e=e||i.uncache,i.x=c-((i.xPercent=c&&(!e&&i.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-c)?-50:0)))?t.offsetWidth*i.xPercent/100:0)+a,i.y=d-((i.yPercent=d&&(!e&&i.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-d)?-50:0)))?t.offsetHeight*i.yPercent/100:0)+a,i.z=u+a,i.scaleX=Ut(f),i.scaleY=Ut(p),i.rotation=Ut(m)+o,i.rotationX=Ut(_)+o,i.rotationY=Ut(y)+o,i.skewX=v+o,i.skewY=g+o,i.transformPerspective=x+a,(i.zOrigin=parseFloat(l.split(" ")[2])||!e&&i.zOrigin||0)&&(r[fe]=oo(l)),i.xOffset=i.yOffset=0,i.force3D=ge.force3D,i.renderTransform=i.svg?kw:Fm?$m:Lw,i.uncache=0,i},oo=function(t){return(t=t.split(" "))[0]+" "+t[1]},hc=function(t,e,i){var r=ie(e);return Ut(parseFloat(e)+parseFloat(os(t,"x",i+"px",r)))+r},Lw=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,$m(t,e)},ks="0deg",bn="0px",Ns=") ",$m=function(t,e){var i=e||this,r=i.xPercent,n=i.yPercent,a=i.x,o=i.y,h=i.z,l=i.rotation,c=i.rotationY,d=i.rotationX,u=i.skewX,f=i.skewY,p=i.scaleX,m=i.scaleY,_=i.transformPerspective,y=i.force3D,v=i.target,g=i.zOrigin,x="",b=y==="auto"&&t&&t!==1||y===!0;if(g&&(d!==ks||c!==ks)){var w=parseFloat(c)*Tr,T=Math.sin(w),E=Math.cos(w),A;w=parseFloat(d)*Tr,A=Math.cos(w),a=hc(v,a,T*A*-g),o=hc(v,o,-Math.sin(w)*-g),h=hc(v,h,E*A*-g+g)}_!==bn&&(x+="perspective("+_+Ns),(r||n)&&(x+="translate("+r+"%, "+n+"%) "),(b||a!==bn||o!==bn||h!==bn)&&(x+=h!==bn||b?"translate3d("+a+", "+o+", "+h+") ":"translate("+a+", "+o+Ns),l!==ks&&(x+="rotate("+l+Ns),c!==ks&&(x+="rotateY("+c+Ns),d!==ks&&(x+="rotateX("+d+Ns),(u!==ks||f!==ks)&&(x+="skew("+u+", "+f+Ns),(p!==1||m!==1)&&(x+="scale("+p+", "+m+Ns),v.style[Pt]=x||"translate(0, 0)"},kw=function(t,e){var i=e||this,r=i.xPercent,n=i.yPercent,a=i.x,o=i.y,h=i.rotation,l=i.skewX,c=i.skewY,d=i.scaleX,u=i.scaleY,f=i.target,p=i.xOrigin,m=i.yOrigin,_=i.xOffset,y=i.yOffset,v=i.forceCSS,g=parseFloat(a),x=parseFloat(o),b,w,T,E,A;h=parseFloat(h),l=parseFloat(l),c=parseFloat(c),c&&(c=parseFloat(c),l+=c,h+=c),h||l?(h*=Tr,l*=Tr,b=Math.cos(h)*d,w=Math.sin(h)*d,T=Math.sin(h-l)*-u,E=Math.cos(h-l)*u,l&&(c*=Tr,A=Math.tan(l-c),A=Math.sqrt(1+A*A),T*=A,E*=A,c&&(A=Math.tan(c),A=Math.sqrt(1+A*A),b*=A,w*=A)),b=Ut(b),w=Ut(w),T=Ut(T),E=Ut(E)):(b=d,E=u,w=T=0),(g&&!~(a+"").indexOf("px")||x&&!~(o+"").indexOf("px"))&&(g=os(f,"x",a,"px"),x=os(f,"y",o,"px")),(p||m||_||y)&&(g=Ut(g+p-(p*b+m*T)+_),x=Ut(x+m-(p*w+m*E)+y)),(r||n)&&(A=f.getBBox(),g=Ut(g+r/100*A.width),x=Ut(x+n/100*A.height)),A="matrix("+b+","+w+","+T+","+E+","+g+","+x+")",f.setAttribute("transform",A),v&&(f.style[Pt]=A)},Nw=function(t,e,i,r,n){var a=360,o=jt(n),h=parseFloat(n)*(o&&~n.indexOf("rad")?Fs:1),l=h-r,c=r+l+"deg",d,u;return o&&(d=n.split("_")[1],d==="short"&&(l%=a,l!==l%(a/2)&&(l+=l<0?a:-a)),d==="cw"&&l<0?l=(l+a*Im)%a-~~(l/a)*a:d==="ccw"&&l>0&&(l=(l-a*Im)%a-~~(l/a)*a)),t._pt=u=new ue(t._pt,e,i,r,l,bw),u.e=c,u.u="deg",t._props.push(i),u},zm=function(t,e){for(var i in e)t[i]=e[i];return t},Uw=function(t,e,i){var r=zm({},i._gsap),n="perspective,force3D,transformOrigin,svgOrigin",a=i.style,o,h,l,c,d,u,f,p;r.svg?(l=i.getAttribute("transform"),i.setAttribute("transform",""),a[Pt]=e,o=vn(i,1),Ls(i,Pt),i.setAttribute("transform",l)):(l=getComputedStyle(i)[Pt],a[Pt]=e,o=vn(i,1),a[Pt]=l);for(h in Oi)l=r[h],c=o[h],l!==c&&n.indexOf(h)<0&&(f=ie(l),p=ie(c),d=f!==p?os(i,h,l,p):parseFloat(l),u=parseFloat(c),t._pt=new ue(t._pt,o,h,d,u-d,ic),t._pt.u=p||0,t._props.push(h));zm(o,r)};ce("padding,margin,Width,Radius",function(s,t){var e="Top",i="Right",r="Bottom",n="Left",a=(t<3?[e,i,r,n]:[e+n,e+i,r+i,r+n]).map(function(o){return t<2?s+o:"border"+o+s});ao[t>1?"border"+s:s]=function(o,h,l,c,d){var u,f;if(arguments.length<4)return u=a.map(function(p){return Fi(o,p,l)}),f=u.join(" "),f.split(u[0]).length===5?u[0]:f;u=(c+"").split(" "),f={},a.forEach(function(p,m){return f[p]=u[m]=u[m]||u[(m-1)/2|0]}),o.init(h,f,d)}});var Ym={name:"css",register:rc,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,i,r,n){var a=this._props,o=t.style,h=i.vars.startAt,l,c,d,u,f,p,m,_,y,v,g,x,b,w,T,E;Jl||rc(),this.styles=this.styles||Om(t),E=this.styles.props,this.tween=i;for(m in e)if(m!=="autoRound"&&(c=e[m],!(xe[m]&&xm(m,e,i,r,t,n)))){if(f=typeof c,p=ao[m],f==="function"&&(c=c.call(i,r,t,n),f=typeof c),f==="string"&&~c.indexOf("random(")&&(c=fn(c)),p)p(this,t,m,c,i)&&(T=1);else if(m.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(m)+"").trim(),c+="",ss.lastIndex=0,ss.test(l)||(_=ie(l),y=ie(c)),y?_!==y&&(l=os(t,m,l,y)+y):_&&(c+=_),this.add(o,"setProperty",l,c,r,n,0,0,m),a.push(m),E.push(m,0,o[m]);else if(f!=="undefined"){if(h&&m in h?(l=typeof h[m]=="function"?h[m].call(i,r,t,n):h[m],jt(l)&&~l.indexOf("random(")&&(l=fn(l)),ie(l+"")||l==="auto"||(l+=ge.units[m]||ie(Fi(t,m))||""),(l+"").charAt(1)==="="&&(l=Fi(t,m))):l=Fi(t,m),u=parseFloat(l),v=f==="string"&&c.charAt(1)==="="&&c.substr(0,2),v&&(c=c.substr(2)),d=parseFloat(c),m in pi&&(m==="autoAlpha"&&(u===1&&Fi(t,"visibility")==="hidden"&&d&&(u=0),E.push("visibility",0,o.visibility),as(this,o,"visibility",u?"inherit":"hidden",d?"inherit":"hidden",!d)),m!=="scale"&&m!=="transform"&&(m=pi[m],~m.indexOf(",")&&(m=m.split(",")[0]))),g=m in Oi,g){if(this.styles.save(m),x||(b=t._gsap,b.renderTransform&&!e.parseTransform||vn(t,e.parseTransform),w=e.smoothOrigin!==!1&&b.smooth,x=this._pt=new ue(this._pt,o,Pt,0,1,b.renderTransform,b,0,-1),x.dep=1),m==="scale")this._pt=new ue(this._pt,b,"scaleY",b.scaleY,(v?_r(b.scaleY,v+d):d)-b.scaleY||0,ic),this._pt.u=0,a.push("scaleY",m),m+="X";else if(m==="transformOrigin"){E.push(fe,0,o[fe]),c=Ow(c),b.svg?oc(t,c,0,w,0,this):(y=parseFloat(c.split(" ")[2])||0,y!==b.zOrigin&&as(this,b,"zOrigin",b.zOrigin,y),as(this,o,m,oo(l),oo(c)));continue}else if(m==="svgOrigin"){oc(t,c,1,w,0,this);continue}else if(m in Vm){Nw(this,b,m,u,v?_r(u,v+c):c);continue}else if(m==="smoothOrigin"){as(this,b,"smooth",b.smooth,c);continue}else if(m==="force3D"){b[m]=c;continue}else if(m==="transform"){Uw(this,c,t);continue}}else m in o||(m=Er(m)||m);if(g||(d||d===0)&&(u||u===0)&&!vw.test(c)&&m in o)_=(l+"").substr((u+"").length),d||(d=0),y=ie(c)||(m in ge.units?ge.units[m]:_),_!==y&&(u=os(t,m,l,y)),this._pt=new ue(this._pt,g?b:o,m,u,(v?_r(u,v+d):d)-u,!g&&(y==="px"||m==="zIndex")&&e.autoRound!==!1?ww:ic),this._pt.u=y||0,_!==y&&y!=="%"&&(this._pt.b=l,this._pt.r=Tw);else if(m in o)Bw.call(this,t,m,l,v?v+c:c);else if(m in t)this.add(t,m,l||t[m],v?v+c:c,r,n);else if(m!=="parseTransform"){Il(m,c);continue}g||(m in o?E.push(m,0,o[m]):E.push(m,1,l||t[m])),a.push(m)}}T&&Am(this)},render:function(t,e){if(e.tween._time||!tc())for(var i=e._pt;i;)i.r(t,i.d),i=i._next;else e.styles.revert()},get:Fi,aliases:pi,getSetter:function(t,e,i){var r=pi[e];return r&&r.indexOf(",")<0&&(e=r),e in Oi&&e!==fe&&(t._gsap.x||Fi(t,"x"))?i&&Rm===i?e==="scale"?Cw:Sw:(Rm=i||{})&&(e==="scale"?Pw:Rw):t.style&&!El(t.style[e])?Ew:~e.indexOf("-")?Aw:jl(t,e)},core:{_removeProperty:Ls,_getMatrix:ac}};de.utils.checkPrefix=Er,de.core.getStyleSaver=Om,function(s,t,e,i){var r=ce(s+","+t+","+e,function(n){Oi[n]=1});ce(t,function(n){ge.units[n]="deg",Vm[n]=1}),pi[r[13]]=s+","+t,ce(i,function(n){var a=n.split(":");pi[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"),ce("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(s){ge.units[s]="px"}),de.registerPlugin(Ym);var ct=de.registerPlugin(Ym)||de;ct.core.Tween;class lc extends li{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:i=0,width:r=0,height:n=0,bgColor:a="#fff",alpha:o=1,radius:h=0,borderWidth:l=0,borderColor:c="black",enableTint:d=!0}=t;this.x=e,this.y=i,this.bgAlpha=o,this.radius=h,this.enableTint=d,this.bgColor=a,this.borderWidth=l,this.borderColor=c,this.renderBg(r,n)}updateColor(t){ct.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 Tn extends bt{constructor(t,e,i,r){if(super(),r){const n=new li;n.beginFill(16777215),n.drawRect(0,0,t,e),n.endFill(),this.addChild(n),this.mask=n}i?(this._bgColorFill=new lc({width:t,height:e,bgColor:i}),this.addChild(this._bgColorFill)):(this._fill=new _e,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 Wg,Ki,En,Jc,kr,zg,tu,sS=function(){return typeof window<"u"},wi={},Br=180/Math.PI,Tn=Math.PI/180,An=Math.atan2,jg=1e8,eu=/([A-Z])/g,iS=/(left|right|width|margin|padding|x)/i,rS=/[\s,\(]\S/,ei={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)},nS=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)},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)},qg=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},lS=function(t,e,s){return t.style.setProperty(e,s)},cS=function(t,e,s){return t._gsap[e]=s},uS=function(t,e,s){return t._gsap.scaleX=t._gsap.scaleY=s},dS=function(t,e,s,i,n){var o=t._gsap;o.scaleX=o.scaleY=s,o.renderTransform(n,o)},fS=function(t,e,s,i,n){var o=t._gsap;o[e]=s,o.renderTransform(n,o)},Xt="transform",$e=Xt+"Origin",pS=function r(t,e){var s=this,i=this.target,n=i.style,o=i._gsap;if(t in wi&&n){if(this.tfm=this.tfm||{},t!=="transform")t=ei[t]||t,~t.indexOf(",")?t.split(",").forEach(function(h){return s.tfm[h]=Ei(i,h)}):this.tfm[t]=o.x?o[t]:Ei(i,t),t===$e&&(this.tfm.zOrigin=o.zOrigin);else return ei.transform.split(",").forEach(function(h){return r.call(s,h,e)});if(this.props.indexOf(Xt)>=0)return;o.svg&&(this.svgo=i.getAttribute("data-svg-origin"),this.props.push($e,e,"")),t=Xt}(n||e)&&this.props.push(t,e,n[t])},Zg=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},mS=function(){var t=this.props,e=this.target,s=e.style,i=e._gsap,n,o;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(o in this.tfm)i[o]=this.tfm[o];i.svg&&(i.renderTransform(),e.setAttribute("data-svg-origin",this.svgo||"")),n=tu(),(!n||!n.isStart)&&!s[Xt]&&(Zg(s),i.zOrigin&&s[$e]&&(s[$e]+=" "+i.zOrigin+"px",i.zOrigin=0,i.renderTransform()),i.uncache=1)}},Qg=function(t,e){var s={target:t,props:[],revert:mS,save:pS};return t._gsap||Ge.core.getCache(t),e&&e.split(",").forEach(function(i){return s.save(i)}),s},Jg,iu=function(t,e){var s=Ki.createElementNS?Ki.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Ki.createElement(t);return s&&s.style?s:Ki.createElement(t)},si=function r(t,e,s){var i=getComputedStyle(t);return i[e]||i.getPropertyValue(e.replace(eu,"-$1").toLowerCase())||i.getPropertyValue(e)||!s&&r(t,Sn(e)||e,1)||""},t0="O,Moz,ms,Ms,Webkit".split(","),Sn=function(t,e,s){var i=e||kr,n=i.style,o=5;if(t in n&&!s)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);o--&&!(t0[o]+t in n););return o<0?null:(o===3?"ms":o>=0?t0[o]:"")+t},ru=function(){sS()&&window.document&&(Wg=window,Ki=Wg.document,En=Ki.documentElement,kr=iu("div")||{style:{}},iu("div"),Xt=Sn(Xt),$e=Xt+"Origin",kr.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",Jg=!!Sn("perspective"),tu=Ge.core.reverting,Jc=1)},nu=function r(t){var e=iu("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),s=this.parentNode,i=this.nextSibling,n=this.style.cssText,o;if(En.appendChild(e),e.appendChild(this),this.style.display="block",t)try{o=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=r}catch{}else this._gsapBBox&&(o=this._gsapBBox());return s&&(i?s.insertBefore(this,i):s.appendChild(this)),En.removeChild(e),this.style.cssText=n,o},e0=function(t,e){for(var s=e.length;s--;)if(t.hasAttribute(e[s]))return t.getAttribute(e[s])},s0=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:+e0(t,["x","cx","x1"])||0,y:+e0(t,["y","cy","y1"])||0,width:0,height:0}:e},i0=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&s0(t))},Dr=function(t,e){if(e){var s=t.style,i;e in wi&&e!==$e&&(e=Xt),s.removeProperty?(i=e.substr(0,2),(i==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),s.removeProperty(i==="--"?e:e.replace(eu,"-$1").toLowerCase())):s.removeAttribute(e)}},Zi=function(t,e,s,i,n,o){var h=new Xe(t._pt,e,s,0,1,o?Kg:qg);return t._pt=h,h.b=i,h.e=n,t._props.push(s),h},r0={deg:1,rad:1,turn:1},gS={grid:1,flex:1},Qi=function r(t,e,s,i){var n=parseFloat(s)||0,o=(s+"").trim().substr((n+"").length)||"px",h=kr.style,a=iS.test(e),l=t.tagName.toLowerCase()==="svg",c=(l?"client":"offset")+(a?"Width":"Height"),d=100,u=i==="px",f=i==="%",p,m,g,y;if(i===o||!n||r0[i]||r0[o])return n;if(o!=="px"&&!u&&(n=r(t,e,s,"px")),y=t.getCTM&&i0(t),(f||o==="%")&&(wi[e]||~e.indexOf("adius")))return p=y?t.getBBox()[a?"width":"height"]:t[c],te(f?n/p*d:n/100*p);if(h[a?"width":"height"]=d+(u?o:i),m=~e.indexOf("adius")||i==="em"&&t.appendChild&&!l?t:t.parentNode,y&&(m=(t.ownerSVGElement||{}).parentNode),(!m||m===Ki||!m.appendChild)&&(m=Ki.body),g=m._gsap,g&&f&&g.width&&a&&g.time===ts.time&&!g.uncache)return te(n/g.width*d);if(f&&(e==="height"||e==="width")){var x=t.style[e];t.style[e]=d+i,p=t[c],x?t.style[e]=x:Dr(t,e)}else(f||o==="%")&&!gS[si(m,"display")]&&(h.position=si(t,"position")),m===t&&(h.position="static"),m.appendChild(kr),p=kr[c],m.removeChild(kr),h.position="absolute";return a&&f&&(g=Cr(m),g.time=ts.time,g.width=m[c]),te(u?p*n/d:p&&n?d/p*n:0)},Ei=function(t,e,s,i){var n;return Jc||ru(),e in ei&&e!=="transform"&&(e=ei[e],~e.indexOf(",")&&(e=e.split(",")[0])),wi[e]&&e!=="transform"?(n=wa(t,i),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:dh(si(t,$e))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||i||~(n+"").indexOf("calc("))&&(n=uh[e]&&uh[e](t,e,s)||si(t,e)||hg(t,e)||(e==="opacity"?1:0))),s&&!~(n+"").trim().indexOf(" ")?Qi(t,e,n,s)+s:n},_S=function(t,e,s,i){if(!s||s==="none"){var n=Sn(e,t,1),o=n&&si(t,n,1);o&&o!==s?(e=n,s=o):e==="borderColor"&&(s=si(t,"borderTopColor"))}var h=new Xe(this._pt,t.style,e,0,1,Gg),a=0,l=0,c,d,u,f,p,m,g,y,x,_,v,b;if(h.b=s,h.e=i,s+="",i+="",i==="auto"&&(m=t.style[e],t.style[e]=i,i=si(t,e)||i,m?t.style[e]=m:Dr(t,e)),c=[s,i],Fg(c),s=c[0],i=c[1],u=s.match(_n)||[],b=i.match(_n)||[],b.length){for(;d=_n.exec(i);)g=d[0],x=i.substring(a,d.index),p?p=(p+1)%5:(x.substr(-5)==="rgba("||x.substr(-5)==="hsla(")&&(p=1),g!==(m=u[l++]||"")&&(f=parseFloat(m)||0,v=m.substr((f+"").length),g.charAt(1)==="="&&(g=xn(f,g)+v),y=parseFloat(g),_=g.substr((y+"").length),a=_n.lastIndex-_.length,_||(_=_||Ke.units[e]||v,a===i.length&&(i+=_,h.e+=_)),v!==_&&(f=Qi(t,e,m,_)||0),h._pt={_next:h._pt,p:x||l===1?x:",",s:f,c:y-f,m:p&&p<4||e==="zIndex"?Math.round:0});h.c=a<i.length?i.substring(a,i.length):""}else h.r=e==="display"&&i==="none"?Kg:qg;return eg.test(i)&&(h.e=0),this._pt=h,h},n0={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},xS=function(t){var e=t.split(" "),s=e[0],i=e[1]||"50%";return(s==="top"||s==="bottom"||i==="left"||i==="right")&&(t=s,s=i,i=t),e[0]=n0[s]||s,e[1]=n0[i]||i,e.join(" ")},yS=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var s=e.t,i=s.style,n=e.u,o=s._gsap,h,a,l;if(n==="all"||n===!0)i.cssText="",a=1;else for(n=n.split(","),l=n.length;--l>-1;)h=n[l],wi[h]&&(a=1,h=h==="transformOrigin"?$e:Xt),Dr(s,h);a&&(Dr(s,Xt),o&&(o.svg&&s.removeAttribute("transform"),wa(s,1),o.uncache=1,Zg(i)))}},uh={clearProps:function(t,e,s,i,n){if(n.data!=="isFromStart"){var o=t._pt=new Xe(t._pt,e,s,0,0,yS);return o.u=i,o.pr=-10,o.tween=n,t._props.push(s),1}}},ba=[1,0,0,1,0,0],a0={},o0=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},h0=function(t){var e=si(t,Xt);return o0(e)?ba:e.substr(7).match(tg).map(te)},au=function(t,e){var s=t._gsap||Cr(t),i=t.style,n=h0(t),o,h,a,l;return s.svg&&t.getAttribute("transform")?(a=t.transform.baseVal.consolidate().matrix,n=[a.a,a.b,a.c,a.d,a.e,a.f],n.join(",")==="1,0,0,1,0,0"?ba:n):(n===ba&&!t.offsetParent&&t!==En&&!s.svg&&(a=i.display,i.display="block",o=t.parentNode,(!o||!t.offsetParent)&&(l=1,h=t.nextElementSibling,En.appendChild(t)),n=h0(t),a?i.display=a:Dr(t,"display"),l&&(h?o.insertBefore(t,h):o?o.appendChild(t):En.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},ou=function(t,e,s,i,n,o){var h=t._gsap,a=n||au(t,!0),l=h.xOrigin||0,c=h.yOrigin||0,d=h.xOffset||0,u=h.yOffset||0,f=a[0],p=a[1],m=a[2],g=a[3],y=a[4],x=a[5],_=e.split(" "),v=parseFloat(_[0])||0,b=parseFloat(_[1])||0,w,E,T,A;s?a!==ba&&(E=f*g-p*m)&&(T=v*(g/E)+b*(-m/E)+(m*x-g*y)/E,A=v*(-p/E)+b*(f/E)-(f*x-p*y)/E,v=T,b=A):(w=s0(t),v=w.x+(~_[0].indexOf("%")?v/100*w.width:v),b=w.y+(~(_[1]||_[0]).indexOf("%")?b/100*w.height:b)),i||i!==!1&&h.smooth?(y=v-l,x=b-c,h.xOffset=d+(y*f+x*m)-y,h.yOffset=u+(y*p+x*g)-x):h.xOffset=h.yOffset=0,h.xOrigin=v,h.yOrigin=b,h.smooth=!!i,h.origin=e,h.originIsAbsolute=!!s,t.style[$e]="0px 0px",o&&(Zi(o,h,"xOrigin",l,v),Zi(o,h,"yOrigin",c,b),Zi(o,h,"xOffset",d,h.xOffset),Zi(o,h,"yOffset",u,h.yOffset)),t.setAttribute("data-svg-origin",v+" "+b)},wa=function(t,e){var s=t._gsap||new Og(t);if("x"in s&&!e&&!s.uncache)return s;var i=t.style,n=s.scaleX<0,o="px",h="deg",a=getComputedStyle(t),l=si(t,$e)||"0",c,d,u,f,p,m,g,y,x,_,v,b,w,E,T,A,I,M,R,C,P,k,V,U,L,$,O,N,K,Q,H,ht;return c=d=u=m=g=y=x=_=v=0,f=p=1,s.svg=!!(t.getCTM&&i0(t)),a.translate&&((a.translate!=="none"||a.scale!=="none"||a.rotate!=="none")&&(i[Xt]=(a.translate!=="none"?"translate3d("+(a.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(a.rotate!=="none"?"rotate("+a.rotate+") ":"")+(a.scale!=="none"?"scale("+a.scale.split(" ").join(",")+") ":"")+(a[Xt]!=="none"?a[Xt]:"")),i.scale=i.rotate=i.translate="none"),E=au(t,s.svg),s.svg&&(s.uncache?(L=t.getBBox(),l=s.xOrigin-L.x+"px "+(s.yOrigin-L.y)+"px",U=""):U=!e&&t.getAttribute("data-svg-origin"),ou(t,U||l,!!U||s.originIsAbsolute,s.smooth!==!1,E)),b=s.xOrigin||0,w=s.yOrigin||0,E!==ba&&(M=E[0],R=E[1],C=E[2],P=E[3],c=k=E[4],d=V=E[5],E.length===6?(f=Math.sqrt(M*M+R*R),p=Math.sqrt(P*P+C*C),m=M||R?An(R,M)*Br:0,x=C||P?An(C,P)*Br+m:0,x&&(p*=Math.abs(Math.cos(x*Tn))),s.svg&&(c-=b-(b*M+w*C),d-=w-(b*R+w*P))):(ht=E[6],Q=E[7],O=E[8],N=E[9],K=E[10],H=E[11],c=E[12],d=E[13],u=E[14],T=An(ht,K),g=T*Br,T&&(A=Math.cos(-T),I=Math.sin(-T),U=k*A+O*I,L=V*A+N*I,$=ht*A+K*I,O=k*-I+O*A,N=V*-I+N*A,K=ht*-I+K*A,H=Q*-I+H*A,k=U,V=L,ht=$),T=An(-C,K),y=T*Br,T&&(A=Math.cos(-T),I=Math.sin(-T),U=M*A-O*I,L=R*A-N*I,$=C*A-K*I,H=P*I+H*A,M=U,R=L,C=$),T=An(R,M),m=T*Br,T&&(A=Math.cos(T),I=Math.sin(T),U=M*A+R*I,L=k*A+V*I,R=R*A-M*I,V=V*A-k*I,M=U,k=L),g&&Math.abs(g)+Math.abs(m)>359.9&&(g=m=0,y=180-y),f=te(Math.sqrt(M*M+R*R+C*C)),p=te(Math.sqrt(V*V+ht*ht)),T=An(k,V),x=Math.abs(T)>2e-4?T*Br:0,v=H?1/(H<0?-H:H):0),s.svg&&(U=t.getAttribute("transform"),s.forceCSS=t.setAttribute("transform","")||!o0(si(t,Xt)),U&&t.setAttribute("transform",U))),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=c-((s.xPercent=c&&(!e&&s.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-c)?-50:0)))?t.offsetWidth*s.xPercent/100:0)+o,s.y=d-((s.yPercent=d&&(!e&&s.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-d)?-50:0)))?t.offsetHeight*s.yPercent/100:0)+o,s.z=u+o,s.scaleX=te(f),s.scaleY=te(p),s.rotation=te(m)+h,s.rotationX=te(g)+h,s.rotationY=te(y)+h,s.skewX=x+h,s.skewY=_+h,s.transformPerspective=v+o,(s.zOrigin=parseFloat(l.split(" ")[2])||!e&&s.zOrigin||0)&&(i[$e]=dh(l)),s.xOffset=s.yOffset=0,s.force3D=Ke.force3D,s.renderTransform=s.svg?bS:Jg?l0:vS,s.uncache=0,s},dh=function(t){return(t=t.split(" "))[0]+" "+t[1]},hu=function(t,e,s){var i=Ce(e);return te(parseFloat(e)+parseFloat(Qi(t,"x",s+"px",i)))+i},vS=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,l0(t,e)},Or="0deg",Ea="0px",Lr=") ",l0=function(t,e){var s=e||this,i=s.xPercent,n=s.yPercent,o=s.x,h=s.y,a=s.z,l=s.rotation,c=s.rotationY,d=s.rotationX,u=s.skewX,f=s.skewY,p=s.scaleX,m=s.scaleY,g=s.transformPerspective,y=s.force3D,x=s.target,_=s.zOrigin,v="",b=y==="auto"&&t&&t!==1||y===!0;if(_&&(d!==Or||c!==Or)){var w=parseFloat(c)*Tn,E=Math.sin(w),T=Math.cos(w),A;w=parseFloat(d)*Tn,A=Math.cos(w),o=hu(x,o,E*A*-_),h=hu(x,h,-Math.sin(w)*-_),a=hu(x,a,T*A*-_+_)}g!==Ea&&(v+="perspective("+g+Lr),(i||n)&&(v+="translate("+i+"%, "+n+"%) "),(b||o!==Ea||h!==Ea||a!==Ea)&&(v+=a!==Ea||b?"translate3d("+o+", "+h+", "+a+") ":"translate("+o+", "+h+Lr),l!==Or&&(v+="rotate("+l+Lr),c!==Or&&(v+="rotateY("+c+Lr),d!==Or&&(v+="rotateX("+d+Lr),(u!==Or||f!==Or)&&(v+="skew("+u+", "+f+Lr),(p!==1||m!==1)&&(v+="scale("+p+", "+m+Lr),x.style[Xt]=v||"translate(0, 0)"},bS=function(t,e){var s=e||this,i=s.xPercent,n=s.yPercent,o=s.x,h=s.y,a=s.rotation,l=s.skewX,c=s.skewY,d=s.scaleX,u=s.scaleY,f=s.target,p=s.xOrigin,m=s.yOrigin,g=s.xOffset,y=s.yOffset,x=s.forceCSS,_=parseFloat(o),v=parseFloat(h),b,w,E,T,A;a=parseFloat(a),l=parseFloat(l),c=parseFloat(c),c&&(c=parseFloat(c),l+=c,a+=c),a||l?(a*=Tn,l*=Tn,b=Math.cos(a)*d,w=Math.sin(a)*d,E=Math.sin(a-l)*-u,T=Math.cos(a-l)*u,l&&(c*=Tn,A=Math.tan(l-c),A=Math.sqrt(1+A*A),E*=A,T*=A,c&&(A=Math.tan(c),A=Math.sqrt(1+A*A),b*=A,w*=A)),b=te(b),w=te(w),E=te(E),T=te(T)):(b=d,T=u,w=E=0),(_&&!~(o+"").indexOf("px")||v&&!~(h+"").indexOf("px"))&&(_=Qi(f,"x",o,"px"),v=Qi(f,"y",h,"px")),(p||m||g||y)&&(_=te(_+p-(p*b+m*E)+g),v=te(v+m-(p*w+m*T)+y)),(i||n)&&(A=f.getBBox(),_=te(_+i/100*A.width),v=te(v+n/100*A.height)),A="matrix("+b+","+w+","+E+","+T+","+_+","+v+")",f.setAttribute("transform",A),x&&(f.style[Xt]=A)},wS=function(t,e,s,i,n){var o=360,h=me(n),a=parseFloat(n)*(h&&~n.indexOf("rad")?Br:1),l=a-i,c=i+l+"deg",d,u;return h&&(d=n.split("_")[1],d==="short"&&(l%=o,l!==l%(o/2)&&(l+=l<0?o:-o)),d==="cw"&&l<0?l=(l+o*jg)%o-~~(l/o)*o:d==="ccw"&&l>0&&(l=(l-o*jg)%o-~~(l/o)*o)),t._pt=u=new Xe(t._pt,e,s,i,l,nS),u.e=c,u.u="deg",t._props.push(s),u},c0=function(t,e){for(var s in e)t[s]=e[s];return t},ES=function(t,e,s){var i=c0({},s._gsap),n="perspective,force3D,transformOrigin,svgOrigin",o=s.style,h,a,l,c,d,u,f,p;i.svg?(l=s.getAttribute("transform"),s.setAttribute("transform",""),o[Xt]=e,h=wa(s,1),Dr(s,Xt),s.setAttribute("transform",l)):(l=getComputedStyle(s)[Xt],o[Xt]=e,h=wa(s,1),o[Xt]=l);for(a in wi)l=i[a],c=h[a],l!==c&&n.indexOf(a)<0&&(f=Ce(l),p=Ce(c),d=f!==p?Qi(s,a,l,p):parseFloat(l),u=parseFloat(c),t._pt=new Xe(t._pt,h,a,d,u-d,su),t._pt.u=p||0,t._props.push(a));c0(h,i)};Ve("padding,margin,Width,Radius",function(r,t){var e="Top",s="Right",i="Bottom",n="Left",o=(t<3?[e,s,i,n]:[e+n,e+s,i+s,i+n]).map(function(h){return t<2?r+h:"border"+h+r});uh[t>1?"border"+r:r]=function(h,a,l,c,d){var u,f;if(arguments.length<4)return u=o.map(function(p){return Ei(h,p,l)}),f=u.join(" "),f.split(u[0]).length===5?u[0]:f;u=(c+"").split(" "),f={},o.forEach(function(p,m){return f[p]=u[m]=u[m]||u[(m-1)/2|0]}),h.init(a,f,d)}});var u0={name:"css",register:ru,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,s,i,n){var o=this._props,h=t.style,a=s.vars.startAt,l,c,d,u,f,p,m,g,y,x,_,v,b,w,E,T;Jc||ru(),this.styles=this.styles||Qg(t),T=this.styles.props,this.tween=s;for(m in e)if(m!=="autoRound"&&(c=e[m],!(Qe[m]&&Lg(m,e,s,i,t,n)))){if(f=typeof c,p=uh[m],f==="function"&&(c=c.call(s,i,t,n),f=typeof c),f==="string"&&~c.indexOf("random(")&&(c=ma(c)),p)p(this,t,m,c,s)&&(E=1);else if(m.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(m)+"").trim(),c+="",ji.lastIndex=0,ji.test(l)||(g=Ce(l),y=Ce(c)),y?g!==y&&(l=Qi(t,m,l,y)+y):g&&(c+=g),this.add(h,"setProperty",l,c,i,n,0,0,m),o.push(m),T.push(m,0,h[m]);else if(f!=="undefined"){if(a&&m in a?(l=typeof a[m]=="function"?a[m].call(s,i,t,n):a[m],me(l)&&~l.indexOf("random(")&&(l=ma(l)),Ce(l+"")||l==="auto"||(l+=Ke.units[m]||Ce(Ei(t,m))||""),(l+"").charAt(1)==="="&&(l=Ei(t,m))):l=Ei(t,m),u=parseFloat(l),x=f==="string"&&c.charAt(1)==="="&&c.substr(0,2),x&&(c=c.substr(2)),d=parseFloat(c),m in ei&&(m==="autoAlpha"&&(u===1&&Ei(t,"visibility")==="hidden"&&d&&(u=0),T.push("visibility",0,h.visibility),Zi(this,h,"visibility",u?"inherit":"hidden",d?"inherit":"hidden",!d)),m!=="scale"&&m!=="transform"&&(m=ei[m],~m.indexOf(",")&&(m=m.split(",")[0]))),_=m in wi,_){if(this.styles.save(m),v||(b=t._gsap,b.renderTransform&&!e.parseTransform||wa(t,e.parseTransform),w=e.smoothOrigin!==!1&&b.smooth,v=this._pt=new Xe(this._pt,h,Xt,0,1,b.renderTransform,b,0,-1),v.dep=1),m==="scale")this._pt=new Xe(this._pt,b,"scaleY",b.scaleY,(x?xn(b.scaleY,x+d):d)-b.scaleY||0,su),this._pt.u=0,o.push("scaleY",m),m+="X";else if(m==="transformOrigin"){T.push($e,0,h[$e]),c=xS(c),b.svg?ou(t,c,0,w,0,this):(y=parseFloat(c.split(" ")[2])||0,y!==b.zOrigin&&Zi(this,b,"zOrigin",b.zOrigin,y),Zi(this,h,m,dh(l),dh(c)));continue}else if(m==="svgOrigin"){ou(t,c,1,w,0,this);continue}else if(m in a0){wS(this,b,m,u,x?xn(u,x+c):c);continue}else if(m==="smoothOrigin"){Zi(this,b,"smooth",b.smooth,c);continue}else if(m==="force3D"){b[m]=c;continue}else if(m==="transform"){ES(this,c,t);continue}}else m in h||(m=Sn(m)||m);if(_||(d||d===0)&&(u||u===0)&&!rS.test(c)&&m in h)g=(l+"").substr((u+"").length),d||(d=0),y=Ce(c)||(m in Ke.units?Ke.units[m]:g),g!==y&&(u=Qi(t,m,l,y)),this._pt=new Xe(this._pt,_?b:h,m,u,(x?xn(u,x+d):d)-u,!_&&(y==="px"||m==="zIndex")&&e.autoRound!==!1?oS:su),this._pt.u=y||0,g!==y&&y!=="%"&&(this._pt.b=l,this._pt.r=aS);else if(m in h)_S.call(this,t,m,l,x?x+c:c);else if(m in t)this.add(t,m,l||t[m],x?x+c:c,i,n);else if(m!=="parseTransform"){Rc(m,c);continue}_||(m in h?T.push(m,0,h[m]):T.push(m,1,l||t[m])),o.push(m)}}E&&$g(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:Ei,aliases:ei,getSetter:function(t,e,s){var i=ei[e];return i&&i.indexOf(",")<0&&(e=i),e in wi&&e!==$e&&(t._gsap.x||Ei(t,"x"))?s&&zg===s?e==="scale"?uS:cS:(zg=s||{})&&(e==="scale"?dS:fS):t.style&&!Tc(t.style[e])?hS:~e.indexOf("-")?lS:jc(t,e)},core:{_removeProperty:Dr,_getMatrix:au}};Ge.utils.checkPrefix=Sn,Ge.core.getStyleSaver=Qg,function(r,t,e,s){var i=Ve(r+","+t+","+e,function(n){wi[n]=1});Ve(t,function(n){Ke.units[n]="deg",a0[n]=1}),ei[i[13]]=r+","+t,Ve(s,function(n){var o=n.split(":");ei[o[1]]=i[o[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"),Ve("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){Ke.units[r]="px"}),Ge.registerPlugin(u0);var bt=Ge.registerPlugin(u0)||Ge;bt.core.Tween;class lu extends Ks{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:i=0,height:n=0,bgColor:o="#fff",alpha:h=1,radius:a=0,borderWidth:l=0,borderColor:c="black",enableTint:d=!0}=t;this.x=e,this.y=s,this.bgAlpha=h,this.radius=a,this.enableTint=d,this.bgColor=o,this.borderWidth=l,this.borderColor=c,this.renderBg(i,n)}updateColor(t){bt.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 Ta extends Bt{constructor(t,e,s,i){if(super(),i){const n=new Ks;n.beginFill(16777215),n.drawRect(0,0,t,e),n.endFill(),this.addChild(n),this.mask=n}s?(this._bgColorFill=new lu({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 _i{constructor(t,e,i){this.value=t,this.time=e,this.next=null,this.isStepped=!1,i?this.ease=typeof i=="function"?i:Km(i):this.ease=null}static createList(t){if("list"in t){const i=t.list;let r;const{value:n,time:a}=i[0],o=r=new _i(typeof n=="string"?lo(n):n,a,t.ease);if(i.length>2||i.length===2&&i[1].value!==n)for(let h=1;h<i.length;++h){const{value:l,time:c}=i[h];r.next=new _i(typeof l=="string"?lo(l):l,c),r=r.next}return o.isStepped=!!t.isStepped,o}const e=new _i(typeof t.start=="string"?lo(t.start):t.start,0);return t.end!==t.start&&(e.next=new _i(typeof t.end=="string"?lo(t.end):t.end,1)),e}}let wn=X.from;const gi=Math.PI/180;function Li(s,t){if(!s)return;const e=Math.sin(s),i=Math.cos(s),r=t.x*i-t.y*e,n=t.x*e+t.y*i;t.x=r,t.y=n}function ho(s,t,e){return s<<16|t<<8|e}function jm(s){return Math.sqrt(s.x*s.x+s.y*s.y)}function Gw(s){const t=1/jm(s);s.x*=t,s.y*=t}function qm(s,t){s.x*=t,s.y*=t}function lo(s,t){t||(t={}),s.charAt(0)==="#"?s=s.substr(1):s.indexOf("0x")===0&&(s=s.substr(2));let e;return s.length===8&&(e=s.substr(0,2),s=s.substr(2)),t.r=parseInt(s.substr(0,2),16),t.g=parseInt(s.substr(2,2),16),t.b=parseInt(s.substr(4,2),16),e&&(t.a=parseInt(e,16)),t}function Km(s){const t=s.length,e=1/t;return function(i){const r=t*i|0,n=(i-r*e)*t,a=s[r]||s[t-1];return a.s+n*(2*(1-n)*(a.cp-a.s)+n*(a.e-a.s))}}function Hw(s){return s?(s=s.toUpperCase().replace(/ /g,"_"),K[s]||K.NORMAL):K.NORMAL}class cc extends _e{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 xt;(function(s){s[s.Spawn=0]="Spawn",s[s.Normal=2]="Normal",s[s.Late=5]="Late"})(xt||(xt={}));const uc=ft.shared,Us=Symbol("Position particle per emitter position");class ut{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 tt,this.particlesPerWave=1,this.rotation=0,this.ownerPos=new tt,this._prevEmitterPos=new tt,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){ut.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:Km(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(i=>{const r=ut.knownBehaviors[i.type];return r?new r(i.config):(console.error(`Unknown behavior: ${i.type}`),null)}).filter(i=>!!i);e.push(Us),e.sort((i,r)=>i===Us?r.order===xt.Spawn?1:-1:r===Us?i.order===xt.Spawn?-1:1:i.order-r.order),this.initBehaviors=e.slice(),this.updateBehaviors=e.filter(i=>i!==Us&&i.updateParticle),this.recycleBehaviors=e.filter(i=>i!==Us&&i.recycleParticle)}getBehavior(t){return ut.knownBehaviors[t]&&this.initBehaviors.find(e=>e instanceof ut.knownBehaviors[t])||null}fillPool(t){for(;t>0;--t){const e=new cc(this);e.next=this._poolFirst,this._poolFirst=e}}recycle(t,e=!1){for(let i=0;i<this.recycleBehaviors.length;++i)this.recycleBehaviors[i].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,Li(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?uc.remove(this.update,this):!this._autoUpdate&&t&&uc.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=uc.elapsedMS*.001),!this._parent)return;for(let a=this._activeParticlesFirst,o;a;a=o)if(o=a.next,a.age+=t,a.age>a.maxLife||a.age<0)this.recycle(a);else{let h=a.age*a.oneOverLife;this.customEase&&(this.customEase.length===4?h=this.customEase(h,0,1,1):h=this.customEase(h)),a.agePercent=h;for(let l=0;l<this.updateBehaviors.length;++l)if(this.updateBehaviors[l].updateParticle(a,t)){this.recycle(a);break}}let e,i;this._prevPosIsValid&&(e=this._prevEmitterPos.x,i=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,o;if(this._prevPosIsValid&&this._posChanged){const c=1+this._spawnTimer/t;a=(r-e)*c+e,o=(n-i)*c+i}else a=r,o=n;let h=null,l=null;for(let c=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),d=0;d<c;++d){if(this.spawnChance<1&&Math.random()>=this.spawnChance)continue;let u;if(this.minLifetime===this.maxLifetime?u=this.minLifetime:u=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,-this._spawnTimer>=u)continue;let f;this._poolFirst?(f=this._poolFirst,this._poolFirst=this._poolFirst.next,f.next=null):f=new cc(this),f.init(u),this.addAtBack?this._parent.addChildAt(f,0):this._parent.addChild(f),h?(l.next=f,f.prev=l,l=f):l=h=f,++this.particleCount}if(h){this._activeParticlesLast?(this._activeParticlesLast.next=h,h.prev=this._activeParticlesLast,this._activeParticlesLast=l):(this._activeParticlesFirst=h,this._activeParticlesLast=l);for(let c=0;c<this.initBehaviors.length;++c){const d=this.initBehaviors[c];if(d===Us)for(let u=h,f;u;u=f){f=u.next,this.rotation!==0&&(Li(this.rotation,u.position),u.rotation+=this.rotation),u.position.x+=a,u.position.y+=o,u.age+=-this._spawnTimer;let p=u.age*u.oneOverLife;this.customEase&&(this.customEase.length===4?p=this.customEase(p,0,1,1):p=this.customEase(p)),u.agePercent=p}else d.initParticles(h)}for(let c=h,d;c;c=d){d=c.next;for(let u=0;u<this.updateBehaviors.length;++u)if(this.updateBehaviors[u].updateParticle(c,-this._spawnTimer)){this.recycle(c);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 i=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 o;this._poolFirst?(o=this._poolFirst,this._poolFirst=this._poolFirst.next,o.next=null):o=new cc(this);let h;this.minLifetime===this.maxLifetime?h=this.minLifetime:h=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,o.init(h),this.addAtBack?this._parent.addChildAt(o,0):this._parent.addChild(o),i?(r.next=o,o.prev=r,r=o):r=i=o,++this.particleCount}if(i){this._activeParticlesLast?(this._activeParticlesLast.next=i,i.prev=this._activeParticlesLast,this._activeParticlesLast=r):(this._activeParticlesFirst=i,this._activeParticlesLast=r);for(let n=0;n<this.initBehaviors.length;++n){const a=this.initBehaviors[n];if(a===Us)for(let o=i,h;o;o=h)h=o.next,this.rotation!==0&&(Li(this.rotation,o.position),o.rotation+=this.rotation),o.position.x+=t,o.position.y+=e;else a.initParticles(i)}}}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}}ut.knownBehaviors={};class dc{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}}dc.type="rect",dc.editorConfig=null;class co{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),Li(e,t.position),t.position.x+=this.x,t.position.y+=this.y}}co.type="torus",co.editorConfig=null;class fc{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 i=t[e];let r=i[0];for(let n=1;n<i.length;++n){const a=i[n];this.segments.push({p1:r,p2:a,l:0}),r=a}}else{let e=t[0];for(let i=1;i<t.length;++i){const r=t[i];this.segments.push({p1:e,p2:r,l:0}),e=r}}for(let e=0;e<this.segments.length;++e){const{p1:i,p2:r}=this.segments[e],n=Math.sqrt((r.x-i.x)*(r.x-i.x)+(r.y-i.y)*(r.y-i.y));this.segments[e].l=n,this.totalLength+=n,this.countingLengths.push(this.totalLength)}}getRandPos(t){const e=Math.random()*this.totalLength;let i,r;if(this.segments.length===1)i=this.segments[0],r=e;else for(let o=0;o<this.countingLengths.length;++o)if(e<this.countingLengths[o]){i=this.segments[o],r=o===0?e:e-this.countingLengths[o-1];break}r/=i.l||1;const{p1:n,p2:a}=i;t.x=n.x+r*(a.x-n.x),t.y=n.y+r*(a.y-n.y)}}fc.type="polygonalChain",fc.editorConfig=null;class pc{constructor(t){var e;this.order=xt.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 i=Math.random()*(this.maxStart-this.minStart)+this.minStart;e.config.velocity?e.config.velocity.set(i,0):e.config.velocity=new tt(i,0),Li(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const i=t.config.velocity,r=i.x,n=i.y;if(i.x+=this.accel.x*e,i.y+=this.accel.y*e,this.maxSpeed){const a=jm(i);a>this.maxSpeed&&qm(i,this.maxSpeed/a)}t.x+=(r+i.x)/2*e,t.y+=(n+i.y)/2*e,this.rotate&&(t.rotation=Math.atan2(i.y,i.x))}}pc.type="moveAcceleration",pc.editorConfig=null;function Vw(s){return this.ease&&(s=this.ease(s)),(this.first.next.value-this.first.value)*s+this.first.value}function Ww(s){this.ease&&(s=this.ease(s));const t=this.first.value,e=this.first.next.value,i=(e.r-t.r)*s+t.r,r=(e.g-t.g)*s+t.g,n=(e.b-t.b)*s+t.b;return ho(i,r,n)}function Xw(s){this.ease&&(s=this.ease(s));let t=this.first,e=t.next;for(;s>e.time;)t=e,e=e.next;return s=(s-t.time)/(e.time-t.time),(e.value-t.value)*s+t.value}function $w(s){this.ease&&(s=this.ease(s));let t=this.first,e=t.next;for(;s>e.time;)t=e,e=e.next;s=(s-t.time)/(e.time-t.time);const i=t.value,r=e.value,n=(r.r-i.r)*s+i.r,a=(r.g-i.g)*s+i.g,o=(r.b-i.b)*s+i.b;return ho(n,a,o)}function zw(s){this.ease&&(s=this.ease(s));let t=this.first;for(;t.next&&s>t.next.time;)t=t.next;return t.value}function Yw(s){this.ease&&(s=this.ease(s));let t=this.first;for(;t.next&&s>t.next.time;)t=t.next;const e=t.value;return ho(e.r,e.g,e.b)}class En{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?Ww:Vw:t.isStepped?this.interpolate=this.isColor?Yw:zw:this.interpolate=this.isColor?$w:Xw,this.ease=this.first.ease}}class mc{constructor(t){this.order=xt.Normal,this.list=new En(!1),this.list.reset(_i.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)}}mc.type="alpha",mc.editorConfig=null;class _c{constructor(t){this.order=xt.Normal,this.value=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.value,e=e.next}}_c.type="alphaStatic",_c.editorConfig=null;function Zm(s){const t=[];for(let e=0;e<s.length;++e){let i=s[e];if(typeof i=="string")t.push(wn(i));else if(i instanceof X)t.push(i);else{let r=i.count||1;for(typeof i.texture=="string"?i=wn(i.texture):i=i.texture;r>0;--r)t.push(i)}}return t}class gc{constructor(t){this.order=xt.Normal,this.anims=[];for(let e=0;e<t.anims.length;++e){const i=t.anims[e],r=Zm(i.textures),n=i.framerate<0?-1:i.framerate>0?i.framerate:60,a={textures:r,duration:n>0?r.length/n:0,framerate:n,loop:n>0?!!i.loop:!1};this.anims.push(a)}}initParticles(t){let e=t;for(;e;){const i=Math.floor(Math.random()*this.anims.length),r=e.config.anim=this.anims[i];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 i=t.config,r=i.anim;i.animElapsed+=e,i.animElapsed>=i.animDuration&&(i.anim.loop?i.animElapsed=i.animElapsed%i.animDuration:i.animElapsed=i.animDuration-1e-6);const n=i.animElapsed*i.animFramerate+1e-7|0;t.texture=r.textures[n]||r.textures[r.textures.length-1]||X.EMPTY}}gc.type="animatedRandom",gc.editorConfig=null;class yc{constructor(t){this.order=xt.Normal;const e=t.anim,i=Zm(e.textures),r=e.framerate<0?-1:e.framerate>0?e.framerate:60;this.anim={textures:i,duration:r>0?i.length/r:0,framerate:r,loop:r>0?!!e.loop:!1}}initParticles(t){let e=t;const i=this.anim;for(;e;)e.texture=i.textures[0],e.config.animElapsed=0,i.framerate===-1?(e.config.animDuration=e.maxLife,e.config.animFramerate=i.textures.length/e.maxLife):(e.config.animDuration=i.duration,e.config.animFramerate=i.framerate),e=e.next}updateParticle(t,e){const i=this.anim,r=t.config;r.animElapsed+=e,r.animElapsed>=r.animDuration&&(i.loop?r.animElapsed=r.animElapsed%r.animDuration:r.animElapsed=r.animDuration-1e-6);const n=r.animElapsed*r.animFramerate+1e-7|0;t.texture=i.textures[n]||i.textures[i.textures.length-1]||X.EMPTY}}yc.type="animatedSingle",yc.editorConfig=null;class xc{constructor(t){this.order=xt.Normal,this.value=t.blendMode}initParticles(t){let e=t;for(;e;)e.blendMode=Hw(this.value),e=e.next}}xc.type="blendMode",xc.editorConfig=null;class vc{constructor(t){this.order=xt.Spawn,this.spacing=t.spacing*gi,this.start=t.start*gi,this.distance=t.distance}initParticles(t){let e=0,i=t;for(;i;){let r;this.spacing?r=this.start+this.spacing*e:r=Math.random()*Math.PI*2,i.rotation=r,this.distance&&(i.position.x=this.distance,Li(r,i.position)),i=i.next,++e}}}vc.type="spawnBurst",vc.editorConfig=null;class bc{constructor(t){this.order=xt.Normal,this.list=new En(!0),this.list.reset(_i.createList(t.color))}initParticles(t){let e=t;const i=this.list.first.value,r=ho(i.r,i.g,i.b);for(;e;)e.tint=r,e=e.next}updateParticle(t){t.tint=this.list.interpolate(t.agePercent)}}bc.type="color",bc.editorConfig=null;class Tc{constructor(t){this.order=xt.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}}Tc.type="colorStatic",Tc.editorConfig=null;class wc{constructor(t){this.order=xt.Normal,this.index=0,this.textures=t.textures.map(e=>typeof e=="string"?wn(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}}wc.type="textureOrdered",wc.editorConfig=null;const Ar=new tt,Qm=["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"],jw=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(Qm).join("|"),"g");function qw(s){const t=s.match(jw);for(let e=t.length-1;e>=0;--e)Qm.indexOf(t[e])>=0&&(t[e]=`Math.${t[e]}`);return s=t.join(""),new Function("x",`return ${s};`)}class Ec{constructor(t){var e;if(this.order=xt.Late,t.path)if(typeof t.path=="function")this.path=t.path;else try{this.path=qw(t.path)}catch{this.path=null}else this.path=i=>i;this.list=new En(!1),this.list.reset(_i.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 tt(e.x,e.y),e.config.movement=0;const i=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=i,e=e.next}}updateParticle(t,e){const i=this.list.interpolate(t.agePercent)*t.config.speedMult;t.config.movement+=i*e,Ar.x=t.config.movement,Ar.y=this.path(Ar.x),Li(t.config.initRotation,Ar),t.position.x=t.config.initPosition.x+Ar.x,t.position.y=t.config.initPosition.y+Ar.y}}Ec.type="movePath",Ec.editorConfig=null;class Ac{constructor(){this.order=xt.Spawn}initParticles(t){}}Ac.type="spawnPoint",Ac.editorConfig=null;class Sc{constructor(t){this.order=xt.Normal,this.textures=t.textures.map(e=>typeof e=="string"?wn(e):e)}initParticles(t){let e=t;for(;e;){const i=Math.floor(Math.random()*this.textures.length);e.texture=this.textures[i],e=e.next}}}Sc.type="textureRandom",Sc.editorConfig=null;class Cc{constructor(t){this.order=xt.Normal,this.minStart=t.minStart*gi,this.maxStart=t.maxStart*gi,this.minSpeed=t.minSpeed*gi,this.maxSpeed=t.maxSpeed*gi,this.accel=t.accel*gi}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 i=t.config.rotSpeed;t.config.rotSpeed+=this.accel*e,t.rotation+=(t.config.rotSpeed+i)/2*e}else t.rotation+=t.config.rotSpeed*e}}Cc.type="rotation",Cc.editorConfig=null;class Pc{constructor(t){this.order=xt.Normal,this.min=t.min*gi,this.max=t.max*gi}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}}Pc.type="rotationStatic",Pc.editorConfig=null;class Rc{constructor(t){this.order=xt.Late+1,this.rotation=(t.rotation||0)*gi}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}}Rc.type="noRotation",Rc.editorConfig=null;class Ic{constructor(t){var e;this.order=xt.Normal,this.list=new En(!1),this.list.reset(_i.createList(t.scale)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const i=Math.random()*(1-this.minMult)+this.minMult;e.config.scaleMult=i,e.scale.x=e.scale.y=this.list.first.value*i,e=e.next}}updateParticle(t){t.scale.x=t.scale.y=this.list.interpolate(t.agePercent)*t.config.scaleMult}}Ic.type="scale",Ic.editorConfig=null;class Mc{constructor(t){this.order=xt.Normal,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const i=Math.random()*(this.max-this.min)+this.min;e.scale.x=e.scale.y=i,e=e.next}}}Mc.type="scaleStatic",Mc.editorConfig=null;class ze{constructor(t){this.order=xt.Spawn;const e=ze.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){ze.shapes[e||t.type]=t}initParticles(t){let e=t;for(;e;)this.shape.getRandPos(e),e=e.next}}ze.type="spawnShape",ze.editorConfig=null,ze.shapes={},ze.registerShape(fc),ze.registerShape(dc),ze.registerShape(co),ze.registerShape(co,"circle");class Dc{constructor(t){this.order=xt.Normal,this.texture=typeof t.texture=="string"?wn(t.texture):t.texture}initParticles(t){let e=t;for(;e;)e.texture=this.texture,e=e.next}}Dc.type="textureSingle",Dc.editorConfig=null;class Bc{constructor(t){var e;this.order=xt.Late,this.list=new En(!1),this.list.reset(_i.createList(t.speed)),this.minMult=(e=t.minMult)!==null&&e!==void 0?e:1}initParticles(t){let e=t;for(;e;){const i=Math.random()*(1-this.minMult)+this.minMult;e.config.speedMult=i,e.config.velocity?e.config.velocity.set(this.list.first.value*i,0):e.config.velocity=new tt(this.list.first.value*i,0),Li(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const i=this.list.interpolate(t.agePercent)*t.config.speedMult,r=t.config.velocity;Gw(r),qm(r,i),t.x+=r.x*e,t.y+=r.y*e}}Bc.type="moveSpeed",Bc.editorConfig=null;class Oc{constructor(t){this.order=xt.Late,this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){const i=Math.random()*(this.max-this.min)+this.min;e.config.velocity?e.config.velocity.set(i,0):e.config.velocity=new tt(i,0),Li(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const i=t.config.velocity;t.x+=i.x*e,t.y+=i.y*e}}Oc.type="moveSpeedStatic",Oc.editorConfig=null,ut.registerBehavior(pc),ut.registerBehavior(mc),ut.registerBehavior(_c),ut.registerBehavior(gc),ut.registerBehavior(yc),ut.registerBehavior(xc),ut.registerBehavior(vc),ut.registerBehavior(bc),ut.registerBehavior(Tc),ut.registerBehavior(wc),ut.registerBehavior(Ec),ut.registerBehavior(Ac),ut.registerBehavior(Sc),ut.registerBehavior(Cc),ut.registerBehavior(Pc),ut.registerBehavior(Rc),ut.registerBehavior(Ic),ut.registerBehavior(Mc),ut.registerBehavior(ze),ut.registerBehavior(Dc),ut.registerBehavior(Bc),ut.registerBehavior(Oc);class Fc extends Va{constructor(t){const{text:e,fontSize:i=36,fontColor:r=16777215,stroke:n,strokeColor:a,strokeThickness:o,fontFamily:h="MicrosoftYaHei",fontWeight:l="normal",wordWrap:c=!1,wordWrapWidth:d=100,lineHeight:u=1.25,align:f="left",indent:p=0,shadow:m}=t,_=new Mi({fontSize:i,wordWrap:c,wordWrapWidth:d,fontWeight:l,lineHeight:u*i,breakWords:c,fill:r,align:f,fontFamily:h,stroke:n?a:"transparent",strokeThickness:n?o:0,lineJoin:"round"});m&&(_.dropShadow=!0,_.dropShadowColor=m[0],_.dropShadowAngle=m[1]*(Math.PI/180),_.dropShadowBlur=m[2],_.dropShadowDistance=m[3]),super(e,_),this.position.x=p*i}}class Kw extends bt{constructor(t){super();const{start:e,control:i,end:r,json:n,duration:a,ease:o="power1.out",showControl:h=!1,loop:l=!1}=t;this._particleContainer=new jb,this.addChild(this._particleContainer);const c=new ut(this._particleContainer,n),d=this._createBezierPoints([e,...i,r],100,h),u={pathThrough:0};ct.to(u,{duration:a,pathThrough:d.length-1,repeat:l?-1:0,ease:o,onStart:()=>{c.emit=!0},onUpdate:()=>{const p=Math.floor(u.pathThrough),m=d[p];c.updateOwnerPos(m.x,m.y)},onComplete:()=>{ct.to(this,{alpha:0,duration:.5,onComplete:()=>{c.emit=!1,f.destroy(),this.removeFromParent()}})}});const f=new ft;f.add(()=>{c.update(1/75)}),f.start()}_createBezierPoints(t,e,i){const r=[];i&&t.forEach((n,a)=>{const o=new Fc({text:a+1,fontSize:16});o.position.set(n.x,n.y),this.addChild(o)});for(let n=0;n<e;n++){const a=this._multiPointBezier(t,n/e);r.push(a)}return r}_multiPointBezier(t,e){const i=t.length;let r=0,n=0;const a=[];for(let o=0;o<i;o++)a[o]=this._binomial(i-1,o);for(let o=0;o<i;o++){const h=t[o],l=a[o],c=Math.pow(e,o),d=Math.pow(1-e,i-1-o);r+=h.x*d*c*l,n+=h.y*d*c*l}return{x:r,y:n}}_binomial(t,e){if(e===0||e===t)return 1;let i=1;for(let r=1;r<=e;r++)i=i*(t-r+1)/r;return i}}var yi=(s=>(s[s.Region=0]="Region",s[s.BoundingBox=1]="BoundingBox",s[s.Mesh=2]="Mesh",s[s.LinkedMesh=3]="LinkedMesh",s[s.Path=4]="Path",s[s.Point=5]="Point",s[s.Clipping=6]="Clipping",s))(yi||{}),j=(s=>(s[s.setup=0]="setup",s[s.first=1]="first",s[s.replace=2]="replace",s[s.add=3]="add",s))(j||{}),Te=(s=>(s[s.mixIn=0]="mixIn",s[s.mixOut=1]="mixOut",s))(Te||{}),uo=(s=>(s[s.Fixed=0]="Fixed",s[s.Percent=1]="Percent",s))(uo||{}),Gs=(s=>(s[s.Tangent=0]="Tangent",s[s.Chain=1]="Chain",s[s.ChainScale=2]="ChainScale",s))(Gs||{}),se=(s=>(s[s.Normal=0]="Normal",s[s.OnlyTranslation=1]="OnlyTranslation",s[s.NoRotationOrReflection=2]="NoRotationOrReflection",s[s.NoScale=3]="NoScale",s[s.NoScaleOrReflection=4]="NoScaleOrReflection",s))(se||{});class Jm{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 Zw{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}}const Hs=class{constructor(s=0,t=0,e=0,i=0){this.r=s,this.g=t,this.b=e,this.a=i}set(s,t,e,i){return this.r=s,this.g=t,this.b=e,this.a=i,this.clamp()}setFromColor(s){return this.r=s.r,this.g=s.g,this.b=s.b,this.a=s.a,this}setFromString(s){return s=s.charAt(0)=="#"?s.substr(1):s,this.r=parseInt(s.substr(0,2),16)/255,this.g=parseInt(s.substr(2,2),16)/255,this.b=parseInt(s.substr(4,2),16)/255,this.a=s.length!=8?1:parseInt(s.substr(6,2),16)/255,this}add(s,t,e,i){return this.r+=s,this.g+=t,this.b+=e,this.a+=i,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(s,t){s.r=((t&4278190080)>>>24)/255,s.g=((t&16711680)>>>16)/255,s.b=((t&65280)>>>8)/255,s.a=(t&255)/255}static rgb888ToColor(s,t){s.r=((t&16711680)>>>16)/255,s.g=((t&65280)>>>8)/255,s.b=(t&255)/255}static fromString(s){return new Hs().setFromString(s)}};let we=Hs;we.WHITE=new Hs(1,1,1,1),we.RED=new Hs(1,0,0,1),we.GREEN=new Hs(0,1,0,1),we.BLUE=new Hs(0,0,1,1),we.MAGENTA=new Hs(1,0,1,1);const ki=class{static clamp(s,t,e){return s<t?t:s>e?e:s}static cosDeg(s){return Math.cos(s*ki.degRad)}static sinDeg(s){return Math.sin(s*ki.degRad)}static signum(s){return Math.sign(s)}static toInt(s){return s>0?Math.floor(s):Math.ceil(s)}static cbrt(s){const t=Math.pow(Math.abs(s),.3333333333333333);return s<0?-t:t}static randomTriangular(s,t){return ki.randomTriangularWith(s,t,(s+t)*.5)}static randomTriangularWith(s,t,e){const i=Math.random(),r=t-s;return i<=(e-s)/r?s+Math.sqrt(i*r*(e-s)):t-Math.sqrt((1-i)*r*(t-e))}static isPowerOfTwo(s){return s&&(s&s-1)===0}};let k=ki;k.PI=3.1415927,k.PI2=ki.PI*2,k.radiansToDegrees=180/ki.PI,k.radDeg=ki.radiansToDegrees,k.degreesToRadians=ki.PI/180,k.degRad=ki.degreesToRadians;class Qw{apply(t,e,i){return t+(e-t)*this.applyInternal(i)}}class Jw extends Qw{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 tE extends Jw{applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}const Sr=class{static arrayCopy(s,t,e,i,r){for(let n=t,a=i;n<t+r;n++,a++)e[a]=s[n]}static arrayFill(s,t,e,i){for(let r=t;r<e;r++)s[r]=i}static setArraySize(s,t,e=0){const i=s.length;if(i==t)return s;if(s.length=t,i<t)for(let r=i;r<t;r++)s[r]=e;return s}static ensureArrayCapacity(s,t,e=0){return s.length>=t?s:Sr.setArraySize(s,t,e)}static newArray(s,t){const e=new Array(s);for(let i=0;i<s;i++)e[i]=t;return e}static newFloatArray(s){if(Sr.SUPPORTS_TYPED_ARRAYS)return new Float32Array(s);const t=new Array(s);for(let e=0;e<t.length;e++)t[e]=0;return t}static newShortArray(s){if(Sr.SUPPORTS_TYPED_ARRAYS)return new Int16Array(s);const t=new Array(s);for(let e=0;e<t.length;e++)t[e]=0;return t}static toFloatArray(s){return Sr.SUPPORTS_TYPED_ARRAYS?new Float32Array(s):s}static toSinglePrecision(s){return Sr.SUPPORTS_TYPED_ARRAYS?Math.fround(s):s}static webkit602BugfixHelper(s,t){}static contains(s,t,e=!0){for(let i=0;i<s.length;i++)if(s[i]==t)return!0;return!1}static enumValue(s,t){return s[t[0].toUpperCase()+t.slice(1)]}};let Q=Sr;Q.SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";class eE{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 iE{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 sE={yDown:!0,FAIL_ON_NON_EXISTING_SKIN:!1,GLOBAL_AUTO_UPDATE:!0,GLOBAL_DELAY_LIMIT:0},hs=[0,0,0];class rE extends _e{constructor(){super(...arguments),this.region=null,this.attachment=null}}class nE extends Yb{constructor(t,e,i,r,n){super(t,e,i,r,n),this.region=null,this.attachment=null}}const t_=class extends bt{constructor(s){if(super(),!s)throw new Error("The spineData param is required.");if(typeof s=="string")throw new Error('spineData param cant be string. Please use spine.Spine.fromAtlas("YOUR_RESOURCE_NAME") from now on.');this.spineData=s,this.createSkeleton(s),this.slotContainers=[],this.tempClipContainers=[];for(let t=0,e=this.skeleton.slots.length;t<e;t++){const i=this.skeleton.slots[t],r=i.getAttachment(),n=this.newContainer();if(this.slotContainers.push(n),this.addChild(n),this.tempClipContainers.push(null),!!r)if(r.type===yi.Region){const a=r.name,o=this.createSprite(i,r,a);i.currentSprite=o,i.currentSpriteName=a,n.addChild(o)}else if(r.type===yi.Mesh){const a=this.createMesh(i,r);i.currentMesh=a,i.currentMeshId=r.id,i.currentMeshName=r.name,n.addChild(a)}else r.type===yi.Clipping&&(this.createGraphics(i,r),n.addChild(i.clippingContainer),n.addChild(i.currentGraphics))}this.tintRgb=new Float32Array([1,1,1]),this.autoUpdate=!0,this.visible=!0}get debug(){return this._debug}set debug(s){var t;s!=this._debug&&((t=this._debug)==null||t.unregisterSpine(this),s==null||s.registerSpine(this),this._debug=s)}get autoUpdate(){return this._autoUpdate}set autoUpdate(s){s!==this._autoUpdate&&(this._autoUpdate=s,this.updateTransform=s?t_.prototype.autoUpdateTransform:bt.prototype.updateTransform)}get tint(){return Qr(this.tintRgb)}set tint(s){this.tintRgb=Md(s,this.tintRgb)}get delayLimit(){return(typeof this.localDelayLimit<"u"?this.localDelayLimit:sE.GLOBAL_DELAY_LIMIT)||Number.MAX_VALUE}update(s){var l;const t=this.delayLimit;if(s>t&&(s=t),this.state.update(s),this.state.apply(this.skeleton),!this.skeleton)return;this.skeleton.updateWorldTransform();const e=this.skeleton.slots,i=this.color;let r=null,n=null;i?(r=i.light,n=i.dark):r=this.tintRgb;for(let c=0,d=e.length;c<d;c++){const u=e[c],f=u.getAttachment(),p=this.slotContainers[c];if(!f){p.visible=!1;continue}let m=null;f.sequence&&f.sequence.apply(u,f);let _=f.region;const y=f.color;switch(f!=null&&f.type){case yi.Region:if(p.transform.setFromMatrix(u.bone.matrix),_=f.region,u.currentMesh&&(u.currentMesh.visible=!1,u.currentMesh=null,u.currentMeshId=void 0,u.currentMeshName=void 0),!_){u.currentSprite&&(u.currentSprite.renderable=!1);break}if(!u.currentSpriteName||u.currentSpriteName!==f.name){const x=f.name;if(u.currentSprite&&(u.currentSprite.visible=!1),u.sprites=u.sprites||{},u.sprites[x]!==void 0)u.sprites[x].visible=!0;else{const b=this.createSprite(u,f,x);p.addChild(b)}u.currentSprite=u.sprites[x],u.currentSpriteName=x}u.currentSprite.renderable=!0,u.hackRegion||this.setSpriteRegion(f,u.currentSprite,_),u.currentSprite.color?m=u.currentSprite.color:(hs[0]=r[0]*u.color.r*y.r,hs[1]=r[1]*u.color.g*y.g,hs[2]=r[2]*u.color.b*y.b,u.currentSprite.tint=Qr(hs)),u.currentSprite.blendMode=u.blendMode;break;case yi.Mesh:if(u.currentSprite){u.currentSprite.visible=!1,u.currentSprite=null,u.currentSpriteName=void 0;const x=new ca;x._parentID=-1,x._worldID=p.transform._worldID,p.transform=x}if(!_){u.currentMesh&&(u.currentMesh.renderable=!1);break}const g=f.id;if(u.currentMeshId===void 0||u.currentMeshId!==g){const x=g;if(u.currentMesh&&(u.currentMesh.visible=!1),u.meshes=u.meshes||{},u.meshes[x]!==void 0)u.meshes[x].visible=!0;else{const b=this.createMesh(u,f);p.addChild(b)}u.currentMesh=u.meshes[x],u.currentMeshName=f.name,u.currentMeshId=x}u.currentMesh.renderable=!0,f.computeWorldVerticesOld(u,u.currentMesh.vertices),u.currentMesh.color?m=u.currentMesh.color:(hs[0]=r[0]*u.color.r*y.r,hs[1]=r[1]*u.color.g*y.g,hs[2]=r[2]*u.color.b*y.b,u.currentMesh.tint=Qr(hs)),u.currentMesh.blendMode=u.blendMode,u.hackRegion||this.setMeshRegion(f,u.currentMesh,_);break;case yi.Clipping:u.currentGraphics||(this.createGraphics(u,f),p.addChild(u.clippingContainer),p.addChild(u.currentGraphics)),this.updateGraphics(u,f),p.alpha=1,p.visible=!0;continue;default:p.visible=!1;continue}if(p.visible=!0,m){let v=u.color.r*y.r,g=u.color.g*y.g,x=u.color.b*y.b;m.setLight(r[0]*v+n[0]*(1-v),r[1]*g+n[1]*(1-g),r[2]*x+n[2]*(1-x)),u.darkColor?(v=u.darkColor.r,g=u.darkColor.g,x=u.darkColor.b):(v=0,g=0,x=0),m.setDark(r[0]*v+n[0]*(1-v),r[1]*g+n[1]*(1-g),r[2]*x+n[2]*(1-x))}p.alpha=u.color.a}const a=this.skeleton.drawOrder;let o=null,h=null;for(let c=0,d=a.length;c<d;c++){const u=e[a[c].data.index],f=this.slotContainers[a[c].data.index];if(h||f.parent!==null&&f.parent!==this&&(f.parent.removeChild(f),f.parent=this),u.currentGraphics&&u.getAttachment())h=u.clippingContainer,o=u.getAttachment(),h.children.length=0,this.children[c]=f,o.endSlot===u.data&&(o.endSlot=null);else if(h){let p=this.tempClipContainers[c];p||(p=this.tempClipContainers[c]=this.newContainer(),p.visible=!1),this.children[c]=p,f.parent=null,h.addChild(f),o.endSlot==u.data&&(h.renderable=!0,h=null,o=null)}else this.children[c]=f}(l=this._debug)==null||l.renderDebug(this)}setSpriteRegion(s,t,e){t.attachment===s&&t.region===e||(t.region=e,t.attachment=s,t.texture=e.texture,t.rotation=s.rotation*k.degRad,t.position.x=s.x,t.position.y=s.y,t.alpha=s.color.a,e.size?(t.scale.x=e.size.width/e.originalWidth,t.scale.y=-e.size.height/e.originalHeight):(t.scale.x=s.scaleX*s.width/e.originalWidth,t.scale.y=-s.scaleY*s.height/e.originalHeight))}setMeshRegion(s,t,e){t.attachment===s&&t.region===e||(t.region=e,t.attachment=s,t.texture=e.texture,e.texture.updateUvs(),t.uvBuffer.update(s.regionUVs))}autoUpdateTransform(){{this.lastTime=this.lastTime||Date.now();const s=(Date.now()-this.lastTime)*.001;this.lastTime=Date.now(),this.update(s)}bt.prototype.updateTransform.call(this)}createSprite(s,t,e){let i=t.region;s.hackAttachment===t&&(i=s.hackRegion);const r=i?i.texture:null,n=this.newSprite(r);return n.anchor.set(.5),i&&this.setSpriteRegion(t,n,t.region),s.sprites=s.sprites||{},s.sprites[e]=n,n}createMesh(s,t){let e=t.region;s.hackAttachment===t&&(e=s.hackRegion,s.hackAttachment=null,s.hackRegion=null);const i=this.newMesh(e?e.texture:null,new Float32Array(t.regionUVs.length),t.regionUVs,new Uint16Array(t.triangles),Ue.TRIANGLES);return typeof i._canvasPadding<"u"&&(i._canvasPadding=1.5),i.alpha=t.color.a,i.region=t.region,e&&this.setMeshRegion(t,i,e),s.meshes=s.meshes||{},s.meshes[t.id]=i,i}createGraphics(s,t){const e=this.newGraphics(),i=new $i([]);return e.clear(),e.beginFill(16777215,1),e.drawPolygon(i),e.renderable=!1,s.currentGraphics=e,s.clippingContainer=this.newContainer(),s.clippingContainer.mask=s.currentGraphics,e}updateGraphics(s,t){const e=s.currentGraphics.geometry,i=e.graphicsData[0].shape.points,r=t.worldVerticesLength;i.length=r,t.computeWorldVertices(s,0,r,i,0,2),e.invalidate()}hackTextureBySlotIndex(s,t=null,e=null){const i=this.skeleton.slots[s];if(!i)return!1;const r=i.getAttachment();let n=r.region;return t?(n=new Jm,n.texture=t,n.size=e,i.hackRegion=n,i.hackAttachment=r):(i.hackRegion=null,i.hackAttachment=null),i.currentSprite?this.setSpriteRegion(r,i.currentSprite,n):i.currentMesh&&this.setMeshRegion(r,i.currentMesh,n),!0}hackTextureBySlotName(s,t=null,e=null){const i=this.skeleton.findSlotIndex(s);return i==-1?!1:this.hackTextureBySlotIndex(i,t,e)}hackTextureAttachment(s,t,e,i=null){const r=this.skeleton.findSlotIndex(s),n=this.skeleton.getAttachmentByName(s,t);n.region.texture=e;const a=this.skeleton.slots[r];if(!a)return!1;const o=a.getAttachment();if(t===o.name){let h=n.region;return e?(h=new Jm,h.texture=e,h.size=i,a.hackRegion=h,a.hackAttachment=o):(a.hackRegion=null,a.hackAttachment=null),a.currentSprite&&a.currentSprite.region!=h?(this.setSpriteRegion(o,a.currentSprite,h),a.currentSprite.region=h):a.currentMesh&&a.currentMesh.region!=h&&this.setMeshRegion(o,a.currentMesh,h),!0}return!1}newContainer(){return new bt}newSprite(s){return new rE(s)}newGraphics(){return new li}newMesh(s,t,e,i,r){return new nE(s,t,e,i,r)}transformHack(){return 1}hackAttachmentGroups(s,t,e){if(!s)return;const i=[],r=[];for(let n=0,a=this.skeleton.slots.length;n<a;n++){const o=this.skeleton.slots[n],h=o.currentSpriteName||o.currentMeshName||"",l=o.currentSprite||o.currentMesh;h.endsWith(s)?(l.parentGroup=t,r.push(l)):e&&l&&(l.parentGroup=e,i.push(l))}return[i,r]}destroy(s){this.debug=null;for(let t=0,e=this.skeleton.slots.length;t<e;t++){const i=this.skeleton.slots[t];for(const r in i.meshes)i.meshes[r].destroy(s);i.meshes=null;for(const r in i.sprites)i.sprites[r].destroy(s);i.sprites=null}for(let t=0,e=this.slotContainers.length;t<e;t++)this.slotContainers[t].destroy(s);this.spineData=null,this.skeleton=null,this.slotContainers=null,this.stateData=null,this.state=null,this.tempClipContainers=null,super.destroy(s)}};let Lc=t_;Lc.clippingPolygon=[],Object.defineProperty(Lc.prototype,"visible",{get(){return this._visible},set(s){s!==this._visible&&(this._visible=s,s&&(this.lastTime=0))}});class e_{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}}const i_=class extends e_{constructor(s){super(s),this.id=(i_.nextID++&65535)<<11,this.worldVerticesLength=0,this.deformAttachment=this}computeWorldVerticesOld(s,t){this.computeWorldVertices(s,0,this.worldVerticesLength,t,0,2)}computeWorldVertices(s,t,e,i,r,n){e=r+(e>>1)*n;const a=s.bone.skeleton,o=s.deform;let h=this.vertices;const l=this.bones;if(l==null){o.length>0&&(h=o);const f=s.bone.matrix,p=f.tx,m=f.ty,_=f.a,y=f.c,v=f.b,g=f.d;for(let x=t,b=r;b<e;x+=2,b+=n){const w=h[x],T=h[x+1];i[b]=w*_+T*y+p,i[b+1]=w*v+T*g+m}return}let c=0,d=0;for(let f=0;f<t;f+=2){const p=l[c];c+=p+1,d+=p}const u=a.bones;if(o.length==0)for(let f=r,p=d*3;f<e;f+=n){let m=0,_=0,y=l[c++];for(y+=c;c<y;c++,p+=3){const v=u[l[c]].matrix,g=h[p],x=h[p+1],b=h[p+2];m+=(g*v.a+x*v.c+v.tx)*b,_+=(g*v.b+x*v.d+v.ty)*b}i[f]=m,i[f+1]=_}else{const f=o;for(let p=r,m=d*3,_=d<<1;p<e;p+=n){let y=0,v=0,g=l[c++];for(g+=c;c<g;c++,m+=3,_+=2){const x=u[l[c]].matrix,b=h[m]+f[_],w=h[m+1]+f[_+1],T=h[m+2];y+=(b*x.a+w*x.c+x.tx)*T,v+=(b*x.b+w*x.d+x.ty)*T}i[p]=y,i[p+1]=v}}}copyTo(s){this.bones!=null?(s.bones=new Array(this.bones.length),Q.arrayCopy(this.bones,0,s.bones,0,this.bones.length)):s.bones=null,this.vertices!=null?(s.vertices=Q.newFloatArray(this.vertices.length),Q.arrayCopy(this.vertices,0,s.vertices,0,this.vertices.length)):s.vertices=null,s.worldVerticesLength=this.worldVerticesLength,s.deformAttachment=this.deformAttachment}};let kc=i_;kc.nextID=0;class fo extends kc{constructor(t){super(t),this.type=yi.Mesh,this.color=new we(1,1,1,1),this.tempColor=new we(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 fo(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),Q.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=new Array(this.triangles.length),Q.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges!=null&&(t.edges=new Array(this.edges.length),Q.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}newLinkedMesh(){const t=new fo(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}}class An extends kc{constructor(t){super(t),this.type=yi.Path,this.closed=!1,this.constantSpeed=!1,this.color=new we(1,1,1,1)}copy(){const t=new An(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),Q.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class s_{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 we,this.darkColor=t.darkColor==null?null:new we,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 Kt=class extends e_{constructor(s){super(s),this.type=yi.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 we(1,1,1,1),this.offset=Q.newFloatArray(8),this.uvs=Q.newFloatArray(8),this.tempColor=new we(1,1,1,1)}updateOffset(){const s=this.width/this.region.originalWidth*this.scaleX,t=this.height/this.region.originalHeight*this.scaleY,e=-this.width/2*this.scaleX+this.region.offsetX*s,i=-this.height/2*this.scaleY+this.region.offsetY*t,r=e+this.region.width*s,n=i+this.region.height*t,a=this.rotation*Math.PI/180,o=Math.cos(a),h=Math.sin(a),l=e*o+this.x,c=e*h,d=i*o+this.y,u=i*h,f=r*o+this.x,p=r*h,m=n*o+this.y,_=n*h,y=this.offset;y[Kt.OX1]=l-u,y[Kt.OY1]=d+c,y[Kt.OX2]=l-_,y[Kt.OY2]=m+c,y[Kt.OX3]=f-_,y[Kt.OY3]=m+p,y[Kt.OX4]=f-u,y[Kt.OY4]=d+p}setRegion(s){this.region=s;const t=this.uvs;s.rotate?(t[2]=s.u,t[3]=s.v2,t[4]=s.u,t[5]=s.v,t[6]=s.u2,t[7]=s.v,t[0]=s.u2,t[1]=s.v2):(t[0]=s.u,t[1]=s.v2,t[2]=s.u,t[3]=s.v,t[4]=s.u2,t[5]=s.v,t[6]=s.u2,t[7]=s.v2)}computeWorldVertices(s,t,e,i){const r=this.offset,n=s instanceof s_?s.bone.matrix:s.matrix,a=n.tx,o=n.ty,h=n.a,l=n.c,c=n.b,d=n.d;let u=0,f=0;u=r[Kt.OX1],f=r[Kt.OY1],t[e]=u*h+f*l+a,t[e+1]=u*c+f*d+o,e+=i,u=r[Kt.OX2],f=r[Kt.OY2],t[e]=u*h+f*l+a,t[e+1]=u*c+f*d+o,e+=i,u=r[Kt.OX3],f=r[Kt.OY3],t[e]=u*h+f*l+a,t[e+1]=u*c+f*d+o,e+=i,u=r[Kt.OX4],f=r[Kt.OY4],t[e]=u*h+f*l+a,t[e+1]=u*c+f*d+o}copy(){const s=new Kt(this.name);return s.region=this.region,s.rendererObject=this.rendererObject,s.path=this.path,s.x=this.x,s.y=this.y,s.scaleX=this.scaleX,s.scaleY=this.scaleY,s.rotation=this.rotation,s.width=this.width,s.height=this.height,Q.arrayCopy(this.uvs,0,s.uvs,0,8),Q.arrayCopy(this.offset,0,s.offset,0,8),s.color.setFromColor(this.color),s}};let et=Kt;et.OX1=0,et.OY1=1,et.OX2=2,et.OY2=3,et.OX3=4,et.OY3=5,et.OX4=6,et.OY4=7,et.X1=0,et.Y1=1,et.C1R=2,et.C1G=3,et.C1B=4,et.C1A=5,et.U1=6,et.V1=7,et.X2=8,et.Y2=9,et.C2R=10,et.C2G=11,et.C2B=12,et.C2A=13,et.U2=14,et.V2=15,et.X3=16,et.Y3=17,et.C3R=18,et.C3G=19,et.C3B=20,et.C3A=21,et.U3=22,et.V3=23,et.X4=24,et.Y4=25,et.C4R=26,et.C4G=27,et.C4B=28,et.C4A=29,et.U4=30,et.V4=31,new tE(2);class pe{constructor(t,e,i){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=i}hasTimeline(t){return this.timelineIds[t]==!0}apply(t,e,i,r,n,a,o,h){if(t==null)throw new Error("skeleton cannot be null.");r&&this.duration!=0&&(i%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let c=0,d=l.length;c<d;c++)l[c].apply(t,e,i,n,a,o,h)}static binarySearch(t,e,i=1){let r=0,n=t.length/i-2;if(n==0)return i;let a=n>>>1;for(;;){if(t[(a+1)*i]<=e?r=a+1:n=a,r==n)return(r+1)*i;a=r+n>>>1}}static linearSearch(t,e,i){for(let r=0,n=t.length-i;r<=n;r+=i)if(t[r]>e)return r;return-1}}const Gt=class{constructor(s){if(s<=0)throw new Error(`frameCount must be > 0: ${s}`);this.curves=Q.newFloatArray((s-1)*Gt.BEZIER_SIZE)}getFrameCount(){return this.curves.length/Gt.BEZIER_SIZE+1}setLinear(s){this.curves[s*Gt.BEZIER_SIZE]=Gt.LINEAR}setStepped(s){this.curves[s*Gt.BEZIER_SIZE]=Gt.STEPPED}getCurveType(s){const t=s*Gt.BEZIER_SIZE;if(t==this.curves.length)return Gt.LINEAR;const e=this.curves[t];return e==Gt.LINEAR?Gt.LINEAR:e==Gt.STEPPED?Gt.STEPPED:Gt.BEZIER}setCurve(s,t,e,i,r){const n=(-t*2+i)*.03,a=(-e*2+r)*.03,o=((t-i)*3+1)*.006,h=((e-r)*3+1)*.006;let l=n*2+o,c=a*2+h,d=t*.3+n+o*.16666667,u=e*.3+a+h*.16666667,f=s*Gt.BEZIER_SIZE;const p=this.curves;p[f++]=Gt.BEZIER;let m=d,_=u;for(let y=f+Gt.BEZIER_SIZE-1;f<y;f+=2)p[f]=m,p[f+1]=_,d+=l,u+=c,l+=o,c+=h,m+=d,_+=u}getCurvePercent(s,t){t=k.clamp(t,0,1);const e=this.curves;let i=s*Gt.BEZIER_SIZE;const r=e[i];if(r==Gt.LINEAR)return t;if(r==Gt.STEPPED)return 0;i++;let n=0;for(let o=i,h=i+Gt.BEZIER_SIZE-1;i<h;i+=2)if(n=e[i],n>=t){let l,c;return i==o?(l=0,c=0):(l=e[i-2],c=e[i-1]),c+(e[i+1]-c)*(t-l)/(n-l)}const a=e[i-1];return a+(1-a)*(t-n)/(1-n)}};let Fe=Gt;Fe.LINEAR=0,Fe.STEPPED=1,Fe.BEZIER=2,Fe.BEZIER_SIZE=10*2-1;const ls=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(s,t,e){s<<=1,this.frames[s]=t,this.frames[s+ls.ROTATION]=e}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.bones[this.boneIndex];if(!h.active)return;if(e<o[0]){switch(n){case j.setup:h.rotation=h.data.rotation;return;case j.first:const p=h.data.rotation-h.rotation;h.rotation+=(p-(16384-(16384.499999999996-p/360|0))*360)*r}return}if(e>=o[o.length-ls.ENTRIES]){let p=o[o.length+ls.PREV_ROTATION];switch(n){case j.setup:h.rotation=h.data.rotation+p*r;break;case j.first:case j.replace:p+=h.data.rotation-h.rotation,p-=(16384-(16384.499999999996-p/360|0))*360;case j.add:h.rotation+=p*r}return}const l=pe.binarySearch(o,e,ls.ENTRIES),c=o[l+ls.PREV_ROTATION],d=o[l],u=this.getCurvePercent((l>>1)-1,1-(e-d)/(o[l+ls.PREV_TIME]-d));let f=o[l+ls.ROTATION]-c;switch(f=c+(f-(16384-(16384.499999999996-f/360|0))*360)*u,n){case j.setup:h.rotation=h.data.rotation+(f-(16384-(16384.499999999996-f/360|0))*360)*r;break;case j.first:case j.replace:f+=h.data.rotation-h.rotation;case j.add:h.rotation+=(f-(16384-(16384.499999999996-f/360|0))*360)*r}}};let Le=ls;Le.ENTRIES=2,Le.PREV_TIME=-2,Le.PREV_ROTATION=-1,Le.ROTATION=1;const ae=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*ae.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(s,t,e,i){s*=ae.ENTRIES,this.frames[s]=t,this.frames[s+ae.X]=e,this.frames[s+ae.Y]=i}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.bones[this.boneIndex];if(!h.active)return;if(e<o[0]){switch(n){case j.setup:h.x=h.data.x,h.y=h.data.y;return;case j.first:h.x+=(h.data.x-h.x)*r,h.y+=(h.data.y-h.y)*r}return}let l=0,c=0;if(e>=o[o.length-ae.ENTRIES])l=o[o.length+ae.PREV_X],c=o[o.length+ae.PREV_Y];else{const d=pe.binarySearch(o,e,ae.ENTRIES);l=o[d+ae.PREV_X],c=o[d+ae.PREV_Y];const u=o[d],f=this.getCurvePercent(d/ae.ENTRIES-1,1-(e-u)/(o[d+ae.PREV_TIME]-u));l+=(o[d+ae.X]-l)*f,c+=(o[d+ae.Y]-c)*f}switch(n){case j.setup:h.x=h.data.x+l*r,h.y=h.data.y+c*r;break;case j.first:case j.replace:h.x+=(h.data.x+l-h.x)*r,h.y+=(h.data.y+c-h.y)*r;break;case j.add:h.x+=l*r,h.y+=c*r}}};let Cr=ae;Cr.ENTRIES=3,Cr.PREV_TIME=-3,Cr.PREV_X=-2,Cr.PREV_Y=-1,Cr.X=1,Cr.Y=2;const Rt=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*Rt.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(s,t,e,i,r,n){s*=Rt.ENTRIES,this.frames[s]=t,this.frames[s+Rt.R]=e,this.frames[s+Rt.G]=i,this.frames[s+Rt.B]=r,this.frames[s+Rt.A]=n}apply(s,t,e,i,r,n,a){const o=s.slots[this.slotIndex];if(!o.bone.active)return;const h=this.frames;if(e<h[0]){switch(n){case j.setup:o.color.setFromColor(o.data.color);return;case j.first:const f=o.color,p=o.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,c=0,d=0,u=0;if(e>=h[h.length-Rt.ENTRIES]){const f=h.length;l=h[f+Rt.PREV_R],c=h[f+Rt.PREV_G],d=h[f+Rt.PREV_B],u=h[f+Rt.PREV_A]}else{const f=pe.binarySearch(h,e,Rt.ENTRIES);l=h[f+Rt.PREV_R],c=h[f+Rt.PREV_G],d=h[f+Rt.PREV_B],u=h[f+Rt.PREV_A];const p=h[f],m=this.getCurvePercent(f/Rt.ENTRIES-1,1-(e-p)/(h[f+Rt.PREV_TIME]-p));l+=(h[f+Rt.R]-l)*m,c+=(h[f+Rt.G]-c)*m,d+=(h[f+Rt.B]-d)*m,u+=(h[f+Rt.A]-u)*m}if(r==1)o.color.set(l,c,d,u);else{const f=o.color;n==j.setup&&f.setFromColor(o.data.color),f.add((l-f.r)*r,(c-f.g)*r,(d-f.b)*r,(u-f.a)*r)}}};let xi=Rt;xi.ENTRIES=5,xi.PREV_TIME=-5,xi.PREV_R=-4,xi.PREV_G=-3,xi.PREV_B=-2,xi.PREV_A=-1,xi.R=1,xi.G=2,xi.B=3,xi.A=4;const ot=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*ot.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(s,t,e,i,r,n,a,o,h){s*=ot.ENTRIES,this.frames[s]=t,this.frames[s+ot.R]=e,this.frames[s+ot.G]=i,this.frames[s+ot.B]=r,this.frames[s+ot.A]=n,this.frames[s+ot.R2]=a,this.frames[s+ot.G2]=o,this.frames[s+ot.B2]=h}apply(s,t,e,i,r,n,a){const o=s.slots[this.slotIndex];if(!o.bone.active)return;const h=this.frames;if(e<h[0]){switch(n){case j.setup:o.color.setFromColor(o.data.color),o.darkColor.setFromColor(o.data.darkColor);return;case j.first:const _=o.color,y=o.darkColor,v=o.data.color,g=o.data.darkColor;_.add((v.r-_.r)*r,(v.g-_.g)*r,(v.b-_.b)*r,(v.a-_.a)*r),y.add((g.r-y.r)*r,(g.g-y.g)*r,(g.b-y.b)*r,0)}return}let l=0,c=0,d=0,u=0,f=0,p=0,m=0;if(e>=h[h.length-ot.ENTRIES]){const _=h.length;l=h[_+ot.PREV_R],c=h[_+ot.PREV_G],d=h[_+ot.PREV_B],u=h[_+ot.PREV_A],f=h[_+ot.PREV_R2],p=h[_+ot.PREV_G2],m=h[_+ot.PREV_B2]}else{const _=pe.binarySearch(h,e,ot.ENTRIES);l=h[_+ot.PREV_R],c=h[_+ot.PREV_G],d=h[_+ot.PREV_B],u=h[_+ot.PREV_A],f=h[_+ot.PREV_R2],p=h[_+ot.PREV_G2],m=h[_+ot.PREV_B2];const y=h[_],v=this.getCurvePercent(_/ot.ENTRIES-1,1-(e-y)/(h[_+ot.PREV_TIME]-y));l+=(h[_+ot.R]-l)*v,c+=(h[_+ot.G]-c)*v,d+=(h[_+ot.B]-d)*v,u+=(h[_+ot.A]-u)*v,f+=(h[_+ot.R2]-f)*v,p+=(h[_+ot.G2]-p)*v,m+=(h[_+ot.B2]-m)*v}if(r==1)o.color.set(l,c,d,u),o.darkColor.set(f,p,m,1);else{const _=o.color,y=o.darkColor;n==j.setup&&(_.setFromColor(o.data.color),y.setFromColor(o.data.darkColor)),_.add((l-_.r)*r,(c-_.g)*r,(d-_.b)*r,(u-_.a)*r),y.add((f-y.r)*r,(p-y.g)*r,(m-y.b)*r,0)}}};let re=ot;re.ENTRIES=8,re.PREV_TIME=-8,re.PREV_R=-7,re.PREV_G=-6,re.PREV_B=-5,re.PREV_A=-4,re.PREV_R2=-3,re.PREV_G2=-2,re.PREV_B2=-1,re.R=1,re.G=2,re.B=3,re.A=4,re.R2=5,re.G2=6,re.B2=7;class po{constructor(t){this.frames=Q.newFloatArray(t),this.attachmentNames=new Array(t)}getPropertyId(){return(4<<24)+this.slotIndex}getFrameCount(){return this.frames.length}setFrame(t,e,i){this.frames[t]=e,this.attachmentNames[t]=i}apply(t,e,i,r,n,a,o){const h=t.slots[this.slotIndex];if(!h.bone.active)return;if(o==Te.mixOut){a==j.setup&&this.setAttachment(t,h,h.data.attachmentName);return}const l=this.frames;if(i<l[0]){(a==j.setup||a==j.first)&&this.setAttachment(t,h,h.data.attachmentName);return}let c=0;i>=l[l.length-1]?c=l.length-1:c=pe.binarySearch(l,i,1)-1;const d=this.attachmentNames[c];t.slots[this.slotIndex].setAttachment(d==null?null:t.getAttachment(this.slotIndex,d))}setAttachment(t,e,i){e.setAttachment(i==null?null:t.getAttachment(this.slotIndex,i))}}class aE{constructor(t){this.frames=Q.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,i,r,n,a,o){if(r==null)return;const h=this.frames,l=this.frames.length;if(e>i)this.apply(t,e,Number.MAX_VALUE,r,n,a,o),e=-1;else if(e>=h[l-1])return;if(i<h[0])return;let c=0;if(e<h[0])c=0;else{c=pe.binarySearch(h,e);const d=h[c];for(;c>0&&h[c-1]==d;)c--}for(;c<l&&i>=h[c];c++)r.push(this.events[c])}}class Nc{constructor(t){this.frames=Q.newFloatArray(t),this.drawOrders=new Array(t)}getPropertyId(){return 8<<24}getFrameCount(){return this.frames.length}setFrame(t,e,i){this.frames[t]=e,this.drawOrders[t]=i}apply(t,e,i,r,n,a,o){const h=t.drawOrder,l=t.slots;if(o==Te.mixOut&&a==j.setup){Q.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const c=this.frames;if(i<c[0]){(a==j.setup||a==j.first)&&Q.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let d=0;i>=c[c.length-1]?d=c.length-1:d=pe.binarySearch(c,i)-1;const u=this.drawOrders[d];if(u==null)Q.arrayCopy(l,0,h,0,l.length);else for(let f=0,p=u.length;f<p;f++)h[f]=l[u[f]]}}const ht=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*ht.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(s,t,e,i,r,n,a){s*=ht.ENTRIES,this.frames[s]=t,this.frames[s+ht.MIX]=e,this.frames[s+ht.SOFTNESS]=i,this.frames[s+ht.BEND_DIRECTION]=r,this.frames[s+ht.COMPRESS]=n?1:0,this.frames[s+ht.STRETCH]=a?1:0}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.ikConstraints[this.ikConstraintIndex];if(!h.active)return;if(e<o[0]){switch(n){case j.setup:h.mix=h.data.mix,h.softness=h.data.softness,h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch;return;case j.first:h.mix+=(h.data.mix-h.mix)*r,h.softness+=(h.data.softness-h.softness)*r,h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch}return}if(e>=o[o.length-ht.ENTRIES]){n==j.setup?(h.mix=h.data.mix+(o[o.length+ht.PREV_MIX]-h.data.mix)*r,h.softness=h.data.softness+(o[o.length+ht.PREV_SOFTNESS]-h.data.softness)*r,a==Te.mixOut?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=o[o.length+ht.PREV_BEND_DIRECTION],h.compress=o[o.length+ht.PREV_COMPRESS]!=0,h.stretch=o[o.length+ht.PREV_STRETCH]!=0)):(h.mix+=(o[o.length+ht.PREV_MIX]-h.mix)*r,h.softness+=(o[o.length+ht.PREV_SOFTNESS]-h.softness)*r,a==Te.mixIn&&(h.bendDirection=o[o.length+ht.PREV_BEND_DIRECTION],h.compress=o[o.length+ht.PREV_COMPRESS]!=0,h.stretch=o[o.length+ht.PREV_STRETCH]!=0));return}const l=pe.binarySearch(o,e,ht.ENTRIES),c=o[l+ht.PREV_MIX],d=o[l+ht.PREV_SOFTNESS],u=o[l],f=this.getCurvePercent(l/ht.ENTRIES-1,1-(e-u)/(o[l+ht.PREV_TIME]-u));n==j.setup?(h.mix=h.data.mix+(c+(o[l+ht.MIX]-c)*f-h.data.mix)*r,h.softness=h.data.softness+(d+(o[l+ht.SOFTNESS]-d)*f-h.data.softness)*r,a==Te.mixOut?(h.bendDirection=h.data.bendDirection,h.compress=h.data.compress,h.stretch=h.data.stretch):(h.bendDirection=o[l+ht.PREV_BEND_DIRECTION],h.compress=o[l+ht.PREV_COMPRESS]!=0,h.stretch=o[l+ht.PREV_STRETCH]!=0)):(h.mix+=(c+(o[l+ht.MIX]-c)*f-h.mix)*r,h.softness+=(d+(o[l+ht.SOFTNESS]-d)*f-h.softness)*r,a==Te.mixIn&&(h.bendDirection=o[l+ht.PREV_BEND_DIRECTION],h.compress=o[l+ht.PREV_COMPRESS]!=0,h.stretch=o[l+ht.PREV_STRETCH]!=0))}};let ke=ht;ke.ENTRIES=6,ke.PREV_TIME=-6,ke.PREV_MIX=-5,ke.PREV_SOFTNESS=-4,ke.PREV_BEND_DIRECTION=-3,ke.PREV_COMPRESS=-2,ke.PREV_STRETCH=-1,ke.MIX=1,ke.SOFTNESS=2,ke.BEND_DIRECTION=3,ke.COMPRESS=4,ke.STRETCH=5;const It=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*It.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(s,t,e,i,r,n){s*=It.ENTRIES,this.frames[s]=t,this.frames[s+It.ROTATE]=e,this.frames[s+It.TRANSLATE]=i,this.frames[s+It.SCALE]=r,this.frames[s+It.SHEAR]=n}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.transformConstraints[this.transformConstraintIndex];if(!h.active)return;if(e<o[0]){const f=h.data;switch(n){case j.setup:h.rotateMix=f.rotateMix,h.translateMix=f.translateMix,h.scaleMix=f.scaleMix,h.shearMix=f.shearMix;return;case j.first:h.rotateMix+=(f.rotateMix-h.rotateMix)*r,h.translateMix+=(f.translateMix-h.translateMix)*r,h.scaleMix+=(f.scaleMix-h.scaleMix)*r,h.shearMix+=(f.shearMix-h.shearMix)*r}return}let l=0,c=0,d=0,u=0;if(e>=o[o.length-It.ENTRIES]){const f=o.length;l=o[f+It.PREV_ROTATE],c=o[f+It.PREV_TRANSLATE],d=o[f+It.PREV_SCALE],u=o[f+It.PREV_SHEAR]}else{const f=pe.binarySearch(o,e,It.ENTRIES);l=o[f+It.PREV_ROTATE],c=o[f+It.PREV_TRANSLATE],d=o[f+It.PREV_SCALE],u=o[f+It.PREV_SHEAR];const p=o[f],m=this.getCurvePercent(f/It.ENTRIES-1,1-(e-p)/(o[f+It.PREV_TIME]-p));l+=(o[f+It.ROTATE]-l)*m,c+=(o[f+It.TRANSLATE]-c)*m,d+=(o[f+It.SCALE]-d)*m,u+=(o[f+It.SHEAR]-u)*m}if(n==j.setup){const f=h.data;h.rotateMix=f.rotateMix+(l-f.rotateMix)*r,h.translateMix=f.translateMix+(c-f.translateMix)*r,h.scaleMix=f.scaleMix+(d-f.scaleMix)*r,h.shearMix=f.shearMix+(u-f.shearMix)*r}else h.rotateMix+=(l-h.rotateMix)*r,h.translateMix+=(c-h.translateMix)*r,h.scaleMix+=(d-h.scaleMix)*r,h.shearMix+=(u-h.shearMix)*r}};let vi=It;vi.ENTRIES=5,vi.PREV_TIME=-5,vi.PREV_ROTATE=-4,vi.PREV_TRANSLATE=-3,vi.PREV_SCALE=-2,vi.PREV_SHEAR=-1,vi.ROTATE=1,vi.TRANSLATE=2,vi.SCALE=3,vi.SHEAR=4;const Ye=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*Ye.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(s,t,e){s*=Ye.ENTRIES,this.frames[s]=t,this.frames[s+Ye.VALUE]=e}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.pathConstraints[this.pathConstraintIndex];if(!h.active)return;if(e<o[0]){switch(n){case j.setup:h.position=h.data.position;return;case j.first:h.position+=(h.data.position-h.position)*r}return}let l=0;if(e>=o[o.length-Ye.ENTRIES])l=o[o.length+Ye.PREV_VALUE];else{const c=pe.binarySearch(o,e,Ye.ENTRIES);l=o[c+Ye.PREV_VALUE];const d=o[c],u=this.getCurvePercent(c/Ye.ENTRIES-1,1-(e-d)/(o[c+Ye.PREV_TIME]-d));l+=(o[c+Ye.VALUE]-l)*u}n==j.setup?h.position=h.data.position+(l-h.data.position)*r:h.position+=(l-h.position)*r}};let mo=Ye;mo.ENTRIES=2,mo.PREV_TIME=-2,mo.PREV_VALUE=-1,mo.VALUE=1;const oe=class extends Fe{constructor(s){super(s),this.frames=Q.newFloatArray(s*oe.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(s,t,e,i){s*=oe.ENTRIES,this.frames[s]=t,this.frames[s+oe.ROTATE]=e,this.frames[s+oe.TRANSLATE]=i}apply(s,t,e,i,r,n,a){const o=this.frames,h=s.pathConstraints[this.pathConstraintIndex];if(!h.active)return;if(e<o[0]){switch(n){case j.setup:h.rotateMix=h.data.rotateMix,h.translateMix=h.data.translateMix;return;case j.first:h.rotateMix+=(h.data.rotateMix-h.rotateMix)*r,h.translateMix+=(h.data.translateMix-h.translateMix)*r}return}let l=0,c=0;if(e>=o[o.length-oe.ENTRIES])l=o[o.length+oe.PREV_ROTATE],c=o[o.length+oe.PREV_TRANSLATE];else{const d=pe.binarySearch(o,e,oe.ENTRIES);l=o[d+oe.PREV_ROTATE],c=o[d+oe.PREV_TRANSLATE];const u=o[d],f=this.getCurvePercent(d/oe.ENTRIES-1,1-(e-u)/(o[d+oe.PREV_TIME]-u));l+=(o[d+oe.ROTATE]-l)*f,c+=(o[d+oe.TRANSLATE]-c)*f}n==j.setup?(h.rotateMix=h.data.rotateMix+(l-h.data.rotateMix)*r,h.translateMix=h.data.translateMix+(c-h.data.translateMix)*r):(h.rotateMix+=(l-h.rotateMix)*r,h.translateMix+=(c-h.translateMix)*r)}};let Pr=oe;Pr.ENTRIES=3,Pr.PREV_TIME=-3,Pr.PREV_ROTATE=-2,Pr.PREV_TRANSLATE=-1,Pr.ROTATE=1,Pr.TRANSLATE=2;const Mt=class{constructor(s){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new r_(this),this.propertyIDs=new Zw,this.animationsChanged=!1,this.trackEntryPool=new eE(()=>new Uc),this.data=s}update(s){s*=this.timeScale;const t=this.tracks;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r==null)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let n=s*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 o=r.trackLast-a.delay;if(o>=0){for(a.delay=0,a.trackTime+=r.timeScale==0?0:(o/r.timeScale+s)*a.timeScale,r.trackTime+=n,this.setCurrent(e,a,!0);a.mixingFrom!=null;)a.mixTime+=s,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,s)){let o=r.mixingFrom;for(r.mixingFrom=null,o!=null&&(o.mixingTo=null);o!=null;)this.queue.end(o),o=o.mixingFrom}r.trackTime+=n}this.queue.drain()}updateMixingFrom(s,t){const e=s.mixingFrom;if(e==null)return!0;const i=this.updateMixingFrom(e,t);return e.animationLast=e.nextAnimationLast,e.trackLast=e.nextTrackLast,s.mixTime>0&&s.mixTime>=s.mixDuration?((e.totalAlpha==0||s.mixDuration==0)&&(s.mixingFrom=e.mixingFrom,e.mixingFrom!=null&&(e.mixingFrom.mixingTo=s),s.interruptAlpha=e.interruptAlpha,this.queue.end(e)),i):(e.trackTime+=t*e.timeScale,s.mixTime+=t,!1)}apply(s){if(s==null)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const t=this.events,e=this.tracks;let i=!1;for(let a=0,o=e.length;a<o;a++){const h=e[a];if(h==null||h.delay>0)continue;i=!0;const l=a==0?j.first:h.mixBlend;let c=h.alpha;h.mixingFrom!=null?c*=this.applyMixingFrom(h,s,l):h.trackTime>=h.trackEnd&&h.next==null&&(c=0);const d=h.animationLast,u=h.getAnimationTime(),f=h.animation.timelines.length,p=h.animation.timelines;if(a==0&&c==1||l==j.add)for(let m=0;m<f;m++){const _=p[m];_ instanceof po?this.applyAttachmentTimeline(_,s,u,l,!0):_.apply(s,d,u,t,c,l,Te.mixIn)}else{const m=h.timelineMode,_=h.timelinesRotation.length==0;_&&Q.setArraySize(h.timelinesRotation,f<<1,null);const y=h.timelinesRotation;for(let v=0;v<f;v++){const g=p[v],x=m[v]==Mt.SUBSEQUENT?l:j.setup;g instanceof Le?this.applyRotateTimeline(g,s,u,c,x,y,v<<1,_):g instanceof po?this.applyAttachmentTimeline(g,s,u,l,!0):g.apply(s,d,u,t,c,x,Te.mixIn)}}this.queueEvents(h,u),t.length=0,h.nextAnimationLast=u,h.nextTrackLast=h.trackTime}const r=this.unkeyedState+Mt.SETUP,n=s.slots;for(let a=0,o=s.slots.length;a<o;a++){const h=n[a];if(h.attachmentState==r){const l=h.data.attachmentName;h.setAttachment(l==null?null:s.getAttachment(h.data.index,l))}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(s,t,e){const i=s.mixingFrom;i.mixingFrom!=null&&this.applyMixingFrom(i,t,e);let r=0;s.mixDuration==0?(r=1,e==j.first&&(e=j.setup)):(r=s.mixTime/s.mixDuration,r>1&&(r=1),e!=j.first&&(e=i.mixBlend));const n=r<i.eventThreshold?this.events:null,a=r<i.attachmentThreshold,o=r<i.drawOrderThreshold,h=i.animationLast,l=i.getAnimationTime(),c=i.animation.timelines.length,d=i.animation.timelines,u=i.alpha*s.interruptAlpha,f=u*(1-r);if(e==j.add)for(let p=0;p<c;p++)d[p].apply(t,h,l,n,f,e,Te.mixOut);else{const p=i.timelineMode,m=i.timelineHoldMix,_=i.timelinesRotation.length==0;_&&Q.setArraySize(i.timelinesRotation,c<<1,null);const y=i.timelinesRotation;i.totalAlpha=0;for(let v=0;v<c;v++){const g=d[v];let x=Te.mixOut,b,w=0;switch(p[v]){case Mt.SUBSEQUENT:if(!o&&g instanceof Nc)continue;b=e,w=f;break;case Mt.FIRST:b=j.setup,w=f;break;case Mt.HOLD_SUBSEQUENT:b=e,w=u;break;case Mt.HOLD_FIRST:b=j.setup,w=u;break;default:b=j.setup;const T=m[v];w=u*Math.max(0,1-T.mixTime/T.mixDuration);break}i.totalAlpha+=w,g instanceof Le?this.applyRotateTimeline(g,t,l,w,b,y,v<<1,_):g instanceof po?this.applyAttachmentTimeline(g,t,l,b,a):(o&&g instanceof Nc&&b==j.setup&&(x=Te.mixIn),g.apply(t,h,l,n,w,b,x))}}return s.mixDuration>0&&this.queueEvents(i,l),this.events.length=0,i.nextAnimationLast=l,i.nextTrackLast=i.trackTime,r}applyAttachmentTimeline(s,t,e,i,r){const n=t.slots[s.slotIndex];if(!n.bone.active)return;const a=s.frames;if(e<a[0])(i==j.setup||i==j.first)&&this.setAttachment(t,n,n.data.attachmentName,r);else{let o;e>=a[a.length-1]?o=a.length-1:o=pe.binarySearch(a,e)-1,this.setAttachment(t,n,s.attachmentNames[o],r)}n.attachmentState<=this.unkeyedState&&(n.attachmentState=this.unkeyedState+Mt.SETUP)}setAttachment(s,t,e,i){t.setAttachment(e==null?null:s.getAttachment(t.data.index,e)),i&&(t.attachmentState=this.unkeyedState+Mt.CURRENT)}applyRotateTimeline(s,t,e,i,r,n,a,o){if(o&&(n[a]=0),i==1){s.apply(t,0,e,null,1,r,Te.mixIn);return}const h=s,l=h.frames,c=t.bones[h.boneIndex];if(!c.active)return;let d=0,u=0;if(e<l[0])switch(r){case j.setup:c.rotation=c.data.rotation;default:return;case j.first:d=c.rotation,u=c.data.rotation}else if(d=r==j.setup?c.data.rotation:c.rotation,e>=l[l.length-Le.ENTRIES])u=c.data.rotation+l[l.length+Le.PREV_ROTATION];else{const m=pe.binarySearch(l,e,Le.ENTRIES),_=l[m+Le.PREV_ROTATION],y=l[m],v=h.getCurvePercent((m>>1)-1,1-(e-y)/(l[m+Le.PREV_TIME]-y));u=l[m+Le.ROTATION]-_,u-=(16384-(16384.499999999996-u/360|0))*360,u=_+u*v+c.data.rotation,u-=(16384-(16384.499999999996-u/360|0))*360}let f=0,p=u-d;if(p-=(16384-(16384.499999999996-p/360|0))*360,p==0)f=n[a];else{let m=0,_=0;o?(m=0,_=p):(m=n[a],_=n[a+1]);const y=p>0;let v=m>=0;k.signum(_)!=k.signum(p)&&Math.abs(_)<=90&&(Math.abs(m)>180&&(m+=360*k.signum(m)),v=y),f=p+m-m%360,v!=y&&(f+=360*k.signum(m)),n[a]=f}n[a+1]=p,d+=f*i,c.rotation=d-(16384-(16384.499999999996-d/360|0))*360}queueEvents(s,t){const e=s.animationStart,i=s.animationEnd,r=i-e,n=s.trackLast%r,a=this.events;let o=0;const h=a.length;for(;o<h;o++){const c=a[o];if(c.time<n)break;c.time>i||this.queue.event(s,c)}let l=!1;for(s.loop?l=r==0||n>s.trackTime%r:l=t>=i&&s.animationLast<i,l&&this.queue.complete(s);o<h;o++)a[o].time<e||this.queue.event(s,a[o])}clearTracks(){const s=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=s,this.queue.drain()}clearTrack(s){if(s>=this.tracks.length)return;const t=this.tracks[s];if(t==null)return;this.queue.end(t),this.disposeNext(t);let e=t;for(;;){const i=e.mixingFrom;if(i==null)break;this.queue.end(i),e.mixingFrom=null,e.mixingTo=null,e=i}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(s,t,e){const i=this.expandToIndex(s);this.tracks[s]=t,i!=null&&(e&&this.queue.interrupt(i),t.mixingFrom=i,i.mixingTo=t,t.mixTime=0,i.mixingFrom!=null&&i.mixDuration>0&&(t.interruptAlpha*=Math.min(1,i.mixTime/i.mixDuration)),i.timelinesRotation.length=0),this.queue.start(t)}setAnimation(s,t,e){const i=this.data.skeletonData.findAnimation(t);if(i==null)throw new Error(`Animation not found: ${t}`);return this.setAnimationWith(s,i,e)}setAnimationWith(s,t,e){if(t==null)throw new Error("animation cannot be null.");let i=!0,r=this.expandToIndex(s);r!=null&&(r.nextTrackLast==-1?(this.tracks[s]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.disposeNext(r),r=r.mixingFrom,i=!1):this.disposeNext(r));const n=this.trackEntry(s,t,e,r);return this.setCurrent(s,n,i),this.queue.drain(),n}addAnimation(s,t,e,i){const r=this.data.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);return this.addAnimationWith(s,r,e,i)}addAnimationWith(s,t,e,i){if(t==null)throw new Error("animation cannot be null.");let r=this.expandToIndex(s);if(r!=null)for(;r.next!=null;)r=r.next;const n=this.trackEntry(s,t,e,r);if(r==null)this.setCurrent(s,n,!0),this.queue.drain();else if(r.next=n,i<=0){const a=r.animationEnd-r.animationStart;a!=0?(r.loop?i+=a*(1+(r.trackTime/a|0)):i+=Math.max(a,r.trackTime),i-=this.data.getMix(r.animation,t)):i=r.trackTime}return n.delay=i,n}setEmptyAnimation(s,t){const e=this.setAnimationWith(s,Mt.emptyAnimation,!1);return e.mixDuration=t,e.trackEnd=t,e}addEmptyAnimation(s,t,e){e<=0&&(e-=t);const i=this.addAnimationWith(s,Mt.emptyAnimation,!1,e);return i.mixDuration=t,i.trackEnd=t,i}setEmptyAnimations(s){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,i=this.tracks.length;e<i;e++){const r=this.tracks[e];r!=null&&this.setEmptyAnimation(r.trackIndex,s)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(s){return s<this.tracks.length?this.tracks[s]:(Q.ensureArrayCapacity(this.tracks,s+1,null),this.tracks.length=s+1,null)}trackEntry(s,t,e,i){const r=this.trackEntryPool.obtain();return r.trackIndex=s,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=i==null?0:this.data.getMix(i.animation,t),r.mixBlend=j.replace,r}disposeNext(s){let t=s.next;for(;t!=null;)this.queue.dispose(t),t=t.next;s.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();for(let s=0,t=this.tracks.length;s<t;s++){let e=this.tracks[s];if(e!=null){for(;e.mixingFrom!=null;)e=e.mixingFrom;do(e.mixingFrom==null||e.mixBlend!=j.add)&&this.computeHold(e),e=e.mixingTo;while(e!=null)}}}computeHold(s){const t=s.mixingTo,e=s.animation.timelines,i=s.animation.timelines.length,r=Q.setArraySize(s.timelineMode,i);s.timelineHoldMix.length=0;const n=Q.setArraySize(s.timelineHoldMix,i),a=this.propertyIDs;if(t!=null&&t.holdPrevious){for(let o=0;o<i;o++)r[o]=a.add(e[o].getPropertyId())?Mt.HOLD_FIRST:Mt.HOLD_SUBSEQUENT;return}t:for(let o=0;o<i;o++){const h=e[o],l=h.getPropertyId();if(!a.add(l))r[o]=Mt.SUBSEQUENT;else if(t==null||h instanceof po||h instanceof Nc||h instanceof aE||!t.animation.hasTimeline(l))r[o]=Mt.FIRST;else{for(let c=t.mixingTo;c!=null;c=c.mixingTo)if(!c.animation.hasTimeline(l)){if(s.mixDuration>0){r[o]=Mt.HOLD_MIX,n[o]=c;continue t}break}r[o]=Mt.HOLD_FIRST}}}getCurrent(s){return s>=this.tracks.length?null:this.tracks[s]}addListener(s){if(s==null)throw new Error("listener cannot be null.");this.listeners.push(s)}removeListener(s){const t=this.listeners.indexOf(s);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(s,t,e){Mt.deprecatedWarning1||(Mt.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(s,t,e)}addAnimationByName(s,t,e,i){Mt.deprecatedWarning2||(Mt.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(s,t,e,i)}hasAnimation(s){return this.data.skeletonData.findAnimation(s)!==null}hasAnimationByName(s){return Mt.deprecatedWarning3||(Mt.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(s)}};let Ne=Mt;Ne.emptyAnimation=new pe("<empty>",[],0),Ne.SUBSEQUENT=0,Ne.FIRST=1,Ne.HOLD_SUBSEQUENT=2,Ne.HOLD_FIRST=3,Ne.HOLD_MIX=4,Ne.SETUP=1,Ne.CURRENT=2,Ne.deprecatedWarning1=!1,Ne.deprecatedWarning2=!1,Ne.deprecatedWarning3=!1;const Ni=class{constructor(){this.mixBlend=j.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 s=this.animationEnd-this.animationStart;return s==0?this.animationStart:this.trackTime%s+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(s){this.animationLast=s,this.nextAnimationLast=s}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}get time(){return Ni.deprecatedWarning1||(Ni.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(s){Ni.deprecatedWarning1||(Ni.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=s}get endTime(){return Ni.deprecatedWarning2||(Ni.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(s){Ni.deprecatedWarning2||(Ni.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=s}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};let Uc=Ni;Uc.deprecatedWarning1=!1,Uc.deprecatedWarning2=!1;const Gc=class{constructor(s){this.objects=[],this.drainDisabled=!1,this.animState=s}start(s){this.objects.push(Ee.start),this.objects.push(s),this.animState.animationsChanged=!0}interrupt(s){this.objects.push(Ee.interrupt),this.objects.push(s)}end(s){this.objects.push(Ee.end),this.objects.push(s),this.animState.animationsChanged=!0}dispose(s){this.objects.push(Ee.dispose),this.objects.push(s)}complete(s){this.objects.push(Ee.complete),this.objects.push(s)}event(s,t){this.objects.push(Ee.event),this.objects.push(s),this.objects.push(t)}deprecateStuff(){return Gc.deprecatedWarning1||(Gc.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 s=this.objects,t=this.animState.listeners;for(let e=0;e<s.length;e+=2){const i=s[e],r=s[e+1];switch(i){case Ee.start:r.listener!=null&&r.listener.start&&r.listener.start(r);for(let o=0;o<t.length;o++)t[o].start&&t[o].start(r);r.onStart&&this.deprecateStuff()&&r.onStart(r.trackIndex),this.animState.onStart&&this.deprecateStuff()&&this.deprecateStuff&&this.animState.onStart(r.trackIndex);break;case Ee.interrupt:r.listener!=null&&r.listener.interrupt&&r.listener.interrupt(r);for(let o=0;o<t.length;o++)t[o].interrupt&&t[o].interrupt(r);break;case Ee.end:r.listener!=null&&r.listener.end&&r.listener.end(r);for(let o=0;o<t.length;o++)t[o].end&&t[o].end(r);r.onEnd&&this.deprecateStuff()&&r.onEnd(r.trackIndex),this.animState.onEnd&&this.deprecateStuff()&&this.animState.onEnd(r.trackIndex);case Ee.dispose:r.listener!=null&&r.listener.dispose&&r.listener.dispose(r);for(let o=0;o<t.length;o++)t[o].dispose&&t[o].dispose(r);this.animState.trackEntryPool.free(r);break;case Ee.complete:r.listener!=null&&r.listener.complete&&r.listener.complete(r);for(let o=0;o<t.length;o++)t[o].complete&&t[o].complete(r);const n=k.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 Ee.event:const a=s[e+++2];r.listener!=null&&r.listener.event&&r.listener.event(r,a);for(let o=0;o<t.length;o++)t[o].event&&t[o].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 r_=Gc;r_.deprecatedWarning1=!1;var Ee=(s=>(s[s.start=0]="start",s[s.interrupt=1]="interrupt",s[s.end=2]="end",s[s.dispose=3]="dispose",s[s.complete=4]="complete",s[s.event=5]="event",s))(Ee||{});const Hc=class{constructor(s){if(this.animationToMixTime={},this.defaultMix=0,s==null)throw new Error("skeletonData cannot be null.");this.skeletonData=s}setMix(s,t,e){const i=this.skeletonData.findAnimation(s);if(i==null)throw new Error(`Animation not found: ${s}`);const r=this.skeletonData.findAnimation(t);if(r==null)throw new Error(`Animation not found: ${t}`);this.setMixWith(i,r,e)}setMixByName(s,t,e){Hc.deprecatedWarning1||(Hc.deprecatedWarning1=!0,console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.")),this.setMix(s,t,e)}setMixWith(s,t,e){if(s==null)throw new Error("from cannot be null.");if(t==null)throw new Error("to cannot be null.");const i=`${s.name}.${t.name}`;this.animationToMixTime[i]=e}getMix(s,t){const e=`${s.name}.${t.name}`,i=this.animationToMixTime[e];return i===void 0?this.defaultMix:i}};let n_=Hc;n_.deprecatedWarning1=!1;class a_{constructor(t,e,i){if(this.matrix=new gt,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=i,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,i,r,n,a,o){this.ax=t,this.ay=e,this.arotation=i,this.ascaleX=r,this.ascaleY=n,this.ashearX=a,this.ashearY=o,this.appliedValid=!0;const h=this.parent,l=this.matrix,c=this.skeleton.scaleX,d=-this.skeleton.scaleY;if(h==null){const _=this.skeleton,y=i+90+o;l.a=k.cosDeg(i+a)*r*c,l.c=k.cosDeg(y)*n*c,l.b=k.sinDeg(i+a)*r*d,l.d=k.sinDeg(y)*n*d,l.tx=t*c+_.x,l.ty=e*d+_.y;return}let u=h.matrix.a,f=h.matrix.c,p=h.matrix.b,m=h.matrix.d;switch(l.tx=u*t+f*e+h.matrix.tx,l.ty=p*t+m*e+h.matrix.ty,this.data.transformMode){case se.Normal:{const _=i+90+o,y=k.cosDeg(i+a)*r,v=k.cosDeg(_)*n,g=k.sinDeg(i+a)*r,x=k.sinDeg(_)*n;l.a=u*y+f*g,l.c=u*v+f*x,l.b=p*y+m*g,l.d=p*v+m*x;return}case se.OnlyTranslation:{const _=i+90+o;l.a=k.cosDeg(i+a)*r,l.c=k.cosDeg(_)*n,l.b=k.sinDeg(i+a)*r,l.d=k.sinDeg(_)*n;break}case se.NoRotationOrReflection:{let _=u*u+p*p,y=0;_>1e-4?(_=Math.abs(u*m-f*p)/_,u/=this.skeleton.scaleX,p/=this.skeleton.scaleY,f=p*_,m=u*_,y=Math.atan2(p,u)*k.radDeg):(u=0,p=0,y=90-Math.atan2(m,f)*k.radDeg);const v=i+a-y,g=i+o-y+90,x=k.cosDeg(v)*r,b=k.cosDeg(g)*n,w=k.sinDeg(v)*r,T=k.sinDeg(g)*n;l.a=u*x-f*w,l.c=u*b-f*T,l.b=p*x+m*w,l.d=p*b+m*T;break}case se.NoScale:case se.NoScaleOrReflection:{const _=k.cosDeg(i),y=k.sinDeg(i);let v=(u*_+f*y)/c,g=(p*_+m*y)/d,x=Math.sqrt(v*v+g*g);x>1e-5&&(x=1/x),v*=x,g*=x,x=Math.sqrt(v*v+g*g),this.data.transformMode==se.NoScale&&u*m-f*p<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY>0)&&(x=-x);const b=Math.PI/2+Math.atan2(g,v),w=Math.cos(b)*x,T=Math.sin(b)*x,E=k.cosDeg(a)*r,A=k.cosDeg(90+o)*n,P=k.sinDeg(a)*r,L=k.sinDeg(90+o)*n;l.a=v*E+w*P,l.c=v*A+w*L,l.b=g*E+T*P,l.d=g*A+T*L;break}}l.a*=c,l.c*=c,l.b*=d,l.d*=d}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)*k.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*k.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)*k.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)*k.radDeg;return}const i=t.matrix,r=1/(i.a*i.d-i.b*i.c),n=e.tx-i.tx,a=e.ty-i.ty;this.ax=n*i.d*r-a*i.c*r,this.ay=a*i.a*r-n*i.b*r;const o=r*i.d,h=r*i.a,l=r*i.c,c=r*i.b,d=o*e.a-l*e.b,u=o*e.c-l*e.d,f=h*e.b-c*e.a,p=h*e.d-c*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+f*f),this.ascaleX>1e-4){const m=d*p-u*f;this.ascaleY=m/this.ascaleX,this.ashearY=Math.atan2(d*u+f*p,m)*k.radDeg,this.arotation=Math.atan2(f,d)*k.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(u*u+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,u)*k.radDeg}worldToLocal(t){const e=this.matrix,i=e.a,r=e.c,n=e.b,a=e.d,o=1/(i*a-r*n),h=t.x-e.tx,l=t.y-e.ty;return t.x=h*a*o-l*r*o,t.y=l*i*o-h*n*o,t}localToWorld(t){const e=this.matrix,i=t.x,r=t.y;return t.x=i*e.a+r*e.c+e.tx,t.y=i*e.b+r*e.d+e.ty,t}worldToLocalRotation(t){const e=k.sinDeg(t),i=k.cosDeg(t),r=this.matrix;return Math.atan2(r.a*e-r.b*i,r.d*i-r.c*e)*k.radDeg}localToWorldRotation(t){const e=k.sinDeg(t),i=k.cosDeg(t),r=this.matrix;return Math.atan2(i*r.b+e*r.d,i*r.a+e*r.c)*k.radDeg}rotateWorld(t){const e=this.matrix,i=e.a,r=e.c,n=e.b,a=e.d,o=k.cosDeg(t),h=k.sinDeg(t);e.a=o*i-h*n,e.c=o*r-h*a,e.b=h*i+o*n,e.d=h*r+o*a,this.appliedValid=!1}}class oE{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 i=0;i<t.bones.length;i++)this.bones.push(e.findBone(t.bones[i].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,i,r,n,a,o){t.appliedValid||t.updateAppliedTransform();const h=t.parent.matrix,l=h.a;let c=h.c;const d=h.b;let u=h.d,f=-t.ashearX-t.arotation,p=0,m=0;switch(t.data.transformMode){case se.OnlyTranslation:p=e-t.worldX,m=i-t.worldY;break;case se.NoRotationOrReflection:const v=Math.abs(l*u-c*d)/(l*l+d*d),g=l/t.skeleton.scaleX,x=d/t.skeleton.scaleY;c=-x*v*t.skeleton.scaleX,u=g*v*t.skeleton.scaleY,f+=Math.atan2(x,g)*k.radDeg;default:const b=e-h.tx,w=i-h.ty,T=l*u-c*d;p=(b*u-w*c)/T-t.ax,m=(w*l-b*d)/T-t.ay}f+=Math.atan2(m,p)*k.radDeg,t.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let _=t.ascaleX,y=t.ascaleY;if(r||n){switch(t.data.transformMode){case se.NoScale:case se.NoScaleOrReflection:p=e-t.worldX,m=i-t.worldY}const v=t.data.length*_,g=Math.sqrt(p*p+m*m);if(r&&g<v||n&&g>v&&v>1e-4){const x=(g/v-1)*o+1;_*=x,a&&(y*=x)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*o,_,y,t.ashearX,t.ashearY)}apply2(t,e,i,r,n,a,o,h){if(h==0){e.updateWorldTransform();return}t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();const l=t.ax,c=t.ay;let d=t.ascaleX,u=d,f=t.ascaleY,p=e.ascaleX;const m=t.matrix;let _=0,y=0,v=0;d<0?(d=-d,_=180,v=-1):(_=0,v=1),f<0&&(f=-f,v=-v),p<0?(p=-p,y=180):y=0;const g=e.ax;let x=0,b=0,w=0,T=m.a,E=m.c,A=m.b,P=m.d;const L=Math.abs(d-f)<=1e-4;L?(x=e.ay,b=T*g+E*x+m.tx,w=A*g+P*x+m.ty):(x=0,b=T*g+m.tx,w=A*g+m.ty);const M=t.parent.matrix;T=M.a,E=M.c,A=M.b,P=M.d;const S=1/(T*P-E*A);let C=b-M.tx,R=w-M.ty;const N=(C*P-R*E)*S-l,F=(R*T-C*A)*S-c,B=Math.sqrt(N*N+F*F);let W=e.data.length*p,I,D;if(B<1e-4){this.apply1(t,i,r,!1,a,!1,h),e.updateWorldTransformWith(g,x,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}C=i-M.tx,R=r-M.ty;let $=(C*P-R*E)*S-l,Y=(R*T-C*A)*S-c,U=$*$+Y*Y;if(o!=0){o*=d*(p+1)/2;const lt=Math.sqrt(U),vt=lt-B-W*d+o;if(vt>0){let Dt=Math.min(1,vt/(o*2))-1;Dt=(vt-o*(1-Dt*Dt))/lt,$-=Dt*$,Y-=Dt*Y,U=$*$+Y*Y}}t:if(L){W*=d;let lt=(U-B*B-W*W)/(2*B*W);lt<-1?lt=-1:lt>1&&(lt=1,a&&(u*=(Math.sqrt(U)/(B+W)-1)*h+1)),D=Math.acos(lt)*n,T=B+W*lt,E=W*Math.sin(D),I=Math.atan2(Y*T-$*E,$*T+Y*E)}else{T=d*W,E=f*W;const lt=T*T,vt=E*E,Dt=Math.atan2(Y,$);A=vt*B*B+lt*U-lt*vt;const kt=-2*vt*B,_t=vt-lt;if(P=kt*kt-4*_t*A,P>=0){let Dr=Math.sqrt(P);kt<0&&(Dr=-Dr),Dr=-(kt+Dr)/2;const T_=Dr/_t,w_=A/Dr,Br=Math.abs(T_)<Math.abs(w_)?T_:w_;if(Br*Br<=U){R=Math.sqrt(U-Br*Br)*n,I=Dt-Math.atan2(R,Br),D=Math.atan2(R/f,(Br-B)/d);break t}}let Bt=k.PI,wt=B-T,me=wt*wt,Ae=0,cs=0,Mr=B+T,us=Mr*Mr,b_=0;A=-T*B/(lt-vt),A>=-1&&A<=1&&(A=Math.acos(A),C=T*Math.cos(A)+B,R=E*Math.sin(A),P=C*C+R*R,P<me&&(Bt=A,me=P,wt=C,Ae=R),P>us&&(cs=A,us=P,Mr=C,b_=R)),U<=(me+us)/2?(I=Dt-Math.atan2(Ae*n,wt),D=Bt*n):(I=Dt-Math.atan2(b_*n,Mr),D=cs*n)}const rt=Math.atan2(x,g)*v;let dt=t.arotation;I=(I-rt)*k.radDeg+_-dt,I>180?I-=360:I<-180&&(I+=360),t.updateWorldTransformWith(l,c,dt+I*h,u,t.ascaleY,0,0),dt=e.arotation,D=((D+rt)*k.radDeg-e.ashearX)*v+y-dt,D>180?D-=360:D<-180&&(D+=360),e.updateWorldTransformWith(g,x,dt+D*h,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}var Rr=(s=>(s[s.Length=0]="Length",s[s.Fixed=1]="Fixed",s[s.Percent=2]="Percent",s))(Rr||{});const Vs=class{constructor(s,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,s==null)throw new Error("data cannot be null.");if(t==null)throw new Error("skeleton cannot be null.");this.data=s,this.bones=new Array;for(let e=0,i=s.bones.length;e<i;e++)this.bones.push(t.findBone(s.bones[e].name));this.target=t.findSlot(s.target.name),this.position=s.position,this.spacing=s.spacing,this.rotateMix=s.rotateMix,this.translateMix=s.translateMix}isActive(){return this.active}apply(){this.update()}update(){const s=this.target.getAttachment();if(!(s instanceof An))return;const t=this.rotateMix,e=this.translateMix,i=e>0,r=t>0;if(!i&&!r)return;const n=this.data,a=n.spacingMode,o=a==Rr.Length,h=n.rotateMode,l=h==Gs.Tangent,c=h==Gs.ChainScale,d=this.bones.length,u=l?d:d+1,f=this.bones,p=Q.setArraySize(this.spaces,u);let m=null;const _=this.spacing;if(c||o){c&&(m=Q.setArraySize(this.lengths,d));for(let w=0,T=u-1;w<T;){const E=f[w],A=E.data.length;if(A<Vs.epsilon)c&&(m[w]=0),p[++w]=0;else{const P=A*E.matrix.a,L=A*E.matrix.b,M=Math.sqrt(P*P+L*L);c&&(m[w]=M),p[++w]=(o?A+_:_)*M/A}}}else for(let w=1;w<u;w++)p[w]=_;const y=this.computeWorldPositions(s,u,l,n.positionMode==uo.Percent,a==Rr.Percent);let v=y[0],g=y[1],x=n.offsetRotation,b=!1;if(x==0)b=h==Gs.Chain;else{b=!1;const w=this.target.bone.matrix;x*=w.a*w.d-w.b*w.c>0?k.degRad:-k.degRad}for(let w=0,T=3;w<d;w++,T+=3){const E=f[w],A=E.matrix;A.tx+=(v-A.tx)*e,A.ty+=(g-A.ty)*e;const P=y[T],L=y[T+1],M=P-v,S=L-g;if(c){const C=m[w];if(C!=0){const R=(Math.sqrt(M*M+S*S)/C-1)*t+1;A.a*=R,A.b*=R}}if(v=P,g=L,r){const C=A.a,R=A.c,N=A.b,F=A.d;let B=0,W=0,I=0;if(l&&(l?B=y[T-1]:p[w+1]==0?B=y[T+2]:B=Math.atan2(S,M)),B-=Math.atan2(N,C),b){W=Math.cos(B),I=Math.sin(B);const D=E.data.length;v+=(D*(W*C-I*N)-M)*t,g+=(D*(I*C+W*N)-S)*t}else B+=x;B>k.PI?B-=k.PI2:B<-k.PI&&(B+=k.PI2),B*=t,W=Math.cos(B),I=Math.sin(B),A.a=W*C-I*N,A.c=W*R-I*F,A.b=I*C+W*N,A.d=I*R+W*F}E.appliedValid=!1}}computeWorldPositions(s,t,e,i,r){const n=this.target;let a=this.position;const o=this.spaces,h=Q.setArraySize(this.positions,t*3+2);let l=null;const c=s.closed;let d=s.worldVerticesLength,u=d/6,f=Vs.NONE;if(!s.constantSpeed){const B=s.lengths;u-=c?1:2;const W=B[u];if(i&&(a*=W),r)for(let I=0;I<t;I++)o[I]*=W;l=Q.setArraySize(this.world,8);for(let I=0,D=0,$=0;I<t;I++,D+=3){const Y=o[I];a+=Y;let U=a;if(c)U%=W,U<0&&(U+=W),$=0;else if(U<0){f!=Vs.BEFORE&&(f=Vs.BEFORE,s.computeWorldVertices(n,2,4,l,0,2)),this.addBeforePosition(U,l,0,h,D);continue}else if(U>W){f!=Vs.AFTER&&(f=Vs.AFTER,s.computeWorldVertices(n,d-6,4,l,0,2)),this.addAfterPosition(U-W,l,0,h,D);continue}for(;;$++){const rt=B[$];if(!(U>rt)){if($==0)U/=rt;else{const dt=B[$-1];U=(U-dt)/(rt-dt)}break}}$!=f&&(f=$,c&&$==u?(s.computeWorldVertices(n,d-4,4,l,0,2),s.computeWorldVertices(n,0,4,l,4,2)):s.computeWorldVertices(n,$*6+2,8,l,0,2)),this.addCurvePosition(U,l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7],h,D,e||I>0&&Y==0)}return h}c?(d+=2,l=Q.setArraySize(this.world,d),s.computeWorldVertices(n,2,d-4,l,0,2),s.computeWorldVertices(n,0,2,l,d-4,2),l[d-2]=l[0],l[d-1]=l[1]):(u--,d-=4,l=Q.setArraySize(this.world,d),s.computeWorldVertices(n,2,d,l,0,2));const p=Q.setArraySize(this.curves,u);let m=0,_=l[0],y=l[1],v=0,g=0,x=0,b=0,w=0,T=0,E=0,A=0,P=0,L=0,M=0,S=0,C=0,R=0;for(let B=0,W=2;B<u;B++,W+=6)v=l[W],g=l[W+1],x=l[W+2],b=l[W+3],w=l[W+4],T=l[W+5],E=(_-v*2+x)*.1875,A=(y-g*2+b)*.1875,P=((v-x)*3-_+w)*.09375,L=((g-b)*3-y+T)*.09375,M=E*2+P,S=A*2+L,C=(v-_)*.75+E+P*.16666667,R=(g-y)*.75+A+L*.16666667,m+=Math.sqrt(C*C+R*R),C+=M,R+=S,M+=P,S+=L,m+=Math.sqrt(C*C+R*R),C+=M,R+=S,m+=Math.sqrt(C*C+R*R),C+=M+P,R+=S+L,m+=Math.sqrt(C*C+R*R),p[B]=m,_=w,y=T;if(i&&(a*=m),r)for(let B=0;B<t;B++)o[B]*=m;const N=this.segments;let F=0;for(let B=0,W=0,I=0,D=0;B<t;B++,W+=3){const $=o[B];a+=$;let Y=a;if(c)Y%=m,Y<0&&(Y+=m),I=0;else if(Y<0){this.addBeforePosition(Y,l,0,h,W);continue}else if(Y>m){this.addAfterPosition(Y-m,l,d-4,h,W);continue}for(;;I++){const U=p[I];if(!(Y>U)){if(I==0)Y/=U;else{const rt=p[I-1];Y=(Y-rt)/(U-rt)}break}}if(I!=f){f=I;let U=I*6;for(_=l[U],y=l[U+1],v=l[U+2],g=l[U+3],x=l[U+4],b=l[U+5],w=l[U+6],T=l[U+7],E=(_-v*2+x)*.03,A=(y-g*2+b)*.03,P=((v-x)*3-_+w)*.006,L=((g-b)*3-y+T)*.006,M=E*2+P,S=A*2+L,C=(v-_)*.3+E+P*.16666667,R=(g-y)*.3+A+L*.16666667,F=Math.sqrt(C*C+R*R),N[0]=F,U=1;U<8;U++)C+=M,R+=S,M+=P,S+=L,F+=Math.sqrt(C*C+R*R),N[U]=F;C+=M,R+=S,F+=Math.sqrt(C*C+R*R),N[8]=F,C+=M+P,R+=S+L,F+=Math.sqrt(C*C+R*R),N[9]=F,D=0}for(Y*=F;;D++){const U=N[D];if(!(Y>U)){if(D==0)Y/=U;else{const rt=N[D-1];Y=D+(Y-rt)/(U-rt)}break}}this.addCurvePosition(Y*.1,_,y,v,g,x,b,w,T,h,W,e||B>0&&$==0)}return h}addBeforePosition(s,t,e,i,r){const n=t[e],a=t[e+1],o=t[e+2]-n,h=t[e+3]-a,l=Math.atan2(h,o);i[r]=n+s*Math.cos(l),i[r+1]=a+s*Math.sin(l),i[r+2]=l}addAfterPosition(s,t,e,i,r){const n=t[e+2],a=t[e+3],o=n-t[e],h=a-t[e+1],l=Math.atan2(h,o);i[r]=n+s*Math.cos(l),i[r+1]=a+s*Math.sin(l),i[r+2]=l}addCurvePosition(s,t,e,i,r,n,a,o,h,l,c,d){(s==0||isNaN(s))&&(s=1e-4);const u=s*s,f=u*s,p=1-s,m=p*p,_=m*p,y=p*s,v=y*3,g=p*v,x=v*s,b=t*_+i*g+n*x+o*f,w=e*_+r*g+a*x+h*f;l[c]=b,l[c+1]=w,d&&(l[c+2]=Math.atan2(w-(e*m+r*y*2+a*u),b-(t*m+i*y*2+n*u)))}};let Sn=Vs;Sn.NONE=-1,Sn.BEFORE=-2,Sn.AFTER=-3,Sn.epsilon=1e-5;class hE{constructor(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new iE,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 i=0;i<t.bones.length;i++)this.bones.push(e.findBone(t.bones[i].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,i=this.scaleMix,r=this.shearMix,n=this.target,a=n.matrix,o=a.a,h=a.c,l=a.b,c=a.d,d=o*c-h*l>0?k.degRad:-k.degRad,u=this.data.offsetRotation*d,f=this.data.offsetShearY*d,p=this.bones;for(let m=0,_=p.length;m<_;m++){const y=p[m];let v=!1;const g=y.matrix;if(t!=0){const x=g.a,b=g.c,w=g.b,T=g.d;let E=Math.atan2(l,o)-Math.atan2(w,x)+u;E>k.PI?E-=k.PI2:E<-k.PI&&(E+=k.PI2),E*=t;const A=Math.cos(E),P=Math.sin(E);g.a=A*x-P*w,g.c=A*b-P*T,g.b=P*x+A*w,g.d=P*b+A*T,v=!0}if(e!=0){const x=this.temp;n.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.tx+=(x.x-g.tx)*e,g.ty+=(x.y-g.ty)*e,v=!0}if(i>0){let x=Math.sqrt(g.a*g.a+g.b*g.b),b=Math.sqrt(o*o+l*l);x>1e-5&&(x=(x+(b-x+this.data.offsetScaleX)*i)/x),g.a*=x,g.b*=x,x=Math.sqrt(g.c*g.c+g.d*g.d),b=Math.sqrt(h*h+c*c),x>1e-5&&(x=(x+(b-x+this.data.offsetScaleY)*i)/x),g.c*=x,g.d*=x,v=!0}if(r>0){const x=g.c,b=g.d,w=Math.atan2(b,x);let T=Math.atan2(c,h)-Math.atan2(l,o)-(w-Math.atan2(g.b,g.a));T>k.PI?T-=k.PI2:T<-k.PI&&(T+=k.PI2),T=w+(T+f)*r;const E=Math.sqrt(x*x+b*b);g.c=Math.cos(T)*E,g.d=Math.sin(T)*E,v=!0}v&&(y.appliedValid=!1)}}applyRelativeWorld(){const t=this.rotateMix,e=this.translateMix,i=this.scaleMix,r=this.shearMix,n=this.target,a=n.matrix,o=a.a,h=a.c,l=a.b,c=a.d,d=o*c-h*l>0?k.degRad:-k.degRad,u=this.data.offsetRotation*d,f=this.data.offsetShearY*d,p=this.bones;for(let m=0,_=p.length;m<_;m++){const y=p[m];let v=!1;const g=y.matrix;if(t!=0){const x=g.a,b=g.c,w=g.b,T=g.d;let E=Math.atan2(l,o)+u;E>k.PI?E-=k.PI2:E<-k.PI&&(E+=k.PI2),E*=t;const A=Math.cos(E),P=Math.sin(E);g.a=A*x-P*w,g.c=A*b-P*T,g.b=P*x+A*w,g.d=P*b+A*T,v=!0}if(e!=0){const x=this.temp;n.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),g.tx+=x.x*e,g.ty+=x.y*e,v=!0}if(i>0){let x=(Math.sqrt(o*o+l*l)-1+this.data.offsetScaleX)*i+1;g.a*=x,g.b*=x,x=(Math.sqrt(h*h+c*c)-1+this.data.offsetScaleY)*i+1,g.c*=x,g.d*=x,v=!0}if(r>0){let x=Math.atan2(c,h)-Math.atan2(l,o);x>k.PI?x-=k.PI2:x<-k.PI&&(x+=k.PI2);const b=g.c,w=g.d;x=Math.atan2(w,b)+(x-k.PI/2+f)*r;const T=Math.sqrt(b*b+w*w);g.c=Math.cos(x)*T,g.d=Math.sin(x)*T,v=!0}v&&(y.appliedValid=!1)}}applyAbsoluteLocal(){const t=this.rotateMix,e=this.translateMix,i=this.scaleMix,r=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const a=this.bones;for(let o=0,h=a.length;o<h;o++){const l=a[o];l.appliedValid||l.updateAppliedTransform();let c=l.arotation;if(t!=0){let _=n.arotation-c+this.data.offsetRotation;_-=(16384-(16384.499999999996-_/360|0))*360,c+=_*t}let d=l.ax,u=l.ay;e!=0&&(d+=(n.ax-d+this.data.offsetX)*e,u+=(n.ay-u+this.data.offsetY)*e);let f=l.ascaleX,p=l.ascaleY;i>0&&(f>1e-5&&(f=(f+(n.ascaleX-f+this.data.offsetScaleX)*i)/f),p>1e-5&&(p=(p+(n.ascaleY-p+this.data.offsetScaleY)*i)/p));const m=l.ashearY;if(r>0){let _=n.ashearY-m+this.data.offsetShearY;_-=(16384-(16384.499999999996-_/360|0))*360,l.shearY+=_*r}l.updateWorldTransformWith(d,u,c,f,p,l.ashearX,m)}}applyRelativeLocal(){const t=this.rotateMix,e=this.translateMix,i=this.scaleMix,r=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const a=this.bones;for(let o=0,h=a.length;o<h;o++){const l=a[o];l.appliedValid||l.updateAppliedTransform();let c=l.arotation;t!=0&&(c+=(n.arotation+this.data.offsetRotation)*t);let d=l.ax,u=l.ay;e!=0&&(d+=(n.ax+this.data.offsetX)*e,u+=(n.ay+this.data.offsetY)*e);let f=l.ascaleX,p=l.ascaleY;i>0&&(f>1e-5&&(f*=(n.ascaleX-1+this.data.offsetScaleX)*i+1),p>1e-5&&(p*=(n.ascaleY-1+this.data.offsetScaleY)*i+1));let m=l.ashearY;r>0&&(m+=(n.ashearY+this.data.offsetShearY)*r),l.updateWorldTransformWith(d,u,c,f,p,l.ashearX,m)}}}const Cn=class{constructor(s){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,s==null)throw new Error("data cannot be null.");this.data=s,this.bones=new Array;for(let t=0;t<s.bones.length;t++){const e=s.bones[t];let i;if(e.parent==null)i=new a_(e,this,null);else{const r=this.bones[e.parent.index];i=new a_(e,this,r),r.children.push(i)}this.bones.push(i)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<s.slots.length;t++){const e=s.slots[t],i=this.bones[e.boneData.index],r=new s_(e,i);this.slots.push(r),this.drawOrder.push(r)}this.ikConstraints=new Array;for(let t=0;t<s.ikConstraints.length;t++){const e=s.ikConstraints[t];this.ikConstraints.push(new oE(e,this))}this.transformConstraints=new Array;for(let t=0;t<s.transformConstraints.length;t++){const e=s.transformConstraints[t];this.transformConstraints.push(new hE(e,this))}this.pathConstraints=new Array;for(let t=0;t<s.pathConstraints.length;t++){const e=s.pathConstraints[t];this.pathConstraints.push(new Sn(e,this))}this.color=new we(1,1,1,1),this.updateCache()}updateCache(){const s=this._updateCache;s.length=0,this.updateCacheReset.length=0;const t=this.bones;for(let l=0,c=t.length;l<c;l++){const d=t[l];d.sorted=d.data.skinRequired,d.active=!d.sorted}if(this.skin!=null){const l=this.skin.bones;for(let c=0,d=this.skin.bones.length;c<d;c++){let u=this.bones[l[c].index];do u.sorted=!1,u.active=!0,u=u.parent;while(u!=null)}}const e=this.ikConstraints,i=this.transformConstraints,r=this.pathConstraints,n=e.length,a=i.length,o=r.length,h=n+a+o;t:for(let l=0;l<h;l++){for(let c=0;c<n;c++){const d=e[c];if(d.data.order==l){this.sortIkConstraint(d);continue t}}for(let c=0;c<a;c++){const d=i[c];if(d.data.order==l){this.sortTransformConstraint(d);continue t}}for(let c=0;c<o;c++){const d=r[c];if(d.data.order==l){this.sortPathConstraint(d);continue t}}}for(let l=0,c=t.length;l<c;l++)this.sortBone(t[l])}sortIkConstraint(s){if(s.active=s.target.isActive()&&(!s.data.skinRequired||this.skin!=null&&Q.contains(this.skin.constraints,s.data,!0)),!s.active)return;const t=s.target;this.sortBone(t);const e=s.bones,i=e[0];if(this.sortBone(i),e.length>1){const r=e[e.length-1];this._updateCache.indexOf(r)>-1||this.updateCacheReset.push(r)}this._updateCache.push(s),this.sortReset(i.children),e[e.length-1].sorted=!0}sortPathConstraint(s){if(s.active=s.target.bone.isActive()&&(!s.data.skinRequired||this.skin!=null&&Q.contains(this.skin.constraints,s.data,!0)),!s.active)return;const t=s.target,e=t.data.index,i=t.bone;this.skin!=null&&this.sortPathConstraintAttachment(this.skin,e,i),this.data.defaultSkin!=null&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,e,i);for(let o=0,h=this.data.skins.length;o<h;o++)this.sortPathConstraintAttachment(this.data.skins[o],e,i);const r=t.getAttachment();r instanceof An&&this.sortPathConstraintAttachmentWith(r,i);const n=s.bones,a=n.length;for(let o=0;o<a;o++)this.sortBone(n[o]);this._updateCache.push(s);for(let o=0;o<a;o++)this.sortReset(n[o].children);for(let o=0;o<a;o++)n[o].sorted=!0}sortTransformConstraint(s){if(s.active=s.target.isActive()&&(!s.data.skinRequired||this.skin!=null&&Q.contains(this.skin.constraints,s.data,!0)),!s.active)return;this.sortBone(s.target);const t=s.bones,e=t.length;if(s.data.local)for(let i=0;i<e;i++){const r=t[i];this.sortBone(r.parent),this._updateCache.indexOf(r)>-1||this.updateCacheReset.push(r)}else for(let i=0;i<e;i++)this.sortBone(t[i]);this._updateCache.push(s);for(let i=0;i<e;i++)this.sortReset(t[i].children);for(let i=0;i<e;i++)t[i].sorted=!0}sortPathConstraintAttachment(s,t,e){const i=s.attachments[t];if(i)for(const r in i)this.sortPathConstraintAttachmentWith(i[r],e)}sortPathConstraintAttachmentWith(s,t){if(!(s instanceof An))return;const e=s.bones;if(e==null)this.sortBone(t);else{const i=this.bones;let r=0;for(;r<e.length;){const n=e[r++];for(let a=r+n;r<a;r++){const o=e[r];this.sortBone(i[o])}}}}sortBone(s){if(s.sorted)return;const t=s.parent;t!=null&&this.sortBone(t),s.sorted=!0,this._updateCache.push(s)}sortReset(s){for(let t=0,e=s.length;t<e;t++){const i=s[t];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(){const s=this.updateCacheReset;for(let e=0,i=s.length;e<i;e++){const r=s[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,i=t.length;e<i;e++)t[e].update()}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){const s=this.bones;for(let r=0,n=s.length;r<n;r++)s[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],o=a.data;a.rotateMix=o.rotateMix,a.translateMix=o.translateMix,a.scaleMix=o.scaleMix,a.shearMix=o.shearMix}const i=this.pathConstraints;for(let r=0,n=i.length;r<n;r++){const a=i[r],o=a.data;a.position=o.position,a.spacing=o.spacing,a.rotateMix=o.rotateMix,a.translateMix=o.translateMix}}setSlotsToSetupPose(){const s=this.slots;Q.arrayCopy(s,0,this.drawOrder,0,s.length);for(let t=0,e=s.length;t<e;t++)s[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(s){if(s==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r.data.name==s)return r}return null}findBoneIndex(s){if(s==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,i=t.length;e<i;e++)if(t[e].data.name==s)return e;return-1}findSlot(s){if(s==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r.data.name==s)return r}return null}findSlotIndex(s){if(s==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,i=t.length;e<i;e++)if(t[e].data.name==s)return e;return-1}setSkinByName(s){const t=this.data.findSkin(s);if(t==null)throw new Error(`Skin not found: ${s}`);this.setSkin(t)}setSkin(s){if(s!=this.skin){if(s!=null)if(this.skin!=null)s.attachAll(this,this.skin);else{const t=this.slots;for(let e=0,i=t.length;e<i;e++){const r=t[e],n=r.data.attachmentName;if(n!=null){const a=s.getAttachment(e,n);a!=null&&r.setAttachment(a)}}}this.skin=s,this.updateCache()}}getAttachmentByName(s,t){return this.getAttachment(this.data.findSlotIndex(s),t)}getAttachment(s,t){if(t==null)throw new Error("attachmentName cannot be null.");if(this.skin!=null){const e=this.skin.getAttachment(s,t);if(e!=null)return e}return this.data.defaultSkin!=null?this.data.defaultSkin.getAttachment(s,t):null}setAttachment(s,t){if(s==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let i=0,r=e.length;i<r;i++){const n=e[i];if(n.data.name==s){let a=null;if(t!=null&&(a=this.getAttachment(i,t),a==null))throw new Error(`Attachment not found: ${t}, for slot: ${s}`);n.setAttachment(a);return}}throw new Error(`Slot not found: ${s}`)}findIkConstraint(s){if(s==null)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r.data.name==s)return r}return null}findTransformConstraint(s){if(s==null)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r.data.name==s)return r}return null}findPathConstraint(s){if(s==null)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let e=0,i=t.length;e<i;e++){const r=t[e];if(r.data.name==s)return r}return null}getBounds(s,t,e=new Array(2)){if(s==null)throw new Error("offset cannot be null.");if(t==null)throw new Error("size cannot be null.");const i=this.drawOrder;let r=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(let h=0,l=i.length;h<l;h++){const c=i[h];if(!c.bone.active)continue;let d=0,u=null;const f=c.getAttachment();if(f instanceof et)d=8,u=Q.setArraySize(e,d,0),f.computeWorldVertices(c.bone,u,0,2);else if(f instanceof fo){const p=f;d=p.worldVerticesLength,u=Q.setArraySize(e,d,0),p.computeWorldVertices(c,0,d,u,0,2)}if(u!=null)for(let p=0,m=u.length;p<m;p+=2){const _=u[p],y=u[p+1];r=Math.min(r,_),n=Math.min(n,y),a=Math.max(a,_),o=Math.max(o,y)}}s.set(r,n),t.set(a-r,o-n)}update(s){this.time+=s}get flipX(){return this.scaleX==-1}set flipX(s){Cn.deprecatedWarning1||(Cn.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleX=s?1:-1}get flipY(){return this.scaleY==-1}set flipY(s){Cn.deprecatedWarning1||(Cn.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleY=s?1:-1}};let o_=Cn;o_.deprecatedWarning1=!1,se.Normal,se.OnlyTranslation,se.NoRotationOrReflection,se.NoScale,se.NoScaleOrReflection,uo.Fixed,uo.Percent,Rr.Length,Rr.Fixed,Rr.Percent,Gs.Tangent,Gs.Chain,Gs.ChainScale,K.NORMAL,K.ADD,K.MULTIPLY,K.SCREEN;class lE extends Lc{createSkeleton(t){this.skeleton=new o_(t),this.skeleton.updateWorldTransform(),this.stateData=new n_(t),this.state=new Ne(this.stateData)}}class cE extends lE{constructor(t,e){const{followPointList:i,visible:r=!1}=e||{};let n;typeof t=="string"?n=qi.get(t).spineData:n=t.spineData,super(n),this._followDots=[],this._isStart=!1,this.visible=r,this.autoUpdate=!1,i!=null&&i.length&&(i==null||i.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),ft.system.add(this._loopFn)}setAnimation(t="animation",e=!1){return new Promise(i=>{this.visible=!0,this.state.setAnimation(0,t,e).listener={complete:()=>{i()}}})}addAnimation(t="animation",e=!1,i=0){return new Promise(r=>{this.visible=!0,this.state.addAnimation(0,t,e,i).listener={complete:()=>{r()}}})}setSkin(t){this.skeleton.setSkinByName(t)}destroyAll(){ft.system.remove(this._loopFn),this.destroy()}_loop(){this.update(ft.system.deltaMS/1e3),this._updateFollowPoint()}_updateFollowPoint(){this._followDots.length!==0&&(this._followDots.forEach(t=>{const{worldX:e,worldY:i}=t.point,r=t.point.getWorldRotationX()*(Math.PI/180),n=t.point.getWorldScaleX(),a=t.point.getWorldScaleY();t.onUpdate?t.onUpdate({x:e,y:i,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,i+1080/2-t.follow.height/2))}),this._isStart||(this._isStart=!0,this._followDots.forEach(t=>{ct.to(t.follow,{alpha:1,duration:.25,delay:.15})})))}}const Ws=(s,t,e,i=!1)=>{s.cursor="pointer",s.eventMode="static";const r=n=>{n.button!==2&&e(n)};i?s.once(t,r):s.on(t,r)};class uE extends bt{constructor(t){super(),this.disabled=!1;const{texture:e,hoverTexture:i,tintColor:r,hoverTintColor:n="#fff",disabledColor:a="#999"}=t;this._texture=e,this._hoverTexture=i,this._tintColor=r,this._disabledColor=a,this._btn=new _e(e),this.addChild(this._btn),this._btn.anchor.set(.5),r&&(this._btn.tint=r),Ws(this._btn,"pointerenter",()=>{this.disabled||(this._btn.tint=n,this._hoverTexture&&(this._btn._texture=this._hoverTexture))}),Ws(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 dE extends Tn{constructor(t){const{sprite:e,onClick:i}=t;super(e.width,e.height),this.addChild(e),e.anchor.set(.5),e.x=e.width/2,e.y=e.height/2,Ws(this,"pointerenter",()=>{ct.to(e,{duration:.25,rotation:180*(Math.PI/180)})}),Ws(this,"pointerleave",()=>{e.alpha=1,ct.to(e,{duration:.25,rotation:0})}),Ws(this,"pointerdown",()=>{e.alpha=.5}),Ws(this,"pointerup",()=>{i()})}}class fE extends bt{constructor(t){super(),this._maskUI=new lc({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,ct.to(this._maskUI,{duration:.25,alpha:.5}),ct.to(this._drawerContainer,{duration:.25,ease:"power1.out",y:this._maskUI.height-this._drawerContainer.height})}async close(){ct.to(this._drawerContainer,{duration:.25,y:this._maskUI.height}),await ct.to(this._maskUI,{duration:.25,delay:.125,alpha:0})}}class pE 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 i=new Fc({text:"",fontWeight:"bold",fontSize:36,shadow:["#000",45,3,5],fontColor:"#fff"});this._paramTxts[e]=i,i.x=0,i.y=i.height*e,this.addChild(i),i.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++},ft.shared.add(()=>{const t=ft.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},zi.UTILITY)}_setTxtInfo(t,e){const i=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=[()=>(i(e),`Fps:${e}`),()=>(r(e),`Draw Call:${e}`),()=>(r(e),`Max Draw Call:${e}`)];this._paramTxts[t].text=n[t]()}}class mE extends bt{constructor(t){super();const{bgWidth:e,bgHeight:i,barWidth:r,barHeight:n,bgTexture:a,barTexture:o}=t,h=new _e(a);this.addChild(h),this._progressBar=new _e(o),this.addChild(this._progressBar),this._progressBar.x=(e-r)/2,this._progressBar.y=(i-n)/2;const l=new li;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 _E extends Tn{constructor(t){const{width:e,height:i,scrollContent:r,bottomMargin:n=50}=t;if(super(e,i),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 _e;this._content.addChild(a),a.y=this._content.height+n}this._maskGraphics=new li,this.addChild(this._maskGraphics),this._maskGraphics.clear(),this._maskGraphics.beginFill(0),this._maskGraphics.drawRect(0,0,e,i),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(){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,ct.killTweensOf(this._content)}_onDragMove(t){if(this._isDragging){const i=t.data.getLocalPosition(this).y-this._startY;this._content.y=i}}_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)),ct.to(this._content,{duration:.25,ease:"power1.out",y:e})}_applyInertia(){ct.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)ct.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);ct.to(this._content,{duration:.75,y:t,ease:"elastic.out"})}else ct.to(this._content,{duration:.25,y:0})}}class gE extends Tn{constructor(t){const{width:e,height:i,content:r,slideCallback:n,scrollCallback:a,pageNum:o,pageHeight:h}=t;super(e,i),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 li;l.beginFill(16777215),l.drawRect(0,0,this.width,this.height),l.endFill(),this.addChild(l),this.mask=l,this._scrollHeight=i,this._slideHeight=h,this._slideArea=r,this._slideCallback=n,this._scrollCallback=a,this._pageNum=o-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 i;t<0?(ct.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?(ct.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,ct.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)}})),(i=this._slideCallback)==null||i.call(this,this._currentIndex)}_onDragStart(t){this._isDragging=!0,this._startY=t.data.global.y,this._offsetY=this._slideArea.y,ct.killTweensOf(this._slideArea),this._startTime=new Date().getTime()}_onDragMove(t){var i;if(!this._isDragging)return;const e=t.pageY-this._startY;this._slideArea.y=this._offsetY+e,(i=this._scrollCallback)==null||i.call(this,this._slideArea.y,this._currentIndex)}_onDragEnd(t){if(!this._isDragging)return;this._isDragging=!1;const e=new Date().getTime()-this._startTime,i=this._startY-t.pageY,r=Math.abs(i)/e,n=.275,a=this._slideHeight/2,o=Math.round(i/this._slideHeight);(Math.abs(i)>a||r>n)&&(this._currentIndex+=o),this._currentIndex<0?this._currentIndex=0:this._currentIndex>this._pageNum&&(this._currentIndex=this._pageNum),this.slideTo(this._currentIndex)}}const h_=s=>{const t=new li;return t.beginFill(16777215),t.drawRect(0,0,s.width,s.height),t.endFill(),s.addChild(t),s.mask=t,t};class yE extends Tn{constructor(t,e,i,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,h_(this),this._slideWidth=t,this._slideArea=i,this.slideCallback=r,this._pageNum=Math.floor(i.width/this._slideWidth)-1,this.addChild(i),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?(ct.to(this._slideArea,{x:0,duration:.25}),this._currentIndex=0):t>this._pageNum?(ct.to(this._slideArea,{x:-this._pageNum*this._slideWidth,duration:.5}),this._currentIndex=this._pageNum):(this._currentIndex=t,ct.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,ct.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,i=this._startX-t.pageX,r=Math.abs(i)/e,n=this._slideWidth/2,a=.275;(Math.abs(i)>n||r>a)&&(i>0?this._currentIndex++:this._currentIndex--),this._slideTo(this._currentIndex)}}class xE{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 vE{constructor(t){this._betAmountListLength=0;const{initialBetIndex:e,betAmountListLength:i,onAmountIndex:r,onDisabled:n}=t;this._onAmountIndex=r,this._onDisabled=n,this._betAmountListLength=i,this._baseNumSteper=new xE(i,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 l_=(s,t,e)=>{const i=t/s.width*s.scale.x,r=e?e/s.height*s.scale.y:i,n=Math.min(i,r);s.scale.set(n>1?1:n)};class bE extends bt{constructor(t){super();const{data:e,cellWidth:i=130,cellHeight:r=100,fontColor:n="#B4B4B8",fontSize:a=24,lineWidth:o=3,lineColor:h="#B4B4B8"}=t;this._data=e,this._rows=e.length,this._cols=e[0].length,this._cellWidth=i,this._cellHeight=r,this._fontColor=n,this._fontSize=a,this._lineWidth=o,this._lineColor=h,this._drawTable(),this.fillNumbers()}_drawTable(){const t=this._cellWidth*this._cols,e=this._cellHeight*this._rows,i=new li;i.lineStyle(this._lineWidth,this._lineColor),i.drawRect(0,0,t,e);for(let r=1;r<this._rows;r++)i.moveTo(0,r*this._cellHeight),i.lineTo(t,r*this._cellHeight);for(let r=1;r<this._cols;r++)i.moveTo(r*this._cellWidth,0),i.lineTo(r*this._cellWidth,e);this.addChild(i)}fillNumbers(){for(let t=0;t<this._rows;t++)for(let e=0;e<this._cols;e++){const i=this._data[t][e];this._createNumberText(i,e,t)}}_createNumberText(t,e,i){const r=new Va(t.toString(),{_fontSize:this._fontSize,fill:this._fontColor}),n=e*this._cellWidth+this._cellWidth/2,a=i*this._cellHeight+this._cellHeight/2;this.addChild(r),r.anchor.set(.5),r.position.set(n,a),l_(r,this._cellWidth*.9)}}let c_;function TE(s){return c_=s,s}function Pn(){return c_}let wE=0;const Vc=class extends Je{constructor(s){super(),this.id=wE++,this.init(s)}set(s,t){if(this[s]===void 0)throw new Error(`Property with name ${s} does not exist.`);switch(s){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:s}=this._source;return s/this._duration}get paused(){return this._paused}set paused(s){this._paused=s,this.refreshPaused()}_onPlay(){this._playing=!0}_onPause(){this._playing=!1}init(s){this._playing=!1,this._duration=s.source.duration;const t=this._source=s.source.cloneNode(!1);t.src=s.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),s.context.on("refresh",this.refresh,this),s.context.on("refreshPaused",this.refreshPaused,this),this._media=s}_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(s){this._speed=s,this.refresh()}get volume(){return this._volume}set volume(s){this._volume=s,this.refresh()}get loop(){return this._loop}set loop(s){this._loop=s,this.refresh()}get muted(){return this._muted}set muted(s){this._muted=s,this.refresh()}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(s){console.warn("HTML Audio does not support filters")}refresh(){const s=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;const e=s.volume*(s.muted?0:1),i=t.volume*(t.muted?0:1),r=this._volume*(this._muted?0:1);this._source.volume=r*e*i,this._source.playbackRate=this._speed*s.speed*t.speed}refreshPaused(){const s=this._media.context,t=this._media.parent,e=this._paused||t.paused||s.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(s){const{start:t,end:e,speed:i,loop:r,volume:n,muted:a}=s;e&&console.assert(e>t,"End time is before start time"),this._speed=i,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-Vc.PADDING),this._end=Math.min(this._end+Vc.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t,this._duration),ft.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(){ft.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this)}destroy(){ft.shared.remove(this._onUpdate,this),this.removeAllListeners();const s=this._source;s&&(s.onended=null,s.onplay=null,s.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 u_=Vc;u_.PADDING=.1;class EE extends Je{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url)}create(){return new u_(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,i=this.parent;if(e.readyState===4){i.isLoaded=!0;const h=i.autoPlayStart();t&&setTimeout(()=>{t(null,i,h)},0);return}if(!i.url){t(new Error("sound.url or sound.source must be set"));return}e.src=i.url;const r=()=>{o(),i.isLoaded=!0;const h=i.autoPlayStart();t&&t(null,i,h)},n=()=>{o(),t&&t(new Error("Sound loading has been aborted"))},a=()=>{o();const h=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(h)):console.error(h)},o=()=>{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 AE{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 _o=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],SE=["audio/mpeg","audio/ogg"],go={};function CE(s){const t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...s||{}},e=document.createElement("audio"),i={},r=/^no$/;_o.forEach(n=>{const a=e.canPlayType(`audio/${n}`).replace(r,""),o=t[n]?e.canPlayType(t[n]).replace(r,""):"";i[n]=!!a||!!o}),Object.assign(go,i)}CE();class Wc{static setParamValue(t,e){if(t.setValueAtTime){const i=Pn().context;t.setValueAtTime(e,i.audioContext.currentTime)}else t.value=e;return e}}let PE=0;class RE extends Je{constructor(t){super(),this.id=PE++,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(i=>i).forEach(i=>i.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 i=t.volume*(t.muted?0:1),r=e.volume*(e.muted?0:1),n=this._volume*(this._muted?0:1);Wc.setParamValue(this._gain.gain,n*r*i),Wc.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(i=>{e.connect(i.destination),e=i}),e.connect(this._gain)}}refreshPaused(){const t=this._media.context,e=this._media.parent,i=this._paused||e.paused||t.paused;i!==this._pausedReal&&(this._pausedReal=i,i?(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",i))}play(t){const{start:e,end:i,speed:r,loop:n,volume:a,muted:o,filters:h}=t;i&&console.assert(i>e,"End time is before start time"),this._paused=!1;const{source:l,gain:c}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=c,this._speed=r,this._volume=a,this._loop=!!n,this._muted=o,this._filters=h,this.refresh();const d=this._source.buffer.duration;this._duration=d,this._end=i,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=i,this._source.loopStart=e,this._source.start(0,e)):i?this._source.start(0,e,i-e):this._source.start(0,e),this.emit("start"),this._update(!0),this.enableTicker(!0)}enableTicker(t){ft.shared.remove(this._updateListener,this),t&&ft.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(),i=e-this._lastUpdate;if(i>0||t){const r=this._source.playbackRate.value;this._elapsed+=i*r,this._lastUpdate=e;const n=this._duration;let a;if(this._source.loopStart){const o=this._source.loopEnd-this._source.loopStart;a=(this._source.loopStart+this._elapsed%o)/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 d_{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(i=>{e===null?this._input.connect(i.destination):e.connect(i.destination),e=i}),e.connect(this._output)}}destroy(){this.filters=null,this._input=null,this._output=null}}const f_=class extends d_{constructor(s){const t=s.audioContext,e=t.createBufferSource(),i=t.createGain(),r=t.createAnalyser();e.connect(r),r.connect(i),i.connect(s.destination),super(r,i),this.context=s,this.bufferSource=e,this.gain=i,this.analyser=r}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(f_.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 s=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=s.buffer,Wc.setParamValue(t.playbackRate,s.playbackRate.value),t.loop=s.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 p_=f_;p_.BUFFER_SIZE=0;class IE{init(t){this.parent=t,this._nodes=new p_(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 RE(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,i=await H.ADAPTER.fetch(e);this._decode(await i.arrayBuffer(),t)}_decode(t,e){const i=(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?i(null,t):this.parent.context.decode(t,i)}}const Ir=class{static from(s){let t={};typeof s=="string"?t.url=s:s instanceof ArrayBuffer||s instanceof AudioBuffer||s instanceof HTMLAudioElement?t.source=s:Array.isArray(s)?t.url=s:t=s,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=Pn().useLegacy?new EE:new IE;return new Ir(e,t)}constructor(s,t){this.media=s,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(s){const[t]=s.map(e=>({url:e,ext:Ft.extname(e).slice(1)})).filter(({ext:e})=>go[e]).sort((e,i)=>_o.indexOf(e.ext)-_o.indexOf(i.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return Pn().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(s){this._paused=s,this.refreshPaused()}get speed(){return this._speed}set speed(s){this._speed=s,this.refresh()}get filters(){return this.media.filters}set filters(s){this.media.filters=s}addSprites(s,t){if(typeof s=="object"){const i={};for(const r in s)i[r]=this.addSprites(r,s[r]);return i}console.assert(!this._sprites[s],`Alias ${s} is already taken`);const e=new AE(this,t);return this._sprites[s]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null}removeSprites(s){if(s){const t=this._sprites[s];t!==void 0&&(t.destroy(),delete this._sprites[s])}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 s=this._instances.length-1;s>=0;s--)this._instances[s].stop();return this}play(s,t){let e;if(typeof s=="string"?e={sprite:s,loop:this.loop,complete:t}:typeof s=="function"?(e={},e.complete=s):e=s,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,o,h)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,a?n(a):(e.loaded&&e.loaded(a,o,h),r(h))})}));(this.singleInstance||e.singleInstance)&&this._removeInstances();const i=this._createInstance();return this._instances.push(i),this.isPlaying=!0,i.once("end",()=>{e.complete&&e.complete(this),this._onComplete(i)}),i.once("stop",()=>{this._onComplete(i)}),i.play(e),i}refresh(){const s=this._instances.length;for(let t=0;t<s;t++)this._instances[t].refresh()}refreshPaused(){const s=this._instances.length;for(let t=0;t<s;t++)this._instances[t].refreshPaused()}get volume(){return this._volume}set volume(s){this._volume=s,this.refresh()}get muted(){return this._muted}set muted(s){this._muted=s,this.refresh()}get loop(){return this._loop}set loop(s){this._loop=s,this.refresh()}_preload(s){this.media.load(s)}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let s;return this.autoPlay&&(s=this.play(this._autoPlayOptions)),s}_removeInstances(){for(let s=this._instances.length-1;s>=0;s--)this._poolInstance(this._instances[s]);this._instances.length=0}_onComplete(s){if(this._instances){const t=this._instances.indexOf(s);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0}this._poolInstance(s)}_createInstance(){if(Ir._pool.length>0){const s=Ir._pool.pop();return s.init(this.media),s}return this.media.create()}_poolInstance(s){s.destroy(),Ir._pool.indexOf(s)<0&&Ir._pool.push(s)}};let yo=Ir;yo._pool=[];class ME extends Je{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 Rn extends d_{constructor(){const t=window,e=new Rn.AudioContext,i=e.createDynamicsCompressor(),r=e.createAnalyser();r.connect(i),i.connect(e.destination),super(r,i),this.autoPause=!0,this._ctx=e,this._offlineCtx=new Rn.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=i,this.analyser=r,this.events=new Je,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 i=n=>{e(new Error((n==null?void 0:n.message)||"Unable to decode file"))},r=this._offlineCtx.decodeAudioData(t,n=>{e(null,n)},i);r&&r.catch(i)}}class DE{constructor(){this.init()}init(){return this.supported&&(this._webAudioContext=new Rn),this._htmlAudioContext=new ME,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 Rn.AudioContext!==null}add(t,e){if(typeof t=="object"){const n={};for(const a in t){const o=this._getOptions(t[a],e);n[a]=this.add(a,o)}return n}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof yo)return this._sounds[t]=e,e;const i=this._getOptions(e),r=yo.from(i);return this._sounds[t]=r,r}_getOptions(t,e){let i;return typeof t=="string"?i={url:t}:Array.isArray(t)?i={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?i={source:t}:i=t,i={...i,...e||{}},i}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 i=!!this._sounds[t];return e&&console.assert(i,`No sound matching alias '${t}'.`),i}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 i=this.find(t);return e!==void 0&&(i.volume=e),i.volume}speed(t,e){const i=this.find(t);return e!==void 0&&(i.speed=e),i.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 m_=s=>{var e;const t=s.src;return((e=s==null?void 0:s.alias)==null?void 0:e[0])??Ft.basename(t,Ft.extname(t))},BE={extension:G.Asset,detection:{test:async()=>!0,add:async s=>[...s,..._o.filter(t=>go[t])],remove:async s=>s.filter(t=>s.includes(t))},loader:{extension:{type:[G.LoadParser],priority:Re.High},test(s){const t=Ft.extname(s).slice(1);return!!go[t]||SE.some(e=>s.startsWith(`data:${e}`))},async load(s,t){const e=await new Promise((i,r)=>yo.from({...t.data,url:s,preload:!0,loaded(n,a){var o,h;n?r(n):i(a),(h=(o=t.data)==null?void 0:o.loaded)==null||h.call(o,n,a)}}));return Pn().add(m_(t),e),e},async unload(s,t){Pn().remove(m_(t))}}};z.add(BE),TE(new DE);class OE{constructor(){this.effectEnabled=!0,this.musicEnabled=!0,this._isMusicPaused=!1,this._isBackground=!1,this._playingList=[],this._setPlayStatus=t=>{var e,i;t?!this._isMusicPaused&&((e=this._musicPlayer)==null||e.play()):(i=this._musicPlayer)==null||i.pause(),this._playingList.forEach(r=>{t?r.audio.play():r.audio.pause()})},this._musicPlayer=new Audio,document.addEventListener("visibilitychange",()=>{this._isBackground=document.hidden,this._setPlayStatus(!document.hidden)})}playEffect(t,e){return new Promise(i=>{const r=new Date().getTime(),n=qi.get(t).url,a=new Audio(n);a.muted=this._isBackground||!this.effectEnabled,a.addEventListener("ended",()=>{this._playingList=this._playingList.filter(o=>o.id!==r),i()}),a.play().then(()=>{if(e){const h=a.duration-e;a.currentTime=Math.max(h,0)}this._playingList.push({id:r,audio:a,url:n})}).catch(()=>{})})}async playMusic(t){var r;this._musicPlayer&&(ct.killTweensOf(this._musicPlayer),await ct.to(this._musicPlayer,{volume:0,duration:1,ease:"linear"}),(r=this._musicPlayer)==null||r.pause());const e=qi.get(t).url;this._musicPlayer.src=e,this._musicPlayer.loop=!0,this._musicPlayer.volume=0;const i=()=>{this._musicPlayer.play().then(()=>{this._isMusicPaused=!1,ct.killTweensOf(this._musicPlayer),ct.to(this._musicPlayer,{volume:1,duration:1,ease:"linear"})}).catch(()=>{requestAnimationFrame(i.bind(this))})};i()}pauseMusic(){var t;this._isMusicPaused=!0,(t=this._musicPlayer)==null||t.pause()}resumeMusic(){var t;this._isMusicPaused=!1,(t=this._musicPlayer)==null||t.play()}stopEffect(t){const e=qi.get(t).url;this._playingList.forEach(i=>{i.url===e&&i.audio.pause()}),this._playingList=this._playingList.filter(i=>i.url!==e)}setEffectEnabled(t){this.effectEnabled=t,this._setEffectMute(!t)}setMusicEnabled(t){this.musicEnabled=t,this._setMusicMute(!t)}_setMusicMute(t){this._musicPlayer.muted=t||!this.musicEnabled}_setEffectMute(t){this._playingList.forEach(e=>{e.audio.muted=t||!this.effectEnabled})}}const FE=s=>{const{texture:t,dotWidth:e,width:i,height:r}=s;let n=[];Array.isArray(e)?n=e:n=[e,e,e,e];const a=new zb(t,n[0],n[1],n[2],n[3]);return a.width=i,a.height=r,a},LE=(s,t,e)=>{let i=!1;return s.cursor="pointer",s.eventMode="static",s.on(t,r=>{i||r.button!==2&&e(r)}),()=>{i=!0}},kE=(s,t,e=0)=>parseFloat((Math.random()*(t-s)+s).toFixed(e)),NE=(s,t)=>{let e=0;const i=new ft,r=n=>{e+=n*i.deltaMS;let a=0;Array.isArray(t)?a=kE(t[0],t[1],2):a=t,e>=a&&(s(),e=0)};return i.add(r),i.start(),()=>{i.remove(r),i.stop()}},UE=(s,t,e)=>{const i=r=>{const n=t.getBounds().contains(r.clientX,r.clientY),a=s.getBounds().contains(r.clientX,r.clientY);!n&&!a&&s.visible&&(e(),window.removeEventListener("pointerdown",i))};return window.addEventListener("pointerdown",i),()=>{window.removeEventListener("pointerdown",i)}},GE=(s=1,t)=>new Promise(e=>{let i=0;const r=new ft,n=()=>{i+=r.deltaMS,i>=s&&(t==null||t(),r.destroy(),e())};r.add(n),r.start()}),HE=(s,t)=>{let e;if(s==="brightness")e=new ar,e.brightness(t,!1);else if(s==="blur")e=new Hf;else if(s==="desaturate")e=new ar,e.desaturate();else if(s==="contrast")e=new ar,e.contrast(t,!1);else throw new Error("未知滤镜名称");return e.resolution=window.devicePixelRatio||1,e};var VE=`attribute vec2 aVertexPosition;
|
|
1169
|
+
*/class ii{constructor(t,e,s){this.value=t,this.time=e,this.next=null,this.isStepped=!1,s?this.ease=typeof s=="function"?s:p0(s):this.ease=null}static createList(t){if("list"in t){const s=t.list;let i;const{value:n,time:o}=s[0],h=i=new ii(typeof n=="string"?ph(n):n,o,t.ease);if(s.length>2||s.length===2&&s[1].value!==n)for(let a=1;a<s.length;++a){const{value:l,time:c}=s[a];i.next=new ii(typeof l=="string"?ph(l):l,c),i=i.next}return h.isStepped=!!t.isStepped,h}const e=new ii(typeof t.start=="string"?ph(t.start):t.start,0);return t.end!==t.start&&(e.next=new ii(typeof t.end=="string"?ph(t.end):t.end,1)),e}}let Aa=q.from;const ri=Math.PI/180;function Ti(r,t){if(!r)return;const e=Math.sin(r),s=Math.cos(r),i=t.x*s-t.y*e,n=t.x*e+t.y*s;t.x=i,t.y=n}function fh(r,t,e){return r<<16|t<<8|e}function d0(r){return Math.sqrt(r.x*r.x+r.y*r.y)}function TS(r){const t=1/d0(r);r.x*=t,r.y*=t}function f0(r,t){r.x*=t,r.y*=t}function ph(r,t){t||(t={}),r.charAt(0)==="#"?r=r.substr(1):r.indexOf("0x")===0&&(r=r.substr(2));let e;return r.length===8&&(e=r.substr(0,2),r=r.substr(2)),t.r=parseInt(r.substr(0,2),16),t.g=parseInt(r.substr(2,2),16),t.b=parseInt(r.substr(4,2),16),e&&(t.a=parseInt(e,16)),t}function p0(r){const t=r.length,e=1/t;return function(s){const i=t*s|0,n=(s-i*e)*t,o=r[i]||r[t-1];return o.s+n*(2*(1-n)*(o.cp-o.s)+n*(o.e-o.s))}}function AS(r){return r?(r=r.toUpperCase().replace(/ /g,"_"),W[r]||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(r){r[r.Spawn=0]="Spawn",r[r.Normal=2]="Normal",r[r.Late=5]="Late"})(Ft||(Ft={}));const uu=Tt.shared,Nr=Symbol("Position particle per emitter position");class wt{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){wt.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:p0(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 i=wt.knownBehaviors[s.type];return i?new i(s.config):(console.error(`Unknown behavior: ${s.type}`),null)}).filter(s=>!!s);e.push(Nr),e.sort((s,i)=>s===Nr?i.order===Ft.Spawn?1:-1:i===Nr?s.order===Ft.Spawn?-1:1:s.order-i.order),this.initBehaviors=e.slice(),this.updateBehaviors=e.filter(s=>s!==Nr&&s.updateParticle),this.recycleBehaviors=e.filter(s=>s!==Nr&&s.recycleParticle)}getBehavior(t){return wt.knownBehaviors[t]&&this.initBehaviors.find(e=>e instanceof wt.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,Ti(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 o=this._activeParticlesFirst,h;o;o=h)if(h=o.next,o.age+=t,o.age>o.maxLife||o.age<0)this.recycle(o);else{let a=o.age*o.oneOverLife;this.customEase&&(this.customEase.length===4?a=this.customEase(a,0,1,1):a=this.customEase(a)),o.agePercent=a;for(let l=0;l<this.updateBehaviors.length;++l)if(this.updateBehaviors[l].updateParticle(o,t)){this.recycle(o);break}}let e,s;this._prevPosIsValid&&(e=this._prevEmitterPos.x,s=this._prevEmitterPos.y);const i=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 o,h;if(this._prevPosIsValid&&this._posChanged){const c=1+this._spawnTimer/t;o=(i-e)*c+e,h=(n-s)*c+s}else o=i,h=n;let a=null,l=null;for(let c=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),d=0;d<c;++d){if(this.spawnChance<1&&Math.random()>=this.spawnChance)continue;let u;if(this.minLifetime===this.maxLifetime?u=this.minLifetime:u=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,-this._spawnTimer>=u)continue;let f;this._poolFirst?(f=this._poolFirst,this._poolFirst=this._poolFirst.next,f.next=null):f=new cu(this),f.init(u),this.addAtBack?this._parent.addChildAt(f,0):this._parent.addChild(f),a?(l.next=f,f.prev=l,l=f):l=a=f,++this.particleCount}if(a){this._activeParticlesLast?(this._activeParticlesLast.next=a,a.prev=this._activeParticlesLast,this._activeParticlesLast=l):(this._activeParticlesFirst=a,this._activeParticlesLast=l);for(let c=0;c<this.initBehaviors.length;++c){const d=this.initBehaviors[c];if(d===Nr)for(let u=a,f;u;u=f){f=u.next,this.rotation!==0&&(Ti(this.rotation,u.position),u.rotation+=this.rotation),u.position.x+=o,u.position.y+=h,u.age+=-this._spawnTimer;let p=u.age*u.oneOverLife;this.customEase&&(this.customEase.length===4?p=this.customEase(p,0,1,1):p=this.customEase(p)),u.agePercent=p}else d.initParticles(a)}for(let c=a,d;c;c=d){d=c.next;for(let u=0;u<this.updateBehaviors.length;++u)if(this.updateBehaviors[u].updateParticle(c,-this._spawnTimer)){this.recycle(c);break}}}this._spawnTimer+=this._frequency}if(this._posChanged&&(this._prevEmitterPos.x=i,this._prevEmitterPos.y=n,this._prevPosIsValid=!0,this._posChanged=!1),!this._emit&&!this._activeParticlesFirst){if(this._completeCallback){const o=this._completeCallback;this._completeCallback=null,o()}this._destroyWhenComplete&&this.destroy()}}emitNow(){const t=this.ownerPos.x+this.spawnPos.x,e=this.ownerPos.y+this.spawnPos.y;let s=null,i=null;for(let n=Math.min(this.particlesPerWave,this.maxParticles-this.particleCount),o=0;o<n;++o){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 a;this.minLifetime===this.maxLifetime?a=this.minLifetime:a=Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,h.init(a),this.addAtBack?this._parent.addChildAt(h,0):this._parent.addChild(h),s?(i.next=h,h.prev=i,i=h):i=s=h,++this.particleCount}if(s){this._activeParticlesLast?(this._activeParticlesLast.next=s,s.prev=this._activeParticlesLast,this._activeParticlesLast=i):(this._activeParticlesFirst=s,this._activeParticlesLast=i);for(let n=0;n<this.initBehaviors.length;++n){const o=this.initBehaviors[n];if(o===Nr)for(let h=s,a;h;h=a)a=h.next,this.rotation!==0&&(Ti(this.rotation,h.position),h.rotation+=this.rotation),h.position.x+=t,h.position.y+=e;else o.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}}wt.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 mh{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),Ti(e,t.position),t.position.x+=this.x,t.position.y+=this.y}}mh.type="torus",mh.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 i=s[0];for(let n=1;n<s.length;++n){const o=s[n];this.segments.push({p1:i,p2:o,l:0}),i=o}}else{let e=t[0];for(let s=1;s<t.length;++s){const i=t[s];this.segments.push({p1:e,p2:i,l:0}),e=i}}for(let e=0;e<this.segments.length;++e){const{p1:s,p2:i}=this.segments[e],n=Math.sqrt((i.x-s.x)*(i.x-s.x)+(i.y-s.y)*(i.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,i;if(this.segments.length===1)s=this.segments[0],i=e;else for(let h=0;h<this.countingLengths.length;++h)if(e<this.countingLengths[h]){s=this.segments[h],i=h===0?e:e-this.countingLengths[h-1];break}i/=s.l||1;const{p1:n,p2:o}=s;t.x=n.x+i*(o.x-n.x),t.y=n.y+i*(o.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),Ti(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=t.config.velocity,i=s.x,n=s.y;if(s.x+=this.accel.x*e,s.y+=this.accel.y*e,this.maxSpeed){const o=d0(s);o>this.maxSpeed&&f0(s,this.maxSpeed/o)}t.x+=(i+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 SS(r){return this.ease&&(r=this.ease(r)),(this.first.next.value-this.first.value)*r+this.first.value}function CS(r){this.ease&&(r=this.ease(r));const t=this.first.value,e=this.first.next.value,s=(e.r-t.r)*r+t.r,i=(e.g-t.g)*r+t.g,n=(e.b-t.b)*r+t.b;return fh(s,i,n)}function IS(r){this.ease&&(r=this.ease(r));let t=this.first,e=t.next;for(;r>e.time;)t=e,e=e.next;return r=(r-t.time)/(e.time-t.time),(e.value-t.value)*r+t.value}function PS(r){this.ease&&(r=this.ease(r));let t=this.first,e=t.next;for(;r>e.time;)t=e,e=e.next;r=(r-t.time)/(e.time-t.time);const s=t.value,i=e.value,n=(i.r-s.r)*r+s.r,o=(i.g-s.g)*r+s.g,h=(i.b-s.b)*r+s.b;return fh(n,o,h)}function RS(r){this.ease&&(r=this.ease(r));let t=this.first;for(;t.next&&r>t.next.time;)t=t.next;return t.value}function MS(r){this.ease&&(r=this.ease(r));let t=this.first;for(;t.next&&r>t.next.time;)t=t.next;const e=t.value;return fh(e.r,e.g,e.b)}class Sa{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?CS:SS:t.isStepped?this.interpolate=this.isColor?MS:RS:this.interpolate=this.isColor?PS:IS,this.ease=this.first.ease}}class mu{constructor(t){this.order=Ft.Normal,this.list=new Sa(!1),this.list.reset(ii.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 m0(r){const t=[];for(let e=0;e<r.length;++e){let s=r[e];if(typeof s=="string")t.push(Aa(s));else if(s instanceof q)t.push(s);else{let i=s.count||1;for(typeof s.texture=="string"?s=Aa(s.texture):s=s.texture;i>0;--i)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],i=m0(s.textures),n=s.framerate<0?-1:s.framerate>0?s.framerate:60,o={textures:i,duration:n>0?i.length/n:0,framerate:n,loop:n>0?!!s.loop:!1};this.anims.push(o)}}initParticles(t){let e=t;for(;e;){const s=Math.floor(Math.random()*this.anims.length),i=e.config.anim=this.anims[s];e.texture=i.textures[0],e.config.animElapsed=0,i.framerate===-1?(e.config.animDuration=e.maxLife,e.config.animFramerate=i.textures.length/e.maxLife):(e.config.animDuration=i.duration,e.config.animFramerate=i.framerate),e=e.next}}updateParticle(t,e){const s=t.config,i=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=i.textures[n]||i.textures[i.textures.length-1]||q.EMPTY}}_u.type="animatedRandom",_u.editorConfig=null;class xu{constructor(t){this.order=Ft.Normal;const e=t.anim,s=m0(e.textures),i=e.framerate<0?-1:e.framerate>0?e.framerate:60;this.anim={textures:s,duration:i>0?s.length/i:0,framerate:i,loop:i>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,i=t.config;i.animElapsed+=e,i.animElapsed>=i.animDuration&&(s.loop?i.animElapsed=i.animElapsed%i.animDuration:i.animElapsed=i.animDuration-1e-6);const n=i.animElapsed*i.animFramerate+1e-7|0;t.texture=s.textures[n]||s.textures[s.textures.length-1]||q.EMPTY}}xu.type="animatedSingle",xu.editorConfig=null;class yu{constructor(t){this.order=Ft.Normal,this.value=t.blendMode}initParticles(t){let e=t;for(;e;)e.blendMode=AS(this.value),e=e.next}}yu.type="blendMode",yu.editorConfig=null;class vu{constructor(t){this.order=Ft.Spawn,this.spacing=t.spacing*ri,this.start=t.start*ri,this.distance=t.distance}initParticles(t){let e=0,s=t;for(;s;){let i;this.spacing?i=this.start+this.spacing*e:i=Math.random()*Math.PI*2,s.rotation=i,this.distance&&(s.position.x=this.distance,Ti(i,s.position)),s=s.next,++e}}}vu.type="spawnBurst",vu.editorConfig=null;class bu{constructor(t){this.order=Ft.Normal,this.list=new Sa(!0),this.list.reset(ii.createList(t.color))}initParticles(t){let e=t;const s=this.list.first.value,i=fh(s.r,s.g,s.b);for(;e;)e.tint=i,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"?Aa(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 Cn=new st,g0=["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"],FS=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(g0).join("|"),"g");function kS(r){const t=r.match(FS);for(let e=t.length-1;e>=0;--e)g0.indexOf(t[e])>=0&&(t[e]=`Math.${t[e]}`);return r=t.join(""),new Function("x",`return ${r};`)}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=kS(t.path)}catch{this.path=null}else this.path=s=>s;this.list=new Sa(!1),this.list.reset(ii.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,Cn.x=t.config.movement,Cn.y=this.path(Cn.x),Ti(t.config.initRotation,Cn),t.position.x=t.config.initPosition.x+Cn.x,t.position.y=t.config.initPosition.y+Cn.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"?Aa(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*ri,this.maxStart=t.maxStart*ri,this.minSpeed=t.minSpeed*ri,this.maxSpeed=t.maxSpeed*ri,this.accel=t.accel*ri}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*ri,this.max=t.max*ri}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)*ri}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 Sa(!1),this.list.reset(ii.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 Ss{constructor(t){this.order=Ft.Spawn;const e=Ss.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){Ss.shapes[e||t.type]=t}initParticles(t){let e=t;for(;e;)this.shape.getRandPos(e),e=e.next}}Ss.type="spawnShape",Ss.editorConfig=null,Ss.shapes={},Ss.registerShape(fu),Ss.registerShape(du),Ss.registerShape(mh),Ss.registerShape(mh,"circle");class Fu{constructor(t){this.order=Ft.Normal,this.texture=typeof t.texture=="string"?Aa(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 Sa(!1),this.list.reset(ii.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),Ti(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const s=this.list.interpolate(t.agePercent)*t.config.speedMult,i=t.config.velocity;TS(i),f0(i,s),t.x+=i.x*e,t.y+=i.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),Ti(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,wt.registerBehavior(pu),wt.registerBehavior(mu),wt.registerBehavior(gu),wt.registerBehavior(_u),wt.registerBehavior(xu),wt.registerBehavior(yu),wt.registerBehavior(vu),wt.registerBehavior(bu),wt.registerBehavior(wu),wt.registerBehavior(Eu),wt.registerBehavior(Tu),wt.registerBehavior(Au),wt.registerBehavior(Su),wt.registerBehavior(Cu),wt.registerBehavior(Iu),wt.registerBehavior(Pu),wt.registerBehavior(Ru),wt.registerBehavior(Mu),wt.registerBehavior(Ss),wt.registerBehavior(Fu),wt.registerBehavior(ku),wt.registerBehavior(Bu);class Du extends zo{constructor(t){const{text:e,fontSize:s=36,fontColor:i=16777215,stroke:n,strokeColor:o,strokeThickness:h,fontFamily:a="MicrosoftYaHei",fontWeight:l="normal",wordWrap:c=!1,wordWrapWidth:d=100,lineHeight:u=1.25,align:f="left",indent:p=0,shadow:m}=t,g=new yi({fontSize:s,wordWrap:c,wordWrapWidth:d,fontWeight:l,lineHeight:u*s,breakWords:c,fill:i,align:f,fontFamily:a,stroke:n?o:"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 BS extends Bt{constructor(t){super();const{start:e,control:s,end:i,json:n,duration:o,ease:h="power1.out",showControl:a=!1,loop:l=!1}=t;this._particleContainer=new FT,this.addChild(this._particleContainer);const c=new wt(this._particleContainer,n),d=this._createBezierPoints([e,...s,i],100,a),u={pathThrough:0};bt.to(u,{duration:o,pathThrough:d.length-1,repeat:l?-1:0,ease:h,onStart:()=>{c.emit=!0},onUpdate:()=>{const p=Math.floor(u.pathThrough),m=d[p];c.updateOwnerPos(m.x,m.y)},onComplete:()=>{bt.to(this,{alpha:0,duration:.5,onComplete:()=>{c.emit=!1,f.destroy(),this.removeFromParent()}})}});const f=new Tt;f.add(()=>{c.update(1/75)}),f.start()}_createBezierPoints(t,e,s){const i=[];s&&t.forEach((n,o)=>{const h=new Du({text:o+1,fontSize:16});h.position.set(n.x,n.y),this.addChild(h)});for(let n=0;n<e;n++){const o=this._multiPointBezier(t,n/e);i.push(o)}return i}_multiPointBezier(t,e){const s=t.length;let i=0,n=0;const o=[];for(let h=0;h<s;h++)o[h]=this._binomial(s-1,h);for(let h=0;h<s;h++){const a=t[h],l=o[h],c=Math.pow(e,h),d=Math.pow(1-e,s-1-h);i+=a.x*d*c*l,n+=a.y*d*c*l}return{x:i,y:n}}_binomial(t,e){if(e===0||e===t)return 1;let s=1;for(let i=1;i<=e;i++)s=s*(t-i+1)/i;return s}}var ot=(r=>(r[r.Region=0]="Region",r[r.BoundingBox=1]="BoundingBox",r[r.Mesh=2]="Mesh",r[r.LinkedMesh=3]="LinkedMesh",r[r.Path=4]="Path",r[r.Point=5]="Point",r[r.Clipping=6]="Clipping",r))(ot||{});class gh{constructor(t,e=new Array,s=0,i=new DataView(t.buffer)){this.strings=e,this.index=s,this.buffer=i}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 i=this.readUnsignedByte();switch(i>>4){case 12:case 13:e+=String.fromCharCode((i&31)<<6|this.readByte()&63),s+=2;break;case 14:e+=String.fromCharCode((i&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:e+=String.fromCharCode(i),s++}}return e}readFloat(){const t=this.buffer.getFloat32(this.index);return this.index+=4,t}readBoolean(){return this.readByte()!=0}}var S=(r=>(r[r.setup=0]="setup",r[r.first=1]="first",r[r.replace=2]="replace",r[r.add=3]="add",r))(S||{}),At=(r=>(r[r.mixIn=0]="mixIn",r[r.mixOut=1]="mixOut",r))(At||{}),ne=(r=>(r[r.Fixed=0]="Fixed",r[r.Percent=1]="Percent",r))(ne||{}),Fe=(r=>(r[r.Tangent=0]="Tangent",r[r.Chain=1]="Chain",r[r.ChainScale=2]="ChainScale",r))(Fe||{}),yt=(r=>(r[r.Normal=0]="Normal",r[r.OnlyTranslation=1]="OnlyTranslation",r[r.NoRotationOrReflection=2]="NoRotationOrReflection",r[r.NoScale=3]="NoScale",r[r.NoScaleOrReflection=4]="NoScaleOrReflection",r))(yt||{});function _0(r){switch(r.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 ${r}`)}}var Ye=(r=>(r[r.Nearest=9728]="Nearest",r[r.Linear=9729]="Linear",r[r.MipMap=9987]="MipMap",r[r.MipMapNearestNearest=9984]="MipMapNearestNearest",r[r.MipMapLinearNearest=9985]="MipMapLinearNearest",r[r.MipMapNearestLinear=9986]="MipMapNearestLinear",r[r.MipMapLinearLinear=9987]="MipMapLinearLinear",r))(Ye||{}),Ur=(r=>(r[r.MirroredRepeat=33648]="MirroredRepeat",r[r.ClampToEdge=33071]="ClampToEdge",r[r.Repeat=10497]="Repeat",r))(Ur||{});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 DS{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 i=null;for(let o=0;o<s.length;o++)if(s[o].baseTexture===e.baseTexture){i=s[o];break}if(i===null){i=new x0,i.name="texturePage";const o=e.baseTexture;i.width=o.realWidth,i.height=o.realHeight,i.baseTexture=o,i.minFilter=i.magFilter=Ye.Nearest,i.uWrap=Ur.ClampToEdge,i.vWrap=Ur.ClampToEdge,s.push(i)}const n=new y0;return n.name=t,n.page=i,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 i=new OS(t),n=new Array(4);let o=null;const h={};let a=null;h.size=()=>{o.width=parseInt(n[1]),o.height=parseInt(n[2])},h.format=()=>{},h.filter=()=>{o.minFilter=_0(n[1]),o.magFilter=_0(n[2])},h.repeat=()=>{n[1].indexOf("x")!=-1&&(o.uWrap=Ur.Repeat),n[1].indexOf("y")!=-1&&(o.vWrap=Ur.Repeat)},h.pma=()=>{o.pma=n[1]=="true"};const l={};l.xy=()=>{a.x=parseInt(n[1]),a.y=parseInt(n[2])},l.size=()=>{a.width=parseInt(n[1]),a.height=parseInt(n[2])},l.bounds=()=>{a.x=parseInt(n[1]),a.y=parseInt(n[2]),a.width=parseInt(n[3]),a.height=parseInt(n[4])},l.offset=()=>{a.offsetX=parseInt(n[1]),a.offsetY=parseInt(n[2])},l.orig=()=>{a.originalWidth=parseInt(n[1]),a.originalHeight=parseInt(n[2])},l.offsets=()=>{a.offsetX=parseInt(n[1]),a.offsetY=parseInt(n[2]),a.originalWidth=parseInt(n[3]),a.originalHeight=parseInt(n[4])},l.rotate=()=>{const u=n[1];let f=0;u.toLocaleLowerCase()=="true"?f=6:u.toLocaleLowerCase()=="false"?f=0:f=(720-parseFloat(u))%360/45,a.rotate=f},l.index=()=>{a.index=parseInt(n[1])};let c=i.readLine();for(;c!=null&&c.trim().length==0;)c=i.readLine();for(;!(c==null||c.trim().length==0||i.readEntry(n,c)==0);)c=i.readLine();const d=()=>{for(;;){if(c==null)return s&&s(this);if(c.trim().length==0)o=null,c=i.readLine();else if(o===null){for(o=new x0,o.name=c.trim();i.readEntry(n,c=i.readLine())!=0;){const u=h[n[0]];u&&u()}this.pages.push(o),e(o.name,u=>{if(u===null)return this.pages.splice(this.pages.indexOf(o),1),s&&s(null);o.baseTexture=u,o.pma&&(u.alphaMode=Re.PMA),u.valid||u.setSize(o.width,o.height),o.setFilters(),(!o.width||!o.height)&&(o.width=u.realWidth,o.height=u.realHeight,(!o.width||!o.height)&&console.log(`ERROR spine atlas page ${o.name}: meshes wont work if you dont specify size in atlas (http://www.html5gamedevs.com/topic/18888-pixi-spines-and-meshes/?p=107121)`)),d()});break}else{a=new DS;const u=new y0;u.name=c,u.page=o;let f=null,p=null;for(;;){const v=i.readEntry(n,c=i.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)}}a.originalWidth==0&&a.originalHeight==0&&(a.originalWidth=a.width,a.originalHeight=a.height);const m=o.baseTexture.resolution;a.x/=m,a.y/=m,a.width/=m,a.height/=m,a.originalWidth/=m,a.originalHeight/=m,a.offsetX/=m,a.offsetY/=m;const g=a.rotate%4!==0,y=new it(a.x,a.y,g?a.height:a.width,g?a.width:a.height),x=new it(0,0,a.originalWidth,a.originalHeight),_=new it(a.offsetX,a.originalHeight-a.height-a.offsetY,a.width,a.height);u.texture=new q(u.page.baseTexture,y,x,_,a.rotate),u.index=a.index,u.texture.updateUvs(),this.regions.push(u)}}};d()}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 OS{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 i=1,n=s+1;;i++){const o=e.indexOf(",",n);if(o==-1)return t[i]=e.substr(n).trim(),i;if(t[i]=e.substr(n,o-n).trim(),n=o+1,i==4)return 4}}}class x0{constructor(){this.minFilter=Ye.Nearest,this.magFilter=Ye.Nearest,this.uWrap=Ur.ClampToEdge,this.vWrap=Ur.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=ys.POW2,e==Ye.MipMapNearestNearest?t.scaleMode=je.NEAREST:t.scaleMode=je.LINEAR)}}class y0 extends Ou{}class LS{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 NS{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,i=t.length;s<i;s++)this.add(t[s]);return e!=this.size}contains(t){return this.entries[t]}clear(){this.entries={},this.size=0}}const Vr=class{constructor(r=0,t=0,e=0,s=0){this.r=r,this.g=t,this.b=e,this.a=s}set(r,t,e,s){return this.r=r,this.g=t,this.b=e,this.a=s,this.clamp()}setFromColor(r){return this.r=r.r,this.g=r.g,this.b=r.b,this.a=r.a,this}setFromString(r){return r=r.charAt(0)=="#"?r.substr(1):r,this.r=parseInt(r.substr(0,2),16)/255,this.g=parseInt(r.substr(2,2),16)/255,this.b=parseInt(r.substr(4,2),16)/255,this.a=r.length!=8?1:parseInt(r.substr(6,2),16)/255,this}add(r,t,e,s){return this.r+=r,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(r,t){r.r=((t&4278190080)>>>24)/255,r.g=((t&16711680)>>>16)/255,r.b=((t&65280)>>>8)/255,r.a=(t&255)/255}static rgb888ToColor(r,t){r.r=((t&16711680)>>>16)/255,r.g=((t&65280)>>>8)/255,r.b=(t&255)/255}static fromString(r){return new Vr().setFromString(r)}};let G=Vr;G.WHITE=new Vr(1,1,1,1),G.RED=new Vr(1,0,0,1),G.GREEN=new Vr(0,1,0,1),G.BLUE=new Vr(0,0,1,1),G.MAGENTA=new Vr(1,0,1,1);const Ai=class{static clamp(r,t,e){return r<t?t:r>e?e:r}static cosDeg(r){return Math.cos(r*Ai.degRad)}static sinDeg(r){return Math.sin(r*Ai.degRad)}static signum(r){return Math.sign(r)}static toInt(r){return r>0?Math.floor(r):Math.ceil(r)}static cbrt(r){const t=Math.pow(Math.abs(r),.3333333333333333);return r<0?-t:t}static randomTriangular(r,t){return Ai.randomTriangularWith(r,t,(r+t)*.5)}static randomTriangularWith(r,t,e){const s=Math.random(),i=t-r;return s<=(e-r)/i?r+Math.sqrt(s*i*(e-r)):t-Math.sqrt((1-s)*i*(t-e))}static isPowerOfTwo(r){return r&&(r&r-1)===0}};let D=Ai;D.PI=3.1415927,D.PI2=Ai.PI*2,D.radiansToDegrees=180/Ai.PI,D.radDeg=Ai.radiansToDegrees,D.degreesToRadians=Ai.PI/180,D.degRad=Ai.degreesToRadians;class US{apply(t,e,s){return t+(e-t)*this.applyInternal(s)}}class VS 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 v0 extends VS{applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}const In=class{static arrayCopy(r,t,e,s,i){for(let n=t,o=s;n<t+i;n++,o++)e[o]=r[n]}static arrayFill(r,t,e,s){for(let i=t;i<e;i++)r[i]=s}static setArraySize(r,t,e=0){const s=r.length;if(s==t)return r;if(r.length=t,s<t)for(let i=s;i<t;i++)r[i]=e;return r}static ensureArrayCapacity(r,t,e=0){return r.length>=t?r:In.setArraySize(r,t,e)}static newArray(r,t){const e=new Array(r);for(let s=0;s<r;s++)e[s]=t;return e}static newFloatArray(r){if(In.SUPPORTS_TYPED_ARRAYS)return new Float32Array(r);const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=0;return t}static newShortArray(r){if(In.SUPPORTS_TYPED_ARRAYS)return new Int16Array(r);const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=0;return t}static toFloatArray(r){return In.SUPPORTS_TYPED_ARRAYS?new Float32Array(r):r}static toSinglePrecision(r){return In.SUPPORTS_TYPED_ARRAYS?Math.fround(r):r}static webkit602BugfixHelper(r,t){}static contains(r,t,e=!0){for(let s=0;s<r.length;s++)if(r[s]==t)return!0;return!1}static enumValue(r,t){return r[t[0].toUpperCase()+t.slice(1)]}};let B=In;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 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 $S={yDown:!0,FAIL_ON_NON_EXISTING_SKIN:!1,GLOBAL_AUTO_UPDATE:!0,GLOBAL_DELAY_LIMIT:0},Ji=[0,0,0];class YS extends qe{constructor(){super(...arguments),this.region=null,this.attachment=null}}class HS extends MT{constructor(t,e,s,i,n){super(t,e,s,i,n),this.region=null,this.attachment=null}}const b0=class extends Bt{constructor(r){if(super(),!r)throw new Error("The spineData param is required.");if(typeof r=="string")throw new Error('spineData param cant be string. Please use spine.Spine.fromAtlas("YOUR_RESOURCE_NAME") from now on.');this.spineData=r,this.createSkeleton(r),this.slotContainers=[],this.tempClipContainers=[];for(let t=0,e=this.skeleton.slots.length;t<e;t++){const s=this.skeleton.slots[t],i=s.getAttachment(),n=this.newContainer();if(this.slotContainers.push(n),this.addChild(n),this.tempClipContainers.push(null),!!i)if(i.type===ot.Region){const o=i.name,h=this.createSprite(s,i,o);s.currentSprite=h,s.currentSpriteName=o,n.addChild(h)}else if(i.type===ot.Mesh){const o=this.createMesh(s,i);s.currentMesh=o,s.currentMeshId=i.id,s.currentMeshName=i.name,n.addChild(o)}else i.type===ot.Clipping&&(this.createGraphics(s,i),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(r){var t;r!=this._debug&&((t=this._debug)==null||t.unregisterSpine(this),r==null||r.registerSpine(this),this._debug=r)}get autoUpdate(){return this._autoUpdate}set autoUpdate(r){r!==this._autoUpdate&&(this._autoUpdate=r,this.updateTransform=r?b0.prototype.autoUpdateTransform:Bt.prototype.updateTransform)}get tint(){return ea(this.tintRgb)}set tint(r){this.tintRgb=Kf(r,this.tintRgb)}get delayLimit(){return(typeof this.localDelayLimit<"u"?this.localDelayLimit:$S.GLOBAL_DELAY_LIMIT)||Number.MAX_VALUE}update(r){var l;const t=this.delayLimit;if(r>t&&(r=t),this.state.update(r),this.state.apply(this.skeleton),!this.skeleton)return;this.skeleton.updateWorldTransform();const e=this.skeleton.slots,s=this.color;let i=null,n=null;s?(i=s.light,n=s.dark):i=this.tintRgb;for(let c=0,d=e.length;c<d;c++){const u=e[c],f=u.getAttachment(),p=this.slotContainers[c];if(!f){p.visible=!1;continue}let m=null;f.sequence&&f.sequence.apply(u,f);let g=f.region;const y=f.color;switch(f!=null&&f.type){case ot.Region:if(p.transform.setFromMatrix(u.bone.matrix),g=f.region,u.currentMesh&&(u.currentMesh.visible=!1,u.currentMesh=null,u.currentMeshId=void 0,u.currentMeshName=void 0),!g){u.currentSprite&&(u.currentSprite.renderable=!1);break}if(!u.currentSpriteName||u.currentSpriteName!==f.name){const v=f.name;if(u.currentSprite&&(u.currentSprite.visible=!1),u.sprites=u.sprites||{},u.sprites[v]!==void 0)u.sprites[v].visible=!0;else{const b=this.createSprite(u,f,v);p.addChild(b)}u.currentSprite=u.sprites[v],u.currentSpriteName=v}u.currentSprite.renderable=!0,u.hackRegion||this.setSpriteRegion(f,u.currentSprite,g),u.currentSprite.color?m=u.currentSprite.color:(Ji[0]=i[0]*u.color.r*y.r,Ji[1]=i[1]*u.color.g*y.g,Ji[2]=i[2]*u.color.b*y.b,u.currentSprite.tint=ea(Ji)),u.currentSprite.blendMode=u.blendMode;break;case ot.Mesh:if(u.currentSprite){u.currentSprite.visible=!1,u.currentSprite=null,u.currentSpriteName=void 0;const v=new mo;v._parentID=-1,v._worldID=p.transform._worldID,p.transform=v}if(!g){u.currentMesh&&(u.currentMesh.renderable=!1);break}const _=f.id;if(u.currentMeshId===void 0||u.currentMeshId!==_){const v=_;if(u.currentMesh&&(u.currentMesh.visible=!1),u.meshes=u.meshes||{},u.meshes[v]!==void 0)u.meshes[v].visible=!0;else{const b=this.createMesh(u,f);p.addChild(b)}u.currentMesh=u.meshes[v],u.currentMeshName=f.name,u.currentMeshId=v}u.currentMesh.renderable=!0,f.computeWorldVerticesOld(u,u.currentMesh.vertices),u.currentMesh.color?m=u.currentMesh.color:(Ji[0]=i[0]*u.color.r*y.r,Ji[1]=i[1]*u.color.g*y.g,Ji[2]=i[2]*u.color.b*y.b,u.currentMesh.tint=ea(Ji)),u.currentMesh.blendMode=u.blendMode,u.hackRegion||this.setMeshRegion(f,u.currentMesh,g);break;case ot.Clipping:u.currentGraphics||(this.createGraphics(u,f),p.addChild(u.clippingContainer),p.addChild(u.currentGraphics)),this.updateGraphics(u,f),p.alpha=1,p.visible=!0;continue;default:p.visible=!1;continue}if(p.visible=!0,m){let x=u.color.r*y.r,_=u.color.g*y.g,v=u.color.b*y.b;m.setLight(i[0]*x+n[0]*(1-x),i[1]*_+n[1]*(1-_),i[2]*v+n[2]*(1-v)),u.darkColor?(x=u.darkColor.r,_=u.darkColor.g,v=u.darkColor.b):(x=0,_=0,v=0),m.setDark(i[0]*x+n[0]*(1-x),i[1]*_+n[1]*(1-_),i[2]*v+n[2]*(1-v))}p.alpha=u.color.a}const o=this.skeleton.drawOrder;let h=null,a=null;for(let c=0,d=o.length;c<d;c++){const u=e[o[c].data.index],f=this.slotContainers[o[c].data.index];if(a||f.parent!==null&&f.parent!==this&&(f.parent.removeChild(f),f.parent=this),u.currentGraphics&&u.getAttachment())a=u.clippingContainer,h=u.getAttachment(),a.children.length=0,this.children[c]=f,h.endSlot===u.data&&(h.endSlot=null);else if(a){let p=this.tempClipContainers[c];p||(p=this.tempClipContainers[c]=this.newContainer(),p.visible=!1),this.children[c]=p,f.parent=null,a.addChild(f),h.endSlot==u.data&&(a.renderable=!0,a=null,h=null)}else this.children[c]=f}(l=this._debug)==null||l.renderDebug(this)}setSpriteRegion(r,t,e){t.attachment===r&&t.region===e||(t.region=e,t.attachment=r,t.texture=e.texture,t.rotation=r.rotation*D.degRad,t.position.x=r.x,t.position.y=r.y,t.alpha=r.color.a,e.size?(t.scale.x=e.size.width/e.originalWidth,t.scale.y=-e.size.height/e.originalHeight):(t.scale.x=r.scaleX*r.width/e.originalWidth,t.scale.y=-r.scaleY*r.height/e.originalHeight))}setMeshRegion(r,t,e){t.attachment===r&&t.region===e||(t.region=e,t.attachment=r,t.texture=e.texture,e.texture.updateUvs(),t.uvBuffer.update(r.regionUVs))}autoUpdateTransform(){{this.lastTime=this.lastTime||Date.now();const r=(Date.now()-this.lastTime)*.001;this.lastTime=Date.now(),this.update(r)}Bt.prototype.updateTransform.call(this)}createSprite(r,t,e){let s=t.region;r.hackAttachment===t&&(s=r.hackRegion);const i=s?s.texture:null,n=this.newSprite(i);return n.anchor.set(.5),s&&this.setSpriteRegion(t,n,t.region),r.sprites=r.sprites||{},r.sprites[e]=n,n}createMesh(r,t){let e=t.region;r.hackAttachment===t&&(e=r.hackRegion,r.hackAttachment=null,r.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),r.meshes=r.meshes||{},r.meshes[t.id]=s,s}createGraphics(r,t){const e=this.newGraphics(),s=new Li([]);return e.clear(),e.beginFill(16777215,1),e.drawPolygon(s),e.renderable=!1,r.currentGraphics=e,r.clippingContainer=this.newContainer(),r.clippingContainer.mask=r.currentGraphics,e}updateGraphics(r,t){const e=r.currentGraphics.geometry,s=e.graphicsData[0].shape.points,i=t.worldVerticesLength;s.length=i,t.computeWorldVertices(r,0,i,s,0,2),e.invalidate()}hackTextureBySlotIndex(r,t=null,e=null){const s=this.skeleton.slots[r];if(!s)return!1;const i=s.getAttachment();let n=i.region;return t?(n=new Ou,n.texture=t,n.size=e,s.hackRegion=n,s.hackAttachment=i):(s.hackRegion=null,s.hackAttachment=null),s.currentSprite?this.setSpriteRegion(i,s.currentSprite,n):s.currentMesh&&this.setMeshRegion(i,s.currentMesh,n),!0}hackTextureBySlotName(r,t=null,e=null){const s=this.skeleton.findSlotIndex(r);return s==-1?!1:this.hackTextureBySlotIndex(s,t,e)}hackTextureAttachment(r,t,e,s=null){const i=this.skeleton.findSlotIndex(r),n=this.skeleton.getAttachmentByName(r,t);n.region.texture=e;const o=this.skeleton.slots[i];if(!o)return!1;const h=o.getAttachment();if(t===h.name){let a=n.region;return e?(a=new Ou,a.texture=e,a.size=s,o.hackRegion=a,o.hackAttachment=h):(o.hackRegion=null,o.hackAttachment=null),o.currentSprite&&o.currentSprite.region!=a?(this.setSpriteRegion(h,o.currentSprite,a),o.currentSprite.region=a):o.currentMesh&&o.currentMesh.region!=a&&this.setMeshRegion(h,o.currentMesh,a),!0}return!1}newContainer(){return new Bt}newSprite(r){return new YS(r)}newGraphics(){return new Ks}newMesh(r,t,e,s,i){return new HS(r,t,e,s,i)}transformHack(){return 1}hackAttachmentGroups(r,t,e){if(!r)return;const s=[],i=[];for(let n=0,o=this.skeleton.slots.length;n<o;n++){const h=this.skeleton.slots[n],a=h.currentSpriteName||h.currentMeshName||"",l=h.currentSprite||h.currentMesh;a.endsWith(r)?(l.parentGroup=t,i.push(l)):e&&l&&(l.parentGroup=e,s.push(l))}return[s,i]}destroy(r){this.debug=null;for(let t=0,e=this.skeleton.slots.length;t<e;t++){const s=this.skeleton.slots[t];for(const i in s.meshes)s.meshes[i].destroy(r);s.meshes=null;for(const i in s.sprites)s.sprites[i].destroy(r);s.sprites=null}for(let t=0,e=this.slotContainers.length;t<e;t++)this.slotContainers[t].destroy(r);this.spineData=null,this.skeleton=null,this.slotContainers=null,this.stateData=null,this.state=null,this.tempClipContainers=null,super.destroy(r)}};let Nu=b0;Nu.clippingPolygon=[],Object.defineProperty(Nu.prototype,"visible",{get(){return this._visible},set(r){r!==this._visible&&(this._visible=r,r&&(this.lastTime=0))}});let w0=class{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}};const E0=class extends w0{constructor(t){super(t),this.id=(E0.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,i,n,o){s=n+(s>>1)*o;const h=t.bone.skeleton,a=t.deform;let l=this.vertices;const c=this.bones;if(c==null){a.length>0&&(l=a);const p=t.bone.matrix,m=p.tx,g=p.ty,y=p.a,x=p.c,_=p.b,v=p.d;for(let b=e,w=n;w<s;b+=2,w+=o){const E=l[b],T=l[b+1];i[w]=E*y+T*x+m,i[w+1]=E*_+T*v+g}return}let d=0,u=0;for(let p=0;p<e;p+=2){const m=c[d];d+=m+1,u+=m}const f=h.bones;if(a.length==0)for(let p=n,m=u*3;p<s;p+=o){let g=0,y=0,x=c[d++];for(x+=d;d<x;d++,m+=3){const _=f[c[d]].matrix,v=l[m],b=l[m+1],w=l[m+2];g+=(v*_.a+b*_.c+_.tx)*w,y+=(v*_.b+b*_.d+_.ty)*w}i[p]=g,i[p+1]=y}else{const p=a;for(let m=n,g=u*3,y=u<<1;m<s;m+=o){let x=0,_=0,v=c[d++];for(v+=d;d<v;d++,g+=3,y+=2){const b=f[c[d]].matrix,w=l[g]+p[y],E=l[g+1]+p[y+1],T=l[g+2];x+=(w*b.a+E*b.c+b.tx)*T,_+=(w*b.b+E*b.d+b.ty)*T}i[m]=x,i[m+1]=_}}}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 Xr=E0;Xr.nextID=0;let WS=class ex extends Xr{constructor(t){super(t),this.type=ot.BoundingBox,this.color=new G(1,1,1,1)}copy(){const t=new ex(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},zS=class sx extends Xr{constructor(t){super(t),this.type=ot.Clipping,this.color=new G(.2275,.2275,.8078,1)}copy(){const t=new sx(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},Uu=class xd extends Xr{constructor(t){super(t),this.type=ot.Mesh,this.color=new G(1,1,1,1),this.tempColor=new G(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}},_h=class ix extends Xr{constructor(t){super(t),this.type=ot.Path,this.closed=!1,this.constantSpeed=!1,this.color=new G(1,1,1,1)}copy(){const t=new ix(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}},jS=class rx extends Xr{constructor(t){super(t),this.type=ot.Point,this.color=new G(.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),i=D.sinDeg(this.rotation),n=s*e.a+i*e.c,o=s*e.b+i*e.d;return Math.atan2(o,n)*D.radDeg}copy(){const t=new rx(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}},T0=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 G,this.darkColor=t.darkColor==null?null:new G,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 w0{constructor(t){super(t),this.type=ot.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 G(1,1,1,1),this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new G(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,i=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,o=i+this.region.height*e,h=this.rotation*Math.PI/180,a=Math.cos(h),l=Math.sin(h),c=s*a+this.x,d=s*l,u=i*a+this.y,f=i*l,p=n*a+this.x,m=n*l,g=o*a+this.y,y=o*l,x=this.offset;x[_e.OX1]=c-f,x[_e.OY1]=u+d,x[_e.OX2]=c-y,x[_e.OY2]=g+d,x[_e.OX3]=p-y,x[_e.OY3]=g+m,x[_e.OX4]=p-f,x[_e.OY4]=u+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,i){const n=this.offset,o=t instanceof T0?t.bone.matrix:t.matrix,h=o.tx,a=o.ty,l=o.a,c=o.c,d=o.b,u=o.d;let f=0,p=0;f=n[_e.OX1],p=n[_e.OY1],e[s]=f*l+p*c+h,e[s+1]=f*d+p*u+a,s+=i,f=n[_e.OX2],p=n[_e.OY2],e[s]=f*l+p*c+h,e[s+1]=f*d+p*u+a,s+=i,f=n[_e.OX3],p=n[_e.OY3],e[s]=f*l+p*c+h,e[s+1]=f*d+p*u+a,s+=i,f=n[_e.OX4],p=n[_e.OY4],e[s]=f*l+p*c+h,e[s+1]=f*d+p*u+a}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 rt=_e;rt.OX1=0,rt.OY1=1,rt.OX2=2,rt.OY2=3,rt.OX3=4,rt.OY3=5,rt.OX4=6,rt.OY4=7,rt.X1=0,rt.Y1=1,rt.C1R=2,rt.C1G=3,rt.C1B=4,rt.C1A=5,rt.U1=6,rt.V1=7,rt.X2=8,rt.Y2=9,rt.C2R=10,rt.C2G=11,rt.C2B=12,rt.C2A=13,rt.U2=14,rt.V2=15,rt.X3=16,rt.Y3=17,rt.C3R=18,rt.C3G=19,rt.C3B=20,rt.C3A=21,rt.U3=22,rt.V3=23,rt.X4=24,rt.Y4=25,rt.C4R=26,rt.C4G=27,rt.C4B=28,rt.C4A=29,rt.U4=30,rt.V4=31,new v0(2);let ae=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 i=0;i<e.length;i++)this.timelineIds[e[i].getPropertyId()]=!0;this.duration=s}hasTimeline(t){return this.timelineIds[t]==!0}apply(t,e,s,i,n,o,h,a){if(t==null)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let c=0,d=l.length;c<d;c++)l[c].apply(t,e,s,n,o,h,a)}static binarySearch(t,e,s=1){let i=0,n=t.length/s-2;if(n==0)return s;let o=n>>>1;for(;;){if(t[(o+1)*s]<=e?i=o+1:n=o,i==n)return(i+1)*s;o=i+n>>>1}}static linearSearch(t,e,s){for(let i=0,n=t.length-s;i<=n;i+=s)if(t[i]>e)return i;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,i,n){const o=(-e*2+i)*.03,h=(-s*2+n)*.03,a=((e-i)*3+1)*.006,l=((s-n)*3+1)*.006;let c=o*2+a,d=h*2+l,u=e*.3+o+a*.16666667,f=s*.3+h+l*.16666667,p=t*ee.BEZIER_SIZE;const m=this.curves;m[p++]=ee.BEZIER;let g=u,y=f;for(let x=p+ee.BEZIER_SIZE-1;p<x;p+=2)m[p]=g,m[p+1]=y,u+=c,f+=d,c+=a,d+=l,g+=u,y+=f}getCurvePercent(t,e){e=D.clamp(e,0,1);const s=this.curves;let i=t*ee.BEZIER_SIZE;const n=s[i];if(n==ee.LINEAR)return e;if(n==ee.STEPPED)return 0;i++;let o=0;for(let a=i,l=i+ee.BEZIER_SIZE-1;i<l;i+=2)if(o=s[i],o>=e){let c,d;return i==a?(c=0,d=0):(c=s[i-2],d=s[i-1]),d+(s[i+1]-d)*(e-c)/(o-c)}const h=s[i-1];return h+(1-h)*(e-o)/(1-o)}};let es=ee;es.LINEAR=0,es.STEPPED=1,es.BEZIER=2,es.BEZIER_SIZE=10*2-1;const tr=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+tr.ROTATION]=s}apply(t,e,s,i,n,o,h){const a=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<a[0]){switch(o){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>=a[a.length-tr.ENTRIES]){let m=a[a.length+tr.PREV_ROTATION];switch(o){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 c=ae.binarySearch(a,s,tr.ENTRIES),d=a[c+tr.PREV_ROTATION],u=a[c],f=this.getCurvePercent((c>>1)-1,1-(s-u)/(a[c+tr.PREV_TIME]-u));let p=a[c+tr.ROTATION]-d;switch(p=d+(p-(16384-(16384.499999999996-p/360|0))*360)*f,o){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=tr;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,i){t*=ke.ENTRIES,this.frames[t]=e,this.frames[t+ke.X]=s,this.frames[t+ke.Y]=i}apply(t,e,s,i,n,o,h){const a=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<a[0]){switch(o){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 c=0,d=0;if(s>=a[a.length-ke.ENTRIES])c=a[a.length+ke.PREV_X],d=a[a.length+ke.PREV_Y];else{const u=ae.binarySearch(a,s,ke.ENTRIES);c=a[u+ke.PREV_X],d=a[u+ke.PREV_Y];const f=a[u],p=this.getCurvePercent(u/ke.ENTRIES-1,1-(s-f)/(a[u+ke.PREV_TIME]-f));c+=(a[u+ke.X]-c)*p,d+=(a[u+ke.Y]-d)*p}switch(o){case S.setup:l.x=l.data.x+c*n,l.y=l.data.y+d*n;break;case S.first:case S.replace:l.x+=(l.data.x+c-l.x)*n,l.y+=(l.data.y+d-l.y)*n;break;case S.add:l.x+=c*n,l.y+=d*n}}};let fs=ke;fs.ENTRIES=3,fs.PREV_TIME=-3,fs.PREV_X=-2,fs.PREV_Y=-1,fs.X=1,fs.Y=2;let A0=class ks extends fs{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,i,n,o,h){const a=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<a[0]){switch(o){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 c=0,d=0;if(s>=a[a.length-ks.ENTRIES])c=a[a.length+ks.PREV_X]*l.data.scaleX,d=a[a.length+ks.PREV_Y]*l.data.scaleY;else{const u=ae.binarySearch(a,s,ks.ENTRIES);c=a[u+ks.PREV_X],d=a[u+ks.PREV_Y];const f=a[u],p=this.getCurvePercent(u/ks.ENTRIES-1,1-(s-f)/(a[u+ks.PREV_TIME]-f));c=(c+(a[u+ks.X]-c)*p)*l.data.scaleX,d=(d+(a[u+ks.Y]-d)*p)*l.data.scaleY}if(n==1)o==S.add?(l.scaleX+=c-l.data.scaleX,l.scaleY+=d-l.data.scaleY):(l.scaleX=c,l.scaleY=d);else{let u=0,f=0;if(h==At.mixOut)switch(o){case S.setup:u=l.data.scaleX,f=l.data.scaleY,l.scaleX=u+(Math.abs(c)*D.signum(u)-u)*n,l.scaleY=f+(Math.abs(d)*D.signum(f)-f)*n;break;case S.first:case S.replace:u=l.scaleX,f=l.scaleY,l.scaleX=u+(Math.abs(c)*D.signum(u)-u)*n,l.scaleY=f+(Math.abs(d)*D.signum(f)-f)*n;break;case S.add:u=l.scaleX,f=l.scaleY,l.scaleX=u+(Math.abs(c)*D.signum(u)-l.data.scaleX)*n,l.scaleY=f+(Math.abs(d)*D.signum(f)-l.data.scaleY)*n}else switch(o){case S.setup:u=Math.abs(l.data.scaleX)*D.signum(c),f=Math.abs(l.data.scaleY)*D.signum(d),l.scaleX=u+(c-u)*n,l.scaleY=f+(d-f)*n;break;case S.first:case S.replace:u=Math.abs(l.scaleX)*D.signum(c),f=Math.abs(l.scaleY)*D.signum(d),l.scaleX=u+(c-u)*n,l.scaleY=f+(d-f)*n;break;case S.add:u=D.signum(c),f=D.signum(d),l.scaleX=Math.abs(l.scaleX)*u+(c-Math.abs(l.data.scaleX)*u)*n,l.scaleY=Math.abs(l.scaleY)*f+(d-Math.abs(l.data.scaleY)*f)*n}}}},S0=class Bs extends fs{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,i,n,o,h){const a=this.frames,l=t.bones[this.boneIndex];if(!l.active)return;if(s<a[0]){switch(o){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 c=0,d=0;if(s>=a[a.length-Bs.ENTRIES])c=a[a.length+Bs.PREV_X],d=a[a.length+Bs.PREV_Y];else{const u=ae.binarySearch(a,s,Bs.ENTRIES);c=a[u+Bs.PREV_X],d=a[u+Bs.PREV_Y];const f=a[u],p=this.getCurvePercent(u/Bs.ENTRIES-1,1-(s-f)/(a[u+Bs.PREV_TIME]-f));c=c+(a[u+Bs.X]-c)*p,d=d+(a[u+Bs.Y]-d)*p}switch(o){case S.setup:l.shearX=l.data.shearX+c*n,l.shearY=l.data.shearY+d*n;break;case S.first:case S.replace:l.shearX+=(l.data.shearX+c-l.shearX)*n,l.shearY+=(l.data.shearY+d-l.shearY)*n;break;case S.add:l.shearX+=c*n,l.shearY+=d*n}}};const Gt=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Gt.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(t,e,s,i,n,o){t*=Gt.ENTRIES,this.frames[t]=e,this.frames[t+Gt.R]=s,this.frames[t+Gt.G]=i,this.frames[t+Gt.B]=n,this.frames[t+Gt.A]=o}apply(t,e,s,i,n,o,h){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const l=this.frames;if(s<l[0]){switch(o){case S.setup:a.color.setFromColor(a.data.color);return;case S.first:const p=a.color,m=a.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 c=0,d=0,u=0,f=0;if(s>=l[l.length-Gt.ENTRIES]){const p=l.length;c=l[p+Gt.PREV_R],d=l[p+Gt.PREV_G],u=l[p+Gt.PREV_B],f=l[p+Gt.PREV_A]}else{const p=ae.binarySearch(l,s,Gt.ENTRIES);c=l[p+Gt.PREV_R],d=l[p+Gt.PREV_G],u=l[p+Gt.PREV_B],f=l[p+Gt.PREV_A];const m=l[p],g=this.getCurvePercent(p/Gt.ENTRIES-1,1-(s-m)/(l[p+Gt.PREV_TIME]-m));c+=(l[p+Gt.R]-c)*g,d+=(l[p+Gt.G]-d)*g,u+=(l[p+Gt.B]-u)*g,f+=(l[p+Gt.A]-f)*g}if(n==1)a.color.set(c,d,u,f);else{const p=a.color;o==S.setup&&p.setFromColor(a.data.color),p.add((c-p.r)*n,(d-p.g)*n,(u-p.b)*n,(f-p.a)*n)}}};let He=Gt;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,i,n,o,h,a,l){t*=dt.ENTRIES,this.frames[t]=e,this.frames[t+dt.R]=s,this.frames[t+dt.G]=i,this.frames[t+dt.B]=n,this.frames[t+dt.A]=o,this.frames[t+dt.R2]=h,this.frames[t+dt.G2]=a,this.frames[t+dt.B2]=l}apply(t,e,s,i,n,o,h){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const l=this.frames;if(s<l[0]){switch(o){case S.setup:a.color.setFromColor(a.data.color),a.darkColor.setFromColor(a.data.darkColor);return;case S.first:const y=a.color,x=a.darkColor,_=a.data.color,v=a.data.darkColor;y.add((_.r-y.r)*n,(_.g-y.g)*n,(_.b-y.b)*n,(_.a-y.a)*n),x.add((v.r-x.r)*n,(v.g-x.g)*n,(v.b-x.b)*n,0)}return}let c=0,d=0,u=0,f=0,p=0,m=0,g=0;if(s>=l[l.length-dt.ENTRIES]){const y=l.length;c=l[y+dt.PREV_R],d=l[y+dt.PREV_G],u=l[y+dt.PREV_B],f=l[y+dt.PREV_A],p=l[y+dt.PREV_R2],m=l[y+dt.PREV_G2],g=l[y+dt.PREV_B2]}else{const y=ae.binarySearch(l,s,dt.ENTRIES);c=l[y+dt.PREV_R],d=l[y+dt.PREV_G],u=l[y+dt.PREV_B],f=l[y+dt.PREV_A],p=l[y+dt.PREV_R2],m=l[y+dt.PREV_G2],g=l[y+dt.PREV_B2];const x=l[y],_=this.getCurvePercent(y/dt.ENTRIES-1,1-(s-x)/(l[y+dt.PREV_TIME]-x));c+=(l[y+dt.R]-c)*_,d+=(l[y+dt.G]-d)*_,u+=(l[y+dt.B]-u)*_,f+=(l[y+dt.A]-f)*_,p+=(l[y+dt.R2]-p)*_,m+=(l[y+dt.G2]-m)*_,g+=(l[y+dt.B2]-g)*_}if(n==1)a.color.set(c,d,u,f),a.darkColor.set(p,m,g,1);else{const y=a.color,x=a.darkColor;o==S.setup&&(y.setFromColor(a.data.color),x.setFromColor(a.data.darkColor)),y.add((c-y.r)*n,(d-y.g)*n,(u-y.b)*n,(f-y.a)*n),x.add((p-x.r)*n,(m-x.g)*n,(g-x.b)*n,0)}}};let oe=dt;oe.ENTRIES=8,oe.PREV_TIME=-8,oe.PREV_R=-7,oe.PREV_G=-6,oe.PREV_B=-5,oe.PREV_A=-4,oe.PREV_R2=-3,oe.PREV_G2=-2,oe.PREV_B2=-1,oe.R=1,oe.G=2,oe.B=3,oe.A=4,oe.R2=5,oe.G2=6,oe.B2=7;let Pn=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,i,n,o,h){const a=t.slots[this.slotIndex];if(!a.bone.active)return;if(h==At.mixOut){o==S.setup&&this.setAttachment(t,a,a.data.attachmentName);return}const l=this.frames;if(s<l[0]){(o==S.setup||o==S.first)&&this.setAttachment(t,a,a.data.attachmentName);return}let c=0;s>=l[l.length-1]?c=l.length-1:c=ae.binarySearch(l,s,1)-1;const d=this.attachmentNames[c];t.slots[this.slotIndex].setAttachment(d==null?null:t.getAttachment(this.slotIndex,d))}setAttachment(t,e,s){e.setAttachment(s==null?null:t.getAttachment(this.slotIndex,s))}},C0=null,I0=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t),this.frameVertices=new Array(t),C0==null&&(C0=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,i,n,o,h){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const l=a.getAttachment();if(!(l instanceof Xr)||l.deformAttachment!=this.attachment)return;const c=a.deform;c.length==0&&(o=S.setup);const d=this.frameVertices,u=d[0].length,f=this.frames;if(s<f[0]){const v=l;switch(o){case S.setup:c.length=0;return;case S.first:if(n==1){c.length=0;break}const b=B.setArraySize(c,u);if(v.bones==null){const w=v.vertices;for(let E=0;E<u;E++)b[E]+=(w[E]-b[E])*n}else{n=1-n;for(let w=0;w<u;w++)b[w]*=n}}return}const p=B.setArraySize(c,u);if(s>=f[f.length-1]){const v=d[f.length-1];if(n==1)if(o==S.add){const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<u;E++)p[E]+=v[E]-w[E]}else for(let w=0;w<u;w++)p[w]+=v[w]}else B.arrayCopy(v,0,p,0,u);else switch(o){case S.setup:{const w=l;if(w.bones==null){const E=w.vertices;for(let T=0;T<u;T++){const A=E[T];p[T]=A+(v[T]-A)*n}}else for(let E=0;E<u;E++)p[E]=v[E]*n;break}case S.first:case S.replace:for(let w=0;w<u;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<u;E++)p[E]+=(v[E]-w[E])*n}else for(let w=0;w<u;w++)p[w]+=v[w]*n}return}const m=ae.binarySearch(f,s),g=d[m-1],y=d[m],x=f[m],_=this.getCurvePercent(m-1,1-(s-x)/(f[m-1]-x));if(n==1)if(o==S.add){const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<u;w++){const E=g[w];p[w]+=E+(y[w]-E)*_-b[w]}}else for(let b=0;b<u;b++){const w=g[b];p[b]+=w+(y[b]-w)*_}}else for(let v=0;v<u;v++){const b=g[v];p[v]=b+(y[v]-b)*_}else switch(o){case S.setup:{const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<u;E++){const T=g[E],A=w[E];p[E]=A+(T+(y[E]-T)*_-A)*n}}else for(let w=0;w<u;w++){const E=g[w];p[w]=(E+(y[w]-E)*_)*n}break}case S.first:case S.replace:for(let b=0;b<u;b++){const w=g[b];p[b]+=(w+(y[b]-w)*_-p[b])*n}break;case S.add:const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<u;w++){const E=g[w];p[w]+=(E+(y[w]-E)*_-b[w])*n}}else for(let b=0;b<u;b++){const w=g[b];p[b]+=(w+(y[b]-w)*_)*n}}}},Vu=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,i,n,o,h){if(i==null)return;const a=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,i,n,o,h),e=-1;else if(e>=a[l-1])return;if(s<a[0])return;let c=0;if(e<a[0])c=0;else{c=ae.binarySearch(a,e);const d=a[c];for(;c>0&&a[c-1]==d;)c--}for(;c<l&&s>=a[c];c++)i.push(this.events[c])}},Ca=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,i,n,o,h){const a=t.drawOrder,l=t.slots;if(h==At.mixOut&&o==S.setup){B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const c=this.frames;if(s<c[0]){(o==S.setup||o==S.first)&&B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let d=0;s>=c[c.length-1]?d=c.length-1:d=ae.binarySearch(c,s)-1;const u=this.drawOrders[d];if(u==null)B.arrayCopy(l,0,a,0,l.length);else for(let f=0,p=u.length;f<p;f++)a[f]=l[u[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,i,n,o,h){t*=mt.ENTRIES,this.frames[t]=e,this.frames[t+mt.MIX]=s,this.frames[t+mt.SOFTNESS]=i,this.frames[t+mt.BEND_DIRECTION]=n,this.frames[t+mt.COMPRESS]=o?1:0,this.frames[t+mt.STRETCH]=h?1:0}apply(t,e,s,i,n,o,h){const a=this.frames,l=t.ikConstraints[this.ikConstraintIndex];if(!l.active)return;if(s<a[0]){switch(o){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>=a[a.length-mt.ENTRIES]){o==S.setup?(l.mix=l.data.mix+(a[a.length+mt.PREV_MIX]-l.data.mix)*n,l.softness=l.data.softness+(a[a.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=a[a.length+mt.PREV_BEND_DIRECTION],l.compress=a[a.length+mt.PREV_COMPRESS]!=0,l.stretch=a[a.length+mt.PREV_STRETCH]!=0)):(l.mix+=(a[a.length+mt.PREV_MIX]-l.mix)*n,l.softness+=(a[a.length+mt.PREV_SOFTNESS]-l.softness)*n,h==At.mixIn&&(l.bendDirection=a[a.length+mt.PREV_BEND_DIRECTION],l.compress=a[a.length+mt.PREV_COMPRESS]!=0,l.stretch=a[a.length+mt.PREV_STRETCH]!=0));return}const c=ae.binarySearch(a,s,mt.ENTRIES),d=a[c+mt.PREV_MIX],u=a[c+mt.PREV_SOFTNESS],f=a[c],p=this.getCurvePercent(c/mt.ENTRIES-1,1-(s-f)/(a[c+mt.PREV_TIME]-f));o==S.setup?(l.mix=l.data.mix+(d+(a[c+mt.MIX]-d)*p-l.data.mix)*n,l.softness=l.data.softness+(u+(a[c+mt.SOFTNESS]-u)*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=a[c+mt.PREV_BEND_DIRECTION],l.compress=a[c+mt.PREV_COMPRESS]!=0,l.stretch=a[c+mt.PREV_STRETCH]!=0)):(l.mix+=(d+(a[c+mt.MIX]-d)*p-l.mix)*n,l.softness+=(u+(a[c+mt.SOFTNESS]-u)*p-l.softness)*n,h==At.mixIn&&(l.bendDirection=a[c+mt.PREV_BEND_DIRECTION],l.compress=a[c+mt.PREV_COMPRESS]!=0,l.stretch=a[c+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,i,n,o){t*=$t.ENTRIES,this.frames[t]=e,this.frames[t+$t.ROTATE]=s,this.frames[t+$t.TRANSLATE]=i,this.frames[t+$t.SCALE]=n,this.frames[t+$t.SHEAR]=o}apply(t,e,s,i,n,o,h){const a=this.frames,l=t.transformConstraints[this.transformConstraintIndex];if(!l.active)return;if(s<a[0]){const p=l.data;switch(o){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 c=0,d=0,u=0,f=0;if(s>=a[a.length-$t.ENTRIES]){const p=a.length;c=a[p+$t.PREV_ROTATE],d=a[p+$t.PREV_TRANSLATE],u=a[p+$t.PREV_SCALE],f=a[p+$t.PREV_SHEAR]}else{const p=ae.binarySearch(a,s,$t.ENTRIES);c=a[p+$t.PREV_ROTATE],d=a[p+$t.PREV_TRANSLATE],u=a[p+$t.PREV_SCALE],f=a[p+$t.PREV_SHEAR];const m=a[p],g=this.getCurvePercent(p/$t.ENTRIES-1,1-(s-m)/(a[p+$t.PREV_TIME]-m));c+=(a[p+$t.ROTATE]-c)*g,d+=(a[p+$t.TRANSLATE]-d)*g,u+=(a[p+$t.SCALE]-u)*g,f+=(a[p+$t.SHEAR]-f)*g}if(o==S.setup){const p=l.data;l.rotateMix=p.rotateMix+(c-p.rotateMix)*n,l.translateMix=p.translateMix+(d-p.translateMix)*n,l.scaleMix=p.scaleMix+(u-p.scaleMix)*n,l.shearMix=p.shearMix+(f-p.shearMix)*n}else l.rotateMix+=(c-l.rotateMix)*n,l.translateMix+=(d-l.translateMix)*n,l.scaleMix+=(u-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 Cs=class extends es{constructor(t){super(t),this.frames=B.newFloatArray(t*Cs.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(t,e,s){t*=Cs.ENTRIES,this.frames[t]=e,this.frames[t+Cs.VALUE]=s}apply(t,e,s,i,n,o,h){const a=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<a[0]){switch(o){case S.setup:l.position=l.data.position;return;case S.first:l.position+=(l.data.position-l.position)*n}return}let c=0;if(s>=a[a.length-Cs.ENTRIES])c=a[a.length+Cs.PREV_VALUE];else{const d=ae.binarySearch(a,s,Cs.ENTRIES);c=a[d+Cs.PREV_VALUE];const u=a[d],f=this.getCurvePercent(d/Cs.ENTRIES-1,1-(s-u)/(a[d+Cs.PREV_TIME]-u));c+=(a[d+Cs.VALUE]-c)*f}o==S.setup?l.position=l.data.position+(c-l.data.position)*n:l.position+=(c-l.position)*n}};let Si=Cs;Si.ENTRIES=2,Si.PREV_TIME=-2,Si.PREV_VALUE=-1,Si.VALUE=1;let P0=class lr extends Si{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,i,n,o,h){const a=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<a[0]){switch(o){case S.setup:l.spacing=l.data.spacing;return;case S.first:l.spacing+=(l.data.spacing-l.spacing)*n}return}let c=0;if(s>=a[a.length-lr.ENTRIES])c=a[a.length+lr.PREV_VALUE];else{const d=ae.binarySearch(a,s,lr.ENTRIES);c=a[d+lr.PREV_VALUE];const u=a[d],f=this.getCurvePercent(d/lr.ENTRIES-1,1-(s-u)/(a[d+lr.PREV_TIME]-u));c+=(a[d+lr.VALUE]-c)*f}o==S.setup?l.spacing=l.data.spacing+(c-l.data.spacing)*n:l.spacing+=(c-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,i){t*=Be.ENTRIES,this.frames[t]=e,this.frames[t+Be.ROTATE]=s,this.frames[t+Be.TRANSLATE]=i}apply(t,e,s,i,n,o,h){const a=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(!l.active)return;if(s<a[0]){switch(o){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 c=0,d=0;if(s>=a[a.length-Be.ENTRIES])c=a[a.length+Be.PREV_ROTATE],d=a[a.length+Be.PREV_TRANSLATE];else{const u=ae.binarySearch(a,s,Be.ENTRIES);c=a[u+Be.PREV_ROTATE],d=a[u+Be.PREV_TRANSLATE];const f=a[u],p=this.getCurvePercent(u/Be.ENTRIES-1,1-(s-f)/(a[u+Be.PREV_TIME]-f));c+=(a[u+Be.ROTATE]-c)*p,d+=(a[u+Be.TRANSLATE]-d)*p}o==S.setup?(l.rotateMix=l.data.rotateMix+(c-l.data.rotateMix)*n,l.translateMix=l.data.translateMix+(d-l.data.translateMix)*n):(l.rotateMix+=(c-l.rotateMix)*n,l.translateMix+=(d-l.translateMix)*n)}};let ni=Be;ni.ENTRIES=3,ni.PREV_TIME=-3,ni.PREV_ROTATE=-2,ni.PREV_TRANSLATE=-1,ni.ROTATE=1,ni.TRANSLATE=2;const Yt=class{constructor(r){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new R0(this),this.propertyIDs=new LS,this.animationsChanged=!1,this.trackEntryPool=new XS(()=>new Xu),this.data=r}update(r){r*=this.timeScale;const t=this.tracks;for(let e=0,s=t.length;e<s;e++){const i=t[e];if(i==null)continue;i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast;let n=r*i.timeScale;if(i.delay>0){if(i.delay-=n,i.delay>0)continue;n=-i.delay,i.delay=0}let o=i.next;if(o!=null){const h=i.trackLast-o.delay;if(h>=0){for(o.delay=0,o.trackTime+=i.timeScale==0?0:(h/i.timeScale+r)*o.timeScale,i.trackTime+=n,this.setCurrent(e,o,!0);o.mixingFrom!=null;)o.mixTime+=r,o=o.mixingFrom;continue}}else if(i.trackLast>=i.trackEnd&&i.mixingFrom==null){t[e]=null,this.queue.end(i),this.disposeNext(i);continue}if(i.mixingFrom!=null&&this.updateMixingFrom(i,r)){let h=i.mixingFrom;for(i.mixingFrom=null,h!=null&&(h.mixingTo=null);h!=null;)this.queue.end(h),h=h.mixingFrom}i.trackTime+=n}this.queue.drain()}updateMixingFrom(r,t){const e=r.mixingFrom;if(e==null)return!0;const s=this.updateMixingFrom(e,t);return e.animationLast=e.nextAnimationLast,e.trackLast=e.nextTrackLast,r.mixTime>0&&r.mixTime>=r.mixDuration?((e.totalAlpha==0||r.mixDuration==0)&&(r.mixingFrom=e.mixingFrom,e.mixingFrom!=null&&(e.mixingFrom.mixingTo=r),r.interruptAlpha=e.interruptAlpha,this.queue.end(e)),s):(e.trackTime+=t*e.timeScale,r.mixTime+=t,!1)}apply(r){if(r==null)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const t=this.events,e=this.tracks;let s=!1;for(let o=0,h=e.length;o<h;o++){const a=e[o];if(a==null||a.delay>0)continue;s=!0;const l=o==0?S.first:a.mixBlend;let c=a.alpha;a.mixingFrom!=null?c*=this.applyMixingFrom(a,r,l):a.trackTime>=a.trackEnd&&a.next==null&&(c=0);const d=a.animationLast,u=a.getAnimationTime(),f=a.animation.timelines.length,p=a.animation.timelines;if(o==0&&c==1||l==S.add)for(let m=0;m<f;m++){const g=p[m];g instanceof Pn?this.applyAttachmentTimeline(g,r,u,l,!0):g.apply(r,d,u,t,c,l,At.mixIn)}else{const m=a.timelineMode,g=a.timelinesRotation.length==0;g&&B.setArraySize(a.timelinesRotation,f<<1,null);const y=a.timelinesRotation;for(let x=0;x<f;x++){const _=p[x],v=m[x]==Yt.SUBSEQUENT?l:S.setup;_ instanceof Ie?this.applyRotateTimeline(_,r,u,c,v,y,x<<1,g):_ instanceof Pn?this.applyAttachmentTimeline(_,r,u,l,!0):_.apply(r,d,u,t,c,v,At.mixIn)}}this.queueEvents(a,u),t.length=0,a.nextAnimationLast=u,a.nextTrackLast=a.trackTime}const i=this.unkeyedState+Yt.SETUP,n=r.slots;for(let o=0,h=r.slots.length;o<h;o++){const a=n[o];if(a.attachmentState==i){const l=a.data.attachmentName;a.setAttachment(l==null?null:r.getAttachment(a.data.index,l))}}return this.unkeyedState+=2,this.queue.drain(),s}applyMixingFrom(r,t,e){const s=r.mixingFrom;s.mixingFrom!=null&&this.applyMixingFrom(s,t,e);let i=0;r.mixDuration==0?(i=1,e==S.first&&(e=S.setup)):(i=r.mixTime/r.mixDuration,i>1&&(i=1),e!=S.first&&(e=s.mixBlend));const n=i<s.eventThreshold?this.events:null,o=i<s.attachmentThreshold,h=i<s.drawOrderThreshold,a=s.animationLast,l=s.getAnimationTime(),c=s.animation.timelines.length,d=s.animation.timelines,u=s.alpha*r.interruptAlpha,f=u*(1-i);if(e==S.add)for(let p=0;p<c;p++)d[p].apply(t,a,l,n,f,e,At.mixOut);else{const p=s.timelineMode,m=s.timelineHoldMix,g=s.timelinesRotation.length==0;g&&B.setArraySize(s.timelinesRotation,c<<1,null);const y=s.timelinesRotation;s.totalAlpha=0;for(let x=0;x<c;x++){const _=d[x];let v=At.mixOut,b,w=0;switch(p[x]){case Yt.SUBSEQUENT:if(!h&&_ instanceof Ca)continue;b=e,w=f;break;case Yt.FIRST:b=S.setup,w=f;break;case Yt.HOLD_SUBSEQUENT:b=e,w=u;break;case Yt.HOLD_FIRST:b=S.setup,w=u;break;default:b=S.setup;const E=m[x];w=u*Math.max(0,1-E.mixTime/E.mixDuration);break}s.totalAlpha+=w,_ instanceof Ie?this.applyRotateTimeline(_,t,l,w,b,y,x<<1,g):_ instanceof Pn?this.applyAttachmentTimeline(_,t,l,b,o):(h&&_ instanceof Ca&&b==S.setup&&(v=At.mixIn),_.apply(t,a,l,n,w,b,v))}}return r.mixDuration>0&&this.queueEvents(s,l),this.events.length=0,s.nextAnimationLast=l,s.nextTrackLast=s.trackTime,i}applyAttachmentTimeline(r,t,e,s,i){const n=t.slots[r.slotIndex];if(!n.bone.active)return;const o=r.frames;if(e<o[0])(s==S.setup||s==S.first)&&this.setAttachment(t,n,n.data.attachmentName,i);else{let h;e>=o[o.length-1]?h=o.length-1:h=ae.binarySearch(o,e)-1,this.setAttachment(t,n,r.attachmentNames[h],i)}n.attachmentState<=this.unkeyedState&&(n.attachmentState=this.unkeyedState+Yt.SETUP)}setAttachment(r,t,e,s){t.setAttachment(e==null?null:r.getAttachment(t.data.index,e)),s&&(t.attachmentState=this.unkeyedState+Yt.CURRENT)}applyRotateTimeline(r,t,e,s,i,n,o,h){if(h&&(n[o]=0),s==1){r.apply(t,0,e,null,1,i,At.mixIn);return}const a=r,l=a.frames,c=t.bones[a.boneIndex];if(!c.active)return;let d=0,u=0;if(e<l[0])switch(i){case S.setup:c.rotation=c.data.rotation;default:return;case S.first:d=c.rotation,u=c.data.rotation}else if(d=i==S.setup?c.data.rotation:c.rotation,e>=l[l.length-Ie.ENTRIES])u=c.data.rotation+l[l.length+Ie.PREV_ROTATION];else{const m=ae.binarySearch(l,e,Ie.ENTRIES),g=l[m+Ie.PREV_ROTATION],y=l[m],x=a.getCurvePercent((m>>1)-1,1-(e-y)/(l[m+Ie.PREV_TIME]-y));u=l[m+Ie.ROTATION]-g,u-=(16384-(16384.499999999996-u/360|0))*360,u=g+u*x+c.data.rotation,u-=(16384-(16384.499999999996-u/360|0))*360}let f=0,p=u-d;if(p-=(16384-(16384.499999999996-p/360|0))*360,p==0)f=n[o];else{let m=0,g=0;h?(m=0,g=p):(m=n[o],g=n[o+1]);const y=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=y),f=p+m-m%360,x!=y&&(f+=360*D.signum(m)),n[o]=f}n[o+1]=p,d+=f*s,c.rotation=d-(16384-(16384.499999999996-d/360|0))*360}queueEvents(r,t){const e=r.animationStart,s=r.animationEnd,i=s-e,n=r.trackLast%i,o=this.events;let h=0;const a=o.length;for(;h<a;h++){const c=o[h];if(c.time<n)break;c.time>s||this.queue.event(r,c)}let l=!1;for(r.loop?l=i==0||n>r.trackTime%i:l=t>=s&&r.animationLast<s,l&&this.queue.complete(r);h<a;h++)o[h].time<e||this.queue.event(r,o[h])}clearTracks(){const r=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=r,this.queue.drain()}clearTrack(r){if(r>=this.tracks.length)return;const t=this.tracks[r];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(r,t,e){const s=this.expandToIndex(r);this.tracks[r]=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(r,t,e){const s=this.data.skeletonData.findAnimation(t);if(s==null)throw new Error(`Animation not found: ${t}`);return this.setAnimationWith(r,s,e)}setAnimationWith(r,t,e){if(t==null)throw new Error("animation cannot be null.");let s=!0,i=this.expandToIndex(r);i!=null&&(i.nextTrackLast==-1?(this.tracks[r]=i.mixingFrom,this.queue.interrupt(i),this.queue.end(i),this.disposeNext(i),i=i.mixingFrom,s=!1):this.disposeNext(i));const n=this.trackEntry(r,t,e,i);return this.setCurrent(r,n,s),this.queue.drain(),n}addAnimation(r,t,e,s){const i=this.data.skeletonData.findAnimation(t);if(i==null)throw new Error(`Animation not found: ${t}`);return this.addAnimationWith(r,i,e,s)}addAnimationWith(r,t,e,s){if(t==null)throw new Error("animation cannot be null.");let i=this.expandToIndex(r);if(i!=null)for(;i.next!=null;)i=i.next;const n=this.trackEntry(r,t,e,i);if(i==null)this.setCurrent(r,n,!0),this.queue.drain();else if(i.next=n,s<=0){const o=i.animationEnd-i.animationStart;o!=0?(i.loop?s+=o*(1+(i.trackTime/o|0)):s+=Math.max(o,i.trackTime),s-=this.data.getMix(i.animation,t)):s=i.trackTime}return n.delay=s,n}setEmptyAnimation(r,t){const e=this.setAnimationWith(r,Yt.emptyAnimation,!1);return e.mixDuration=t,e.trackEnd=t,e}addEmptyAnimation(r,t,e){e<=0&&(e-=t);const s=this.addAnimationWith(r,Yt.emptyAnimation,!1,e);return s.mixDuration=t,s.trackEnd=t,s}setEmptyAnimations(r){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,s=this.tracks.length;e<s;e++){const i=this.tracks[e];i!=null&&this.setEmptyAnimation(i.trackIndex,r)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(r){return r<this.tracks.length?this.tracks[r]:(B.ensureArrayCapacity(this.tracks,r+1,null),this.tracks.length=r+1,null)}trackEntry(r,t,e,s){const i=this.trackEntryPool.obtain();return i.trackIndex=r,i.animation=t,i.loop=e,i.holdPrevious=!1,i.eventThreshold=0,i.attachmentThreshold=0,i.drawOrderThreshold=0,i.animationStart=0,i.animationEnd=t.duration,i.animationLast=-1,i.nextAnimationLast=-1,i.delay=0,i.trackTime=0,i.trackLast=-1,i.nextTrackLast=-1,i.trackEnd=Number.MAX_VALUE,i.timeScale=1,i.alpha=1,i.interruptAlpha=1,i.mixTime=0,i.mixDuration=s==null?0:this.data.getMix(s.animation,t),i.mixBlend=S.replace,i}disposeNext(r){let t=r.next;for(;t!=null;)this.queue.dispose(t),t=t.next;r.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();for(let r=0,t=this.tracks.length;r<t;r++){let e=this.tracks[r];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(r){const t=r.mixingTo,e=r.animation.timelines,s=r.animation.timelines.length,i=B.setArraySize(r.timelineMode,s);r.timelineHoldMix.length=0;const n=B.setArraySize(r.timelineHoldMix,s),o=this.propertyIDs;if(t!=null&&t.holdPrevious){for(let h=0;h<s;h++)i[h]=o.add(e[h].getPropertyId())?Yt.HOLD_FIRST:Yt.HOLD_SUBSEQUENT;return}t:for(let h=0;h<s;h++){const a=e[h],l=a.getPropertyId();if(!o.add(l))i[h]=Yt.SUBSEQUENT;else if(t==null||a instanceof Pn||a instanceof Ca||a instanceof Vu||!t.animation.hasTimeline(l))i[h]=Yt.FIRST;else{for(let c=t.mixingTo;c!=null;c=c.mixingTo)if(!c.animation.hasTimeline(l)){if(r.mixDuration>0){i[h]=Yt.HOLD_MIX,n[h]=c;continue t}break}i[h]=Yt.HOLD_FIRST}}}getCurrent(r){return r>=this.tracks.length?null:this.tracks[r]}addListener(r){if(r==null)throw new Error("listener cannot be null.");this.listeners.push(r)}removeListener(r){const t=this.listeners.indexOf(r);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}setAnimationByName(r,t,e){Yt.deprecatedWarning1||(Yt.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: AnimationState.setAnimationByName is deprecated, please use setAnimation from now on.")),this.setAnimation(r,t,e)}addAnimationByName(r,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(r,t,e,s)}hasAnimation(r){return this.data.skeletonData.findAnimation(r)!==null}hasAnimationByName(r){return Yt.deprecatedWarning3||(Yt.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(r)}};let ps=Yt;ps.emptyAnimation=new ae("<empty>",[],0),ps.SUBSEQUENT=0,ps.FIRST=1,ps.HOLD_SUBSEQUENT=2,ps.HOLD_FIRST=3,ps.HOLD_MIX=4,ps.SETUP=1,ps.CURRENT=2,ps.deprecatedWarning1=!1,ps.deprecatedWarning2=!1,ps.deprecatedWarning3=!1;const Ci=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 r=this.animationEnd-this.animationStart;return r==0?this.animationStart:this.trackTime%r+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(r){this.animationLast=r,this.nextAnimationLast=r}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}get time(){return Ci.deprecatedWarning1||(Ci.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(r){Ci.deprecatedWarning1||(Ci.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=r}get endTime(){return Ci.deprecatedWarning2||(Ci.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(r){Ci.deprecatedWarning2||(Ci.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime=r}loopsCount(){return Math.floor(this.trackTime/this.trackEnd)}};let Xu=Ci;Xu.deprecatedWarning1=!1,Xu.deprecatedWarning2=!1;const Gu=class{constructor(r){this.objects=[],this.drainDisabled=!1,this.animState=r}start(r){this.objects.push(ss.start),this.objects.push(r),this.animState.animationsChanged=!0}interrupt(r){this.objects.push(ss.interrupt),this.objects.push(r)}end(r){this.objects.push(ss.end),this.objects.push(r),this.animState.animationsChanged=!0}dispose(r){this.objects.push(ss.dispose),this.objects.push(r)}complete(r){this.objects.push(ss.complete),this.objects.push(r)}event(r,t){this.objects.push(ss.event),this.objects.push(r),this.objects.push(t)}deprecateStuff(){return Gu.deprecatedWarning1||(Gu.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 r=this.objects,t=this.animState.listeners;for(let e=0;e<r.length;e+=2){const s=r[e],i=r[e+1];switch(s){case ss.start:i.listener!=null&&i.listener.start&&i.listener.start(i);for(let h=0;h<t.length;h++)t[h].start&&t[h].start(i);i.onStart&&this.deprecateStuff()&&i.onStart(i.trackIndex),this.animState.onStart&&this.deprecateStuff()&&this.deprecateStuff&&this.animState.onStart(i.trackIndex);break;case ss.interrupt:i.listener!=null&&i.listener.interrupt&&i.listener.interrupt(i);for(let h=0;h<t.length;h++)t[h].interrupt&&t[h].interrupt(i);break;case ss.end:i.listener!=null&&i.listener.end&&i.listener.end(i);for(let h=0;h<t.length;h++)t[h].end&&t[h].end(i);i.onEnd&&this.deprecateStuff()&&i.onEnd(i.trackIndex),this.animState.onEnd&&this.deprecateStuff()&&this.animState.onEnd(i.trackIndex);case ss.dispose:i.listener!=null&&i.listener.dispose&&i.listener.dispose(i);for(let h=0;h<t.length;h++)t[h].dispose&&t[h].dispose(i);this.animState.trackEntryPool.free(i);break;case ss.complete:i.listener!=null&&i.listener.complete&&i.listener.complete(i);for(let h=0;h<t.length;h++)t[h].complete&&t[h].complete(i);const n=D.toInt(i.loopsCount());i.onComplete&&this.deprecateStuff()&&i.onComplete(i.trackIndex,n),this.animState.onComplete&&this.deprecateStuff()&&this.animState.onComplete(i.trackIndex,n);break;case ss.event:const o=r[e+++2];i.listener!=null&&i.listener.event&&i.listener.event(i,o);for(let h=0;h<t.length;h++)t[h].event&&t[h].event(i,o);i.onEvent&&this.deprecateStuff()&&i.onEvent(i.trackIndex,o),this.animState.onEvent&&this.deprecateStuff()&&this.animState.onEvent(i.trackIndex,o);break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}};let R0=Gu;R0.deprecatedWarning1=!1;var ss=(r=>(r[r.start=0]="start",r[r.interrupt=1]="interrupt",r[r.end=2]="end",r[r.dispose=3]="dispose",r[r.complete=4]="complete",r[r.event=5]="event",r))(ss||{});const $u=class{constructor(r){if(this.animationToMixTime={},this.defaultMix=0,r==null)throw new Error("skeletonData cannot be null.");this.skeletonData=r}setMix(r,t,e){const s=this.skeletonData.findAnimation(r);if(s==null)throw new Error(`Animation not found: ${r}`);const i=this.skeletonData.findAnimation(t);if(i==null)throw new Error(`Animation not found: ${t}`);this.setMixWith(s,i,e)}setMixByName(r,t,e){$u.deprecatedWarning1||($u.deprecatedWarning1=!0,console.warn("Deprecation Warning: AnimationStateData.setMixByName is deprecated, please use setMix from now on.")),this.setMix(r,t,e)}setMixWith(r,t,e){if(r==null)throw new Error("from cannot be null.");if(t==null)throw new Error("to cannot be null.");const s=`${r.name}.${t.name}`;this.animationToMixTime[s]=e}getMix(r,t){const e=`${r.name}.${t.name}`,s=this.animationToMixTime[e];return s===void 0?this.defaultMix:s}};let M0=$u;M0.deprecatedWarning1=!1;let F0=class{constructor(t){this.atlas=t}newRegionAttachment(t,e,s){const i=this.atlas.findRegion(s);if(i==null)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);const n=new rt(e);return n.region=i,n}newMeshAttachment(t,e,s){const i=this.atlas.findRegion(s);if(i==null)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);const n=new Uu(e);return n.region=i,n}newBoundingBoxAttachment(t,e){return new WS(e)}newPathAttachment(t,e){return new _h(e)}newPointAttachment(t,e){return new jS(e)}newClippingAttachment(t,e){return new zS(e)}};class k0{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,i,n,o,h){this.ax=t,this.ay=e,this.arotation=s,this.ascaleX=i,this.ascaleY=n,this.ashearX=o,this.ashearY=h,this.appliedValid=!0;const a=this.parent,l=this.matrix,c=this.skeleton.scaleX,d=-this.skeleton.scaleY;if(a==null){const g=this.skeleton,y=s+90+h;l.a=D.cosDeg(s+o)*i*c,l.c=D.cosDeg(y)*n*c,l.b=D.sinDeg(s+o)*i*d,l.d=D.sinDeg(y)*n*d,l.tx=t*c+g.x,l.ty=e*d+g.y;return}let u=a.matrix.a,f=a.matrix.c,p=a.matrix.b,m=a.matrix.d;switch(l.tx=u*t+f*e+a.matrix.tx,l.ty=p*t+m*e+a.matrix.ty,this.data.transformMode){case yt.Normal:{const g=s+90+h,y=D.cosDeg(s+o)*i,x=D.cosDeg(g)*n,_=D.sinDeg(s+o)*i,v=D.sinDeg(g)*n;l.a=u*y+f*_,l.c=u*x+f*v,l.b=p*y+m*_,l.d=p*x+m*v;return}case yt.OnlyTranslation:{const g=s+90+h;l.a=D.cosDeg(s+o)*i,l.c=D.cosDeg(g)*n,l.b=D.sinDeg(s+o)*i,l.d=D.sinDeg(g)*n;break}case yt.NoRotationOrReflection:{let g=u*u+p*p,y=0;g>1e-4?(g=Math.abs(u*m-f*p)/g,u/=this.skeleton.scaleX,p/=this.skeleton.scaleY,f=p*g,m=u*g,y=Math.atan2(p,u)*D.radDeg):(u=0,p=0,y=90-Math.atan2(m,f)*D.radDeg);const x=s+o-y,_=s+h-y+90,v=D.cosDeg(x)*i,b=D.cosDeg(_)*n,w=D.sinDeg(x)*i,E=D.sinDeg(_)*n;l.a=u*v-f*w,l.c=u*b-f*E,l.b=p*v+m*w,l.d=p*b+m*E;break}case yt.NoScale:case yt.NoScaleOrReflection:{const g=D.cosDeg(s),y=D.sinDeg(s);let x=(u*g+f*y)/c,_=(p*g+m*y)/d,v=Math.sqrt(x*x+_*_);v>1e-5&&(v=1/v),x*=v,_*=v,v=Math.sqrt(x*x+_*_),this.data.transformMode==yt.NoScale&&u*m-f*p<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY>0)&&(v=-v);const b=Math.PI/2+Math.atan2(_,x),w=Math.cos(b)*v,E=Math.sin(b)*v,T=D.cosDeg(o)*i,A=D.cosDeg(90+h)*n,I=D.sinDeg(o)*i,M=D.sinDeg(90+h)*n;l.a=x*T+w*I,l.c=x*A+w*M,l.b=_*T+E*I,l.d=_*A+E*M;break}}l.a*=c,l.c*=c,l.b*=d,l.d*=d}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,i=1/(s.a*s.d-s.b*s.c),n=e.tx-s.tx,o=e.ty-s.ty;this.ax=n*s.d*i-o*s.c*i,this.ay=o*s.a*i-n*s.b*i;const h=i*s.d,a=i*s.a,l=i*s.c,c=i*s.b,d=h*e.a-l*e.b,u=h*e.c-l*e.d,f=a*e.b-c*e.a,p=a*e.d-c*e.c;if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+f*f),this.ascaleX>1e-4){const m=d*p-u*f;this.ascaleY=m/this.ascaleX,this.ashearY=Math.atan2(d*u+f*p,m)*D.radDeg,this.arotation=Math.atan2(f,d)*D.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(u*u+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,u)*D.radDeg}worldToLocal(t){const e=this.matrix,s=e.a,i=e.c,n=e.b,o=e.d,h=1/(s*o-i*n),a=t.x-e.tx,l=t.y-e.ty;return t.x=a*o*h-l*i*h,t.y=l*s*h-a*n*h,t}localToWorld(t){const e=this.matrix,s=t.x,i=t.y;return t.x=s*e.a+i*e.c+e.tx,t.y=s*e.b+i*e.d+e.ty,t}worldToLocalRotation(t){const e=D.sinDeg(t),s=D.cosDeg(t),i=this.matrix;return Math.atan2(i.a*e-i.b*s,i.d*s-i.c*e)*D.radDeg}localToWorldRotation(t){const e=D.sinDeg(t),s=D.cosDeg(t),i=this.matrix;return Math.atan2(s*i.b+e*i.d,s*i.a+e*i.c)*D.radDeg}rotateWorld(t){const e=this.matrix,s=e.a,i=e.c,n=e.b,o=e.d,h=D.cosDeg(t),a=D.sinDeg(t);e.a=h*s-a*n,e.c=h*i-a*o,e.b=a*s+h*n,e.d=a*i+h*o,this.appliedValid=!1}}let B0=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=yt.Normal,this.skinRequired=!1,this.color=new G,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}},D0=class{constructor(t,e){if(e==null)throw new Error("data cannot be null.");this.time=t,this.data=e}},O0=class{constructor(t){this.name=t}};class qS{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,i,n,o,h){t.appliedValid||t.updateAppliedTransform();const a=t.parent.matrix,l=a.a;let c=a.c;const d=a.b;let u=a.d,f=-t.ashearX-t.arotation,p=0,m=0;switch(t.data.transformMode){case yt.OnlyTranslation:p=e-t.worldX,m=s-t.worldY;break;case yt.NoRotationOrReflection:const x=Math.abs(l*u-c*d)/(l*l+d*d),_=l/t.skeleton.scaleX,v=d/t.skeleton.scaleY;c=-v*x*t.skeleton.scaleX,u=_*x*t.skeleton.scaleY,f+=Math.atan2(v,_)*D.radDeg;default:const b=e-a.tx,w=s-a.ty,E=l*u-c*d;p=(b*u-w*c)/E-t.ax,m=(w*l-b*d)/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,y=t.ascaleY;if(i||n){switch(t.data.transformMode){case yt.NoScale:case yt.NoScaleOrReflection:p=e-t.worldX,m=s-t.worldY}const x=t.data.length*g,_=Math.sqrt(p*p+m*m);if(i&&_<x||n&&_>x&&x>1e-4){const v=(_/x-1)*h+1;g*=v,o&&(y*=v)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*h,g,y,t.ashearX,t.ashearY)}apply2(t,e,s,i,n,o,h,a){if(a==0){e.updateWorldTransform();return}t.appliedValid||t.updateAppliedTransform(),e.appliedValid||e.updateAppliedTransform();const l=t.ax,c=t.ay;let d=t.ascaleX,u=d,f=t.ascaleY,p=e.ascaleX;const m=t.matrix;let g=0,y=0,x=0;d<0?(d=-d,g=180,x=-1):(g=0,x=1),f<0&&(f=-f,x=-x),p<0?(p=-p,y=180):y=0;const _=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(d-f)<=1e-4;M?(v=e.ay,b=E*_+T*v+m.tx,w=A*_+I*v+m.ty):(v=0,b=E*_+m.tx,w=A*_+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 V=(P*I-k*T)*C-l,U=(k*E-P*A)*C-c,L=Math.sqrt(V*V+U*U);let $=e.data.length*p,O,N;if(L<1e-4){this.apply1(t,s,i,!1,o,!1,a),e.updateWorldTransformWith(_,v,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}P=s-R.tx,k=i-R.ty;let K=(P*I-k*T)*C-l,Q=(k*E-P*A)*C-c,H=K*K+Q*Q;if(h!=0){h*=d*(p+1)/2;const _t=Math.sqrt(H),kt=_t-L-$*d+h;if(kt>0){let zt=Math.min(1,kt/(h*2))-1;zt=(kt-h*(1-zt*zt))/_t,K-=zt*K,Q-=zt*Q,H=K*K+Q*Q}}t:if(M){$*=d;let _t=(H-L*L-$*$)/(2*L*$);_t<-1?_t=-1:_t>1&&(_t=1,o&&(u*=(Math.sqrt(H)/(L+$)-1)*a+1)),N=Math.acos(_t)*n,E=L+$*_t,T=$*Math.sin(N),O=Math.atan2(Q*E-K*T,K*E+Q*T)}else{E=d*$,T=f*$;const _t=E*E,kt=T*T,zt=Math.atan2(Q,K);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 kn=Math.sqrt(I);Qt<0&&(kn=-kn),kn=-(Qt+kn)/2;const q_=kn/Pt,K_=A/kn,Bn=Math.abs(q_)<Math.abs(K_)?q_:K_;if(Bn*Bn<=H){k=Math.sqrt(H-Bn*Bn)*n,O=zt-Math.atan2(k,Bn),N=Math.atan2(k/f,(Bn-L)/d);break t}}let jt=D.PI,Ot=L-E,ze=Ot*Ot,rs=0,or=0,Fn=L+E,hr=Fn*Fn,j_=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,rs=k),I>hr&&(or=A,hr=I,Fn=P,j_=k)),H<=(ze+hr)/2?(O=zt-Math.atan2(rs*n,Ot),N=jt*n):(O=zt-Math.atan2(j_*n,Fn),N=or*n)}const ht=Math.atan2(v,_)*x;let Et=t.arotation;O=(O-ht)*D.radDeg+g-Et,O>180?O-=360:O<-180&&(O+=360),t.updateWorldTransformWith(l,c,Et+O*a,u,t.ascaleY,0,0),Et=e.arotation,N=((N+ht)*D.radDeg-e.ashearX)*x+y-Et,N>180?N-=360:N<-180&&(N+=360),e.updateWorldTransformWith(_,v,Et+N*a,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}let L0=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}},N0=class extends Yu{constructor(t){super(t,0,!1),this.bones=new Array}};var be=(r=>(r[r.Length=0]="Length",r[r.Fixed=1]="Fixed",r[r.Percent=2]="Percent",r))(be||{});const Gr=class{constructor(r,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,r==null)throw new Error("data cannot be null.");if(t==null)throw new Error("skeleton cannot be null.");this.data=r,this.bones=new Array;for(let e=0,s=r.bones.length;e<s;e++)this.bones.push(t.findBone(r.bones[e].name));this.target=t.findSlot(r.target.name),this.position=r.position,this.spacing=r.spacing,this.rotateMix=r.rotateMix,this.translateMix=r.translateMix}isActive(){return this.active}apply(){this.update()}update(){const r=this.target.getAttachment();if(!(r instanceof _h))return;const t=this.rotateMix,e=this.translateMix,s=e>0,i=t>0;if(!s&&!i)return;const n=this.data,o=n.spacingMode,h=o==be.Length,a=n.rotateMode,l=a==Fe.Tangent,c=a==Fe.ChainScale,d=this.bones.length,u=l?d:d+1,f=this.bones,p=B.setArraySize(this.spaces,u);let m=null;const g=this.spacing;if(c||h){c&&(m=B.setArraySize(this.lengths,d));for(let w=0,E=u-1;w<E;){const T=f[w],A=T.data.length;if(A<Gr.epsilon)c&&(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);c&&(m[w]=R),p[++w]=(h?A+g:g)*R/A}}}else for(let w=1;w<u;w++)p[w]=g;const y=this.computeWorldPositions(r,u,l,n.positionMode==ne.Percent,o==be.Percent);let x=y[0],_=y[1],v=n.offsetRotation,b=!1;if(v==0)b=a==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<d;w++,E+=3){const T=f[w],A=T.matrix;A.tx+=(x-A.tx)*e,A.ty+=(_-A.ty)*e;const I=y[E],M=y[E+1],R=I-x,C=M-_;if(c){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,_=M,i){const P=A.a,k=A.c,V=A.b,U=A.d;let L=0,$=0,O=0;if(l&&(l?L=y[E-1]:p[w+1]==0?L=y[E+2]:L=Math.atan2(C,R)),L-=Math.atan2(V,P),b){$=Math.cos(L),O=Math.sin(L);const N=T.data.length;x+=(N*($*P-O*V)-R)*t,_+=(N*(O*P+$*V)-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*V,A.c=$*k-O*U,A.b=O*P+$*V,A.d=O*k+$*U}T.appliedValid=!1}}computeWorldPositions(r,t,e,s,i){const n=this.target;let o=this.position;const h=this.spaces,a=B.setArraySize(this.positions,t*3+2);let l=null;const c=r.closed;let d=r.worldVerticesLength,u=d/6,f=Gr.NONE;if(!r.constantSpeed){const L=r.lengths;u-=c?1:2;const $=L[u];if(s&&(o*=$),i)for(let O=0;O<t;O++)h[O]*=$;l=B.setArraySize(this.world,8);for(let O=0,N=0,K=0;O<t;O++,N+=3){const Q=h[O];o+=Q;let H=o;if(c)H%=$,H<0&&(H+=$),K=0;else if(H<0){f!=Gr.BEFORE&&(f=Gr.BEFORE,r.computeWorldVertices(n,2,4,l,0,2)),this.addBeforePosition(H,l,0,a,N);continue}else if(H>$){f!=Gr.AFTER&&(f=Gr.AFTER,r.computeWorldVertices(n,d-6,4,l,0,2)),this.addAfterPosition(H-$,l,0,a,N);continue}for(;;K++){const ht=L[K];if(!(H>ht)){if(K==0)H/=ht;else{const Et=L[K-1];H=(H-Et)/(ht-Et)}break}}K!=f&&(f=K,c&&K==u?(r.computeWorldVertices(n,d-4,4,l,0,2),r.computeWorldVertices(n,0,4,l,4,2)):r.computeWorldVertices(n,K*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],a,N,e||O>0&&Q==0)}return a}c?(d+=2,l=B.setArraySize(this.world,d),r.computeWorldVertices(n,2,d-4,l,0,2),r.computeWorldVertices(n,0,2,l,d-4,2),l[d-2]=l[0],l[d-1]=l[1]):(u--,d-=4,l=B.setArraySize(this.world,d),r.computeWorldVertices(n,2,d,l,0,2));const p=B.setArraySize(this.curves,u);let m=0,g=l[0],y=l[1],x=0,_=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<u;L++,$+=6)x=l[$],_=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=((_-b)*3-y+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,y=E;if(s&&(o*=m),i)for(let L=0;L<t;L++)h[L]*=m;const V=this.segments;let U=0;for(let L=0,$=0,O=0,N=0;L<t;L++,$+=3){const K=h[L];o+=K;let Q=o;if(c)Q%=m,Q<0&&(Q+=m),O=0;else if(Q<0){this.addBeforePosition(Q,l,0,a,$);continue}else if(Q>m){this.addAfterPosition(Q-m,l,d-4,a,$);continue}for(;;O++){const H=p[O];if(!(Q>H)){if(O==0)Q/=H;else{const ht=p[O-1];Q=(Q-ht)/(H-ht)}break}}if(O!=f){f=O;let H=O*6;for(g=l[H],y=l[H+1],x=l[H+2],_=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=((_-b)*3-y+E)*.006,R=T*2+I,C=A*2+M,P=(x-g)*.3+T+I*.16666667,k=(_-y)*.3+A+M*.16666667,U=Math.sqrt(P*P+k*k),V[0]=U,H=1;H<8;H++)P+=R,k+=C,R+=I,C+=M,U+=Math.sqrt(P*P+k*k),V[H]=U;P+=R,k+=C,U+=Math.sqrt(P*P+k*k),V[8]=U,P+=R+I,k+=C+M,U+=Math.sqrt(P*P+k*k),V[9]=U,N=0}for(Q*=U;;N++){const H=V[N];if(!(Q>H)){if(N==0)Q/=H;else{const ht=V[N-1];Q=N+(Q-ht)/(H-ht)}break}}this.addCurvePosition(Q*.1,g,y,x,_,v,b,w,E,a,$,e||L>0&&K==0)}return a}addBeforePosition(r,t,e,s,i){const n=t[e],o=t[e+1],h=t[e+2]-n,a=t[e+3]-o,l=Math.atan2(a,h);s[i]=n+r*Math.cos(l),s[i+1]=o+r*Math.sin(l),s[i+2]=l}addAfterPosition(r,t,e,s,i){const n=t[e+2],o=t[e+3],h=n-t[e],a=o-t[e+1],l=Math.atan2(a,h);s[i]=n+r*Math.cos(l),s[i+1]=o+r*Math.sin(l),s[i+2]=l}addCurvePosition(r,t,e,s,i,n,o,h,a,l,c,d){(r==0||isNaN(r))&&(r=1e-4);const u=r*r,f=u*r,p=1-r,m=p*p,g=m*p,y=p*r,x=y*3,_=p*x,v=x*r,b=t*g+s*_+n*v+h*f,w=e*g+i*_+o*v+a*f;l[c]=b,l[c+1]=w,d&&(l[c+2]=Math.atan2(w-(e*m+i*y*2+o*u),b-(t*m+s*y*2+n*u)))}};let Ia=Gr;Ia.NONE=-1,Ia.BEFORE=-2,Ia.AFTER=-3,Ia.epsilon=1e-5;class KS{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,i=this.shearMix,n=this.target,o=n.matrix,h=o.a,a=o.c,l=o.b,c=o.d,d=h*c-a*l>0?D.degRad:-D.degRad,u=this.data.offsetRotation*d,f=this.data.offsetShearY*d,p=this.bones;for(let m=0,g=p.length;m<g;m++){const y=p[m];let x=!1;const _=y.matrix;if(t!=0){const v=_.a,b=_.c,w=_.b,E=_.d;let T=Math.atan2(l,h)-Math.atan2(w,v)+u;T>D.PI?T-=D.PI2:T<-D.PI&&(T+=D.PI2),T*=t;const A=Math.cos(T),I=Math.sin(T);_.a=A*v-I*w,_.c=A*b-I*E,_.b=I*v+A*w,_.d=I*b+A*E,x=!0}if(e!=0){const v=this.temp;n.localToWorld(v.set(this.data.offsetX,this.data.offsetY)),_.tx+=(v.x-_.tx)*e,_.ty+=(v.y-_.ty)*e,x=!0}if(s>0){let v=Math.sqrt(_.a*_.a+_.b*_.b),b=Math.sqrt(h*h+l*l);v>1e-5&&(v=(v+(b-v+this.data.offsetScaleX)*s)/v),_.a*=v,_.b*=v,v=Math.sqrt(_.c*_.c+_.d*_.d),b=Math.sqrt(a*a+c*c),v>1e-5&&(v=(v+(b-v+this.data.offsetScaleY)*s)/v),_.c*=v,_.d*=v,x=!0}if(i>0){const v=_.c,b=_.d,w=Math.atan2(b,v);let E=Math.atan2(c,a)-Math.atan2(l,h)-(w-Math.atan2(_.b,_.a));E>D.PI?E-=D.PI2:E<-D.PI&&(E+=D.PI2),E=w+(E+f)*i;const T=Math.sqrt(v*v+b*b);_.c=Math.cos(E)*T,_.d=Math.sin(E)*T,x=!0}x&&(y.appliedValid=!1)}}applyRelativeWorld(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,i=this.shearMix,n=this.target,o=n.matrix,h=o.a,a=o.c,l=o.b,c=o.d,d=h*c-a*l>0?D.degRad:-D.degRad,u=this.data.offsetRotation*d,f=this.data.offsetShearY*d,p=this.bones;for(let m=0,g=p.length;m<g;m++){const y=p[m];let x=!1;const _=y.matrix;if(t!=0){const v=_.a,b=_.c,w=_.b,E=_.d;let T=Math.atan2(l,h)+u;T>D.PI?T-=D.PI2:T<-D.PI&&(T+=D.PI2),T*=t;const A=Math.cos(T),I=Math.sin(T);_.a=A*v-I*w,_.c=A*b-I*E,_.b=I*v+A*w,_.d=I*b+A*E,x=!0}if(e!=0){const v=this.temp;n.localToWorld(v.set(this.data.offsetX,this.data.offsetY)),_.tx+=v.x*e,_.ty+=v.y*e,x=!0}if(s>0){let v=(Math.sqrt(h*h+l*l)-1+this.data.offsetScaleX)*s+1;_.a*=v,_.b*=v,v=(Math.sqrt(a*a+c*c)-1+this.data.offsetScaleY)*s+1,_.c*=v,_.d*=v,x=!0}if(i>0){let v=Math.atan2(c,a)-Math.atan2(l,h);v>D.PI?v-=D.PI2:v<-D.PI&&(v+=D.PI2);const b=_.c,w=_.d;v=Math.atan2(w,b)+(v-D.PI/2+f)*i;const E=Math.sqrt(b*b+w*w);_.c=Math.cos(v)*E,_.d=Math.sin(v)*E,x=!0}x&&(y.appliedValid=!1)}}applyAbsoluteLocal(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,i=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const o=this.bones;for(let h=0,a=o.length;h<a;h++){const l=o[h];l.appliedValid||l.updateAppliedTransform();let c=l.arotation;if(t!=0){let g=n.arotation-c+this.data.offsetRotation;g-=(16384-(16384.499999999996-g/360|0))*360,c+=g*t}let d=l.ax,u=l.ay;e!=0&&(d+=(n.ax-d+this.data.offsetX)*e,u+=(n.ay-u+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(i>0){let g=n.ashearY-m+this.data.offsetShearY;g-=(16384-(16384.499999999996-g/360|0))*360,l.shearY+=g*i}l.updateWorldTransformWith(d,u,c,f,p,l.ashearX,m)}}applyRelativeLocal(){const t=this.rotateMix,e=this.translateMix,s=this.scaleMix,i=this.shearMix,n=this.target;n.appliedValid||n.updateAppliedTransform();const o=this.bones;for(let h=0,a=o.length;h<a;h++){const l=o[h];l.appliedValid||l.updateAppliedTransform();let c=l.arotation;t!=0&&(c+=(n.arotation+this.data.offsetRotation)*t);let d=l.ax,u=l.ay;e!=0&&(d+=(n.ax+this.data.offsetX)*e,u+=(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;i>0&&(m+=(n.ashearY+this.data.offsetShearY)*i),l.updateWorldTransformWith(d,u,c,f,p,l.ashearX,m)}}}const Pa=class{constructor(r){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,r==null)throw new Error("data cannot be null.");this.data=r,this.bones=new Array;for(let t=0;t<r.bones.length;t++){const e=r.bones[t];let s;if(e.parent==null)s=new k0(e,this,null);else{const i=this.bones[e.parent.index];s=new k0(e,this,i),i.children.push(s)}this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<r.slots.length;t++){const e=r.slots[t],s=this.bones[e.boneData.index],i=new T0(e,s);this.slots.push(i),this.drawOrder.push(i)}this.ikConstraints=new Array;for(let t=0;t<r.ikConstraints.length;t++){const e=r.ikConstraints[t];this.ikConstraints.push(new qS(e,this))}this.transformConstraints=new Array;for(let t=0;t<r.transformConstraints.length;t++){const e=r.transformConstraints[t];this.transformConstraints.push(new KS(e,this))}this.pathConstraints=new Array;for(let t=0;t<r.pathConstraints.length;t++){const e=r.pathConstraints[t];this.pathConstraints.push(new Ia(e,this))}this.color=new G(1,1,1,1),this.updateCache()}updateCache(){const r=this._updateCache;r.length=0,this.updateCacheReset.length=0;const t=this.bones;for(let l=0,c=t.length;l<c;l++){const d=t[l];d.sorted=d.data.skinRequired,d.active=!d.sorted}if(this.skin!=null){const l=this.skin.bones;for(let c=0,d=this.skin.bones.length;c<d;c++){let u=this.bones[l[c].index];do u.sorted=!1,u.active=!0,u=u.parent;while(u!=null)}}const e=this.ikConstraints,s=this.transformConstraints,i=this.pathConstraints,n=e.length,o=s.length,h=i.length,a=n+o+h;t:for(let l=0;l<a;l++){for(let c=0;c<n;c++){const d=e[c];if(d.data.order==l){this.sortIkConstraint(d);continue t}}for(let c=0;c<o;c++){const d=s[c];if(d.data.order==l){this.sortTransformConstraint(d);continue t}}for(let c=0;c<h;c++){const d=i[c];if(d.data.order==l){this.sortPathConstraint(d);continue t}}}for(let l=0,c=t.length;l<c;l++)this.sortBone(t[l])}sortIkConstraint(r){if(r.active=r.target.isActive()&&(!r.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,r.data,!0)),!r.active)return;const t=r.target;this.sortBone(t);const e=r.bones,s=e[0];if(this.sortBone(s),e.length>1){const i=e[e.length-1];this._updateCache.indexOf(i)>-1||this.updateCacheReset.push(i)}this._updateCache.push(r),this.sortReset(s.children),e[e.length-1].sorted=!0}sortPathConstraint(r){if(r.active=r.target.bone.isActive()&&(!r.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,r.data,!0)),!r.active)return;const t=r.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,a=this.data.skins.length;h<a;h++)this.sortPathConstraintAttachment(this.data.skins[h],e,s);const i=t.getAttachment();i instanceof _h&&this.sortPathConstraintAttachmentWith(i,s);const n=r.bones,o=n.length;for(let h=0;h<o;h++)this.sortBone(n[h]);this._updateCache.push(r);for(let h=0;h<o;h++)this.sortReset(n[h].children);for(let h=0;h<o;h++)n[h].sorted=!0}sortTransformConstraint(r){if(r.active=r.target.isActive()&&(!r.data.skinRequired||this.skin!=null&&B.contains(this.skin.constraints,r.data,!0)),!r.active)return;this.sortBone(r.target);const t=r.bones,e=t.length;if(r.data.local)for(let s=0;s<e;s++){const i=t[s];this.sortBone(i.parent),this._updateCache.indexOf(i)>-1||this.updateCacheReset.push(i)}else for(let s=0;s<e;s++)this.sortBone(t[s]);this._updateCache.push(r);for(let s=0;s<e;s++)this.sortReset(t[s].children);for(let s=0;s<e;s++)t[s].sorted=!0}sortPathConstraintAttachment(r,t,e){const s=r.attachments[t];if(s)for(const i in s)this.sortPathConstraintAttachmentWith(s[i],e)}sortPathConstraintAttachmentWith(r,t){if(!(r instanceof _h))return;const e=r.bones;if(e==null)this.sortBone(t);else{const s=this.bones;let i=0;for(;i<e.length;){const n=e[i++];for(let o=i+n;i<o;i++){const h=e[i];this.sortBone(s[h])}}}}sortBone(r){if(r.sorted)return;const t=r.parent;t!=null&&this.sortBone(t),r.sorted=!0,this._updateCache.push(r)}sortReset(r){for(let t=0,e=r.length;t<e;t++){const s=r[t];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(){const r=this.updateCacheReset;for(let e=0,s=r.length;e<s;e++){const i=r[e];i.ax=i.x,i.ay=i.y,i.arotation=i.rotation,i.ascaleX=i.scaleX,i.ascaleY=i.scaleY,i.ashearX=i.shearX,i.ashearY=i.shearY,i.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 r=this.bones;for(let i=0,n=r.length;i<n;i++)r[i].setToSetupPose();const t=this.ikConstraints;for(let i=0,n=t.length;i<n;i++){const o=t[i];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}const e=this.transformConstraints;for(let i=0,n=e.length;i<n;i++){const o=e[i],h=o.data;o.rotateMix=h.rotateMix,o.translateMix=h.translateMix,o.scaleMix=h.scaleMix,o.shearMix=h.shearMix}const s=this.pathConstraints;for(let i=0,n=s.length;i<n;i++){const o=s[i],h=o.data;o.position=h.position,o.spacing=h.spacing,o.rotateMix=h.rotateMix,o.translateMix=h.translateMix}}setSlotsToSetupPose(){const r=this.slots;B.arrayCopy(r,0,this.drawOrder,0,r.length);for(let t=0,e=r.length;t<e;t++)r[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(r){if(r==null)throw new Error("boneName cannot be null.");const t=this.bones;for(let e=0,s=t.length;e<s;e++){const i=t[e];if(i.data.name==r)return i}return null}findBoneIndex(r){if(r==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==r)return e;return-1}findSlot(r){if(r==null)throw new Error("slotName cannot be null.");const t=this.slots;for(let e=0,s=t.length;e<s;e++){const i=t[e];if(i.data.name==r)return i}return null}findSlotIndex(r){if(r==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==r)return e;return-1}setSkinByName(r){const t=this.data.findSkin(r);if(t==null)throw new Error(`Skin not found: ${r}`);this.setSkin(t)}setSkin(r){if(r!=this.skin){if(r!=null)if(this.skin!=null)r.attachAll(this,this.skin);else{const t=this.slots;for(let e=0,s=t.length;e<s;e++){const i=t[e],n=i.data.attachmentName;if(n!=null){const o=r.getAttachment(e,n);o!=null&&i.setAttachment(o)}}}this.skin=r,this.updateCache()}}getAttachmentByName(r,t){return this.getAttachment(this.data.findSlotIndex(r),t)}getAttachment(r,t){if(t==null)throw new Error("attachmentName cannot be null.");if(this.skin!=null){const e=this.skin.getAttachment(r,t);if(e!=null)return e}return this.data.defaultSkin!=null?this.data.defaultSkin.getAttachment(r,t):null}setAttachment(r,t){if(r==null)throw new Error("slotName cannot be null.");const e=this.slots;for(let s=0,i=e.length;s<i;s++){const n=e[s];if(n.data.name==r){let o=null;if(t!=null&&(o=this.getAttachment(s,t),o==null))throw new Error(`Attachment not found: ${t}, for slot: ${r}`);n.setAttachment(o);return}}throw new Error(`Slot not found: ${r}`)}findIkConstraint(r){if(r==null)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let e=0,s=t.length;e<s;e++){const i=t[e];if(i.data.name==r)return i}return null}findTransformConstraint(r){if(r==null)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let e=0,s=t.length;e<s;e++){const i=t[e];if(i.data.name==r)return i}return null}findPathConstraint(r){if(r==null)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let e=0,s=t.length;e<s;e++){const i=t[e];if(i.data.name==r)return i}return null}getBounds(r,t,e=new Array(2)){if(r==null)throw new Error("offset cannot be null.");if(t==null)throw new Error("size cannot be null.");const s=this.drawOrder;let i=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let a=0,l=s.length;a<l;a++){const c=s[a];if(!c.bone.active)continue;let d=0,u=null;const f=c.getAttachment();if(f instanceof rt)d=8,u=B.setArraySize(e,d,0),f.computeWorldVertices(c.bone,u,0,2);else if(f instanceof Uu){const p=f;d=p.worldVerticesLength,u=B.setArraySize(e,d,0),p.computeWorldVertices(c,0,d,u,0,2)}if(u!=null)for(let p=0,m=u.length;p<m;p+=2){const g=u[p],y=u[p+1];i=Math.min(i,g),n=Math.min(n,y),o=Math.max(o,g),h=Math.max(h,y)}}r.set(i,n),t.set(o-i,h-n)}update(r){this.time+=r}get flipX(){return this.scaleX==-1}set flipX(r){Pa.deprecatedWarning1||(Pa.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleX=r?1:-1}get flipY(){return this.scaleY==-1}set flipY(r){Pa.deprecatedWarning1||(Pa.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleY=r?1:-1}};let U0=Pa;U0.deprecatedWarning1=!1;let V0=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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;s++)if(e[s].name==t)return s;return-1}},X0=class{constructor(t,e,s){if(this.color=new G(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}},G0=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}},$0=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 i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const i=t.bones[s];let n=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==i){n=!0;break}n||this.bones.push(i)}for(let s=0;s<t.constraints.length;s++){const i=t.constraints[s];let n=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==i){n=!0;break}n||this.constraints.push(i)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const i=e[s];this.setAttachment(i.slotIndex,i.name,i.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const i=t.bones[s];let n=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==i){n=!0;break}n||this.bones.push(i)}for(let s=0;s<t.constraints.length;s++){const i=t.constraints[s];let n=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==i){n=!0;break}n||this.constraints.push(i)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const i=e[s];i.attachment!=null&&(i.attachment instanceof Uu?(i.attachment=i.attachment.newLinkedMesh(),this.setAttachment(i.slotIndex,i.name,i.attachment)):(i.attachment=i.attachment.copy(),this.setAttachment(i.slotIndex,i.name,i.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 i in s){const n=s[i];n&&t.push(new $0(e,i,n))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const i in s){const n=s[i];n&&e.push(new $0(t,i,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){const n=t.slots[i],o=n.getAttachment();if(o&&s<e.attachments.length){const h=e.attachments[s];for(const a in h){const l=h[a];if(o==l){const c=this.getAttachment(s,a);c!=null&&n.setAttachment(c);break}}}s++}}};const Zt=class{constructor(r){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=r}readSkeletonData(r){const t=this.scale,e=new V0;e.name="";const s=new gh(r);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 i=s.readBoolean();i&&(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 a=s.readString(),l=h==0?null:e.bones[s.readInt(!0)],c=new B0(h,a,l);c.rotation=s.readFloat(),c.x=s.readFloat()*t,c.y=s.readFloat()*t,c.scaleX=s.readFloat(),c.scaleY=s.readFloat(),c.shearX=s.readFloat(),c.shearY=s.readFloat(),c.length=s.readFloat()*t,c.transformMode=Zt.TransformModeValues[s.readInt(!0)],c.skinRequired=s.readBoolean(),i&&G.rgba8888ToColor(c.color,s.readInt32()),e.bones.push(c)}n=s.readInt(!0);for(let h=0;h<n;h++){const a=s.readString(),l=e.bones[s.readInt(!0)],c=new X0(h,a,l);G.rgba8888ToColor(c.color,s.readInt32());const d=s.readInt32();d!=-1&&G.rgb888ToColor(c.darkColor=new G,d),c.attachmentName=s.readStringRef(),c.blendMode=Zt.BlendModeValues[s.readInt(!0)],e.slots.push(c)}n=s.readInt(!0);for(let h=0,a;h<n;h++){const l=new L0(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),a=s.readInt(!0);for(let c=0;c<a;c++)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,a;h<n;h++){const l=new G0(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),a=s.readInt(!0);for(let c=0;c<a;c++)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,a;h<n;h++){const l=new N0(s.readString());l.order=s.readInt(!0),l.skinRequired=s.readBoolean(),a=s.readInt(!0);for(let c=0;c<a;c++)l.bones.push(e.bones[s.readInt(!0)]);l.target=e.slots[s.readInt(!0)],l.positionMode=Zt.PositionModeValues[s.readInt(!0)],l.spacingMode=Zt.SpacingModeValues[s.readInt(!0)],l.rotateMode=Zt.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 o=this.readSkin(s,e,!0,i);o!=null&&(e.defaultSkin=o,e.skins.push(o));{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,i)}n=this.linkedMeshes.length;for(let h=0;h<n;h++){const a=this.linkedMeshes[h],l=a.skin==null?e.defaultSkin:e.findSkin(a.skin);if(l==null)throw new Error(`Skin not found: ${a.skin}`);const c=l.getAttachment(a.slotIndex,a.parent);if(c==null)throw new Error(`Parent mesh not found: ${a.parent}`);a.mesh.deformAttachment=a.inheritDeform?c:a.mesh,a.mesh.setParentMesh(c)}this.linkedMeshes.length=0,n=s.readInt(!0);for(let h=0;h<n;h++){const a=new O0(s.readStringRef());a.intValue=s.readInt(!1),a.floatValue=s.readFloat(),a.stringValue=s.readString(),a.audioPath=s.readString(),a.audioPath!=null&&(a.volume=s.readFloat(),a.balance=s.readFloat()),e.events.push(a)}n=s.readInt(!0);for(let h=0;h<n;h++)e.animations.push(this.readAnimation(s,s.readString(),e));return e}readSkin(r,t,e,s){let i=null,n=0;if(e){if(n=r.readInt(!0),n==0)return null;i=new Hu("default")}else{i=new Hu(r.readStringRef()),i.bones.length=r.readInt(!0);for(let o=0,h=i.bones.length;o<h;o++)i.bones[o]=t.bones[r.readInt(!0)];for(let o=0,h=r.readInt(!0);o<h;o++)i.constraints.push(t.ikConstraints[r.readInt(!0)]);for(let o=0,h=r.readInt(!0);o<h;o++)i.constraints.push(t.transformConstraints[r.readInt(!0)]);for(let o=0,h=r.readInt(!0);o<h;o++)i.constraints.push(t.pathConstraints[r.readInt(!0)]);n=r.readInt(!0)}for(let o=0;o<n;o++){const h=r.readInt(!0);for(let a=0,l=r.readInt(!0);a<l;a++){const c=r.readStringRef(),d=this.readAttachment(r,t,i,h,c,s);d!=null&&i.setAttachment(h,c,d)}}return i}readAttachment(r,t,e,s,i,n){const o=this.scale;let h=r.readStringRef();h==null&&(h=i);const a=r.readByte();switch(Zt.AttachmentTypeValues[a]){case ot.Region:{let c=r.readStringRef();const d=r.readFloat(),u=r.readFloat(),f=r.readFloat(),p=r.readFloat(),m=r.readFloat(),g=r.readFloat(),y=r.readFloat(),x=r.readInt32();c==null&&(c=h);const _=this.attachmentLoader.newRegionAttachment(e,h,c);return _==null?null:(_.path=c,_.x=u*o,_.y=f*o,_.scaleX=p,_.scaleY=m,_.rotation=d,_.width=g*o,_.height=y*o,G.rgba8888ToColor(_.color,x),_)}case ot.BoundingBox:{const c=r.readInt(!0),d=this.readVertices(r,c),u=n?r.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(e,h);return f==null?null:(f.worldVerticesLength=c<<1,f.vertices=d.vertices,f.bones=d.bones,n&&G.rgba8888ToColor(f.color,u),f)}case ot.Mesh:{let c=r.readStringRef();const d=r.readInt32(),u=r.readInt(!0),f=this.readFloatArray(r,u<<1,1),p=this.readShortArray(r),m=this.readVertices(r,u),g=r.readInt(!0);let y=null,x=0,_=0;n&&(y=this.readShortArray(r),x=r.readFloat(),_=r.readFloat()),c==null&&(c=h);const v=this.attachmentLoader.newMeshAttachment(e,h,c);return v==null?null:(v.path=c,G.rgba8888ToColor(v.color,d),v.bones=m.bones,v.vertices=m.vertices,v.worldVerticesLength=u<<1,v.triangles=p,v.regionUVs=new Float32Array(f),v.hullLength=g<<1,n&&(v.edges=y,v.width=x*o,v.height=_*o),v)}case ot.LinkedMesh:{let c=r.readStringRef();const d=r.readInt32(),u=r.readStringRef(),f=r.readStringRef(),p=r.readBoolean();let m=0,g=0;n&&(m=r.readFloat(),g=r.readFloat()),c==null&&(c=h);const y=this.attachmentLoader.newMeshAttachment(e,h,c);return y==null?null:(y.path=c,G.rgba8888ToColor(y.color,d),n&&(y.width=m*o,y.height=g*o),this.linkedMeshes.push(new ZS(y,u,s,f,p)),y)}case ot.Path:{const c=r.readBoolean(),d=r.readBoolean(),u=r.readInt(!0),f=this.readVertices(r,u),p=B.newArray(u/3,0);for(let y=0,x=p.length;y<x;y++)p[y]=r.readFloat()*o;const m=n?r.readInt32():0,g=this.attachmentLoader.newPathAttachment(e,h);return g==null?null:(g.closed=c,g.constantSpeed=d,g.worldVerticesLength=u<<1,g.vertices=f.vertices,g.bones=f.bones,g.lengths=p,n&&G.rgba8888ToColor(g.color,m),g)}case ot.Point:{const c=r.readFloat(),d=r.readFloat(),u=r.readFloat(),f=n?r.readInt32():0,p=this.attachmentLoader.newPointAttachment(e,h);return p==null?null:(p.x=d*o,p.y=u*o,p.rotation=c,n&&G.rgba8888ToColor(p.color,f),p)}case ot.Clipping:{const c=r.readInt(!0),d=r.readInt(!0),u=this.readVertices(r,d),f=n?r.readInt32():0,p=this.attachmentLoader.newClippingAttachment(e,h);return p==null?null:(p.endSlot=t.slots[c],p.worldVerticesLength=d<<1,p.vertices=u.vertices,p.bones=u.bones,n&&G.rgba8888ToColor(p.color,f),p)}}return null}readVertices(r,t){const e=t<<1,s=new QS,i=this.scale;if(!r.readBoolean())return s.vertices=this.readFloatArray(r,e,i),s;const n=new Array,o=new Array;for(let h=0;h<t;h++){const a=r.readInt(!0);o.push(a);for(let l=0;l<a;l++)o.push(r.readInt(!0)),n.push(r.readFloat()*i),n.push(r.readFloat()*i),n.push(r.readFloat())}return s.vertices=B.toFloatArray(n),s.bones=o,s}readFloatArray(r,t,e){const s=new Array(t);if(e==1)for(let i=0;i<t;i++)s[i]=r.readFloat();else for(let i=0;i<t;i++)s[i]=r.readFloat()*e;return s}readShortArray(r){const t=r.readInt(!0),e=new Array(t);for(let s=0;s<t;s++)e[s]=r.readShort();return e}readAnimation(r,t,e){const s=new Array,i=this.scale;let n=0;const o=new G,h=new G;for(let c=0,d=r.readInt(!0);c<d;c++){const u=r.readInt(!0);for(let f=0,p=r.readInt(!0);f<p;f++){const m=r.readByte(),g=r.readInt(!0);switch(m){case Zt.SLOT_ATTACHMENT:{const y=new Pn(g);y.slotIndex=u;for(let x=0;x<g;x++)y.setFrame(x,r.readFloat(),r.readStringRef());s.push(y),n=Math.max(n,y.frames[g-1]);break}case Zt.SLOT_COLOR:{const y=new He(g);y.slotIndex=u;for(let x=0;x<g;x++){const _=r.readFloat();G.rgba8888ToColor(o,r.readInt32()),y.setFrame(x,_,o.r,o.g,o.b,o.a),x<g-1&&this.readCurve(r,x,y)}s.push(y),n=Math.max(n,y.frames[(g-1)*He.ENTRIES]);break}case Zt.SLOT_TWO_COLOR:{const y=new oe(g);y.slotIndex=u;for(let x=0;x<g;x++){const _=r.readFloat();G.rgba8888ToColor(o,r.readInt32()),G.rgb888ToColor(h,r.readInt32()),y.setFrame(x,_,o.r,o.g,o.b,o.a,h.r,h.g,h.b),x<g-1&&this.readCurve(r,x,y)}s.push(y),n=Math.max(n,y.frames[(g-1)*oe.ENTRIES]);break}}}}for(let c=0,d=r.readInt(!0);c<d;c++){const u=r.readInt(!0);for(let f=0,p=r.readInt(!0);f<p;f++){const m=r.readByte(),g=r.readInt(!0);switch(m){case Zt.BONE_ROTATE:{const y=new Ie(g);y.boneIndex=u;for(let x=0;x<g;x++)y.setFrame(x,r.readFloat(),r.readFloat()),x<g-1&&this.readCurve(r,x,y);s.push(y),n=Math.max(n,y.frames[(g-1)*Ie.ENTRIES]);break}case Zt.BONE_TRANSLATE:case Zt.BONE_SCALE:case Zt.BONE_SHEAR:{let y,x=1;m==Zt.BONE_SCALE?y=new A0(g):m==Zt.BONE_SHEAR?y=new S0(g):(y=new fs(g),x=i),y.boneIndex=u;for(let _=0;_<g;_++)y.setFrame(_,r.readFloat(),r.readFloat()*x,r.readFloat()*x),_<g-1&&this.readCurve(r,_,y);s.push(y),n=Math.max(n,y.frames[(g-1)*fs.ENTRIES]);break}}}}for(let c=0,d=r.readInt(!0);c<d;c++){const u=r.readInt(!0),f=r.readInt(!0),p=new Pe(f);p.ikConstraintIndex=u;for(let m=0;m<f;m++)p.setFrame(m,r.readFloat(),r.readFloat(),r.readFloat()*i,r.readByte(),r.readBoolean(),r.readBoolean()),m<f-1&&this.readCurve(r,m,p);s.push(p),n=Math.max(n,p.frames[(f-1)*Pe.ENTRIES])}for(let c=0,d=r.readInt(!0);c<d;c++){const u=r.readInt(!0),f=r.readInt(!0),p=new We(f);p.transformConstraintIndex=u;for(let m=0;m<f;m++)p.setFrame(m,r.readFloat(),r.readFloat(),r.readFloat(),r.readFloat(),r.readFloat()),m<f-1&&this.readCurve(r,m,p);s.push(p),n=Math.max(n,p.frames[(f-1)*We.ENTRIES])}for(let c=0,d=r.readInt(!0);c<d;c++){const u=r.readInt(!0),f=e.pathConstraints[u];for(let p=0,m=r.readInt(!0);p<m;p++){const g=r.readByte(),y=r.readInt(!0);switch(g){case Zt.PATH_POSITION:case Zt.PATH_SPACING:{let x,_=1;g==Zt.PATH_SPACING?(x=new P0(y),(f.spacingMode==be.Length||f.spacingMode==be.Fixed)&&(_=i)):(x=new Si(y),f.positionMode==ne.Fixed&&(_=i)),x.pathConstraintIndex=u;for(let v=0;v<y;v++)x.setFrame(v,r.readFloat(),r.readFloat()*_),v<y-1&&this.readCurve(r,v,x);s.push(x),n=Math.max(n,x.frames[(y-1)*Si.ENTRIES]);break}case Zt.PATH_MIX:{const x=new ni(y);x.pathConstraintIndex=u;for(let _=0;_<y;_++)x.setFrame(_,r.readFloat(),r.readFloat(),r.readFloat()),_<y-1&&this.readCurve(r,_,x);s.push(x),n=Math.max(n,x.frames[(y-1)*ni.ENTRIES]);break}}}}for(let c=0,d=r.readInt(!0);c<d;c++){const u=e.skins[r.readInt(!0)];for(let f=0,p=r.readInt(!0);f<p;f++){const m=r.readInt(!0);for(let g=0,y=r.readInt(!0);g<y;g++){const x=u.getAttachment(m,r.readStringRef()),_=x.bones!=null,v=x.vertices,b=_?v.length/3*2:v.length,w=r.readInt(!0),E=new I0(w);E.slotIndex=m,E.attachment=x;for(let T=0;T<w;T++){const A=r.readFloat();let I,M=r.readInt(!0);if(M==0)I=_?B.newFloatArray(b):v;else{I=B.newFloatArray(b);const R=r.readInt(!0);if(M+=R,i==1)for(let C=R;C<M;C++)I[C]=r.readFloat();else for(let C=R;C<M;C++)I[C]=r.readFloat()*i;if(!_)for(let C=0,P=I.length;C<P;C++)I[C]+=v[C]}E.setFrame(T,A,I),T<w-1&&this.readCurve(r,T,E)}s.push(E),n=Math.max(n,E.frames[w-1])}}}const a=r.readInt(!0);if(a>0){const c=new Ca(a),d=e.slots.length;for(let u=0;u<a;u++){const f=r.readFloat(),p=r.readInt(!0),m=B.newArray(d,0);for(let _=d-1;_>=0;_--)m[_]=-1;const g=B.newArray(d-p,0);let y=0,x=0;for(let _=0;_<p;_++){const v=r.readInt(!0);for(;y!=v;)g[x++]=y++;m[y+r.readInt(!0)]=y++}for(;y<d;)g[x++]=y++;for(let _=d-1;_>=0;_--)m[_]==-1&&(m[_]=g[--x]);c.setFrame(u,f,m)}s.push(c),n=Math.max(n,c.frames[a-1])}const l=r.readInt(!0);if(l>0){const c=new Vu(l);for(let d=0;d<l;d++){const u=r.readFloat(),f=e.events[r.readInt(!0)],p=new D0(u,f);p.intValue=r.readInt(!1),p.floatValue=r.readFloat(),p.stringValue=r.readBoolean()?r.readString():f.stringValue,p.data.audioPath!=null&&(p.volume=r.readFloat(),p.balance=r.readFloat()),c.setFrame(d,p)}s.push(c),n=Math.max(n,c.frames[l-1])}return new ae(t,s,n)}readCurve(r,t,e){switch(r.readByte()){case Zt.CURVE_STEPPED:e.setStepped(t);break;case Zt.CURVE_BEZIER:this.setCurve(e,t,r.readFloat(),r.readFloat(),r.readFloat(),r.readFloat());break}}setCurve(r,t,e,s,i,n){r.setCurve(t,e,s,i,n)}};let he=Zt;he.AttachmentTypeValues=[0,1,2,3,4,5,6],he.TransformModeValues=[yt.Normal,yt.OnlyTranslation,yt.NoRotationOrReflection,yt.NoScale,yt.NoScaleOrReflection],he.PositionModeValues=[ne.Fixed,ne.Percent],he.SpacingModeValues=[be.Length,be.Fixed,be.Percent],he.RotateModeValues=[Fe.Tangent,Fe.Chain,Fe.ChainScale],he.BlendModeValues=[W.NORMAL,W.ADD,W.MULTIPLY,W.SCREEN],he.BONE_ROTATE=0,he.BONE_TRANSLATE=1,he.BONE_SCALE=2,he.BONE_SHEAR=3,he.SLOT_ATTACHMENT=0,he.SLOT_COLOR=1,he.SLOT_TWO_COLOR=2,he.PATH_POSITION=0,he.PATH_SPACING=1,he.PATH_MIX=2,he.CURVE_LINEAR=0,he.CURVE_STEPPED=1,he.CURVE_BEZIER=2;let ZS=class{constructor(t,e,s,i,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritDeform=n}},QS=class{constructor(t=null,e=null){this.bones=t,this.vertices=e}},JS=class Un{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new V0,i=typeof t=="string"?JSON.parse(t):t,n=i.skeleton;if(n!=null){if(s.hash=n.hash,s.version=n.spine,s.version.substr(0,3)!=="3.8"){const o=`Spine 3.8 loader cant load version ${n.spine}. Please configure your pixi-spine bundle`;console.error(o)}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(i.bones)for(let o=0;o<i.bones.length;o++){const h=i.bones[o];let a=null;const l=this.getValue(h,"parent",null);if(l!=null&&(a=s.findBone(l),a==null))throw new Error(`Parent bone not found: ${l}`);const c=new B0(s.bones.length,h.name,a);c.length=this.getValue(h,"length",0)*e,c.x=this.getValue(h,"x",0)*e,c.y=this.getValue(h,"y",0)*e,c.rotation=this.getValue(h,"rotation",0),c.scaleX=this.getValue(h,"scaleX",1),c.scaleY=this.getValue(h,"scaleY",1),c.shearX=this.getValue(h,"shearX",0),c.shearY=this.getValue(h,"shearY",0),c.transformMode=Un.transformModeFromString(this.getValue(h,"transform","normal")),c.skinRequired=this.getValue(h,"skin",!1),s.bones.push(c)}if(i.slots)for(let o=0;o<i.slots.length;o++){const h=i.slots[o],a=h.name,l=h.bone,c=s.findBone(l);if(c==null)throw new Error(`Slot bone not found: ${l}`);const d=new X0(s.slots.length,a,c),u=this.getValue(h,"color",null);u!=null&&d.color.setFromString(u);const f=this.getValue(h,"dark",null);f!=null&&(d.darkColor=new G(1,1,1,1),d.darkColor.setFromString(f)),d.attachmentName=this.getValue(h,"attachment",null),d.blendMode=Un.blendModeFromString(this.getValue(h,"blend","normal")),s.slots.push(d)}if(i.ik)for(let o=0;o<i.ik.length;o++){const h=i.ik[o],a=new L0(h.name);a.order=this.getValue(h,"order",0),a.skinRequired=this.getValue(h,"skin",!1);for(let c=0;c<h.bones.length;c++){const d=h.bones[c],u=s.findBone(d);if(u==null)throw new Error(`IK bone not found: ${d}`);a.bones.push(u)}const l=h.target;if(a.target=s.findBone(l),a.target==null)throw new Error(`IK target bone not found: ${l}`);a.mix=this.getValue(h,"mix",1),a.softness=this.getValue(h,"softness",0)*e,a.bendDirection=this.getValue(h,"bendPositive",!0)?1:-1,a.compress=this.getValue(h,"compress",!1),a.stretch=this.getValue(h,"stretch",!1),a.uniform=this.getValue(h,"uniform",!1),s.ikConstraints.push(a)}if(i.transform)for(let o=0;o<i.transform.length;o++){const h=i.transform[o],a=new G0(h.name);a.order=this.getValue(h,"order",0),a.skinRequired=this.getValue(h,"skin",!1);for(let c=0;c<h.bones.length;c++){const d=h.bones[c],u=s.findBone(d);if(u==null)throw new Error(`Transform constraint bone not found: ${d}`);a.bones.push(u)}const l=h.target;if(a.target=s.findBone(l),a.target==null)throw new Error(`Transform constraint target bone not found: ${l}`);a.local=this.getValue(h,"local",!1),a.relative=this.getValue(h,"relative",!1),a.offsetRotation=this.getValue(h,"rotation",0),a.offsetX=this.getValue(h,"x",0)*e,a.offsetY=this.getValue(h,"y",0)*e,a.offsetScaleX=this.getValue(h,"scaleX",0),a.offsetScaleY=this.getValue(h,"scaleY",0),a.offsetShearY=this.getValue(h,"shearY",0),a.rotateMix=this.getValue(h,"rotateMix",1),a.translateMix=this.getValue(h,"translateMix",1),a.scaleMix=this.getValue(h,"scaleMix",1),a.shearMix=this.getValue(h,"shearMix",1),s.transformConstraints.push(a)}if(i.path)for(let o=0;o<i.path.length;o++){const h=i.path[o],a=new N0(h.name);a.order=this.getValue(h,"order",0),a.skinRequired=this.getValue(h,"skin",!1);for(let c=0;c<h.bones.length;c++){const d=h.bones[c],u=s.findBone(d);if(u==null)throw new Error(`Transform constraint bone not found: ${d}`);a.bones.push(u)}const l=h.target;if(a.target=s.findSlot(l),a.target==null)throw new Error(`Path target slot not found: ${l}`);a.positionMode=Un.positionModeFromString(this.getValue(h,"positionMode","percent")),a.spacingMode=Un.spacingModeFromString(this.getValue(h,"spacingMode","length")),a.rotateMode=Un.rotateModeFromString(this.getValue(h,"rotateMode","tangent")),a.offsetRotation=this.getValue(h,"rotation",0),a.position=this.getValue(h,"position",0),a.positionMode==ne.Fixed&&(a.position*=e),a.spacing=this.getValue(h,"spacing",0),(a.spacingMode==be.Length||a.spacingMode==be.Fixed)&&(a.spacing*=e),a.rotateMix=this.getValue(h,"rotateMix",1),a.translateMix=this.getValue(h,"translateMix",1),s.pathConstraints.push(a)}if(i.skins)for(let o=0;o<i.skins.length;o++){const h=i.skins[o],a=new Hu(h.name);if(h.bones)for(let l=0;l<h.bones.length;l++){const c=s.findBone(h.bones[l]);if(c==null)throw new Error(`Skin bone not found: ${h.bones[o]}`);a.bones.push(c)}if(h.ik)for(let l=0;l<h.ik.length;l++){const c=s.findIkConstraint(h.ik[l]);if(c==null)throw new Error(`Skin IK constraint not found: ${h.ik[o]}`);a.constraints.push(c)}if(h.transform)for(let l=0;l<h.transform.length;l++){const c=s.findTransformConstraint(h.transform[l]);if(c==null)throw new Error(`Skin transform constraint not found: ${h.transform[o]}`);a.constraints.push(c)}if(h.path)for(let l=0;l<h.path.length;l++){const c=s.findPathConstraint(h.path[l]);if(c==null)throw new Error(`Skin path constraint not found: ${h.path[o]}`);a.constraints.push(c)}for(const l in h.attachments){const c=s.findSlot(l);if(c==null)throw new Error(`Slot not found: ${l}`);const d=h.attachments[l];for(const u in d){const f=this.readAttachment(d[u],a,c.index,u,s);f!=null&&a.setAttachment(c.index,u,f)}}s.skins.push(a),a.name=="default"&&(s.defaultSkin=a)}for(let o=0,h=this.linkedMeshes.length;o<h;o++){const a=this.linkedMeshes[o],l=a.skin==null?s.defaultSkin:s.findSkin(a.skin);if(l==null)throw new Error(`Skin not found: ${a.skin}`);const c=l.getAttachment(a.slotIndex,a.parent);if(c==null)throw new Error(`Parent mesh not found: ${a.parent}`);a.mesh.deformAttachment=a.inheritDeform?c:a.mesh,a.mesh.setParentMesh(c)}if(this.linkedMeshes.length=0,i.events)for(const o in i.events){const h=i.events[o],a=new O0(o);a.intValue=this.getValue(h,"int",0),a.floatValue=this.getValue(h,"float",0),a.stringValue=this.getValue(h,"string",""),a.audioPath=this.getValue(h,"audio",null),a.audioPath!=null&&(a.volume=this.getValue(h,"volume",1),a.balance=this.getValue(h,"balance",0)),s.events.push(a)}if(i.animations)for(const o in i.animations){const h=i.animations[o];this.readAnimation(h,o,s)}return s}readAttachment(t,e,s,i,n){const o=this.scale;switch(i=this.getValue(t,"name",i),this.getValue(t,"type","region")){case"region":{const a=this.getValue(t,"path",i),l=this.attachmentLoader.newRegionAttachment(e,i,a);if(l==null)return null;l.path=a,l.x=this.getValue(t,"x",0)*o,l.y=this.getValue(t,"y",0)*o,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*o,l.height=t.height*o;const c=this.getValue(t,"color",null);return c!=null&&l.color.setFromString(c),l}case"boundingbox":{const a=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(a==null)return null;this.readVertices(t,a,t.vertexCount<<1);const l=this.getValue(t,"color",null);return l!=null&&a.color.setFromString(l),a}case"mesh":case"linkedmesh":{const a=this.getValue(t,"path",i),l=this.attachmentLoader.newMeshAttachment(e,i,a);if(l==null)return null;l.path=a;const c=this.getValue(t,"color",null);c!=null&&l.color.setFromString(c),l.width=this.getValue(t,"width",0)*o,l.height=this.getValue(t,"height",0)*o;const d=this.getValue(t,"parent",null);if(d!=null)return this.linkedMeshes.push(new tC(l,this.getValue(t,"skin",null),s,d,this.getValue(t,"deform",!0))),l;const u=t.uvs;return this.readVertices(t,l,u.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(u),l.edges=this.getValue(t,"edges",null),l.hullLength=this.getValue(t,"hull",0)*2,l}case"path":{const a=this.attachmentLoader.newPathAttachment(e,i);if(a==null)return null;a.closed=this.getValue(t,"closed",!1),a.constantSpeed=this.getValue(t,"constantSpeed",!0);const l=t.vertexCount;this.readVertices(t,a,l<<1);const c=B.newArray(l/3,0);for(let u=0;u<t.lengths.length;u++)c[u]=t.lengths[u]*o;a.lengths=c;const d=this.getValue(t,"color",null);return d!=null&&a.color.setFromString(d),a}case"point":{const a=this.attachmentLoader.newPointAttachment(e,i);if(a==null)return null;a.x=this.getValue(t,"x",0)*o,a.y=this.getValue(t,"y",0)*o,a.rotation=this.getValue(t,"rotation",0);const l=this.getValue(t,"color",null);return l!=null&&a.color.setFromString(l),a}case"clipping":{const a=this.attachmentLoader.newClippingAttachment(e,i);if(a==null)return null;const l=this.getValue(t,"end",null);if(l!=null){const u=n.findSlot(l);if(u==null)throw new Error(`Clipping end slot not found: ${l}`);a.endSlot=u}const c=t.vertexCount;this.readVertices(t,a,c<<1);const d=this.getValue(t,"color",null);return d!=null&&a.color.setFromString(d),a}}return null}readVertices(t,e,s){const i=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const a=B.toFloatArray(n);if(i!=1)for(let l=0,c=n.length;l<c;l++)a[l]*=i;e.vertices=a;return}const o=new Array,h=new Array;for(let a=0,l=n.length;a<l;){const c=n[a++];h.push(c);for(let d=a+c*4;a<d;a+=4)h.push(n[a]),o.push(n[a+1]*i),o.push(n[a+2]*i),o.push(n[a+3])}e.bones=h,e.vertices=B.toFloatArray(o)}readAnimation(t,e,s){const i=this.scale,n=new Array;let o=0;if(t.slots)for(const a in t.slots){const l=t.slots[a],c=s.findSlotIndex(a);if(c==-1)throw new Error(`Slot not found: ${a}`);for(const d in l){const u=l[d];if(d=="attachment"){const f=new Pn(u.length);f.slotIndex=c;let p=0;for(let m=0;m<u.length;m++){const g=u[m];f.setFrame(p++,this.getValue(g,"time",0),g.name)}n.push(f),o=Math.max(o,f.frames[f.getFrameCount()-1])}else if(d=="color"){const f=new He(u.length);f.slotIndex=c;let p=0;for(let m=0;m<u.length;m++){const g=u[m],y=new G;y.setFromString(g.color||"ffffffff"),f.setFrame(p,this.getValue(g,"time",0),y.r,y.g,y.b,y.a),this.readCurve(g,f,p),p++}n.push(f),o=Math.max(o,f.frames[(f.getFrameCount()-1)*He.ENTRIES])}else if(d=="twoColor"){const f=new oe(u.length);f.slotIndex=c;let p=0;for(let m=0;m<u.length;m++){const g=u[m],y=new G,x=new G;y.setFromString(g.light),x.setFromString(g.dark),f.setFrame(p,this.getValue(g,"time",0),y.r,y.g,y.b,y.a,x.r,x.g,x.b),this.readCurve(g,f,p),p++}n.push(f),o=Math.max(o,f.frames[(f.getFrameCount()-1)*oe.ENTRIES])}else throw new Error(`Invalid timeline type for a slot: ${d} (${a})`)}}if(t.bones)for(const a in t.bones){const l=t.bones[a],c=s.findBoneIndex(a);if(c==-1)throw new Error(`Bone not found: ${a}`);for(const d in l){const u=l[d];if(d==="rotate"){const f=new Ie(u.length);f.boneIndex=c;let p=0;for(let m=0;m<u.length;m++){const g=u[m];f.setFrame(p,this.getValue(g,"time",0),this.getValue(g,"angle",0)),this.readCurve(g,f,p),p++}n.push(f),o=Math.max(o,f.frames[(f.getFrameCount()-1)*Ie.ENTRIES])}else if(d==="translate"||d==="scale"||d==="shear"){let f=null,p=1,m=0;d==="scale"?(f=new A0(u.length),m=1):d==="shear"?f=new S0(u.length):(f=new fs(u.length),p=i),f.boneIndex=c;let g=0;for(let y=0;y<u.length;y++){const x=u[y],_=this.getValue(x,"x",m),v=this.getValue(x,"y",m);f.setFrame(g,this.getValue(x,"time",0),_*p,v*p),this.readCurve(x,f,g),g++}n.push(f),o=Math.max(o,f.frames[(f.getFrameCount()-1)*fs.ENTRIES])}else throw new Error(`Invalid timeline type for a bone: ${d} (${a})`)}}if(t.ik)for(const a in t.ik){const l=t.ik[a],c=s.findIkConstraint(a),d=new Pe(l.length);d.ikConstraintIndex=s.ikConstraints.indexOf(c);let u=0;for(let f=0;f<l.length;f++){const p=l[f];d.setFrame(u,this.getValue(p,"time",0),this.getValue(p,"mix",1),this.getValue(p,"softness",0)*i,this.getValue(p,"bendPositive",!0)?1:-1,this.getValue(p,"compress",!1),this.getValue(p,"stretch",!1)),this.readCurve(p,d,u),u++}n.push(d),o=Math.max(o,d.frames[(d.getFrameCount()-1)*Pe.ENTRIES])}if(t.transform)for(const a in t.transform){const l=t.transform[a],c=s.findTransformConstraint(a),d=new We(l.length);d.transformConstraintIndex=s.transformConstraints.indexOf(c);let u=0;for(let f=0;f<l.length;f++){const p=l[f];d.setFrame(u,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,d,u),u++}n.push(d),o=Math.max(o,d.frames[(d.getFrameCount()-1)*We.ENTRIES])}if(t.path)for(const a in t.path){const l=t.path[a],c=s.findPathConstraintIndex(a);if(c==-1)throw new Error(`Path constraint not found: ${a}`);const d=s.pathConstraints[c];for(const u in l){const f=l[u];if(u==="position"||u==="spacing"){let p=null,m=1;u==="spacing"?(p=new P0(f.length),(d.spacingMode==be.Length||d.spacingMode==be.Fixed)&&(m=i)):(p=new Si(f.length),d.positionMode==ne.Fixed&&(m=i)),p.pathConstraintIndex=c;let g=0;for(let y=0;y<f.length;y++){const x=f[y];p.setFrame(g,this.getValue(x,"time",0),this.getValue(x,u,0)*m),this.readCurve(x,p,g),g++}n.push(p),o=Math.max(o,p.frames[(p.getFrameCount()-1)*Si.ENTRIES])}else if(u==="mix"){const p=new ni(f.length);p.pathConstraintIndex=c;let m=0;for(let g=0;g<f.length;g++){const y=f[g];p.setFrame(m,this.getValue(y,"time",0),this.getValue(y,"rotateMix",1),this.getValue(y,"translateMix",1)),this.readCurve(y,p,m),m++}n.push(p),o=Math.max(o,p.frames[(p.getFrameCount()-1)*ni.ENTRIES])}}}if(t.deform)for(const a in t.deform){const l=t.deform[a],c=s.findSkin(a);if(c!=null)for(const d in l){const u=l[d],f=s.findSlotIndex(d);if(f==-1)throw new Error(`Slot not found: ${u.name}`);for(const p in u){const m=u[p],g=c.getAttachment(f,p);if(g==null)throw new Error(`Deform attachment not found: ${m.name}`);const y=g.bones!=null,x=g.vertices,_=y?x.length/3*2:x.length,v=new I0(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=y?B.newFloatArray(_):x;else{T=B.newFloatArray(_);const I=this.getValue(E,"offset",0);if(B.arrayCopy(A,0,T,I,A.length),i!=1)for(let M=I,R=M+A.length;M<R;M++)T[M]*=i;if(!y)for(let M=0;M<_;M++)T[M]+=x[M]}v.setFrame(b,this.getValue(E,"time",0),T),this.readCurve(E,v,b),b++}n.push(v),o=Math.max(o,v.frames[v.getFrameCount()-1])}}}let h=t.drawOrder;if(h==null&&(h=t.draworder),h!=null){const a=new Ca(h.length),l=s.slots.length;let c=0;for(let d=0;d<h.length;d++){const u=h[d];let f=null;const p=this.getValue(u,"offsets",null);if(p!=null){f=B.newArray(l,-1);const m=B.newArray(l-p.length,0);let g=0,y=0;for(let x=0;x<p.length;x++){const _=p[x],v=s.findSlotIndex(_.slot);if(v==-1)throw new Error(`Slot not found: ${_.slot}`);for(;g!=v;)m[y++]=g++;f[g+_.offset]=g++}for(;g<l;)m[y++]=g++;for(let x=l-1;x>=0;x--)f[x]==-1&&(f[x]=m[--y])}a.setFrame(c++,this.getValue(u,"time",0),f)}n.push(a),o=Math.max(o,a.frames[a.getFrameCount()-1])}if(t.events){const a=new Vu(t.events.length);let l=0;for(let c=0;c<t.events.length;c++){const d=t.events[c],u=s.findEvent(d.name);if(u==null)throw new Error(`Event not found: ${d.name}`);const f=new D0(B.toSinglePrecision(this.getValue(d,"time",0)),u);f.intValue=this.getValue(d,"int",u.intValue),f.floatValue=this.getValue(d,"float",u.floatValue),f.stringValue=this.getValue(d,"string",u.stringValue),f.data.audioPath!=null&&(f.volume=this.getValue(d,"volume",1),f.balance=this.getValue(d,"balance",0)),a.setFrame(l++,f)}n.push(a),o=Math.max(o,a.frames[a.getFrameCount()-1])}if(isNaN(o))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new ae(e,n,o))}readCurve(t,e,s){if(t.hasOwnProperty("curve"))if(t.curve==="stepped")e.setStepped(s);else{const i=t.curve;e.setCurve(s,i,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 yt.Normal;if(t=="onlytranslation")return yt.OnlyTranslation;if(t=="norotationorreflection")return yt.NoRotationOrReflection;if(t=="noscale")return yt.NoScale;if(t=="noscaleorreflection")return yt.NoScaleOrReflection;throw new Error(`Unknown transform mode: ${t}`)}},tC=class{constructor(t,e,s,i,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritDeform=n}};class eC extends Nu{createSkeleton(t){this.skeleton=new U0(t),this.skeleton.updateWorldTransform(),this.stateData=new M0(t),this.state=new ps(this.stateData)}}const sC={extension:Y.Asset,loader:{extension:{type:Y.LoadParser,priority:Ne.Normal},test(r){return Le(r,".atlas")},async load(r){return await(await z.ADAPTER.fetch(r)).text()},testParse(r,t){const e=Le(t.src,".atlas"),s=typeof r=="string";return Promise.resolve(e&&s)},async parse(r,t,e){const s=t.data;let i=vt.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");let n=null,o=null;const h=new Promise((c,d)=>{n=c,o=d});let a;const l=c=>{c||o(`Something went terribly wrong loading a spine .atlas file
|
|
1170
|
+
Most likely your texture failed to load.`),n(a)};if(s.image||s.images){const c=Object.assign(s.image?{default:s.image}:{},s.images);a=new Lu(r,(d,u)=>{const f=c[d]||c.default;f&&f.baseTexture?u(f.baseTexture):u(f)},l)}else a=new Lu(r,Y0(e,i,s.imageMetadata),l);return await h},unload(r){r.dispose()}}},Y0=(r,t,e)=>async(s,i)=>{const n=vt.normalize([...t.split(vt.sep),s].join(vt.sep)),o=await r.load({src:n,data:e});i(o.baseTexture)};Z.add(sC);function H0(r){return r.hasOwnProperty("bones")}function iC(r){return r 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,i){var a;const n=Le(i.src,".json")&&H0(s),o=Le(i.src,".skel")&&iC(s),h=((a=i.data)==null?void 0:a.spineAtlas)===!1;return Promise.resolve(n&&!h||o)},async parse(s,i,n){const o=vt.extname(i.src).toLowerCase(),h=vt.basename(i.src,o);let a=vt.dirname(i.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");const l=Le(i.src,".json")&&H0(s);let c=null,d=s;l?c=t.createJsonParser():(c=t.createBinaryParser(),d=new Uint8Array(s));const u=i.data||{},f=(u==null?void 0:u.spineSkeletonScale)??null;f&&(c.scale=f);const p=u.spineAtlas;if(p&&p.pages)return t.parseData(c,p,d);const m=u.atlasRawData;if(m){let x=null,_=null;const v=new Promise((E,T)=>{x=E,_=T}),b=new Lu(m,Y0(n,a,u.imageMetadata),E=>{E||_(`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(c,w,d)}let g=u.spineAtlasFile;g||(g=`${a+h}.atlas`);const y=await n.load({src:g,data:u,alias:u.spineAtlasAlias});return t.parseData(c,y,d)}}};return Z.add(e),e}}let W0=class{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}};const z0=class extends W0{constructor(t){super(t),this.id=(z0.nextID++&65535)<<11,this.worldVerticesLength=0}computeWorldVerticesOld(t,e){this.computeWorldVertices(t,0,this.worldVerticesLength,e,0,2)}computeWorldVertices(t,e,s,i,n,o){s=n+(s>>1)*o;const h=t.bone.skeleton,a=t.attachmentVertices;let l=this.vertices;const c=this.bones;if(c==null){a.length>0&&(l=a);const p=t.bone.matrix,m=p.tx,g=p.ty,y=p.a,x=p.c,_=p.b,v=p.d;for(let b=e,w=n;w<s;b+=2,w+=o){const E=l[b],T=l[b+1];i[w]=E*y+T*x+m,i[w+1]=E*_+T*v+g}return}let d=0,u=0;for(let p=0;p<e;p+=2){const m=c[d];d+=m+1,u+=m}const f=h.bones;if(a.length==0)for(let p=n,m=u*3;p<s;p+=o){let g=0,y=0,x=c[d++];for(x+=d;d<x;d++,m+=3){const _=f[c[d]].matrix,v=l[m],b=l[m+1],w=l[m+2];g+=(v*_.a+b*_.c+_.tx)*w,y+=(v*_.b+b*_.d+_.ty)*w}i[p]=g,i[p+1]=y}else{const p=a;for(let m=n,g=u*3,y=u<<1;m<s;m+=o){let x=0,_=0,v=c[d++];for(v+=d;d<v;d++,g+=3,y+=2){const b=f[c[d]].matrix,w=l[g]+p[y],E=l[g+1]+p[y+1],T=l[g+2];x+=(w*b.a+E*b.c+b.tx)*T,_+=(w*b.b+E*b.d+b.ty)*T}i[m]=x,i[m+1]=_}}}applyDeform(t){return this==t}};let $r=z0;$r.nextID=0;let nC=class extends $r{constructor(t){super(t),this.type=ot.BoundingBox,this.color=new G(1,1,1,1)}},aC=class extends $r{constructor(t){super(t),this.type=ot.Clipping,this.color=new G(.2275,.2275,.8078,1)}},oC=class extends $r{constructor(t){super(t),this.type=ot.Mesh,this.color=new G(1,1,1,1),this.inheritDeform=!1,this.tempColor=new G(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 $r{constructor(t){super(t),this.type=ot.Path,this.closed=!1,this.constantSpeed=!1,this.color=new G(1,1,1,1)}},lC=class extends $r{constructor(t){super(t),this.type=ot.Point,this.color=new G(.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),i=D.sinDeg(this.rotation),n=s*e.a+i*e.c,o=s*e.b+i*e.d;return Math.atan2(o,n)*D.radDeg}};class cC{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 G,this.darkColor=t.darkColor==null?null:new G,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 W0{constructor(t){super(t),this.type=ot.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 G(1,1,1,1),this.offset=B.newFloatArray(8),this.uvs=B.newFloatArray(8),this.tempColor=new G(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,i=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,o=i+this.region.height*e,h=this.rotation*Math.PI/180,a=Math.cos(h),l=Math.sin(h),c=s*a+this.x,d=s*l,u=i*a+this.y,f=i*l,p=n*a+this.x,m=n*l,g=o*a+this.y,y=o*l,x=this.offset;x[we.OX1]=c-f,x[we.OY1]=u+d,x[we.OX2]=c-y,x[we.OY2]=g+d,x[we.OX3]=p-y,x[we.OY3]=g+m,x[we.OX4]=p-f,x[we.OY4]=u+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,i){const n=this.offset,o=t instanceof cC?t.bone.matrix:t.matrix,h=o.tx,a=o.ty,l=o.a,c=o.c,d=o.b,u=o.d;let f=0,p=0;f=n[we.OX1],p=n[we.OY1],e[s]=f*l+p*c+h,e[s+1]=f*d+p*u+a,s+=i,f=n[we.OX2],p=n[we.OY2],e[s]=f*l+p*c+h,e[s+1]=f*d+p*u+a,s+=i,f=n[we.OX3],p=n[we.OY3],e[s]=f*l+p*c+h,e[s+1]=f*d+p*u+a,s+=i,f=n[we.OX4],p=n[we.OY4],e[s]=f*l+p*c+h,e[s+1]=f*d+p*u+a}};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 v0(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,i,n,o,h,a){if(t==null)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let c=0,d=l.length;c<d;c++)l[c].apply(t,e,s,n,o,h,a)}static binarySearch(t,e,s=1){let i=0,n=t.length/s-2;if(n==0)return s;let o=n>>>1;for(;;){if(t[(o+1)*s]<=e?i=o+1:n=o,i==n)return(i+1)*s;o=i+n>>>1}}static linearSearch(t,e,s){for(let i=0,n=t.length-s;i<=n;i+=s)if(t[i]>e)return i;return-1}};const se=class{constructor(r){if(r<=0)throw new Error(`frameCount must be > 0: ${r}`);this.curves=B.newFloatArray((r-1)*se.BEZIER_SIZE)}getFrameCount(){return this.curves.length/se.BEZIER_SIZE+1}setLinear(r){this.curves[r*se.BEZIER_SIZE]=se.LINEAR}setStepped(r){this.curves[r*se.BEZIER_SIZE]=se.STEPPED}getCurveType(r){const t=r*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(r,t,e,s,i){const n=(-t*2+s)*.03,o=(-e*2+i)*.03,h=((t-s)*3+1)*.006,a=((e-i)*3+1)*.006;let l=n*2+h,c=o*2+a,d=t*.3+n+h*.16666667,u=e*.3+o+a*.16666667,f=r*se.BEZIER_SIZE;const p=this.curves;p[f++]=se.BEZIER;let m=d,g=u;for(let y=f+se.BEZIER_SIZE-1;f<y;f+=2)p[f]=m,p[f+1]=g,d+=l,u+=c,l+=h,c+=a,m+=d,g+=u}getCurvePercent(r,t){t=D.clamp(t,0,1);const e=this.curves;let s=r*se.BEZIER_SIZE;const i=e[s];if(i==se.LINEAR)return t;if(i==se.STEPPED)return 0;s++;let n=0;for(let h=s,a=s+se.BEZIER_SIZE-1;s<a;s+=2)if(n=e[s],n>=t){let l,c;return s==h?(l=0,c=0):(l=e[s-2],c=e[s-1]),c+(e[s+1]-c)*(t-l)/(n-l)}const o=e[s-1];return o+(1-o)*(t-n)/(1-n)}};let is=se;is.LINEAR=0,is.STEPPED=1,is.BEZIER=2,is.BEZIER_SIZE=10*2-1;const er=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(r,t,e){r<<=1,this.frames[r]=t,this.frames[r+er.ROTATION]=e}apply(r,t,e,s,i,n,o){const h=this.frames,a=r.bones[this.boneIndex];if(e<h[0]){switch(n){case S.setup:a.rotation=a.data.rotation;return;case S.first:const p=a.data.rotation-a.rotation;a.rotation+=(p-(16384-(16384.499999999996-p/360|0))*360)*i}return}if(e>=h[h.length-er.ENTRIES]){let p=h[h.length+er.PREV_ROTATION];switch(n){case S.setup:a.rotation=a.data.rotation+p*i;break;case S.first:case S.replace:p+=a.data.rotation-a.rotation,p-=(16384-(16384.499999999996-p/360|0))*360;case S.add:a.rotation+=p*i}return}const l=Ee.binarySearch(h,e,er.ENTRIES),c=h[l+er.PREV_ROTATION],d=h[l],u=this.getCurvePercent((l>>1)-1,1-(e-d)/(h[l+er.PREV_TIME]-d));let f=h[l+er.ROTATION]-c;switch(f=c+(f-(16384-(16384.499999999996-f/360|0))*360)*u,n){case S.setup:a.rotation=a.data.rotation+(f-(16384-(16384.499999999996-f/360|0))*360)*i;break;case S.first:case S.replace:f+=a.data.rotation-a.rotation;case S.add:a.rotation+=(f-(16384-(16384.499999999996-f/360|0))*360)*i}}};let Rn=er;Rn.ENTRIES=2,Rn.PREV_TIME=-2,Rn.PREV_ROTATION=-1,Rn.ROTATION=1;const De=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r*De.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(r,t,e,s){r*=De.ENTRIES,this.frames[r]=t,this.frames[r+De.X]=e,this.frames[r+De.Y]=s}apply(r,t,e,s,i,n,o){const h=this.frames,a=r.bones[this.boneIndex];if(e<h[0]){switch(n){case S.setup:a.x=a.data.x,a.y=a.data.y;return;case S.first:a.x+=(a.data.x-a.x)*i,a.y+=(a.data.y-a.y)*i}return}let l=0,c=0;if(e>=h[h.length-De.ENTRIES])l=h[h.length+De.PREV_X],c=h[h.length+De.PREV_Y];else{const d=Ee.binarySearch(h,e,De.ENTRIES);l=h[d+De.PREV_X],c=h[d+De.PREV_Y];const u=h[d],f=this.getCurvePercent(d/De.ENTRIES-1,1-(e-u)/(h[d+De.PREV_TIME]-u));l+=(h[d+De.X]-l)*f,c+=(h[d+De.Y]-c)*f}switch(n){case S.setup:a.x=a.data.x+l*i,a.y=a.data.y+c*i;break;case S.first:case S.replace:a.x+=(a.data.x+l-a.x)*i,a.y+=(a.data.y+c-a.y)*i;break;case S.add:a.x+=l*i,a.y+=c*i}}};let ai=De;ai.ENTRIES=3,ai.PREV_TIME=-3,ai.PREV_X=-2,ai.PREV_Y=-1,ai.X=1,ai.Y=2;let uC=class Ds extends ai{constructor(t){super(t)}getPropertyId(){return(2<<24)+this.boneIndex}apply(t,e,s,i,n,o,h){const a=this.frames,l=t.bones[this.boneIndex];if(s<a[0]){switch(o){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 c=0,d=0;if(s>=a[a.length-Ds.ENTRIES])c=a[a.length+Ds.PREV_X]*l.data.scaleX,d=a[a.length+Ds.PREV_Y]*l.data.scaleY;else{const u=Ee.binarySearch(a,s,Ds.ENTRIES);c=a[u+Ds.PREV_X],d=a[u+Ds.PREV_Y];const f=a[u],p=this.getCurvePercent(u/Ds.ENTRIES-1,1-(s-f)/(a[u+Ds.PREV_TIME]-f));c=(c+(a[u+Ds.X]-c)*p)*l.data.scaleX,d=(d+(a[u+Ds.Y]-d)*p)*l.data.scaleY}if(n==1)o==S.add?(l.scaleX+=c-l.data.scaleX,l.scaleY+=d-l.data.scaleY):(l.scaleX=c,l.scaleY=d);else{let u=0,f=0;if(h==At.mixOut)switch(o){case S.setup:u=l.data.scaleX,f=l.data.scaleY,l.scaleX=u+(Math.abs(c)*D.signum(u)-u)*n,l.scaleY=f+(Math.abs(d)*D.signum(f)-f)*n;break;case S.first:case S.replace:u=l.scaleX,f=l.scaleY,l.scaleX=u+(Math.abs(c)*D.signum(u)-u)*n,l.scaleY=f+(Math.abs(d)*D.signum(f)-f)*n;break;case S.add:u=l.scaleX,f=l.scaleY,l.scaleX=u+(Math.abs(c)*D.signum(u)-l.data.scaleX)*n,l.scaleY=f+(Math.abs(d)*D.signum(f)-l.data.scaleY)*n}else switch(o){case S.setup:u=Math.abs(l.data.scaleX)*D.signum(c),f=Math.abs(l.data.scaleY)*D.signum(d),l.scaleX=u+(c-u)*n,l.scaleY=f+(d-f)*n;break;case S.first:case S.replace:u=Math.abs(l.scaleX)*D.signum(c),f=Math.abs(l.scaleY)*D.signum(d),l.scaleX=u+(c-u)*n,l.scaleY=f+(d-f)*n;break;case S.add:u=D.signum(c),f=D.signum(d),l.scaleX=Math.abs(l.scaleX)*u+(c-Math.abs(l.data.scaleX)*u)*n,l.scaleY=Math.abs(l.scaleY)*f+(d-Math.abs(l.data.scaleY)*f)*n}}}},dC=class Os extends ai{constructor(t){super(t)}getPropertyId(){return(3<<24)+this.boneIndex}apply(t,e,s,i,n,o,h){const a=this.frames,l=t.bones[this.boneIndex];if(s<a[0]){switch(o){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 c=0,d=0;if(s>=a[a.length-Os.ENTRIES])c=a[a.length+Os.PREV_X],d=a[a.length+Os.PREV_Y];else{const u=Ee.binarySearch(a,s,Os.ENTRIES);c=a[u+Os.PREV_X],d=a[u+Os.PREV_Y];const f=a[u],p=this.getCurvePercent(u/Os.ENTRIES-1,1-(s-f)/(a[u+Os.PREV_TIME]-f));c=c+(a[u+Os.X]-c)*p,d=d+(a[u+Os.Y]-d)*p}switch(o){case S.setup:l.shearX=l.data.shearX+c*n,l.shearY=l.data.shearY+d*n;break;case S.first:case S.replace:l.shearX+=(l.data.shearX+c-l.shearX)*n,l.shearY+=(l.data.shearY+d-l.shearY)*n;break;case S.add:l.shearX+=c*n,l.shearY+=d*n}}};const Ht=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r*Ht.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(r,t,e,s,i,n){r*=Ht.ENTRIES,this.frames[r]=t,this.frames[r+Ht.R]=e,this.frames[r+Ht.G]=s,this.frames[r+Ht.B]=i,this.frames[r+Ht.A]=n}apply(r,t,e,s,i,n,o){const h=r.slots[this.slotIndex],a=this.frames;if(e<a[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)*i,(p.g-f.g)*i,(p.b-f.b)*i,(p.a-f.a)*i)}return}let l=0,c=0,d=0,u=0;if(e>=a[a.length-Ht.ENTRIES]){const f=a.length;l=a[f+Ht.PREV_R],c=a[f+Ht.PREV_G],d=a[f+Ht.PREV_B],u=a[f+Ht.PREV_A]}else{const f=Ee.binarySearch(a,e,Ht.ENTRIES);l=a[f+Ht.PREV_R],c=a[f+Ht.PREV_G],d=a[f+Ht.PREV_B],u=a[f+Ht.PREV_A];const p=a[f],m=this.getCurvePercent(f/Ht.ENTRIES-1,1-(e-p)/(a[f+Ht.PREV_TIME]-p));l+=(a[f+Ht.R]-l)*m,c+=(a[f+Ht.G]-c)*m,d+=(a[f+Ht.B]-d)*m,u+=(a[f+Ht.A]-u)*m}if(i==1)h.color.set(l,c,d,u);else{const f=h.color;n==S.setup&&f.setFromColor(h.data.color),f.add((l-f.r)*i,(c-f.g)*i,(d-f.b)*i,(u-f.a)*i)}}};let ms=Ht;ms.ENTRIES=5,ms.PREV_TIME=-5,ms.PREV_R=-4,ms.PREV_G=-3,ms.PREV_B=-2,ms.PREV_A=-1,ms.R=1,ms.G=2,ms.B=3,ms.A=4;const ft=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r*ft.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(r,t,e,s,i,n,o,h,a){r*=ft.ENTRIES,this.frames[r]=t,this.frames[r+ft.R]=e,this.frames[r+ft.G]=s,this.frames[r+ft.B]=i,this.frames[r+ft.A]=n,this.frames[r+ft.R2]=o,this.frames[r+ft.G2]=h,this.frames[r+ft.B2]=a}apply(r,t,e,s,i,n,o){const h=r.slots[this.slotIndex],a=this.frames;if(e<a[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,y=h.darkColor,x=h.data.color,_=h.data.darkColor;g.add((x.r-g.r)*i,(x.g-g.g)*i,(x.b-g.b)*i,(x.a-g.a)*i),y.add((_.r-y.r)*i,(_.g-y.g)*i,(_.b-y.b)*i,0)}return}let l=0,c=0,d=0,u=0,f=0,p=0,m=0;if(e>=a[a.length-ft.ENTRIES]){const g=a.length;l=a[g+ft.PREV_R],c=a[g+ft.PREV_G],d=a[g+ft.PREV_B],u=a[g+ft.PREV_A],f=a[g+ft.PREV_R2],p=a[g+ft.PREV_G2],m=a[g+ft.PREV_B2]}else{const g=Ee.binarySearch(a,e,ft.ENTRIES);l=a[g+ft.PREV_R],c=a[g+ft.PREV_G],d=a[g+ft.PREV_B],u=a[g+ft.PREV_A],f=a[g+ft.PREV_R2],p=a[g+ft.PREV_G2],m=a[g+ft.PREV_B2];const y=a[g],x=this.getCurvePercent(g/ft.ENTRIES-1,1-(e-y)/(a[g+ft.PREV_TIME]-y));l+=(a[g+ft.R]-l)*x,c+=(a[g+ft.G]-c)*x,d+=(a[g+ft.B]-d)*x,u+=(a[g+ft.A]-u)*x,f+=(a[g+ft.R2]-f)*x,p+=(a[g+ft.G2]-p)*x,m+=(a[g+ft.B2]-m)*x}if(i==1)h.color.set(l,c,d,u),h.darkColor.set(f,p,m,1);else{const g=h.color,y=h.darkColor;n==S.setup&&(g.setFromColor(h.data.color),y.setFromColor(h.data.darkColor)),g.add((l-g.r)*i,(c-g.g)*i,(d-g.b)*i,(u-g.a)*i),y.add((f-y.r)*i,(p-y.g)*i,(m-y.b)*i,0)}}};let xe=ft;xe.ENTRIES=8,xe.PREV_TIME=-8,xe.PREV_R=-7,xe.PREV_G=-6,xe.PREV_B=-5,xe.PREV_A=-4,xe.PREV_R2=-3,xe.PREV_G2=-2,xe.PREV_B2=-1,xe.R=1,xe.G=2,xe.B=3,xe.A=4,xe.R2=5,xe.G2=6,xe.B2=7;let fC=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,i,n,o,h){const a=t.slots[this.slotIndex];if(h==At.mixOut&&o==S.setup){const u=a.data.attachmentName;a.setAttachment(u==null?null:t.getAttachment(this.slotIndex,u));return}const l=this.frames;if(s<l[0]){if(o==S.setup||o==S.first){const u=a.data.attachmentName;a.setAttachment(u==null?null:t.getAttachment(this.slotIndex,u))}return}let c=0;s>=l[l.length-1]?c=l.length-1:c=Ee.binarySearch(l,s,1)-1;const d=this.attachmentNames[c];t.slots[this.slotIndex].setAttachment(d==null?null:t.getAttachment(this.slotIndex,d))}},j0=null,pC=class extends is{constructor(t){super(t),this.frames=B.newFloatArray(t),this.frameVertices=new Array(t),j0==null&&(j0=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,i,n,o,h){const a=t.slots[this.slotIndex],l=a.getAttachment();if(!(l instanceof $r)||!l.applyDeform(this.attachment))return;const c=a.attachmentVertices;c.length==0&&(o=S.setup);const d=this.frameVertices,u=d[0].length,f=this.frames;if(s<f[0]){const v=l;switch(o){case S.setup:c.length=0;return;case S.first:if(n==1){c.length=0;break}const b=B.setArraySize(c,u);if(v.bones==null){const w=v.vertices;for(let E=0;E<u;E++)b[E]+=(w[E]-b[E])*n}else{n=1-n;for(let w=0;w<u;w++)b[w]*=n}}return}const p=B.setArraySize(c,u);if(s>=f[f.length-1]){const v=d[f.length-1];if(n==1)if(o==S.add){const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<u;E++)p[E]+=v[E]-w[E]}else for(let w=0;w<u;w++)p[w]+=v[w]}else B.arrayCopy(v,0,p,0,u);else switch(o){case S.setup:{const w=l;if(w.bones==null){const E=w.vertices;for(let T=0;T<u;T++){const A=E[T];p[T]=A+(v[T]-A)*n}}else for(let E=0;E<u;E++)p[E]=v[E]*n;break}case S.first:case S.replace:for(let w=0;w<u;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<u;E++)p[E]+=(v[E]-w[E])*n}else for(let w=0;w<u;w++)p[w]+=v[w]*n}return}const m=Ee.binarySearch(f,s),g=d[m-1],y=d[m],x=f[m],_=this.getCurvePercent(m-1,1-(s-x)/(f[m-1]-x));if(n==1)if(o==S.add){const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<u;w++){const E=g[w];p[w]+=E+(y[w]-E)*_-b[w]}}else for(let b=0;b<u;b++){const w=g[b];p[b]+=w+(y[b]-w)*_}}else for(let v=0;v<u;v++){const b=g[v];p[v]=b+(y[v]-b)*_}else switch(o){case S.setup:{const b=l;if(b.bones==null){const w=b.vertices;for(let E=0;E<u;E++){const T=g[E],A=w[E];p[E]=A+(T+(y[E]-T)*_-A)*n}}else for(let w=0;w<u;w++){const E=g[w];p[w]=(E+(y[w]-E)*_)*n}break}case S.first:case S.replace:for(let b=0;b<u;b++){const w=g[b];p[b]+=(w+(y[b]-w)*_-p[b])*n}break;case S.add:const v=l;if(v.bones==null){const b=v.vertices;for(let w=0;w<u;w++){const E=g[w];p[w]+=(E+(y[w]-E)*_-b[w])*n}}else for(let b=0;b<u;b++){const w=g[b];p[b]+=(w+(y[b]-w)*_)*n}}}},mC=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,i,n,o,h){if(i==null)return;const a=this.frames,l=this.frames.length;if(e>s)this.apply(t,e,Number.MAX_VALUE,i,n,o,h),e=-1;else if(e>=a[l-1])return;if(s<a[0])return;let c=0;if(e<a[0])c=0;else{c=Ee.binarySearch(a,e);const d=a[c];for(;c>0&&a[c-1]==d;)c--}for(;c<l&&s>=a[c];c++)i.push(this.events[c])}},gC=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,i,n,o,h){const a=t.drawOrder,l=t.slots;if(h==At.mixOut&&o==S.setup){B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}const c=this.frames;if(s<c[0]){(o==S.setup||o==S.first)&&B.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let d=0;s>=c[c.length-1]?d=c.length-1:d=Ee.binarySearch(c,s)-1;const u=this.drawOrders[d];if(u==null)B.arrayCopy(l,0,a,0,l.length);else for(let f=0,p=u.length;f<p;f++)a[f]=l[u[f]]}};const St=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r*St.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(r,t,e,s,i,n){r*=St.ENTRIES,this.frames[r]=t,this.frames[r+St.MIX]=e,this.frames[r+St.BEND_DIRECTION]=s,this.frames[r+St.COMPRESS]=i?1:0,this.frames[r+St.STRETCH]=n?1:0}apply(r,t,e,s,i,n,o){const h=this.frames,a=r.ikConstraints[this.ikConstraintIndex];if(e<h[0]){switch(n){case S.setup:a.mix=a.data.mix,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch;return;case S.first:a.mix+=(a.data.mix-a.mix)*i,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch}return}if(e>=h[h.length-St.ENTRIES]){n==S.setup?(a.mix=a.data.mix+(h[h.length+St.PREV_MIX]-a.data.mix)*i,o==At.mixOut?(a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch):(a.bendDirection=h[h.length+St.PREV_BEND_DIRECTION],a.compress=h[h.length+St.PREV_COMPRESS]!=0,a.stretch=h[h.length+St.PREV_STRETCH]!=0)):(a.mix+=(h[h.length+St.PREV_MIX]-a.mix)*i,o==At.mixIn&&(a.bendDirection=h[h.length+St.PREV_BEND_DIRECTION],a.compress=h[h.length+St.PREV_COMPRESS]!=0,a.stretch=h[h.length+St.PREV_STRETCH]!=0));return}const l=Ee.binarySearch(h,e,St.ENTRIES),c=h[l+St.PREV_MIX],d=h[l],u=this.getCurvePercent(l/St.ENTRIES-1,1-(e-d)/(h[l+St.PREV_TIME]-d));n==S.setup?(a.mix=a.data.mix+(c+(h[l+St.MIX]-c)*u-a.data.mix)*i,o==At.mixOut?(a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch):(a.bendDirection=h[l+St.PREV_BEND_DIRECTION],a.compress=h[l+St.PREV_COMPRESS]!=0,a.stretch=h[l+St.PREV_STRETCH]!=0)):(a.mix+=(c+(h[l+St.MIX]-c)*u-a.mix)*i,o==At.mixIn&&(a.bendDirection=h[l+St.PREV_BEND_DIRECTION],a.compress=h[l+St.PREV_COMPRESS]!=0,a.stretch=h[l+St.PREV_STRETCH]!=0))}};let gs=St;gs.ENTRIES=5,gs.PREV_TIME=-5,gs.PREV_MIX=-4,gs.PREV_BEND_DIRECTION=-3,gs.PREV_COMPRESS=-2,gs.PREV_STRETCH=-1,gs.MIX=1,gs.BEND_DIRECTION=2,gs.COMPRESS=3,gs.STRETCH=4;const Wt=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r*Wt.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(r,t,e,s,i,n){r*=Wt.ENTRIES,this.frames[r]=t,this.frames[r+Wt.ROTATE]=e,this.frames[r+Wt.TRANSLATE]=s,this.frames[r+Wt.SCALE]=i,this.frames[r+Wt.SHEAR]=n}apply(r,t,e,s,i,n,o){const h=this.frames,a=r.transformConstraints[this.transformConstraintIndex];if(e<h[0]){const f=a.data;switch(n){case S.setup:a.rotateMix=f.rotateMix,a.translateMix=f.translateMix,a.scaleMix=f.scaleMix,a.shearMix=f.shearMix;return;case S.first:a.rotateMix+=(f.rotateMix-a.rotateMix)*i,a.translateMix+=(f.translateMix-a.translateMix)*i,a.scaleMix+=(f.scaleMix-a.scaleMix)*i,a.shearMix+=(f.shearMix-a.shearMix)*i}return}let l=0,c=0,d=0,u=0;if(e>=h[h.length-Wt.ENTRIES]){const f=h.length;l=h[f+Wt.PREV_ROTATE],c=h[f+Wt.PREV_TRANSLATE],d=h[f+Wt.PREV_SCALE],u=h[f+Wt.PREV_SHEAR]}else{const f=Ee.binarySearch(h,e,Wt.ENTRIES);l=h[f+Wt.PREV_ROTATE],c=h[f+Wt.PREV_TRANSLATE],d=h[f+Wt.PREV_SCALE],u=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,c+=(h[f+Wt.TRANSLATE]-c)*m,d+=(h[f+Wt.SCALE]-d)*m,u+=(h[f+Wt.SHEAR]-u)*m}if(n==S.setup){const f=a.data;a.rotateMix=f.rotateMix+(l-f.rotateMix)*i,a.translateMix=f.translateMix+(c-f.translateMix)*i,a.scaleMix=f.scaleMix+(d-f.scaleMix)*i,a.shearMix=f.shearMix+(u-f.shearMix)*i}else a.rotateMix+=(l-a.rotateMix)*i,a.translateMix+=(c-a.translateMix)*i,a.scaleMix+=(d-a.scaleMix)*i,a.shearMix+=(u-a.shearMix)*i}};let _s=Wt;_s.ENTRIES=5,_s.PREV_TIME=-5,_s.PREV_ROTATE=-4,_s.PREV_TRANSLATE=-3,_s.PREV_SCALE=-2,_s.PREV_SHEAR=-1,_s.ROTATE=1,_s.TRANSLATE=2,_s.SCALE=3,_s.SHEAR=4;const Is=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r*Is.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(r,t,e){r*=Is.ENTRIES,this.frames[r]=t,this.frames[r+Is.VALUE]=e}apply(r,t,e,s,i,n,o){const h=this.frames,a=r.pathConstraints[this.pathConstraintIndex];if(e<h[0]){switch(n){case S.setup:a.position=a.data.position;return;case S.first:a.position+=(a.data.position-a.position)*i}return}let l=0;if(e>=h[h.length-Is.ENTRIES])l=h[h.length+Is.PREV_VALUE];else{const c=Ee.binarySearch(h,e,Is.ENTRIES);l=h[c+Is.PREV_VALUE];const d=h[c],u=this.getCurvePercent(c/Is.ENTRIES-1,1-(e-d)/(h[c+Is.PREV_TIME]-d));l+=(h[c+Is.VALUE]-l)*u}n==S.setup?a.position=a.data.position+(l-a.data.position)*i:a.position+=(l-a.position)*i}};let Yr=Is;Yr.ENTRIES=2,Yr.PREV_TIME=-2,Yr.PREV_VALUE=-1,Yr.VALUE=1;let _C=class cr extends Yr{constructor(t){super(t)}getPropertyId(){return(12<<24)+this.pathConstraintIndex}apply(t,e,s,i,n,o,h){const a=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(s<a[0]){switch(o){case S.setup:l.spacing=l.data.spacing;return;case S.first:l.spacing+=(l.data.spacing-l.spacing)*n}return}let c=0;if(s>=a[a.length-cr.ENTRIES])c=a[a.length+cr.PREV_VALUE];else{const d=Ee.binarySearch(a,s,cr.ENTRIES);c=a[d+cr.PREV_VALUE];const u=a[d],f=this.getCurvePercent(d/cr.ENTRIES-1,1-(s-u)/(a[d+cr.PREV_TIME]-u));c+=(a[d+cr.VALUE]-c)*f}o==S.setup?l.spacing=l.data.spacing+(c-l.data.spacing)*n:l.spacing+=(c-l.spacing)*n}};const Oe=class extends is{constructor(r){super(r),this.frames=B.newFloatArray(r*Oe.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(r,t,e,s){r*=Oe.ENTRIES,this.frames[r]=t,this.frames[r+Oe.ROTATE]=e,this.frames[r+Oe.TRANSLATE]=s}apply(r,t,e,s,i,n,o){const h=this.frames,a=r.pathConstraints[this.pathConstraintIndex];if(e<h[0]){switch(n){case S.setup:a.rotateMix=a.data.rotateMix,a.translateMix=a.data.translateMix;return;case S.first:a.rotateMix+=(a.data.rotateMix-a.rotateMix)*i,a.translateMix+=(a.data.translateMix-a.translateMix)*i}return}let l=0,c=0;if(e>=h[h.length-Oe.ENTRIES])l=h[h.length+Oe.PREV_ROTATE],c=h[h.length+Oe.PREV_TRANSLATE];else{const d=Ee.binarySearch(h,e,Oe.ENTRIES);l=h[d+Oe.PREV_ROTATE],c=h[d+Oe.PREV_TRANSLATE];const u=h[d],f=this.getCurvePercent(d/Oe.ENTRIES-1,1-(e-u)/(h[d+Oe.PREV_TIME]-u));l+=(h[d+Oe.ROTATE]-l)*f,c+=(h[d+Oe.TRANSLATE]-c)*f}n==S.setup?(a.rotateMix=a.data.rotateMix+(l-a.data.rotateMix)*i,a.translateMix=a.data.translateMix+(c-a.data.translateMix)*i):(a.rotateMix+=(l-a.rotateMix)*i,a.translateMix+=(c-a.translateMix)*i)}};let sr=Oe;sr.ENTRIES=3,sr.PREV_TIME=-3,sr.PREV_ROTATE=-2,sr.PREV_TRANSLATE=-1,sr.ROTATE=1,sr.TRANSLATE=2,new Ee("<empty>",[],0);let xC=class{constructor(t){this.atlas=t}newRegionAttachment(t,e,s){const i=this.atlas.findRegion(s);if(i==null)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);const n=new nt(e);return n.region=i,n}newMeshAttachment(t,e,s){const i=this.atlas.findRegion(s);if(i==null)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);const n=new oC(e);return n.region=i,n}newBoundingBoxAttachment(t,e){return new nC(e)}newPathAttachment(t,e){return new hC(e)}newPointAttachment(t,e){return new lC(e)}newClippingAttachment(t,e){return new aC(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=yt.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}},vC=class{constructor(t,e){if(e==null)throw new Error("data cannot be null.");this.time=t,this.data=e}},bC=class{constructor(t){this.name=t}},wC=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}},EC=class{constructor(t){this.order=0,this.bones=new Array,this.name=t}};var ir=(r=>(r[r.Length=0]="Length",r[r.Fixed=1]="Fixed",r[r.Percent=2]="Percent",r))(ir||{});let TC=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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;s++)if(e[s].name==t)return s;return-1}},AC=class{constructor(t,e,s){if(this.color=new G(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}},SC=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}},CC=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 i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}getAttachment(t,e){const s=this.attachments[t];return s?s[e]:null}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){const n=t.slots[i],o=n.getAttachment();if(o&&s<e.attachments.length){const h=e.attachments[s];for(const a in h){const l=h[a];if(o==l){const c=this.getAttachment(s,a);c!=null&&n.setAttachment(c);break}}}s++}}},IC=class Vn{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new TC,i=typeof t=="string"?JSON.parse(t):t,n=i.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),i.bones)for(let o=0;o<i.bones.length;o++){const h=i.bones[o];let a=null;const l=this.getValue(h,"parent",null);if(l!=null&&(a=s.findBone(l),a==null))throw new Error(`Parent bone not found: ${l}`);const c=new yC(s.bones.length,h.name,a);c.length=this.getValue(h,"length",0)*e,c.x=this.getValue(h,"x",0)*e,c.y=this.getValue(h,"y",0)*e,c.rotation=this.getValue(h,"rotation",0),c.scaleX=this.getValue(h,"scaleX",1),c.scaleY=this.getValue(h,"scaleY",1),c.shearX=this.getValue(h,"shearX",0),c.shearY=this.getValue(h,"shearY",0),c.transformMode=Vn.transformModeFromString(this.getValue(h,"transform","normal")),s.bones.push(c)}if(i.slots)for(let o=0;o<i.slots.length;o++){const h=i.slots[o],a=h.name,l=h.bone,c=s.findBone(l);if(c==null)throw new Error(`Slot bone not found: ${l}`);const d=new AC(s.slots.length,a,c),u=this.getValue(h,"color",null);u!=null&&d.color.setFromString(u);const f=this.getValue(h,"dark",null);f!=null&&(d.darkColor=new G(1,1,1,1),d.darkColor.setFromString(f)),d.attachmentName=this.getValue(h,"attachment",null),d.blendMode=Vn.blendModeFromString(this.getValue(h,"blend","normal")),s.slots.push(d)}if(i.ik)for(let o=0;o<i.ik.length;o++){const h=i.ik[o],a=new wC(h.name);a.order=this.getValue(h,"order",0);for(let c=0;c<h.bones.length;c++){const d=h.bones[c],u=s.findBone(d);if(u==null)throw new Error(`IK bone not found: ${d}`);a.bones.push(u)}const l=h.target;if(a.target=s.findBone(l),a.target==null)throw new Error(`IK target bone not found: ${l}`);a.bendDirection=this.getValue(h,"bendPositive",!0)?1:-1,a.mix=this.getValue(h,"mix",1),s.ikConstraints.push(a)}if(i.transform)for(let o=0;o<i.transform.length;o++){const h=i.transform[o],a=new SC(h.name);a.order=this.getValue(h,"order",0);for(let c=0;c<h.bones.length;c++){const d=h.bones[c],u=s.findBone(d);if(u==null)throw new Error(`Transform constraint bone not found: ${d}`);a.bones.push(u)}const l=h.target;if(a.target=s.findBone(l),a.target==null)throw new Error(`Transform constraint target bone not found: ${l}`);a.local=this.getValue(h,"local",!1),a.relative=this.getValue(h,"relative",!1),a.offsetRotation=this.getValue(h,"rotation",0),a.offsetX=this.getValue(h,"x",0)*e,a.offsetY=this.getValue(h,"y",0)*e,a.offsetScaleX=this.getValue(h,"scaleX",0),a.offsetScaleY=this.getValue(h,"scaleY",0),a.offsetShearY=this.getValue(h,"shearY",0),a.rotateMix=this.getValue(h,"rotateMix",1),a.translateMix=this.getValue(h,"translateMix",1),a.scaleMix=this.getValue(h,"scaleMix",1),a.shearMix=this.getValue(h,"shearMix",1),s.transformConstraints.push(a)}if(i.path)for(let o=0;o<i.path.length;o++){const h=i.path[o],a=new EC(h.name);a.order=this.getValue(h,"order",0);for(let c=0;c<h.bones.length;c++){const d=h.bones[c],u=s.findBone(d);if(u==null)throw new Error(`Transform constraint bone not found: ${d}`);a.bones.push(u)}const l=h.target;if(a.target=s.findSlot(l),a.target==null)throw new Error(`Path target slot not found: ${l}`);a.positionMode=Vn.positionModeFromString(this.getValue(h,"positionMode","percent")),a.spacingMode=Vn.spacingModeFromString(this.getValue(h,"spacingMode","length")),a.rotateMode=Vn.rotateModeFromString(this.getValue(h,"rotateMode","tangent")),a.offsetRotation=this.getValue(h,"rotation",0),a.position=this.getValue(h,"position",0),a.positionMode==ne.Fixed&&(a.position*=e),a.spacing=this.getValue(h,"spacing",0),(a.spacingMode==ir.Length||a.spacingMode==ir.Fixed)&&(a.spacing*=e),a.rotateMix=this.getValue(h,"rotateMix",1),a.translateMix=this.getValue(h,"translateMix",1),s.pathConstraints.push(a)}if(i.skins)for(const o in i.skins){const h=i.skins[o],a=new CC(o);for(const l in h){const c=s.findSlotIndex(l);if(c==-1)throw new Error(`Slot not found: ${l}`);const d=h[l];for(const u in d){const f=this.readAttachment(d[u],a,c,u,s);f!=null&&a.addAttachment(c,u,f)}}s.skins.push(a),a.name=="default"&&(s.defaultSkin=a)}for(let o=0,h=this.linkedMeshes.length;o<h;o++){const a=this.linkedMeshes[o],l=a.skin==null?s.defaultSkin:s.findSkin(a.skin);if(l==null)throw new Error(`Skin not found: ${a.skin}`);const c=l.getAttachment(a.slotIndex,a.parent);if(c==null)throw new Error(`Parent mesh not found: ${a.parent}`);a.mesh.setParentMesh(c)}if(this.linkedMeshes.length=0,i.events)for(const o in i.events){const h=i.events[o],a=new bC(o);a.intValue=this.getValue(h,"int",0),a.floatValue=this.getValue(h,"float",0),a.stringValue=this.getValue(h,"string",""),a.audioPath=this.getValue(h,"audio",null),a.audioPath!=null&&(a.volume=this.getValue(h,"volume",1),a.balance=this.getValue(h,"balance",0)),s.events.push(a)}if(i.animations)for(const o in i.animations){const h=i.animations[o];this.readAnimation(h,o,s)}return s}readAttachment(t,e,s,i,n){const o=this.scale;switch(i=this.getValue(t,"name",i),this.getValue(t,"type","region")){case"region":{const a=this.getValue(t,"path",i),l=this.attachmentLoader.newRegionAttachment(e,i,a);if(l==null)return null;l.path=a,l.x=this.getValue(t,"x",0)*o,l.y=this.getValue(t,"y",0)*o,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*o,l.height=t.height*o;const c=this.getValue(t,"color",null);return c!=null&&l.color.setFromString(c),l}case"boundingbox":{const a=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(a==null)return null;this.readVertices(t,a,t.vertexCount<<1);const l=this.getValue(t,"color",null);return l!=null&&a.color.setFromString(l),a}case"mesh":case"linkedmesh":{const a=this.getValue(t,"path",i),l=this.attachmentLoader.newMeshAttachment(e,i,a);if(l==null)return null;l.path=a;const c=this.getValue(t,"color",null);c!=null&&l.color.setFromString(c);const d=this.getValue(t,"parent",null);if(d!=null)return l.inheritDeform=this.getValue(t,"deform",!0),this.linkedMeshes.push(new PC(l,this.getValue(t,"skin",null),s,d)),l;const u=t.uvs;return this.readVertices(t,l,u.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(u),l.hullLength=this.getValue(t,"hull",0)*2,l}case"path":{const a=this.attachmentLoader.newPathAttachment(e,i);if(a==null)return null;a.closed=this.getValue(t,"closed",!1),a.constantSpeed=this.getValue(t,"constantSpeed",!0);const l=t.vertexCount;this.readVertices(t,a,l<<1);const c=B.newArray(l/3,0);for(let u=0;u<t.lengths.length;u++)c[u]=t.lengths[u]*o;a.lengths=c;const d=this.getValue(t,"color",null);return d!=null&&a.color.setFromString(d),a}case"point":{const a=this.attachmentLoader.newPointAttachment(e,i);if(a==null)return null;a.x=this.getValue(t,"x",0)*o,a.y=this.getValue(t,"y",0)*o,a.rotation=this.getValue(t,"rotation",0);const l=this.getValue(t,"color",null);return l!=null&&a.color.setFromString(l),a}case"clipping":{const a=this.attachmentLoader.newClippingAttachment(e,i);if(a==null)return null;const l=this.getValue(t,"end",null);if(l!=null){const u=n.findSlot(l);if(u==null)throw new Error(`Clipping end slot not found: ${l}`);a.endSlot=u}const c=t.vertexCount;this.readVertices(t,a,c<<1);const d=this.getValue(t,"color",null);return d!=null&&a.color.setFromString(d),a}}return null}readVertices(t,e,s){const i=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const a=B.toFloatArray(n);if(i!=1)for(let l=0,c=n.length;l<c;l++)a[l]*=i;e.vertices=a;return}const o=new Array,h=new Array;for(let a=0,l=n.length;a<l;){const c=n[a++];h.push(c);for(let d=a+c*4;a<d;a+=4)h.push(n[a]),o.push(n[a+1]*i),o.push(n[a+2]*i),o.push(n[a+3])}e.bones=h,e.vertices=B.toFloatArray(o)}readAnimation(t,e,s){const i=this.scale,n=new Array;let o=0;if(t.slots)for(const a in t.slots){const l=t.slots[a],c=s.findSlotIndex(a);if(c==-1)throw new Error(`Slot not found: ${a}`);for(const d in l){const u=l[d];if(d=="attachment"){const f=new fC(u.length);f.slotIndex=c;let p=0;for(let m=0;m<u.length;m++){const g=u[m];f.setFrame(p++,g.time,g.name)}n.push(f),o=Math.max(o,f.frames[f.getFrameCount()-1])}else if(d=="color"){const f=new ms(u.length);f.slotIndex=c;let p=0;for(let m=0;m<u.length;m++){const g=u[m],y=new G;y.setFromString(g.color||"ffffffff"),f.setFrame(p,g.time,y.r,y.g,y.b,y.a),this.readCurve(g,f,p),p++}n.push(f),o=Math.max(o,f.frames[(f.getFrameCount()-1)*ms.ENTRIES])}else if(d=="twoColor"){const f=new xe(u.length);f.slotIndex=c;let p=0;for(let m=0;m<u.length;m++){const g=u[m],y=new G,x=new G;y.setFromString(g.light),x.setFromString(g.dark),f.setFrame(p,g.time,y.r,y.g,y.b,y.a,x.r,x.g,x.b),this.readCurve(g,f,p),p++}n.push(f),o=Math.max(o,f.frames[(f.getFrameCount()-1)*xe.ENTRIES])}else throw new Error(`Invalid timeline type for a slot: ${d} (${a})`)}}if(t.bones)for(const a in t.bones){const l=t.bones[a],c=s.findBoneIndex(a);if(c==-1)throw new Error(`Bone not found: ${a}`);for(const d in l){const u=l[d];if(d==="rotate"){const f=new Rn(u.length);f.boneIndex=c;let p=0;for(let m=0;m<u.length;m++){const g=u[m];f.setFrame(p,g.time,g.angle),this.readCurve(g,f,p),p++}n.push(f),o=Math.max(o,f.frames[(f.getFrameCount()-1)*Rn.ENTRIES])}else if(d==="translate"||d==="scale"||d==="shear"){let f=null,p=1;d==="scale"?f=new uC(u.length):d==="shear"?f=new dC(u.length):(f=new ai(u.length),p=i),f.boneIndex=c;let m=0;for(let g=0;g<u.length;g++){const y=u[g],x=this.getValue(y,"x",0),_=this.getValue(y,"y",0);f.setFrame(m,y.time,x*p,_*p),this.readCurve(y,f,m),m++}n.push(f),o=Math.max(o,f.frames[(f.getFrameCount()-1)*ai.ENTRIES])}else throw new Error(`Invalid timeline type for a bone: ${d} (${a})`)}}if(t.ik)for(const a in t.ik){const l=t.ik[a],c=s.findIkConstraint(a),d=new gs(l.length);d.ikConstraintIndex=s.ikConstraints.indexOf(c);let u=0;for(let f=0;f<l.length;f++){const p=l[f];d.setFrame(u,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,d,u),u++}n.push(d),o=Math.max(o,d.frames[(d.getFrameCount()-1)*gs.ENTRIES])}if(t.transform)for(const a in t.transform){const l=t.transform[a],c=s.findTransformConstraint(a),d=new _s(l.length);d.transformConstraintIndex=s.transformConstraints.indexOf(c);let u=0;for(let f=0;f<l.length;f++){const p=l[f];d.setFrame(u,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,d,u),u++}n.push(d),o=Math.max(o,d.frames[(d.getFrameCount()-1)*_s.ENTRIES])}if(t.paths)for(const a in t.paths){const l=t.paths[a],c=s.findPathConstraintIndex(a);if(c==-1)throw new Error(`Path constraint not found: ${a}`);const d=s.pathConstraints[c];for(const u in l){const f=l[u];if(u==="position"||u==="spacing"){let p=null,m=1;u==="spacing"?(p=new _C(f.length),(d.spacingMode==ir.Length||d.spacingMode==ir.Fixed)&&(m=i)):(p=new Yr(f.length),d.positionMode==ne.Fixed&&(m=i)),p.pathConstraintIndex=c;let g=0;for(let y=0;y<f.length;y++){const x=f[y];p.setFrame(g,x.time,this.getValue(x,u,0)*m),this.readCurve(x,p,g),g++}n.push(p),o=Math.max(o,p.frames[(p.getFrameCount()-1)*Yr.ENTRIES])}else if(u==="mix"){const p=new sr(f.length);p.pathConstraintIndex=c;let m=0;for(let g=0;g<f.length;g++){const y=f[g];p.setFrame(m,y.time,this.getValue(y,"rotateMix",1),this.getValue(y,"translateMix",1)),this.readCurve(y,p,m),m++}n.push(p),o=Math.max(o,p.frames[(p.getFrameCount()-1)*sr.ENTRIES])}}}if(t.deform)for(const a in t.deform){const l=t.deform[a],c=s.findSkin(a);if(c!=null)for(const d in l){const u=l[d],f=s.findSlotIndex(d);if(f==-1)throw new Error(`Slot not found: ${u.name}`);for(const p in u){const m=u[p],g=c.getAttachment(f,p);if(g==null)throw new Error(`Deform attachment not found: ${m.name}`);const y=g.bones!=null,x=g.vertices,_=y?x.length/3*2:x.length,v=new pC(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=y?B.newFloatArray(_):x;else{T=B.newFloatArray(_);const I=this.getValue(E,"offset",0);if(B.arrayCopy(A,0,T,I,A.length),i!=1)for(let M=I,R=M+A.length;M<R;M++)T[M]*=i;if(!y)for(let M=0;M<_;M++)T[M]+=x[M]}v.setFrame(b,E.time,T),this.readCurve(E,v,b),b++}n.push(v),o=Math.max(o,v.frames[v.getFrameCount()-1])}}}let h=t.drawOrder;if(h==null&&(h=t.draworder),h!=null){const a=new gC(h.length),l=s.slots.length;let c=0;for(let d=0;d<h.length;d++){const u=h[d];let f=null;const p=this.getValue(u,"offsets",null);if(p!=null){f=B.newArray(l,-1);const m=B.newArray(l-p.length,0);let g=0,y=0;for(let x=0;x<p.length;x++){const _=p[x],v=s.findSlotIndex(_.slot);if(v==-1)throw new Error(`Slot not found: ${_.slot}`);for(;g!=v;)m[y++]=g++;f[g+_.offset]=g++}for(;g<l;)m[y++]=g++;for(let x=l-1;x>=0;x--)f[x]==-1&&(f[x]=m[--y])}a.setFrame(c++,u.time,f)}n.push(a),o=Math.max(o,a.frames[a.getFrameCount()-1])}if(t.events){const a=new mC(t.events.length);let l=0;for(let c=0;c<t.events.length;c++){const d=t.events[c],u=s.findEvent(d.name);if(u==null)throw new Error(`Event not found: ${d.name}`);const f=new vC(B.toSinglePrecision(d.time),u);f.intValue=this.getValue(d,"int",u.intValue),f.floatValue=this.getValue(d,"float",u.floatValue),f.stringValue=this.getValue(d,"string",u.stringValue),f.data.audioPath!=null&&(f.volume=this.getValue(d,"volume",1),f.balance=this.getValue(d,"balance",0)),a.setFrame(l++,f)}n.push(a),o=Math.max(o,a.frames[a.getFrameCount()-1])}if(isNaN(o))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new Ee(e,n,o))}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 i=t.curve;e.setCurve(s,i[0],i[1],i[2],i[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 ir.Length;if(t=="fixed")return ir.Fixed;if(t=="percent")return ir.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 yt.Normal;if(t=="onlytranslation")return yt.OnlyTranslation;if(t=="norotationorreflection")return yt.NoRotationOrReflection;if(t=="noscale")return yt.NoScale;if(t=="noscaleorreflection")return yt.NoScaleOrReflection;throw new Error(`Unknown transform mode: ${t}`)}},PC=class{constructor(t,e,s,i){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i}};class q0{constructor(t){if(!t)throw new Error("name cannot be null.");this.name=t}}const K0=class extends q0{constructor(r){super(r),this.id=K0.nextID++,this.bones=null,this.vertices=[],this.worldVerticesLength=0,this.timelineAttachment=this}computeWorldVerticesOld(r,t){this.computeWorldVertices(r,0,this.worldVerticesLength,t,0,2)}computeWorldVertices(r,t,e,s,i,n){e=i+(e>>1)*n;const o=r.bone.skeleton,h=r.deform;let a=this.vertices;const l=this.bones;if(!l){h.length>0&&(a=h);const f=r.bone.matrix,p=f.tx,m=f.ty,g=f.a,y=f.c,x=f.b,_=f.d;for(let v=t,b=i;b<e;v+=2,b+=n){const w=a[v],E=a[v+1];s[b]=w*g+E*y+p,s[b+1]=w*x+E*_+m}return}let c=0,d=0;for(let f=0;f<t;f+=2){const p=l[c];c+=p+1,d+=p}const u=o.bones;if(h.length==0)for(let f=i,p=d*3;f<e;f+=n){let m=0,g=0,y=l[c++];for(y+=c;c<y;c++,p+=3){const x=u[l[c]].matrix,_=a[p],v=a[p+1],b=a[p+2];m+=(_*x.a+v*x.c+x.tx)*b,g+=(_*x.b+v*x.d+x.ty)*b}s[f]=m,s[f+1]=g}else{const f=h;for(let p=i,m=d*3,g=d<<1;p<e;p+=n){let y=0,x=0,_=l[c++];for(_+=c;c<_;c++,m+=3,g+=2){const v=u[l[c]].matrix,b=a[m]+f[g],w=a[m+1]+f[g+1],E=a[m+2];y+=(b*v.a+w*v.c+v.tx)*E,x+=(b*v.b+w*v.d+v.ty)*E}s[p]=y,s[p+1]=x}}}copyTo(r){this.bones?(r.bones=new Array(this.bones.length),B.arrayCopy(this.bones,0,r.bones,0,this.bones.length)):r.bones=null,this.vertices&&(r.vertices=B.newFloatArray(this.vertices.length),B.arrayCopy(this.vertices,0,r.vertices,0,this.vertices.length)),r.worldVerticesLength=this.worldVerticesLength,r.timelineAttachment=this.timelineAttachment}};let rr=K0;rr.nextID=0;class Wu extends rr{constructor(t){super(t),this.type=ot.BoundingBox,this.color=new G(1,1,1,1)}copy(){const t=new Wu(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class zu extends rr{constructor(t){super(t),this.type=ot.Clipping,this.endSlot=null,this.color=new G(.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 Ra extends rr{constructor(t,e){super(t),this.type=ot.Mesh,this.region=null,this.triangles=[],this.color=new G(1,1,1,1),this.width=0,this.height=0,this.hullLength=0,this.edges=[],this.parentMesh=null,this.sequence=null,this.tempColor=new G(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 Ra(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,i,n,o){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,e,s,i,n,o)}newLinkedMesh(){const t=new Ra(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 rr{constructor(t){super(t),this.type=ot.Path,this.lengths=[],this.closed=!1,this.constantSpeed=!1,this.color=new G(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 rr{constructor(t){super(t),this.type=ot.Point,this.x=0,this.y=0,this.rotation=0,this.color=new G(.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),i=D.sinDeg(this.rotation),n=s*e.a+i*e.c,o=s*e.b+i*e.d;return Math.atan2(o,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 Z0=class extends q0{constructor(r,t){super(r),this.type=ot.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 G(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 G(1,1,1,1),this.path=t}updateRegion(){if(!this.region)throw new Error("Region not set.");const r=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,i=-this.height/2*this.scaleY+this.region.offsetY*e,n=s+this.region.width*t,o=i+this.region.height*e,h=this.rotation*Math.PI/180,a=Math.cos(h),l=Math.sin(h),c=this.x,d=this.y,u=s*a+c,f=s*l,p=i*a+d,m=i*l,g=n*a+c,y=n*l,x=o*a+d,_=o*l,v=this.offset;v[0]=u-m,v[1]=p+f,v[2]=u-_,v[3]=x+f,v[4]=g-_,v[5]=x+y,v[6]=g-m,v[7]=p+y;const b=this.uvs;r.degrees==90?(b[2]=r.u,b[3]=r.v2,b[4]=r.u,b[5]=r.v,b[6]=r.u2,b[7]=r.v,b[0]=r.u2,b[1]=r.v2):(b[0]=r.u,b[1]=r.v2,b[2]=r.u,b[3]=r.v,b[4]=r.u2,b[5]=r.v,b[6]=r.u2,b[7]=r.v2)}computeWorldVertices(r,t,e,s){this.sequence!=null&&this.sequence.apply(r,this);const i=r.bone,n=this.offset,o=i.matrix,h=o.tx,a=o.ty,l=o.a,c=o.c,d=o.b,u=o.d;let f=0,p=0;f=n[0],p=n[1],t[e]=f*l+p*c+h,t[e+1]=f*d+p*u+a,e+=s,f=n[2],p=n[3],t[e]=f*l+p*c+h,t[e+1]=f*d+p*u+a,e+=s,f=n[4],p=n[5],t[e]=f*l+p*c+h,t[e+1]=f*d+p*u+a,e+=s,f=n[6],p=n[7],t[e]=f*l+p*c+h,t[e+1]=f*d+p*u+a}copy(){const r=new Z0(this.name,this.path);return r.region=this.region,r.rendererObject=this.rendererObject,r.x=this.x,r.y=this.y,r.scaleX=this.scaleX,r.scaleY=this.scaleY,r.rotation=this.rotation,r.width=this.width,r.height=this.height,B.arrayCopy(this.uvs,0,r.uvs,0,8),B.arrayCopy(this.offset,0,r.offset,0,8),r.color.setFromColor(this.color),r.sequence=this.sequence!=null?this.sequence.copy():null,r}};let gt=Z0;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 xh=class{constructor(r){this.id=xh.nextID(),this.start=0,this.digits=0,this.setupIndex=0,this.regions=new Array(r)}copy(){const r=new xh(this.regions.length);return B.arrayCopy(this.regions,0,r.regions,0,this.regions.length),r.start=this.start,r.digits=this.digits,r.setupIndex=this.setupIndex,r}apply(r,t){let e=r.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(r,t){let e=r;const s=(this.start+t).toString();for(let i=this.digits-s.length;i>0;i--)e+="0";return e+=s,e}static nextID(){return xh._nextID++}};let Ku=xh;Ku._nextID=0;var Ii=(r=>(r[r.hold=0]="hold",r[r.once=1]="once",r[r.loop=2]="loop",r[r.pingpong=3]="pingpong",r[r.onceReverse=4]="onceReverse",r[r.loopReverse=5]="loopReverse",r[r.pingpongReverse=6]="pingpongReverse",r))(Ii||{});const Q0=[0,1,2,3,4,5,6];class Zu{constructor(t,e,s){if(this.timelines=[],this.timelineIds=new NS,!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,i,n,o,h,a){if(!t)throw new Error("skeleton cannot be null.");i&&this.duration!=0&&(s%=this.duration,e>0&&(e%=this.duration));const l=this.timelines;for(let c=0,d=l.length;c<d;c++)l[c].apply(t,e,s,n,o,h,a)}}const xt={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 le{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 i=1;i<s;i++)if(t[i]>e)return i-1;return s-1}static search(t,e,s){const i=t.length;for(let n=s;n<i;n+=s)if(t[n]>e)return n-s;return i-s}}class oi extends le{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,i,n,o,h,a,l,c,d){const u=this.curves;let f=this.getFrameCount()+t*18;s==0&&(u[e]=2+f);const p=(i-o*2+a)*.03,m=(n-h*2+l)*.03,g=((o-a)*3-i+c)*.006,y=((h-l)*3-n+d)*.006;let x=p*2+g,_=m*2+y,v=(o-i)*.3+p+g*.16666667,b=(h-n)*.3+m+y*.16666667,w=i+v,E=n+b;for(let T=f+18;f<T;f+=2)u[f]=w,u[f+1]=E,v+=x,b+=_,x+=g,_+=y,w+=v,E+=b}getBezierValue(t,e,s,i){const n=this.curves;if(n[i]>t){const l=this.frames[e],c=this.frames[e+s];return c+(t-l)/(n[i]-l)*(n[i+1]-c)}const o=i+18;for(i+=2;i<o;i+=2)if(n[i]>=t){const l=n[i-2],c=n[i-1];return c+(t-l)/(n[i]-l)*(n[i+1]-c)}e+=this.getFrameEntries();const h=n[o-2],a=n[o-1];return a+(t-h)/(this.frames[e]-h)*(this.frames[e+s]-a)}}class hi extends oi{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 i=this.curves[s>>1];switch(i){case 0:const n=e[s],o=e[s+1];return o+(t-n)/(e[s+2]-n)*(e[s+2+1]-o);case 1:return e[s+1]}return this.getBezierValue(t,s,1,i-2)}}class Qu extends oi{constructor(t,e,s,i){super(t,e,[s,i])}getFrameEntries(){return 3}setFrame(t,e,s,i){t*=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i}}class J0 extends hi{constructor(t,e,s){super(t,e,`${xt.rotate}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,o,h){const a=t.bones[this.boneIndex];if(!a.active)return;const l=this.frames;if(s<l[0]){switch(o){case S.setup:a.rotation=a.data.rotation;return;case S.first:a.rotation+=(a.data.rotation-a.rotation)*n}return}let c=this.getCurveValue(s);switch(o){case S.setup:a.rotation=a.data.rotation+c*n;break;case S.first:case S.replace:c+=a.data.rotation-a.rotation;case S.add:a.rotation+=c*n}}}class t_ extends Qu{constructor(t,e,s){super(t,e,`${xt.x}|${s}`,`${xt.y}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,o,h){const a=t.bones[this.boneIndex];if(!a.active)return;const l=this.frames;if(s<l[0]){switch(o){case S.setup:a.x=a.data.x,a.y=a.data.y;return;case S.first:a.x+=(a.data.x-a.x)*n,a.y+=(a.data.y-a.y)*n}return}let c=0,d=0;const u=le.search(l,s,3),f=this.curves[u/3];switch(f){case 0:const p=l[u];c=l[u+1],d=l[u+2];const m=(s-p)/(l[u+3]-p);c+=(l[u+3+1]-c)*m,d+=(l[u+3+2]-d)*m;break;case 1:c=l[u+1],d=l[u+2];break;default:c=this.getBezierValue(s,u,1,f-2),d=this.getBezierValue(s,u,2,f+18-2)}switch(o){case S.setup:a.x=a.data.x+c*n,a.y=a.data.y+d*n;break;case S.first:case S.replace:a.x+=(a.data.x+c-a.x)*n,a.y+=(a.data.y+d-a.y)*n;break;case S.add:a.x+=c*n,a.y+=d*n}}}class e_ extends hi{constructor(t,e,s){super(t,e,`${xt.x}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,o,h){const a=t.bones[this.boneIndex];if(!a.active)return;const l=this.frames;if(s<l[0]){switch(o){case S.setup:a.x=a.data.x;return;case S.first:a.x+=(a.data.x-a.x)*n}return}const c=this.getCurveValue(s);switch(o){case S.setup:a.x=a.data.x+c*n;break;case S.first:case S.replace:a.x+=(a.data.x+c-a.x)*n;break;case S.add:a.x+=c*n}}}class s_ extends hi{constructor(t,e,s){super(t,e,`${xt.y}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,o,h){const a=t.bones[this.boneIndex];if(!a.active)return;const l=this.frames;if(s<l[0]){switch(o){case S.setup:a.y=a.data.y;return;case S.first:a.y+=(a.data.y-a.y)*n}return}const c=this.getCurveValue(s);switch(o){case S.setup:a.y=a.data.y+c*n;break;case S.first:case S.replace:a.y+=(a.data.y+c-a.y)*n;break;case S.add:a.y+=c*n}}}class i_ extends Qu{constructor(t,e,s){super(t,e,`${xt.scaleX}|${s}`,`${xt.scaleY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,o,h){const a=t.bones[this.boneIndex];if(!a.active)return;const l=this.frames;if(s<l[0]){switch(o){case S.setup:a.scaleX=a.data.scaleX,a.scaleY=a.data.scaleY;return;case S.first:a.scaleX+=(a.data.scaleX-a.scaleX)*n,a.scaleY+=(a.data.scaleY-a.scaleY)*n}return}let c,d;const u=le.search(l,s,3),f=this.curves[u/3];switch(f){case 0:const p=l[u];c=l[u+1],d=l[u+2];const m=(s-p)/(l[u+3]-p);c+=(l[u+3+1]-c)*m,d+=(l[u+3+2]-d)*m;break;case 1:c=l[u+1],d=l[u+2];break;default:c=this.getBezierValue(s,u,1,f-2),d=this.getBezierValue(s,u,2,f+18-2)}if(c*=a.data.scaleX,d*=a.data.scaleY,n==1)o==S.add?(a.scaleX+=c-a.data.scaleX,a.scaleY+=d-a.data.scaleY):(a.scaleX=c,a.scaleY=d);else{let p=0,m=0;if(h==At.mixOut)switch(o){case S.setup:p=a.data.scaleX,m=a.data.scaleY,a.scaleX=p+(Math.abs(c)*D.signum(p)-p)*n,a.scaleY=m+(Math.abs(d)*D.signum(m)-m)*n;break;case S.first:case S.replace:p=a.scaleX,m=a.scaleY,a.scaleX=p+(Math.abs(c)*D.signum(p)-p)*n,a.scaleY=m+(Math.abs(d)*D.signum(m)-m)*n;break;case S.add:a.scaleX+=(c-a.data.scaleX)*n,a.scaleY+=(d-a.data.scaleY)*n}else switch(o){case S.setup:p=Math.abs(a.data.scaleX)*D.signum(c),m=Math.abs(a.data.scaleY)*D.signum(d),a.scaleX=p+(c-p)*n,a.scaleY=m+(d-m)*n;break;case S.first:case S.replace:p=Math.abs(a.scaleX)*D.signum(c),m=Math.abs(a.scaleY)*D.signum(d),a.scaleX=p+(c-p)*n,a.scaleY=m+(d-m)*n;break;case S.add:a.scaleX+=(c-a.data.scaleX)*n,a.scaleY+=(d-a.data.scaleY)*n}}}}class r_ extends hi{constructor(t,e,s){super(t,e,`${xt.scaleX}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,o,h){const a=t.bones[this.boneIndex];if(!a.active)return;const l=this.frames;if(s<l[0]){switch(o){case S.setup:a.scaleX=a.data.scaleX;return;case S.first:a.scaleX+=(a.data.scaleX-a.scaleX)*n}return}const c=this.getCurveValue(s)*a.data.scaleX;if(n==1)o==S.add?a.scaleX+=c-a.data.scaleX:a.scaleX=c;else{let d=0;if(h==At.mixOut)switch(o){case S.setup:d=a.data.scaleX,a.scaleX=d+(Math.abs(c)*D.signum(d)-d)*n;break;case S.first:case S.replace:d=a.scaleX,a.scaleX=d+(Math.abs(c)*D.signum(d)-d)*n;break;case S.add:a.scaleX+=(c-a.data.scaleX)*n}else switch(o){case S.setup:d=Math.abs(a.data.scaleX)*D.signum(c),a.scaleX=d+(c-d)*n;break;case S.first:case S.replace:d=Math.abs(a.scaleX)*D.signum(c),a.scaleX=d+(c-d)*n;break;case S.add:a.scaleX+=(c-a.data.scaleX)*n}}}}class n_ extends hi{constructor(t,e,s){super(t,e,`${xt.scaleY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,o,h){const a=t.bones[this.boneIndex];if(!a.active)return;const l=this.frames;if(s<l[0]){switch(o){case S.setup:a.scaleY=a.data.scaleY;return;case S.first:a.scaleY+=(a.data.scaleY-a.scaleY)*n}return}const c=this.getCurveValue(s)*a.data.scaleY;if(n==1)o==S.add?a.scaleY+=c-a.data.scaleY:a.scaleY=c;else{let d=0;if(h==At.mixOut)switch(o){case S.setup:d=a.data.scaleY,a.scaleY=d+(Math.abs(c)*D.signum(d)-d)*n;break;case S.first:case S.replace:d=a.scaleY,a.scaleY=d+(Math.abs(c)*D.signum(d)-d)*n;break;case S.add:a.scaleY+=(c-a.data.scaleY)*n}else switch(o){case S.setup:d=Math.abs(a.data.scaleY)*D.signum(c),a.scaleY=d+(c-d)*n;break;case S.first:case S.replace:d=Math.abs(a.scaleY)*D.signum(c),a.scaleY=d+(c-d)*n;break;case S.add:a.scaleY+=(c-a.data.scaleY)*n}}}}class a_ extends Qu{constructor(t,e,s){super(t,e,`${xt.shearX}|${s}`,`${xt.shearY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,o,h){const a=t.bones[this.boneIndex];if(!a.active)return;const l=this.frames;if(s<l[0]){switch(o){case S.setup:a.shearX=a.data.shearX,a.shearY=a.data.shearY;return;case S.first:a.shearX+=(a.data.shearX-a.shearX)*n,a.shearY+=(a.data.shearY-a.shearY)*n}return}let c=0,d=0;const u=le.search(l,s,3),f=this.curves[u/3];switch(f){case 0:const p=l[u];c=l[u+1],d=l[u+2];const m=(s-p)/(l[u+3]-p);c+=(l[u+3+1]-c)*m,d+=(l[u+3+2]-d)*m;break;case 1:c=l[u+1],d=l[u+2];break;default:c=this.getBezierValue(s,u,1,f-2),d=this.getBezierValue(s,u,2,f+18-2)}switch(o){case S.setup:a.shearX=a.data.shearX+c*n,a.shearY=a.data.shearY+d*n;break;case S.first:case S.replace:a.shearX+=(a.data.shearX+c-a.shearX)*n,a.shearY+=(a.data.shearY+d-a.shearY)*n;break;case S.add:a.shearX+=c*n,a.shearY+=d*n}}}class o_ extends hi{constructor(t,e,s){super(t,e,`${xt.shearX}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,o,h){const a=t.bones[this.boneIndex];if(!a.active)return;const l=this.frames;if(s<l[0]){switch(o){case S.setup:a.shearX=a.data.shearX;return;case S.first:a.shearX+=(a.data.shearX-a.shearX)*n}return}const c=this.getCurveValue(s);switch(o){case S.setup:a.shearX=a.data.shearX+c*n;break;case S.first:case S.replace:a.shearX+=(a.data.shearX+c-a.shearX)*n;break;case S.add:a.shearX+=c*n}}}class h_ extends hi{constructor(t,e,s){super(t,e,`${xt.shearY}|${s}`),this.boneIndex=0,this.boneIndex=s}apply(t,e,s,i,n,o,h){const a=t.bones[this.boneIndex];if(!a.active)return;const l=this.frames;if(s<l[0]){switch(o){case S.setup:a.shearY=a.data.shearY;return;case S.first:a.shearY+=(a.data.shearY-a.shearY)*n}return}const c=this.getCurveValue(s);switch(o){case S.setup:a.shearY=a.data.shearY+c*n;break;case S.first:case S.replace:a.shearY+=(a.data.shearY+c-a.shearY)*n;break;case S.add:a.shearY+=c*n}}}class l_ extends oi{constructor(t,e,s){super(t,e,[`${xt.rgb}|${s}`,`${xt.alpha}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,e,s,i,n,o){t*=5,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=o}apply(t,e,s,i,n,o,h){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const l=this.frames,c=a.color;if(s<l[0]){const y=a.data.color;switch(o){case S.setup:c.setFromColor(y);return;case S.first:c.add((y.r-c.r)*n,(y.g-c.g)*n,(y.b-c.b)*n,(y.a-c.a)*n)}return}let d=0,u=0,f=0,p=0;const m=le.search(l,s,5),g=this.curves[m/5];switch(g){case 0:const y=l[m];d=l[m+1],u=l[m+2],f=l[m+3],p=l[m+4];const x=(s-y)/(l[m+5]-y);d+=(l[m+5+1]-d)*x,u+=(l[m+5+2]-u)*x,f+=(l[m+5+3]-f)*x,p+=(l[m+5+4]-p)*x;break;case 1:d=l[m+1],u=l[m+2],f=l[m+3],p=l[m+4];break;default:d=this.getBezierValue(s,m,1,g-2),u=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?c.set(d,u,f,p):(o==S.setup&&c.setFromColor(a.data.color),c.add((d-c.r)*n,(u-c.g)*n,(f-c.b)*n,(p-c.a)*n))}}class c_ extends oi{constructor(t,e,s){super(t,e,[`${xt.rgb}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){t<<=2,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n}apply(t,e,s,i,n,o,h){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const l=this.frames,c=a.color;if(s<l[0]){const g=a.data.color;switch(o){case S.setup:c.r=g.r,c.g=g.g,c.b=g.b;return;case S.first:c.r+=(g.r-c.r)*n,c.g+=(g.g-c.g)*n,c.b+=(g.b-c.b)*n}return}let d=0,u=0,f=0;const p=le.search(l,s,4),m=this.curves[p>>2];switch(m){case 0:const g=l[p];d=l[p+1],u=l[p+2],f=l[p+3];const y=(s-g)/(l[p+4]-g);d+=(l[p+4+1]-d)*y,u+=(l[p+4+2]-u)*y,f+=(l[p+4+3]-f)*y;break;case 1:d=l[p+1],u=l[p+2],f=l[p+3];break;default:d=this.getBezierValue(s,p,1,m-2),u=this.getBezierValue(s,p,2,m+18-2),f=this.getBezierValue(s,p,3,m+18*2-2)}if(n==1)c.r=d,c.g=u,c.b=f;else{if(o==S.setup){const g=a.data.color;c.r=g.r,c.g=g.g,c.b=g.b}c.r+=(d-c.r)*n,c.g+=(u-c.g)*n,c.b+=(f-c.b)*n}}}class u_ extends hi{constructor(t,e,s){super(t,e,`${xt.alpha}|${s}`),this.slotIndex=0,this.slotIndex=s}apply(t,e,s,i,n,o,h){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const l=a.color;if(s<this.frames[0]){const d=a.data.color;switch(o){case S.setup:l.a=d.a;return;case S.first:l.a+=(d.a-l.a)*n}return}const c=this.getCurveValue(s);n==1?l.a=c:(o==S.setup&&(l.a=a.data.color.a),l.a+=(c-l.a)*n)}}class d_ extends oi{constructor(t,e,s){super(t,e,[`${xt.rgb}|${s}`,`${xt.alpha}|${s}`,`${xt.rgb2}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,e,s,i,n,o,h,a,l){t<<=3,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=o,this.frames[t+5]=h,this.frames[t+6]=a,this.frames[t+7]=l}apply(t,e,s,i,n,o,h){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const l=this.frames,c=a.color,d=a.darkColor;if(s<l[0]){const b=a.data.color,w=a.data.darkColor;switch(o){case S.setup:c.setFromColor(b),d.r=w.r,d.g=w.g,d.b=w.b;return;case S.first:c.add((b.r-c.r)*n,(b.g-c.g)*n,(b.b-c.b)*n,(b.a-c.a)*n),d.r+=(w.r-d.r)*n,d.g+=(w.g-d.g)*n,d.b+=(w.b-d.b)*n}return}let u=0,f=0,p=0,m=0,g=0,y=0,x=0;const _=le.search(l,s,8),v=this.curves[_>>3];switch(v){case 0:const b=l[_];u=l[_+1],f=l[_+2],p=l[_+3],m=l[_+4],g=l[_+5],y=l[_+6],x=l[_+7];const w=(s-b)/(l[_+8]-b);u+=(l[_+8+1]-u)*w,f+=(l[_+8+2]-f)*w,p+=(l[_+8+3]-p)*w,m+=(l[_+8+4]-m)*w,g+=(l[_+8+5]-g)*w,y+=(l[_+8+6]-y)*w,x+=(l[_+8+7]-x)*w;break;case 1:u=l[_+1],f=l[_+2],p=l[_+3],m=l[_+4],g=l[_+5],y=l[_+6],x=l[_+7];break;default:u=this.getBezierValue(s,_,1,v-2),f=this.getBezierValue(s,_,2,v+18-2),p=this.getBezierValue(s,_,3,v+18*2-2),m=this.getBezierValue(s,_,4,v+18*3-2),g=this.getBezierValue(s,_,5,v+18*4-2),y=this.getBezierValue(s,_,6,v+18*5-2),x=this.getBezierValue(s,_,7,v+18*6-2)}if(n==1)c.set(u,f,p,m),d.r=g,d.g=y,d.b=x;else{if(o==S.setup){c.setFromColor(a.data.color);const b=a.data.darkColor;d.r=b.r,d.g=b.g,d.b=b.b}c.add((u-c.r)*n,(f-c.g)*n,(p-c.b)*n,(m-c.a)*n),d.r+=(g-d.r)*n,d.g+=(y-d.g)*n,d.b+=(x-d.b)*n}}}class f_ extends oi{constructor(t,e,s){super(t,e,[`${xt.rgb}|${s}`,`${xt.rgb2}|${s}`]),this.slotIndex=0,this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,o,h,a){t*=7,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=o,this.frames[t+5]=h,this.frames[t+6]=a}apply(t,e,s,i,n,o,h){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const l=this.frames,c=a.color,d=a.darkColor;if(s<l[0]){const v=a.data.color,b=a.data.darkColor;switch(o){case S.setup:c.r=v.r,c.g=v.g,c.b=v.b,d.r=b.r,d.g=b.g,d.b=b.b;return;case S.first:c.r+=(v.r-c.r)*n,c.g+=(v.g-c.g)*n,c.b+=(v.b-c.b)*n,d.r+=(b.r-d.r)*n,d.g+=(b.g-d.g)*n,d.b+=(b.b-d.b)*n}return}let u=0,f=0,p=0,m=0,g=0,y=0;const x=le.search(l,s,7),_=this.curves[x/7];switch(_){case 0:const v=l[x];u=l[x+1],f=l[x+2],p=l[x+3],m=l[x+4],g=l[x+5],y=l[x+6];const b=(s-v)/(l[x+7]-v);u+=(l[x+7+1]-u)*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,y+=(l[x+7+6]-y)*b;break;case 1:u=l[x+1],f=l[x+2],p=l[x+3],m=l[x+4],g=l[x+5],y=l[x+6];break;default:u=this.getBezierValue(s,x,1,_-2),f=this.getBezierValue(s,x,2,_+18-2),p=this.getBezierValue(s,x,3,_+18*2-2),m=this.getBezierValue(s,x,4,_+18*3-2),g=this.getBezierValue(s,x,5,_+18*4-2),y=this.getBezierValue(s,x,6,_+18*5-2)}if(n==1)c.r=u,c.g=f,c.b=p,d.r=m,d.g=g,d.b=y;else{if(o==S.setup){const v=a.data.color,b=a.data.darkColor;c.r=v.r,c.g=v.g,c.b=v.b,d.r=b.r,d.g=b.g,d.b=b.b}c.r+=(u-c.r)*n,c.g+=(f-c.g)*n,c.b+=(p-c.b)*n,d.r+=(m-d.r)*n,d.g+=(g-d.g)*n,d.b+=(y-d.b)*n}}}class p_ extends le{constructor(t,e){super(t,[`${xt.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,i,n,o,h){const a=t.slots[this.slotIndex];if(a.bone.active){if(h==At.mixOut){o==S.setup&&this.setAttachment(t,a,a.data.attachmentName);return}if(s<this.frames[0]){(o==S.setup||o==S.first)&&this.setAttachment(t,a,a.data.attachmentName);return}this.setAttachment(t,a,this.attachmentNames[le.search1(this.frames,s)])}}setAttachment(t,e,s){e.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class m_ extends oi{constructor(t,e,s,i){super(t,e,[`${xt.deform}|${s}|${i.id}`]),this.slotIndex=0,this.slotIndex=s,this.attachment=i,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,i,n,o,h,a,l,c,d){const u=this.curves;let f=this.getFrameCount()+t*18;s==0&&(u[e]=2+f);const p=(i-o*2+a)*.03,m=l*.03-h*.06,g=((o-a)*3-i+c)*.006,y=(h-l+.33333333)*.018;let x=p*2+g,_=m*2+y,v=(o-i)*.3+p+g*.16666667,b=h*.3+m+y*.16666667,w=i+v,E=b;for(let T=f+18;f<T;f+=2)u[f]=w,u[f+1]=E,v+=x,b+=_,x+=g,_+=y,w+=v,E+=b}getCurvePercent(t,e){const s=this.curves;let i=s[e];switch(i){case 0:const a=this.frames[e];return(t-a)/(this.frames[e+this.getFrameEntries()]-a);case 1:return 0}if(i-=2,s[i]>t){const a=this.frames[e];return s[i+1]*(t-a)/(s[i]-a)}const n=i+18;for(i+=2;i<n;i+=2)if(s[i]>=t){const a=s[i-2],l=s[i-1];return l+(t-a)/(s[i]-a)*(s[i+1]-l)}const o=s[n-2],h=s[n-1];return h+(1-h)*(t-o)/(this.frames[e+this.getFrameEntries()]-o)}apply(t,e,s,i,n,o,h){const a=t.slots[this.slotIndex];if(!a.bone.active)return;const l=a.getAttachment();if(!l||!(l instanceof rr)||l.timelineAttachment!=this.attachment)return;const c=a.deform;c.length==0&&(o=S.setup);const d=this.vertices,u=d[0].length,f=this.frames;if(s<f[0]){switch(o){case S.setup:c.length=0;return;case S.first:if(n==1){c.length=0;return}c.length=u;const x=l;if(x.bones){n=1-n;for(let _=0;_<u;_++)c[_]*=n}else{const _=x.vertices;for(let v=0;v<u;v++)c[v]+=(_[v]-c[v])*n}}return}if(c.length=u,s>=f[f.length-1]){const x=d[f.length-1];if(n==1)if(o==S.add){const _=l;if(_.bones)for(let v=0;v<u;v++)c[v]+=x[v];else{const v=_.vertices;for(let b=0;b<u;b++)c[b]+=x[b]-v[b]}}else B.arrayCopy(x,0,c,0,u);else switch(o){case S.setup:{const v=l;if(v.bones)for(let b=0;b<u;b++)c[b]=x[b]*n;else{const b=v.vertices;for(let w=0;w<u;w++){const E=b[w];c[w]=E+(x[w]-E)*n}}break}case S.first:case S.replace:for(let v=0;v<u;v++)c[v]+=(x[v]-c[v])*n;break;case S.add:const _=l;if(_.bones)for(let v=0;v<u;v++)c[v]+=x[v]*n;else{const v=_.vertices;for(let b=0;b<u;b++)c[b]+=(x[b]-v[b])*n}}return}const p=le.search1(f,s),m=this.getCurvePercent(s,p),g=d[p],y=d[p+1];if(n==1)if(o==S.add){const x=l;if(x.bones)for(let _=0;_<u;_++){const v=g[_];c[_]+=v+(y[_]-v)*m}else{const _=x.vertices;for(let v=0;v<u;v++){const b=g[v];c[v]+=b+(y[v]-b)*m-_[v]}}}else for(let x=0;x<u;x++){const _=g[x];c[x]=_+(y[x]-_)*m}else switch(o){case S.setup:{const _=l;if(_.bones)for(let v=0;v<u;v++){const b=g[v];c[v]=(b+(y[v]-b)*m)*n}else{const v=_.vertices;for(let b=0;b<u;b++){const w=g[b],E=v[b];c[b]=E+(w+(y[b]-w)*m-E)*n}}break}case S.first:case S.replace:for(let _=0;_<u;_++){const v=g[_];c[_]+=(v+(y[_]-v)*m-c[_])*n}break;case S.add:const x=l;if(x.bones)for(let _=0;_<u;_++){const v=g[_];c[_]+=(v+(y[_]-v)*m)*n}else{const _=x.vertices;for(let v=0;v<u;v++){const b=g[v];c[v]+=(b+(y[v]-b)*m-_[v])*n}}}}}const g_=class extends le{constructor(r){super(r,g_.propertyIds),this.events=new Array(r)}getFrameCount(){return this.frames.length}setFrame(r,t){this.frames[r]=t.time,this.events[r]=t}apply(r,t,e,s,i,n,o){if(!s)return;const h=this.frames,a=this.frames.length;if(t>e)this.apply(r,t,Number.MAX_VALUE,s,i,n,o),t=-1;else if(t>=h[a-1])return;if(e<h[0])return;let l=0;if(t<h[0])l=0;else{l=le.search1(h,t)+1;const c=h[l];for(;l>0&&h[l-1]==c;)l--}for(;l<a&&e>=h[l];l++)s.push(this.events[l])}};let Ju=g_;Ju.propertyIds=[`${xt.event}`];const __=class extends le{constructor(r){super(r,__.propertyIds),this.drawOrders=new Array(r)}getFrameCount(){return this.frames.length}setFrame(r,t,e){this.frames[r]=t,this.drawOrders[r]=e}apply(r,t,e,s,i,n,o){if(o==At.mixOut){n==S.setup&&B.arrayCopy(r.slots,0,r.drawOrder,0,r.slots.length);return}if(e<this.frames[0]){(n==S.setup||n==S.first)&&B.arrayCopy(r.slots,0,r.drawOrder,0,r.slots.length);return}const h=le.search1(this.frames,e),a=this.drawOrders[h];if(!a)B.arrayCopy(r.slots,0,r.drawOrder,0,r.slots.length);else{const l=r.drawOrder,c=r.slots;for(let d=0,u=a.length;d<u;d++)l[d]=c[a[d]]}}};let td=__;td.propertyIds=[`${xt.drawOrder}`];class x_ extends oi{constructor(t,e,s){super(t,e,[`${xt.ikConstraint}|${s}`]),this.ikConstraintIndex=0,this.ikConstraintIndex=s}getFrameEntries(){return 6}setFrame(t,e,s,i,n,o,h){t*=6,this.frames[t]=e,this.frames[t+1]=s,this.frames[t+2]=i,this.frames[t+3]=n,this.frames[t+4]=o?1:0,this.frames[t+5]=h?1:0}apply(t,e,s,i,n,o,h){const a=t.ikConstraints[this.ikConstraintIndex];if(!a.active)return;const l=this.frames;if(s<l[0]){switch(o){case S.setup: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;return;case S.first:a.mix+=(a.data.mix-a.mix)*n,a.softness+=(a.data.softness-a.softness)*n,a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch}return}let c=0,d=0;const u=le.search(l,s,6),f=this.curves[u/6];switch(f){case 0:const p=l[u];c=l[u+1],d=l[u+2];const m=(s-p)/(l[u+6]-p);c+=(l[u+6+1]-c)*m,d+=(l[u+6+2]-d)*m;break;case 1:c=l[u+1],d=l[u+2];break;default:c=this.getBezierValue(s,u,1,f-2),d=this.getBezierValue(s,u,2,f+18-2)}o==S.setup?(a.mix=a.data.mix+(c-a.data.mix)*n,a.softness=a.data.softness+(d-a.data.softness)*n,h==At.mixOut?(a.bendDirection=a.data.bendDirection,a.compress=a.data.compress,a.stretch=a.data.stretch):(a.bendDirection=l[u+3],a.compress=l[u+4]!=0,a.stretch=l[u+5]!=0)):(a.mix+=(c-a.mix)*n,a.softness+=(d-a.softness)*n,h==At.mixIn&&(a.bendDirection=l[u+3],a.compress=l[u+4]!=0,a.stretch=l[u+5]!=0))}}class y_ extends oi{constructor(t,e,s){super(t,e,[`${xt.transformConstraint}|${s}`]),this.transformConstraintIndex=0,this.transformConstraintIndex=s}getFrameEntries(){return 7}setFrame(t,e,s,i,n,o,h,a){const l=this.frames;t*=7,l[t]=e,l[t+1]=s,l[t+2]=i,l[t+3]=n,l[t+4]=o,l[t+5]=h,l[t+6]=a}apply(t,e,s,i,n,o,h){const a=t.transformConstraints[this.transformConstraintIndex];if(!a.active)return;const l=this.frames;if(s<l[0]){const x=a.data;switch(o){case S.setup:a.mixRotate=x.mixRotate,a.mixX=x.mixX,a.mixY=x.mixY,a.mixScaleX=x.mixScaleX,a.mixScaleY=x.mixScaleY,a.mixShearY=x.mixShearY;return;case S.first:a.mixRotate+=(x.mixRotate-a.mixRotate)*n,a.mixX+=(x.mixX-a.mixX)*n,a.mixY+=(x.mixY-a.mixY)*n,a.mixScaleX+=(x.mixScaleX-a.mixScaleX)*n,a.mixScaleY+=(x.mixScaleY-a.mixScaleY)*n,a.mixShearY+=(x.mixShearY-a.mixShearY)*n}return}let c,d,u,f,p,m;const g=le.search(l,s,7),y=this.curves[g/7];switch(y){case 0:const x=l[g];c=l[g+1],d=l[g+2],u=l[g+3],f=l[g+4],p=l[g+5],m=l[g+6];const _=(s-x)/(l[g+7]-x);c+=(l[g+7+1]-c)*_,d+=(l[g+7+2]-d)*_,u+=(l[g+7+3]-u)*_,f+=(l[g+7+4]-f)*_,p+=(l[g+7+5]-p)*_,m+=(l[g+7+6]-m)*_;break;case 1:c=l[g+1],d=l[g+2],u=l[g+3],f=l[g+4],p=l[g+5],m=l[g+6];break;default:c=this.getBezierValue(s,g,1,y-2),d=this.getBezierValue(s,g,2,y+18-2),u=this.getBezierValue(s,g,3,y+18*2-2),f=this.getBezierValue(s,g,4,y+18*3-2),p=this.getBezierValue(s,g,5,y+18*4-2),m=this.getBezierValue(s,g,6,y+18*5-2)}if(o==S.setup){const x=a.data;a.mixRotate=x.mixRotate+(c-x.mixRotate)*n,a.mixX=x.mixX+(d-x.mixX)*n,a.mixY=x.mixY+(u-x.mixY)*n,a.mixScaleX=x.mixScaleX+(f-x.mixScaleX)*n,a.mixScaleY=x.mixScaleY+(p-x.mixScaleY)*n,a.mixShearY=x.mixShearY+(m-x.mixShearY)*n}else a.mixRotate+=(c-a.mixRotate)*n,a.mixX+=(d-a.mixX)*n,a.mixY+=(u-a.mixY)*n,a.mixScaleX+=(f-a.mixScaleX)*n,a.mixScaleY+=(p-a.mixScaleY)*n,a.mixShearY+=(m-a.mixShearY)*n}}class v_ extends hi{constructor(t,e,s){super(t,e,`${xt.pathConstraintPosition}|${s}`),this.pathConstraintIndex=0,this.pathConstraintIndex=s}apply(t,e,s,i,n,o,h){const a=t.pathConstraints[this.pathConstraintIndex];if(!a.active)return;const l=this.frames;if(s<l[0]){switch(o){case S.setup:a.position=a.data.position;return;case S.first:a.position+=(a.data.position-a.position)*n}return}const c=this.getCurveValue(s);o==S.setup?a.position=a.data.position+(c-a.data.position)*n:a.position+=(c-a.position)*n}}class b_ extends hi{constructor(t,e,s){super(t,e,`${xt.pathConstraintSpacing}|${s}`),this.pathConstraintIndex=0,this.pathConstraintIndex=s}apply(t,e,s,i,n,o,h){const a=t.pathConstraints[this.pathConstraintIndex];if(!a.active)return;const l=this.frames;if(s<l[0]){switch(o){case S.setup:a.spacing=a.data.spacing;return;case S.first:a.spacing+=(a.data.spacing-a.spacing)*n}return}const c=this.getCurveValue(s);o==S.setup?a.spacing=a.data.spacing+(c-a.data.spacing)*n:a.spacing+=(c-a.spacing)*n}}class w_ extends oi{constructor(t,e,s){super(t,e,[`${xt.pathConstraintMix}|${s}`]),this.pathConstraintIndex=0,this.pathConstraintIndex=s}getFrameEntries(){return 4}setFrame(t,e,s,i,n){const o=this.frames;t<<=2,o[t]=e,o[t+1]=s,o[t+2]=i,o[t+3]=n}apply(t,e,s,i,n,o,h){const a=t.pathConstraints[this.pathConstraintIndex];if(!a.active)return;const l=this.frames;if(s<l[0]){switch(o){case S.setup:a.mixRotate=a.data.mixRotate,a.mixX=a.data.mixX,a.mixY=a.data.mixY;return;case S.first:a.mixRotate+=(a.data.mixRotate-a.mixRotate)*n,a.mixX+=(a.data.mixX-a.mixX)*n,a.mixY+=(a.data.mixY-a.mixY)*n}return}let c,d,u;const f=le.search(l,s,4),p=this.curves[f>>2];switch(p){case 0:const m=l[f];c=l[f+1],d=l[f+2],u=l[f+3];const g=(s-m)/(l[f+4]-m);c+=(l[f+4+1]-c)*g,d+=(l[f+4+2]-d)*g,u+=(l[f+4+3]-u)*g;break;case 1:c=l[f+1],d=l[f+2],u=l[f+3];break;default:c=this.getBezierValue(s,f,1,p-2),d=this.getBezierValue(s,f,2,p+18-2),u=this.getBezierValue(s,f,3,p+18*2-2)}if(o==S.setup){const m=a.data;a.mixRotate=m.mixRotate+(c-m.mixRotate)*n,a.mixX=m.mixX+(d-m.mixX)*n,a.mixY=m.mixY+(u-m.mixY)*n}else a.mixRotate+=(c-a.mixRotate)*n,a.mixX+=(d-a.mixX)*n,a.mixY+=(u-a.mixY)*n}}const nr=class extends le{constructor(r,t,e){super(r,[`${xt.sequence}|${t}|${e.sequence.id}`]),this.slotIndex=t,this.attachment=e}getFrameEntries(){return nr.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(r,t,e,s,i){const n=this.frames;r*=nr.ENTRIES,n[r]=t,n[r+nr.MODE]=e|s<<4,n[r+nr.DELAY]=i}apply(r,t,e,s,i,n,o){const h=r.slots[this.slotIndex];if(!h.bone.active)return;const a=h.attachment,l=this.attachment;if(a!=l&&(!(a instanceof rr)||a.timelineAttachment!=l))return;const c=this.frames;if(e<c[0]){(n==S.setup||n==S.first)&&(h.sequenceIndex=-1);return}const d=le.search(c,e,nr.ENTRIES),u=c[d],f=c[d+nr.MODE],p=c[d+nr.DELAY];if(!this.attachment.sequence)return;let m=f>>4;const g=this.attachment.sequence.regions.length,y=Q0[f&15];if(y!=Ii.hold)switch(m+=(e-u)/p+1e-5|0,y){case Ii.once:m=Math.min(g-1,m);break;case Ii.loop:m%=g;break;case Ii.pingpong:{const x=(g<<1)-2;m=x==0?0:m%x,m>=g&&(m=x-m);break}case Ii.onceReverse:m=Math.max(g-1-m,0);break;case Ii.loopReverse:m=g-1-m%g;break;case Ii.pingpongReverse:{const x=(g<<1)-2;m=x==0?0:(m+g-1)%x,m>=g&&(m=x-m)}}h.sequenceIndex=m}};let Ma=nr;Ma.ENTRIES=3,Ma.MODE=1,Ma.DELAY=2,new Zu("<empty>",[],0);class E_{constructor(t){this.atlas=t}loadSequence(t,e,s){const i=s.regions;for(let n=0,o=i.length;n<o;n++){const h=s.getPath(e,n),a=this.atlas.findRegion(h);if(a==null)throw new Error(`Region not found in atlas: ${h} (sequence: ${t})`);i[n]=a,i[n].renderObject=i[n]}}newRegionAttachment(t,e,s,i){const n=new gt(e,s);if(i!=null)this.loadSequence(e,s,i);else{const o=this.atlas.findRegion(s);if(!o)throw new Error(`Region not found in atlas: ${s} (region attachment: ${e})`);o.renderObject=o,n.region=o}return n}newMeshAttachment(t,e,s,i){const n=new Ra(e,s);if(i!=null)this.loadSequence(e,s,i);else{const o=this.atlas.findRegion(s);if(!o)throw new Error(`Region not found in atlas: ${s} (mesh attachment: ${e})`);o.renderObject=o,n.region=o}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 T_{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=yt.Normal,this.skinRequired=!1,this.color=new G,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 A_=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 S_{constructor(t){this.intValue=0,this.floatValue=0,this.stringValue=null,this.audioPath=null,this.volume=0,this.balance=0,this.name=t}}class C_ 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 I_ extends ed{constructor(t){super(t,0,!1),this.bones=new Array,this._target=null,this.positionMode=ne.Fixed,this.spacingMode=Ps.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 Ps=(r=>(r[r.Length=0]="Length",r[r.Fixed=1]="Fixed",r[r.Percent=2]="Percent",r[r.Proportional=3]="Proportional",r))(Ps||{});class P_{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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;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,i=e.length;s<i;s++)if(e[s].name==t)return s;return-1}}class R_{constructor(t,e,s){if(this.index=0,this.color=new G(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 M_ 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 F_{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 i=this.attachments;t>=i.length&&(i.length=t+1),i[t]||(i[t]={}),i[t][e]=s}addSkin(t){for(let s=0;s<t.bones.length;s++){const i=t.bones[s];let n=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==i){n=!0;break}n||this.bones.push(i)}for(let s=0;s<t.constraints.length;s++){const i=t.constraints[s];let n=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==i){n=!0;break}n||this.constraints.push(i)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const i=e[s];this.setAttachment(i.slotIndex,i.name,i.attachment)}}copySkin(t){for(let s=0;s<t.bones.length;s++){const i=t.bones[s];let n=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==i){n=!0;break}n||this.bones.push(i)}for(let s=0;s<t.constraints.length;s++){const i=t.constraints[s];let n=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==i){n=!0;break}n||this.constraints.push(i)}const e=t.getAttachments();for(let s=0;s<e.length;s++){const i=e[s];i.attachment&&(i.attachment instanceof Ra?(i.attachment=i.attachment.newLinkedMesh(),this.setAttachment(i.slotIndex,i.name,i.attachment)):(i.attachment=i.attachment.copy(),this.setAttachment(i.slotIndex,i.name,i.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 i in s){const n=s[i];n&&t.push(new F_(e,i,n))}}return t}getAttachmentsForSlot(t,e){const s=this.attachments[t];if(s)for(const i in s){const n=s[i];n&&e.push(new F_(t,i,n))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(t,e){let s=0;for(let i=0;i<t.slots.length;i++){const n=t.slots[i],o=n.getAttachment();if(o&&s<e.attachments.length){const h=e.attachments[s];for(const a in h){const l=h[a];if(o==l){const c=this.getAttachment(s,a);c&&n.setAttachment(c);break}}}s++}}}class k_{constructor(t){this.ver40=!1,this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new P_;s.name="";const i=new gh(t),n=i.readInt32(),o=i.readInt32();s.hash=o==0&&n==0?null:o.toString(16)+n.toString(16),s.version=i.readString();const h=s.version.substr(0,3);if(h!=="4.0"&&h!=="4.1"){const d=`Spine 4.1 loader cant load version ${s.version}. Please configure your pixi-spine bundle`;console.error(d)}this.ver40=h==="4.0",s.x=i.readFloat(),s.y=i.readFloat(),s.width=i.readFloat(),s.height=i.readFloat();const a=i.readBoolean();a&&(s.fps=i.readFloat(),s.imagesPath=i.readString(),s.audioPath=i.readString());let l=0;l=i.readInt(!0);for(let d=0;d<l;d++){const u=i.readString();if(!u)throw new Error("String in string table must not be null.");i.strings.push(u)}l=i.readInt(!0);for(let d=0;d<l;d++){const u=i.readString();if(!u)throw new Error("Bone name must not be null.");const f=d==0?null:s.bones[i.readInt(!0)],p=new T_(d,u,f);p.rotation=i.readFloat(),p.x=i.readFloat()*e,p.y=i.readFloat()*e,p.scaleX=i.readFloat(),p.scaleY=i.readFloat(),p.shearX=i.readFloat(),p.shearY=i.readFloat(),p.length=i.readFloat()*e,p.transformMode=i.readInt(!0),p.skinRequired=i.readBoolean(),a&&G.rgba8888ToColor(p.color,i.readInt32()),s.bones.push(p)}l=i.readInt(!0);for(let d=0;d<l;d++){const u=i.readString();if(!u)throw new Error("Slot name must not be null.");const f=s.bones[i.readInt(!0)],p=new R_(d,u,f);G.rgba8888ToColor(p.color,i.readInt32());const m=i.readInt32();m!=-1&&G.rgb888ToColor(p.darkColor=new G,m),p.attachmentName=i.readStringRef(),p.blendMode=i.readInt(!0),s.slots.push(p)}l=i.readInt(!0);for(let d=0,u;d<l;d++){const f=i.readString();if(!f)throw new Error("IK constraint data name must not be null.");const p=new C_(f);p.order=i.readInt(!0),p.skinRequired=i.readBoolean(),u=i.readInt(!0);for(let m=0;m<u;m++)p.bones.push(s.bones[i.readInt(!0)]);p.target=s.bones[i.readInt(!0)],p.mix=i.readFloat(),p.softness=i.readFloat()*e,p.bendDirection=i.readByte(),p.compress=i.readBoolean(),p.stretch=i.readBoolean(),p.uniform=i.readBoolean(),s.ikConstraints.push(p)}l=i.readInt(!0);for(let d=0,u;d<l;d++){const f=i.readString();if(!f)throw new Error("Transform constraint data name must not be null.");const p=new M_(f);p.order=i.readInt(!0),p.skinRequired=i.readBoolean(),u=i.readInt(!0);for(let m=0;m<u;m++)p.bones.push(s.bones[i.readInt(!0)]);p.target=s.bones[i.readInt(!0)],p.local=i.readBoolean(),p.relative=i.readBoolean(),p.offsetRotation=i.readFloat(),p.offsetX=i.readFloat()*e,p.offsetY=i.readFloat()*e,p.offsetScaleX=i.readFloat(),p.offsetScaleY=i.readFloat(),p.offsetShearY=i.readFloat(),p.mixRotate=i.readFloat(),p.mixX=i.readFloat(),p.mixY=i.readFloat(),p.mixScaleX=i.readFloat(),p.mixScaleY=i.readFloat(),p.mixShearY=i.readFloat(),s.transformConstraints.push(p)}l=i.readInt(!0);for(let d=0,u;d<l;d++){const f=i.readString();if(!f)throw new Error("Path constraint data name must not be null.");const p=new I_(f);p.order=i.readInt(!0),p.skinRequired=i.readBoolean(),u=i.readInt(!0);for(let m=0;m<u;m++)p.bones.push(s.bones[i.readInt(!0)]);p.target=s.slots[i.readInt(!0)],p.positionMode=i.readInt(!0),p.spacingMode=i.readInt(!0),p.rotateMode=i.readInt(!0),p.offsetRotation=i.readFloat(),p.position=i.readFloat(),p.positionMode==ne.Fixed&&(p.position*=e),p.spacing=i.readFloat(),(p.spacingMode==Ps.Length||p.spacingMode==Ps.Fixed)&&(p.spacing*=e),p.mixRotate=i.readFloat(),p.mixX=i.readFloat(),p.mixY=i.readFloat(),s.pathConstraints.push(p)}const c=this.readSkin(i,s,!0,a);c&&(s.defaultSkin=c,s.skins.push(c));{let d=s.skins.length;for(B.setArraySize(s.skins,l=d+i.readInt(!0));d<l;d++){const u=this.readSkin(i,s,!1,a);if(!u)throw new Error("readSkin() should not have returned null.");s.skins[d]=u}}l=this.linkedMeshes.length;for(let d=0;d<l;d++){const u=this.linkedMeshes[d],f=u.skin?s.findSkin(u.skin):s.defaultSkin;if(!f)throw new Error("Not skin found for linked mesh.");if(!u.parent)throw new Error("Linked mesh parent must not be null");const p=f.getAttachment(u.slotIndex,u.parent);if(!p)throw new Error(`Parent mesh not found: ${u.parent}`);u.mesh.timelineAttachment=u.inheritTimeline?p:u.mesh,u.mesh.setParentMesh(p)}this.linkedMeshes.length=0,l=i.readInt(!0);for(let d=0;d<l;d++){const u=i.readStringRef();if(!u)throw new Error;const f=new S_(u);f.intValue=i.readInt(!1),f.floatValue=i.readFloat(),f.stringValue=i.readString(),f.audioPath=i.readString(),f.audioPath&&(f.volume=i.readFloat(),f.balance=i.readFloat()),s.events.push(f)}l=i.readInt(!0);for(let d=0;d<l;d++){const u=i.readString();if(!u)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(i,u,s))}return s}readSkin(t,e,s,i){let n=null,o=0;if(s){if(o=t.readInt(!0),o==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 a=0,l=n.bones.length;a<l;a++)n.bones[a]=e.bones[t.readInt(!0)];for(let a=0,l=t.readInt(!0);a<l;a++)n.constraints.push(e.ikConstraints[t.readInt(!0)]);for(let a=0,l=t.readInt(!0);a<l;a++)n.constraints.push(e.transformConstraints[t.readInt(!0)]);for(let a=0,l=t.readInt(!0);a<l;a++)n.constraints.push(e.pathConstraints[t.readInt(!0)]);o=t.readInt(!0)}for(let h=0;h<o;h++){const a=t.readInt(!0);for(let l=0,c=t.readInt(!0);l<c;l++){const d=t.readStringRef();if(!d)throw new Error("Attachment name must not be null");const u=this.readAttachment(t,e,n,a,d,i);u&&n.setAttachment(a,d,u)}}return n}readAttachment(t,e,s,i,n,o){const h=this.scale;let a=t.readStringRef();switch(a||(a=n),t.readByte()){case ot.Region:{let l=t.readStringRef();const c=t.readFloat(),d=t.readFloat(),u=t.readFloat(),f=t.readFloat(),p=t.readFloat(),m=t.readFloat(),g=t.readFloat(),y=t.readInt32(),x=this.readSequence(t);l||(l=a);const _=this.attachmentLoader.newRegionAttachment(s,a,l,x);return _?(_.path=l,_.x=d*h,_.y=u*h,_.scaleX=f,_.scaleY=p,_.rotation=c,_.width=m*h,_.height=g*h,G.rgba8888ToColor(_.color,y),_.sequence=x,x==null&&_.updateRegion(),_):null}case ot.BoundingBox:{const l=t.readInt(!0),c=this.readVertices(t,l),d=o?t.readInt32():0,u=this.attachmentLoader.newBoundingBoxAttachment(s,a);return u?(u.worldVerticesLength=l<<1,u.vertices=c.vertices,u.bones=c.bones,o&&G.rgba8888ToColor(u.color,d),u):null}case ot.Mesh:{let l=t.readStringRef();const c=t.readInt32(),d=t.readInt(!0),u=this.readFloatArray(t,d<<1,1),f=this.readShortArray(t),p=this.readVertices(t,d),m=t.readInt(!0),g=this.readSequence(t);let y=[],x=0,_=0;o&&(y=this.readShortArray(t),x=t.readFloat(),_=t.readFloat()),l||(l=a);const v=this.attachmentLoader.newMeshAttachment(s,a,l,g);return v?(v.path=l,G.rgba8888ToColor(v.color,c),v.bones=p.bones,v.vertices=p.vertices,v.worldVerticesLength=d<<1,v.triangles=f,v.regionUVs=new Float32Array(u),v.hullLength=m<<1,v.sequence=g,o&&(v.edges=y,v.width=x*h,v.height=_*h),v):null}case ot.LinkedMesh:{let l=t.readStringRef();const c=t.readInt32(),d=t.readStringRef(),u=t.readStringRef(),f=t.readBoolean(),p=this.readSequence(t);let m=0,g=0;o&&(m=t.readFloat(),g=t.readFloat()),l||(l=a);const y=this.attachmentLoader.newMeshAttachment(s,a,l,p);return y?(y.path=l,G.rgba8888ToColor(y.color,c),y.sequence=p,o&&(y.width=m*h,y.height=g*h),this.linkedMeshes.push(new RC(y,d,i,u,f)),y):null}case ot.Path:{const l=t.readBoolean(),c=t.readBoolean(),d=t.readInt(!0),u=this.readVertices(t,d),f=B.newArray(d/3,0);for(let g=0,y=f.length;g<y;g++)f[g]=t.readFloat()*h;const p=o?t.readInt32():0,m=this.attachmentLoader.newPathAttachment(s,a);return m?(m.closed=l,m.constantSpeed=c,m.worldVerticesLength=d<<1,m.vertices=u.vertices,m.bones=u.bones,m.lengths=f,o&&G.rgba8888ToColor(m.color,p),m):null}case ot.Point:{const l=t.readFloat(),c=t.readFloat(),d=t.readFloat(),u=o?t.readInt32():0,f=this.attachmentLoader.newPointAttachment(s,a);return f?(f.x=c*h,f.y=d*h,f.rotation=l,o&&G.rgba8888ToColor(f.color,u),f):null}case ot.Clipping:{const l=t.readInt(!0),c=t.readInt(!0),d=this.readVertices(t,c),u=o?t.readInt32():0,f=this.attachmentLoader.newClippingAttachment(s,a);return f?(f.endSlot=e.slots[l],f.worldVerticesLength=c<<1,f.vertices=d.vertices,f.bones=d.bones,o&&G.rgba8888ToColor(f.color,u),f):null}}return null}readSequence(t){if(this.ver40||!t.readBoolean())return null;const e=new Ku(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?B_:t.readByte()}readVertices(t,e){const s=this.scale,i=e<<1,n=new MC;if(!t.readBoolean())return n.vertices=this.readFloatArray(t,i,s),n;const o=new Array,h=new Array;for(let a=0;a<e;a++){const l=t.readInt(!0);h.push(l);for(let c=0;c<l;c++)h.push(t.readInt(!0)),o.push(t.readFloat()*s),o.push(t.readFloat()*s),o.push(t.readFloat())}return n.vertices=B.toFloatArray(o),n.bones=h,n}readFloatArray(t,e,s){const i=new Array(e);if(s==1)for(let n=0;n<e;n++)i[n]=t.readFloat();else for(let n=0;n<e;n++)i[n]=t.readFloat()*s;return i}readShortArray(t){const e=t.readInt(!0),s=new Array(e);for(let i=0;i<e;i++)s[i]=t.readShort();return s}readAnimation(t,e,s){t.readInt(!0);const i=new Array,n=this.scale;for(let l=0,c=t.readInt(!0);l<c;l++){const d=t.readInt(!0);for(let u=0,f=t.readInt(!0);u<f;u++){const p=t.readByte(),m=t.readInt(!0),g=m-1;switch(p){case GC:{const y=new p_(m,d);for(let x=0;x<m;x++)y.setFrame(x,t.readFloat(),t.readStringRef());i.push(y);break}case $C:{const y=t.readInt(!0),x=new l_(m,y,d);let _=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,_,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 Rs:x.setStepped(T);break;case Ms:ct(t,x,A++,T,0,_,I,v,M,1),ct(t,x,A++,T,1,_,I,b,R,1),ct(t,x,A++,T,2,_,I,w,C,1),ct(t,x,A++,T,3,_,I,E,P,1)}_=I,v=M,b=R,w=C,E=P}i.push(x);break}case YC:{const y=t.readInt(!0),x=new c_(m,y,d);let _=t.readFloat(),v=t.readUnsignedByte()/255,b=t.readUnsignedByte()/255,w=t.readUnsignedByte()/255;for(let E=0,T=0;x.setFrame(E,_,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 Rs:x.setStepped(E);break;case Ms:ct(t,x,T++,E,0,_,A,v,I,1),ct(t,x,T++,E,1,_,A,b,M,1),ct(t,x,T++,E,2,_,A,w,R,1)}_=A,v=I,b=M,w=R}i.push(x);break}case HC:{const y=t.readInt(!0),x=new d_(m,y,d);let _=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,_,v,b,w,E,T,A,I),M!=g;M++){const C=t.readFloat(),P=t.readUnsignedByte()/255,k=t.readUnsignedByte()/255,V=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255,$=t.readUnsignedByte()/255,O=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:x.setStepped(M);break;case Ms:ct(t,x,R++,M,0,_,C,v,P,1),ct(t,x,R++,M,1,_,C,b,k,1),ct(t,x,R++,M,2,_,C,w,V,1),ct(t,x,R++,M,3,_,C,E,U,1),ct(t,x,R++,M,4,_,C,T,L,1),ct(t,x,R++,M,5,_,C,A,$,1),ct(t,x,R++,M,6,_,C,I,O,1)}_=C,v=P,b=k,w=V,E=U,T=L,A=$,I=O}i.push(x);break}case WC:{const y=t.readInt(!0),x=new f_(m,y,d);let _=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,_,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,V=t.readUnsignedByte()/255,U=t.readUnsignedByte()/255,L=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:x.setStepped(I);break;case Ms:ct(t,x,M++,I,0,_,R,v,C,1),ct(t,x,M++,I,1,_,R,b,P,1),ct(t,x,M++,I,2,_,R,w,k,1),ct(t,x,M++,I,3,_,R,E,V,1),ct(t,x,M++,I,4,_,R,T,U,1),ct(t,x,M++,I,5,_,R,A,L,1)}_=R,v=C,b=P,w=k,E=V,T=U,A=L}i.push(x);break}case zC:{const y=new u_(m,t.readInt(!0),d);let x=t.readFloat(),_=t.readUnsignedByte()/255;for(let v=0,b=0;y.setFrame(v,x,_),v!=g;v++){const w=t.readFloat(),E=t.readUnsignedByte()/255;switch(t.readByte()){case Rs:y.setStepped(v);break;case Ms:ct(t,y,b++,v,0,x,w,_,E,1)}x=w,_=E}i.push(y)}}}}for(let l=0,c=t.readInt(!0);l<c;l++){const d=t.readInt(!0);for(let u=0,f=t.readInt(!0);u<f;u++){const p=t.readByte(),m=t.readInt(!0),g=t.readInt(!0);switch(p){case FC:i.push(Pi(t,new J0(m,g,d),1));break;case kC:i.push(id(t,new t_(m,g,d),n));break;case BC:i.push(Pi(t,new e_(m,g,d),n));break;case DC:i.push(Pi(t,new s_(m,g,d),n));break;case OC:i.push(id(t,new i_(m,g,d),1));break;case LC:i.push(Pi(t,new r_(m,g,d),1));break;case NC:i.push(Pi(t,new n_(m,g,d),1));break;case UC:i.push(id(t,new a_(m,g,d),1));break;case VC:i.push(Pi(t,new o_(m,g,d),1));break;case XC:i.push(Pi(t,new h_(m,g,d),1))}}}for(let l=0,c=t.readInt(!0);l<c;l++){const d=t.readInt(!0),u=t.readInt(!0),f=u-1,p=new x_(u,t.readInt(!0),d);let m=t.readFloat(),g=t.readFloat(),y=t.readFloat()*n;for(let x=0,_=0;p.setFrame(x,m,g,y,t.readByte(),t.readBoolean(),t.readBoolean()),x!=f;x++){const v=t.readFloat(),b=t.readFloat(),w=t.readFloat()*n;switch(t.readByte()){case Rs:p.setStepped(x);break;case Ms:ct(t,p,_++,x,0,m,v,g,b,1),ct(t,p,_++,x,1,m,v,y,w,n)}m=v,g=b,y=w}i.push(p)}for(let l=0,c=t.readInt(!0);l<c;l++){const d=t.readInt(!0),u=t.readInt(!0),f=u-1,p=new y_(u,t.readInt(!0),d);let m=t.readFloat(),g=t.readFloat(),y=t.readFloat(),x=t.readFloat(),_=t.readFloat(),v=t.readFloat(),b=t.readFloat();for(let w=0,E=0;p.setFrame(w,m,g,y,x,_,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 Rs:p.setStepped(w);break;case Ms:ct(t,p,E++,w,0,m,T,g,A,1),ct(t,p,E++,w,1,m,T,y,I,1),ct(t,p,E++,w,2,m,T,x,M,1),ct(t,p,E++,w,3,m,T,_,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,y=I,x=M,_=R,v=C,b=P}i.push(p)}for(let l=0,c=t.readInt(!0);l<c;l++){const d=t.readInt(!0),u=s.pathConstraints[d];for(let f=0,p=t.readInt(!0);f<p;f++)switch(t.readByte()){case qC:i.push(Pi(t,new v_(t.readInt(!0),t.readInt(!0),d),u.positionMode==ne.Fixed?n:1));break;case KC:i.push(Pi(t,new b_(t.readInt(!0),t.readInt(!0),d),u.spacingMode==Ps.Length||u.spacingMode==Ps.Fixed?n:1));break;case ZC:const m=new w_(t.readInt(!0),t.readInt(!0),d);let g=t.readFloat(),y=t.readFloat(),x=t.readFloat(),_=t.readFloat();for(let v=0,b=0,w=m.getFrameCount()-1;m.setFrame(v,g,y,x,_),v!=w;v++){const E=t.readFloat(),T=t.readFloat(),A=t.readFloat(),I=t.readFloat();switch(t.readByte()){case Rs:m.setStepped(v);break;case Ms:ct(t,m,b++,v,0,g,E,y,T,1),ct(t,m,b++,v,1,g,E,x,A,1),ct(t,m,b++,v,2,g,E,_,I,1)}g=E,y=T,x=A,_=I}i.push(m)}}for(let l=0,c=t.readInt(!0);l<c;l++){const d=s.skins[t.readInt(!0)];for(let u=0,f=t.readInt(!0);u<f;u++){const p=t.readInt(!0);for(let m=0,g=t.readInt(!0);m<g;m++){const y=t.readStringRef();if(!y)throw new Error("attachmentName must not be null.");const x=d.getAttachment(p,y),_=this.readDeformTimelineType(t),v=t.readInt(!0),b=v-1;switch(_){case B_:{const w=x,E=w.bones,T=w.vertices,A=E?T.length/3*2:T.length,I=t.readInt(!0),M=new m_(v,I,p,w);let R=t.readFloat();for(let C=0,P=0;;C++){let k,V=t.readInt(!0);if(V==0)k=E?B.newFloatArray(A):T;else{k=B.newFloatArray(A);const L=t.readInt(!0);if(V+=L,n==1)for(let $=L;$<V;$++)k[$]=t.readFloat();else for(let $=L;$<V;$++)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 U=t.readFloat();switch(t.readByte()){case Rs:M.setStepped(C);break;case Ms:ct(t,M,P++,C,0,R,U,0,1,1)}R=U}i.push(M);break}case jC:{const w=new Ma(v,p,x);for(let E=0;E<v;E++){const T=t.readFloat(),A=t.readInt32();w.setFrame(E,T,Q0[A&15],A>>4,t.readFloat())}i.push(w);break}}}}}const o=t.readInt(!0);if(o>0){const l=new td(o),c=s.slots.length;for(let d=0;d<o;d++){const u=t.readFloat(),f=t.readInt(!0),p=B.newArray(c,0);for(let x=c-1;x>=0;x--)p[x]=-1;const m=B.newArray(c-f,0);let g=0,y=0;for(let x=0;x<f;x++){const _=t.readInt(!0);for(;g!=_;)m[y++]=g++;p[g+t.readInt(!0)]=g++}for(;g<c;)m[y++]=g++;for(let x=c-1;x>=0;x--)p[x]==-1&&(p[x]=m[--y]);l.setFrame(d,u,p)}i.push(l)}const h=t.readInt(!0);if(h>0){const l=new Ju(h);for(let c=0;c<h;c++){const d=t.readFloat(),u=s.events[t.readInt(!0)],f=new A_(d,u);f.intValue=t.readInt(!1),f.floatValue=t.readFloat(),f.stringValue=t.readBoolean()?t.readString():u.stringValue,f.data.audioPath&&(f.volume=t.readFloat(),f.balance=t.readFloat()),l.setFrame(c,f)}i.push(l)}let a=0;for(let l=0,c=i.length;l<c;l++)a=Math.max(a,i[l].getDuration());return new Zu(e,i,a)}}k_.BlendModeValues=[W.NORMAL,W.ADD,W.MULTIPLY,W.SCREEN];let RC=class{constructor(t,e,s,i,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=n}};class MC{constructor(t=null,e=null){this.bones=t,this.vertices=e}}function Pi(r,t,e){let s=r.readFloat(),i=r.readFloat()*e;for(let n=0,o=0,h=t.getFrameCount()-1;t.setFrame(n,s,i),n!=h;n++){const a=r.readFloat(),l=r.readFloat()*e;switch(r.readByte()){case Rs:t.setStepped(n);break;case Ms:ct(r,t,o++,n,0,s,a,i,l,e)}s=a,i=l}return t}function id(r,t,e){let s=r.readFloat(),i=r.readFloat()*e,n=r.readFloat()*e;for(let o=0,h=0,a=t.getFrameCount()-1;t.setFrame(o,s,i,n),o!=a;o++){const l=r.readFloat(),c=r.readFloat()*e,d=r.readFloat()*e;switch(r.readByte()){case Rs:t.setStepped(o);break;case Ms:ct(r,t,h++,o,0,s,l,i,c,e),ct(r,t,h++,o,1,s,l,n,d,e)}s=l,i=c,n=d}return t}function ct(r,t,e,s,i,n,o,h,a,l){t.setBezier(e,s,i,n,h,r.readFloat(),r.readFloat()*l,r.readFloat(),r.readFloat()*l,o,a)}const FC=0,kC=1,BC=2,DC=3,OC=4,LC=5,NC=6,UC=7,VC=8,XC=9,GC=0,$C=1,YC=2,HC=3,WC=4,zC=5,B_=0,jC=1,qC=0,KC=1,ZC=2,Rs=1,Ms=2;class rd{constructor(t){this.scale=1,this.linkedMeshes=new Array,this.attachmentLoader=t}readSkeletonData(t){const e=this.scale,s=new P_,i=typeof t=="string"?JSON.parse(t):t,n=i.skeleton;if(n){s.hash=n.hash,s.version=n.spine;const o=s.version.substr(0,3);if(o!=="4.0"&&o!=="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(i.bones)for(let o=0;o<i.bones.length;o++){const h=i.bones[o];let a=null;const l=F(h,"parent",null);if(l!=null&&(a=s.findBone(l),a==null))throw new Error(`Parent bone not found: ${l}`);const c=new T_(s.bones.length,h.name,a);c.length=F(h,"length",0)*e,c.x=F(h,"x",0)*e,c.y=F(h,"y",0)*e,c.rotation=F(h,"rotation",0),c.scaleX=F(h,"scaleX",1),c.scaleY=F(h,"scaleY",1),c.shearX=F(h,"shearX",0),c.shearY=F(h,"shearY",0),c.transformMode=B.enumValue(yt,F(h,"transform","Normal")),c.skinRequired=F(h,"skin",!1);const d=F(h,"color",null);d&&c.color.setFromString(d),s.bones.push(c)}if(i.slots)for(let o=0;o<i.slots.length;o++){const h=i.slots[o],a=s.findBone(h.bone);if(!a)throw new Error(`Couldn't find bone ${h.bone} for slot ${h.name}`);const l=new R_(s.slots.length,h.name,a),c=F(h,"color",null);c&&l.color.setFromString(c);const d=F(h,"dark",null);d&&(l.darkColor=G.fromString(d)),l.attachmentName=F(h,"attachment",null),l.blendMode=rd.blendModeFromString(F(h,"blend","normal")),s.slots.push(l)}if(i.ik)for(let o=0;o<i.ik.length;o++){const h=i.ik[o],a=new C_(h.name);a.order=F(h,"order",0),a.skinRequired=F(h,"skin",!1);for(let l=0;l<h.bones.length;l++){const c=h.bones[l],d=s.findBone(c);if(d==null)throw new Error(`IK bone not found: ${c}`);a.bones.push(d)}a.target=s.findBone(h.target),a.mix=F(h,"mix",1),a.softness=F(h,"softness",0)*e,a.bendDirection=F(h,"bendPositive",!0)?1:-1,a.compress=F(h,"compress",!1),a.stretch=F(h,"stretch",!1),a.uniform=F(h,"uniform",!1),s.ikConstraints.push(a)}if(i.transform)for(let o=0;o<i.transform.length;o++){const h=i.transform[o],a=new M_(h.name);a.order=F(h,"order",0),a.skinRequired=F(h,"skin",!1);for(let d=0;d<h.bones.length;d++){const u=h.bones[d],f=s.findBone(u);if(!f)throw new Error(`Couldn't find bone ${u} for transform constraint ${h.name}.`);a.bones.push(f)}const l=h.target,c=s.findBone(l);if(!c)throw new Error(`Couldn't find target bone ${l} for transform constraint ${h.name}.`);a.target=c,a.local=F(h,"local",!1),a.relative=F(h,"relative",!1),a.offsetRotation=F(h,"rotation",0),a.offsetX=F(h,"x",0)*e,a.offsetY=F(h,"y",0)*e,a.offsetScaleX=F(h,"scaleX",0),a.offsetScaleY=F(h,"scaleY",0),a.offsetShearY=F(h,"shearY",0),a.mixRotate=F(h,"mixRotate",1),a.mixX=F(h,"mixX",1),a.mixY=F(h,"mixY",a.mixX),a.mixScaleX=F(h,"mixScaleX",1),a.mixScaleY=F(h,"mixScaleY",a.mixScaleX),a.mixShearY=F(h,"mixShearY",1),s.transformConstraints.push(a)}if(i.path)for(let o=0;o<i.path.length;o++){const h=i.path[o],a=new I_(h.name);a.order=F(h,"order",0),a.skinRequired=F(h,"skin",!1);for(let d=0;d<h.bones.length;d++){const u=h.bones[d],f=s.findBone(u);if(!f)throw new Error(`Couldn't find bone ${u} for path constraint ${h.name}.`);a.bones.push(f)}const l=h.target,c=s.findSlot(l);if(!c)throw new Error(`Couldn't find target slot ${l} for path constraint ${h.name}.`);a.target=c,a.positionMode=B.enumValue(ne,F(h,"positionMode","Percent")),a.spacingMode=B.enumValue(Ps,F(h,"spacingMode","Length")),a.rotateMode=B.enumValue(Fe,F(h,"rotateMode","Tangent")),a.offsetRotation=F(h,"rotation",0),a.position=F(h,"position",0),a.positionMode==ne.Fixed&&(a.position*=e),a.spacing=F(h,"spacing",0),(a.spacingMode==Ps.Length||a.spacingMode==Ps.Fixed)&&(a.spacing*=e),a.mixRotate=F(h,"mixRotate",1),a.mixX=F(h,"mixX",1),a.mixY=F(h,"mixY",a.mixX),s.pathConstraints.push(a)}if(i.skins)for(let o=0;o<i.skins.length;o++){const h=i.skins[o],a=new sd(h.name);if(h.bones)for(let l=0;l<h.bones.length;l++){const c=h.bones[l],d=s.findBone(c);if(!d)throw new Error(`Couldn't find bone ${c} for skin ${h.name}.`);a.bones.push(d)}if(h.ik)for(let l=0;l<h.ik.length;l++){const c=h.ik[l],d=s.findIkConstraint(c);if(!d)throw new Error(`Couldn't find IK constraint ${c} for skin ${h.name}.`);a.constraints.push(d)}if(h.transform)for(let l=0;l<h.transform.length;l++){const c=h.transform[l],d=s.findTransformConstraint(c);if(!d)throw new Error(`Couldn't find transform constraint ${c} for skin ${h.name}.`);a.constraints.push(d)}if(h.path)for(let l=0;l<h.path.length;l++){const c=h.path[l],d=s.findPathConstraint(c);if(!d)throw new Error(`Couldn't find path constraint ${c} for skin ${h.name}.`);a.constraints.push(d)}for(const l in h.attachments){const c=s.findSlot(l);if(!c)throw new Error(`Couldn't find slot ${l} for skin ${h.name}.`);const d=h.attachments[l];for(const u in d){const f=this.readAttachment(d[u],a,c.index,u,s);f&&a.setAttachment(c.index,u,f)}}s.skins.push(a),a.name=="default"&&(s.defaultSkin=a)}for(let o=0,h=this.linkedMeshes.length;o<h;o++){const a=this.linkedMeshes[o],l=a.skin?s.findSkin(a.skin):s.defaultSkin;if(!l)throw new Error(`Skin not found: ${a.skin}`);const c=l.getAttachment(a.slotIndex,a.parent);if(!c)throw new Error(`Parent mesh not found: ${a.parent}`);a.mesh.timelineAttachment=a.inheritTimeline?c:a.mesh,a.mesh.setParentMesh(c)}if(this.linkedMeshes.length=0,i.events)for(const o in i.events){const h=i.events[o],a=new S_(o);a.intValue=F(h,"int",0),a.floatValue=F(h,"float",0),a.stringValue=F(h,"string",""),a.audioPath=F(h,"audio",null),a.audioPath&&(a.volume=F(h,"volume",1),a.balance=F(h,"balance",0)),s.events.push(a)}if(i.animations)for(const o in i.animations){const h=i.animations[o];this.readAnimation(h,o,s)}return s}readAttachment(t,e,s,i,n){const o=this.scale;switch(i=F(t,"name",i),F(t,"type","region")){case"region":{const h=F(t,"path",i),a=this.readSequence(F(t,"sequence",null)),l=this.attachmentLoader.newRegionAttachment(e,i,h,a);if(!l)return null;l.path=h,l.x=F(t,"x",0)*o,l.y=F(t,"y",0)*o,l.scaleX=F(t,"scaleX",1),l.scaleY=F(t,"scaleY",1),l.rotation=F(t,"rotation",0),l.width=t.width*o,l.height=t.height*o,l.sequence=a;const c=F(t,"color",null);return c&&l.color.setFromString(c),l}case"boundingbox":{const h=this.attachmentLoader.newBoundingBoxAttachment(e,i);if(!h)return null;this.readVertices(t,h,t.vertexCount<<1);const a=F(t,"color",null);return a&&h.color.setFromString(a),h}case"mesh":case"linkedmesh":{const h=F(t,"path",i),a=this.readSequence(F(t,"sequence",null)),l=this.attachmentLoader.newMeshAttachment(e,i,h,a);if(!l)return null;l.path=h;const c=F(t,"color",null);c&&l.color.setFromString(c),l.width=F(t,"width",0)*o,l.height=F(t,"height",0)*o,l.sequence=a;const d=F(t,"parent",null);if(d)return this.linkedMeshes.push(new QC(l,F(t,"skin",null),s,d,F(t,"timelines",!0))),l;const u=t.uvs;return this.readVertices(t,l,u.length),l.triangles=t.triangles,l.regionUVs=new Float32Array(u),l.edges=F(t,"edges",null),l.hullLength=F(t,"hull",0)*2,l}case"path":{const h=this.attachmentLoader.newPathAttachment(e,i);if(!h)return null;h.closed=F(t,"closed",!1),h.constantSpeed=F(t,"constantSpeed",!0);const a=t.vertexCount;this.readVertices(t,h,a<<1);const l=B.newArray(a/3,0);for(let d=0;d<t.lengths.length;d++)l[d]=t.lengths[d]*o;h.lengths=l;const c=F(t,"color",null);return c&&h.color.setFromString(c),h}case"point":{const h=this.attachmentLoader.newPointAttachment(e,i);if(!h)return null;h.x=F(t,"x",0)*o,h.y=F(t,"y",0)*o,h.rotation=F(t,"rotation",0);const a=F(t,"color",null);return a&&h.color.setFromString(a),h}case"clipping":{const h=this.attachmentLoader.newClippingAttachment(e,i);if(!h)return null;const a=F(t,"end",null);if(a!=null){const d=n.findSlot(a);if(d==null)throw new Error(`Clipping end slot not found: ${a}`);h.endSlot=d}const l=t.vertexCount;this.readVertices(t,h,l<<1);const c=F(t,"color",null);return c&&h.color.setFromString(c),h}}return null}readSequence(t){if(t==null)return null;const e=new Ku(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 i=this.scale;e.worldVerticesLength=s;const n=t.vertices;if(s==n.length){const a=B.toFloatArray(n);if(i!=1)for(let l=0,c=n.length;l<c;l++)a[l]*=i;e.vertices=a;return}const o=new Array,h=new Array;for(let a=0,l=n.length;a<l;){const c=n[a++];h.push(c);for(let d=a+c*4;a<d;a+=4)h.push(n[a]),o.push(n[a+1]*i),o.push(n[a+2]*i),o.push(n[a+3])}e.bones=h,e.vertices=B.toFloatArray(o)}readAnimation(t,e,s){const i=this.scale,n=new Array;if(t.slots)for(const h in t.slots){const a=t.slots[h],l=s.findSlot(h);if(!l)throw new Error(`Slot not found: ${h}`);const c=l.index;for(const d in a){const u=a[d];if(!u)continue;const f=u.length;if(d=="attachment"){const p=new p_(f,c);for(let m=0;m<f;m++){const g=u[m];p.setFrame(m,F(g,"time",0),F(g,"name",null))}n.push(p)}else if(d=="rgba"){const p=new l_(f,f<<2,c);let m=u[0],g=F(m,"time",0),y=G.fromString(m.color);for(let x=0,_=0;;x++){p.setFrame(x,g,y.r,y.g,y.b,y.a);const v=u[x+1];if(!v){p.shrink(_);break}const b=F(v,"time",0),w=G.fromString(v.color),E=m.curve;E&&(_=pt(E,p,_,x,0,g,b,y.r,w.r,1),_=pt(E,p,_,x,1,g,b,y.g,w.g,1),_=pt(E,p,_,x,2,g,b,y.b,w.b,1),_=pt(E,p,_,x,3,g,b,y.a,w.a,1)),g=b,y=w,m=v}n.push(p)}else if(d=="rgb"){const p=new c_(f,f*3,c);let m=u[0],g=F(m,"time",0),y=G.fromString(m.color);for(let x=0,_=0;;x++){p.setFrame(x,g,y.r,y.g,y.b);const v=u[x+1];if(!v){p.shrink(_);break}const b=F(v,"time",0),w=G.fromString(v.color),E=m.curve;E&&(_=pt(E,p,_,x,0,g,b,y.r,w.r,1),_=pt(E,p,_,x,1,g,b,y.g,w.g,1),_=pt(E,p,_,x,2,g,b,y.b,w.b,1)),g=b,y=w,m=v}n.push(p)}else if(d=="alpha")n.push(li(u,new u_(f,f,c),0,1));else if(d=="rgba2"){const p=new d_(f,f*7,c);let m=u[0],g=F(m,"time",0),y=G.fromString(m.light),x=G.fromString(m.dark);for(let _=0,v=0;;_++){p.setFrame(_,g,y.r,y.g,y.b,y.a,x.r,x.g,x.b);const b=u[_+1];if(!b){p.shrink(v);break}const w=F(b,"time",0),E=G.fromString(b.light),T=G.fromString(b.dark),A=m.curve;A&&(v=pt(A,p,v,_,0,g,w,y.r,E.r,1),v=pt(A,p,v,_,1,g,w,y.g,E.g,1),v=pt(A,p,v,_,2,g,w,y.b,E.b,1),v=pt(A,p,v,_,3,g,w,y.a,E.a,1),v=pt(A,p,v,_,4,g,w,x.r,T.r,1),v=pt(A,p,v,_,5,g,w,x.g,T.g,1),v=pt(A,p,v,_,6,g,w,x.b,T.b,1)),g=w,y=E,x=T,m=b}n.push(p)}else if(d=="rgb2"){const p=new f_(f,f*6,c);let m=u[0],g=F(m,"time",0),y=G.fromString(m.light),x=G.fromString(m.dark);for(let _=0,v=0;;_++){p.setFrame(_,g,y.r,y.g,y.b,x.r,x.g,x.b);const b=u[_+1];if(!b){p.shrink(v);break}const w=F(b,"time",0),E=G.fromString(b.light),T=G.fromString(b.dark),A=m.curve;A&&(v=pt(A,p,v,_,0,g,w,y.r,E.r,1),v=pt(A,p,v,_,1,g,w,y.g,E.g,1),v=pt(A,p,v,_,2,g,w,y.b,E.b,1),v=pt(A,p,v,_,3,g,w,x.r,T.r,1),v=pt(A,p,v,_,4,g,w,x.g,T.g,1),v=pt(A,p,v,_,5,g,w,x.b,T.b,1)),g=w,y=E,x=T,m=b}n.push(p)}}}if(t.bones)for(const h in t.bones){const a=t.bones[h],l=s.findBone(h);if(!l)throw new Error(`Bone not found: ${h}`);const c=l.index;for(const d in a){const u=a[d],f=u.length;if(f!=0){if(d==="rotate")n.push(li(u,new J0(f,f,c),0,1));else if(d==="translate"){const p=new t_(f,f<<1,c);n.push(nd(u,p,"x","y",0,i))}else if(d==="translatex"){const p=new e_(f,f,c);n.push(li(u,p,0,i))}else if(d==="translatey"){const p=new s_(f,f,c);n.push(li(u,p,0,i))}else if(d==="scale"){const p=new i_(f,f<<1,c);n.push(nd(u,p,"x","y",1,1))}else if(d==="scalex"){const p=new r_(f,f,c);n.push(li(u,p,1,1))}else if(d==="scaley"){const p=new n_(f,f,c);n.push(li(u,p,1,1))}else if(d==="shear"){const p=new a_(f,f<<1,c);n.push(nd(u,p,"x","y",0,1))}else if(d==="shearx"){const p=new o_(f,f,c);n.push(li(u,p,0,1))}else if(d==="sheary"){const p=new h_(f,f,c);n.push(li(u,p,0,1))}}}}if(t.ik)for(const h in t.ik){const a=t.ik[h];let l=a[0];if(!l)continue;const c=s.findIkConstraint(h);if(!c)throw new Error(`IK Constraint not found: ${h}`);const d=s.ikConstraints.indexOf(c),u=new x_(a.length,a.length<<1,d);let f=F(l,"time",0),p=F(l,"mix",1),m=F(l,"softness",0)*i;for(let g=0,y=0;;g++){u.setFrame(g,f,p,m,F(l,"bendPositive",!0)?1:-1,F(l,"compress",!1),F(l,"stretch",!1));const x=a[g+1];if(!x){u.shrink(y);break}const _=F(x,"time",0),v=F(x,"mix",1),b=F(x,"softness",0)*i,w=l.curve;w&&(y=pt(w,u,y,g,0,f,_,p,v,1),y=pt(w,u,y,g,1,f,_,m,b,i)),f=_,p=v,m=b,l=x}n.push(u)}if(t.transform)for(const h in t.transform){const a=t.transform[h];let l=a[0];if(!l)continue;const c=s.findTransformConstraint(h);if(!c)throw new Error(`Transform constraint not found: ${h}`);const d=s.transformConstraints.indexOf(c),u=new y_(a.length,a.length*6,d);let f=F(l,"time",0),p=F(l,"mixRotate",1),m=F(l,"mixX",1),g=F(l,"mixY",m),y=F(l,"mixScaleX",1),x=F(l,"mixScaleY",y);const _=F(l,"mixShearY",1);for(let v=0,b=0;;v++){u.setFrame(v,f,p,m,g,y,x,_);const w=a[v+1];if(!w){u.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,u,b,v,0,f,E,p,T,1),b=pt(P,u,b,v,1,f,E,m,A,1),b=pt(P,u,b,v,2,f,E,g,I,1),b=pt(P,u,b,v,3,f,E,y,M,1),b=pt(P,u,b,v,4,f,E,x,R,1),b=pt(P,u,b,v,5,f,E,_,C,1)),f=E,p=T,m=A,g=I,y=M,x=R,y=M,l=w}n.push(u)}if(t.path)for(const h in t.path){const a=t.path[h],l=s.findPathConstraint(h);if(!l)throw new Error(`Path constraint not found: ${h}`);const c=s.pathConstraints.indexOf(l);for(const d in a){const u=a[d];let f=u[0];if(!f)continue;const p=u.length;if(d==="position"){const m=new v_(p,p,c);n.push(li(u,m,0,l.positionMode==ne.Fixed?i:1))}else if(d==="spacing"){const m=new b_(p,p,c);n.push(li(u,m,0,l.spacingMode==Ps.Length||l.spacingMode==Ps.Fixed?i:1))}else if(d==="mix"){const m=new w_(p,p*3,c);let g=F(f,"time",0),y=F(f,"mixRotate",1),x=F(f,"mixX",1),_=F(f,"mixY",x);for(let v=0,b=0;;v++){m.setFrame(v,g,y,x,_);const w=u[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,y,T,1),b=pt(M,m,b,v,1,g,E,x,A,1),b=pt(M,m,b,v,2,g,E,_,I,1)),g=E,y=T,x=A,_=I,f=w}n.push(m)}}}if(t.deform){t.attachments={};for(const h in t.deform){const a=t.deform[h],l=t.attachments[h]={};for(const c in a){const d=a[c],u=l[c]={};for(const f in d)u[f]={deform:d[f]}}}}if(t.attachments)for(const h in t.attachments){const a=t.attachments[h],l=s.findSkin(h);if(l!=null)for(const c in a){const d=a[c],u=s.findSlot(c);if(!u)throw new Error(`Slot not found: ${c}`);const f=u.index;for(const p in d){const m=d[p],g=l.getAttachment(f,p);for(const y in m){const x=m[y];let _=x[0];if(_){if(y=="deform"){const v=g.bones,b=g.vertices,w=v?b.length/3*2:b.length,E=new m_(x.length,x.length,f,g);let T=F(_,"time",0);for(let A=0,I=0;;A++){let M;const R=F(_,"vertices",null);if(!R)M=v?B.newFloatArray(w):b;else{M=B.newFloatArray(w);const V=F(_,"offset",0);if(B.arrayCopy(R,0,M,V,R.length),i!=1)for(let U=V,L=U+R.length;U<L;U++)M[U]*=i;if(!v)for(let U=0;U<w;U++)M[U]+=b[U]}E.setFrame(A,T,M);const C=x[A+1];if(!C){E.shrink(I);break}const P=F(C,"time",0),k=_.curve;k&&(I=pt(k,E,I,A,0,T,P,0,1,1)),T=P,_=C}n.push(E)}else if(y=="sequence"){const v=new Ma(x.length,f,g);let b=0;for(let w=0;w<x.length;w++){const E=F(_,"delay",b),T=F(_,"time",0),A=Ii[F(_,"mode","hold")],I=F(_,"index",0);v.setFrame(w,T,A,I,E),b=E,_=x[w+1]}n.push(v)}}}}}}if(t.drawOrder){const h=new td(t.drawOrder.length),a=s.slots.length;let l=0;for(let c=0;c<t.drawOrder.length;c++,l++){const d=t.drawOrder[c];let u=null;const f=F(d,"offsets",null);if(f){u=B.newArray(a,-1);const p=B.newArray(a-f.length,0);let m=0,g=0;for(let y=0;y<f.length;y++){const x=f[y],_=s.findSlot(x.slot);if(!_)throw new Error(`Slot not found: ${_}`);const v=_.index;for(;m!=v;)p[g++]=m++;u[m+x.offset]=m++}for(;m<a;)p[g++]=m++;for(let y=a-1;y>=0;y--)u[y]==-1&&(u[y]=p[--g])}h.setFrame(l,F(d,"time",0),u)}n.push(h)}if(t.events){const h=new Ju(t.events.length);let a=0;for(let l=0;l<t.events.length;l++,a++){const c=t.events[l],d=s.findEvent(c.name);if(!d)throw new Error(`Event not found: ${c.name}`);const u=new A_(B.toSinglePrecision(F(c,"time",0)),d);u.intValue=F(c,"int",d.intValue),u.floatValue=F(c,"float",d.floatValue),u.stringValue=F(c,"string",d.stringValue),u.data.audioPath&&(u.volume=F(c,"volume",1),u.balance=F(c,"balance",0)),h.setFrame(a,u)}n.push(h)}let o=0;for(let h=0,a=n.length;h<a;h++)o=Math.max(o,n[h].getDuration());if(isNaN(o))throw new Error("Error while parsing animation, duration is NaN");s.animations.push(new Zu(e,n,o))}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 QC{constructor(t,e,s,i,n){this.mesh=t,this.skin=e,this.slotIndex=s,this.parent=i,this.inheritTimeline=n}}function li(r,t,e,s){let i=r[0],n=F(i,"time",0),o=F(i,"value",e)*s,h=0;for(let a=0;;a++){t.setFrame(a,n,o);const l=r[a+1];if(!l)return t.shrink(h),t;const c=F(l,"time",0),d=F(l,"value",e)*s;i.curve&&(h=pt(i.curve,t,h,a,0,n,c,o,d,s)),n=c,o=d,i=l}}function nd(r,t,e,s,i,n){let o=r[0],h=F(o,"time",0),a=F(o,e,i)*n,l=F(o,s,i)*n,c=0;for(let d=0;;d++){t.setFrame(d,h,a,l);const u=r[d+1];if(!u)return t.shrink(c),t;const f=F(u,"time",0),p=F(u,e,i)*n,m=F(u,s,i)*n,g=o.curve;g&&(c=pt(g,t,c,d,0,h,f,a,p,n),c=pt(g,t,c,d,1,h,f,l,m,n)),h=f,a=p,l=m,o=u}}function pt(r,t,e,s,i,n,o,h,a,l){if(r=="stepped")return t.setStepped(s),e;const c=i<<2,d=r[c],u=r[c+1]*l,f=r[c+2],p=r[c+3]*l;return t.setBezier(e,s,i,n,h,d,u,f,p,o,a),e+1}function F(r,t,e){return r[t]!==void 0?r[t]:e}var ar=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.VER37=37]="VER37",r[r.VER38=38]="VER38",r[r.VER40=40]="VER40",r[r.VER41=41]="VER41",r))(ar||{});function ad(r){const t=r.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 JC{constructor(){this.scale=1}readSkeletonData(t,e){let s=null,i=this.readVersionOldFormat(e),n=ad(i);if(n===ar.VER38&&(s=new he(new F0(t))),i=this.readVersionNewFormat(e),n=ad(i),(n===ar.VER40||n===ar.VER41)&&(s=new k_(new E_(t))),!s){const o=`Unsupported version of spine model ${i}, please update pixi-spine`;console.error(o)}return s.scale=this.scale,s.readSkeletonData(e)}readVersionOldFormat(t){const e=new gh(t);let s;try{e.readString(),s=e.readString()}catch{s=""}return s||""}readVersionNewFormat(t){const e=new gh(t);e.readInt32(),e.readInt32();let s;try{s=e.readString()}catch{s=""}return s||""}}class tI{constructor(){this.scale=1}readSkeletonData(t,e){const s=e.skeleton.spine,i=ad(s);let n=null;if(i===ar.VER37&&(n=new IC(new xC(t))),i===ar.VER38&&(n=new JS(new F0(t))),(i===ar.VER40||i===ar.VER41)&&(n=new rd(new E_(t))),!n){const o=`Unsupported version of spine model ${s}, please update pixi-spine`;console.error(o)}return n.scale=this.scale,n.readSkeletonData(e)}}class eI extends rC{createBinaryParser(){return new JC}createJsonParser(){return new tI}parseData(t,e,s){return{spineData:t.readSkeletonData(e,s),spineAtlas:e}}}new eI().installLoader();class sI extends eC{constructor(t,e){const{followPointList:s,visible:i=!1}=e||{};let n;typeof t=="string"?n=Vi.get(t).spineData:n=t.spineData,super(n),this._followDots=[],this._isStart=!1,this.visible=i,this.autoUpdate=!1,s!=null&&s.length&&(s==null||s.forEach(o=>{o.follow.alpha=0,this._followDots.push({point:this.skeleton.findBone(o.boneName),follow:o.follow,onUpdate:o.onUpdate,angleFollow:o.angleFollow||!1,scaleFollow:o.scaleFollow||!0})})),this._loopFn=this._loop.bind(this),Tt.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(i=>{this.visible=!0,this.state.addAnimation(0,t,e,s).listener={complete:()=>{i()}}})}setSkin(t){this.skeleton.setSkinByName(t)}destroyAll(){Tt.system.remove(this._loopFn),this.destroy()}_loop(){this.update(Tt.system.deltaMS/1e3),this._updateFollowPoint()}_updateFollowPoint(){this._followDots.length!==0&&(this._followDots.forEach(t=>{const{worldX:e,worldY:s}=t.point,i=t.point.getWorldRotationX()*(Math.PI/180),n=t.point.getWorldScaleX(),o=t.point.getWorldScaleY();t.onUpdate?t.onUpdate({x:e,y:s,rotate:i,scaleX:n,scaleY:o}):(t.angleFollow&&(t.follow.rotation=i),t.scaleFollow&&t.follow.scale.set(n,o),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=>{bt.to(t.follow,{alpha:1,duration:.25,delay:.15})})))}}const Ri=(r,t,e,s=!1)=>{r.cursor="pointer",r.eventMode="static";const i=n=>{n.button!==2&&e(n)};s?r.once(t,i):r.on(t,i)};class iI extends Bt{constructor(t){super(),this.disabled=!1;const{texture:e,hoverTexture:s,tintColor:i,hoverTintColor:n="#fff",disabledColor:o="#999"}=t;this._texture=e,this._hoverTexture=s,this._tintColor=i,this._disabledColor=o,this._btn=new qe(e),this.addChild(this._btn),this._btn.anchor.set(.5),i&&(this._btn.tint=i),Ri(this._btn,"pointerenter",()=>{this.disabled||(this._btn.tint=n,this._hoverTexture&&(this._btn._texture=this._hoverTexture))}),Ri(this._btn,"pointerleave",()=>{this.disabled||(this._btn._texture=this._texture,i&&(this._btn.tint=i))})}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 Ta{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,Ri(this,"pointerenter",()=>{bt.to(e,{duration:.25,rotation:180*(Math.PI/180)})}),Ri(this,"pointerleave",()=>{e.alpha=1,bt.to(e,{duration:.25,rotation:0})}),Ri(this,"pointerdown",()=>{e.alpha=.5}),Ri(this,"pointerup",()=>{s()})}}class nI extends Bt{constructor(t){super(),this._maskUI=new lu({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,bt.to(this._maskUI,{duration:.25,alpha:.5}),bt.to(this._drawerContainer,{duration:.25,ease:"power1.out",y:this._maskUI.height-this._drawerContainer.height})}async close(){bt.to(this._drawerContainer,{duration:.25,y:this._maskUI.height}),await bt.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++},Tt.shared.add(()=>{const t=Tt.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},Ni.UTILITY)}_setTxtInfo(t,e){const s=o=>{this._paramTxts[t].style.fill="#fff",o<=30&&(this._paramTxts[t].style.fill="yellow"),o<=20&&(this._paramTxts[t].style.fill="red")},i=o=>{this._paramTxts[t].style.fill="#fff",o>=75&&(this._paramTxts[t].style.fill="yellow"),o>=100&&(this._paramTxts[t].style.fill="red")},n=[()=>(s(e),`Fps:${e}`),()=>(i(e),`Draw Call:${e}`),()=>(i(e),`Max Draw Call:${e}`)];this._paramTxts[t].text=n[t]()}}class oI extends Bt{constructor(t){super();const{bgWidth:e,bgHeight:s,barWidth:i,barHeight:n,bgTexture:o,barTexture:h}=t,a=new qe(o);this.addChild(a),this._progressBar=new qe(h),this.addChild(this._progressBar),this._progressBar.x=(e-i)/2,this._progressBar.y=(s-n)/2;const l=new Ks;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 Ta{constructor(t){const{width:e,height:s,scrollContent:i,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=i,this._content=new Bt,this.addChild(this._content),this._content.addChild(this._scrollContent),n>0){const o=new qe;this._content.addChild(o),o.y=this._content.height+n}this._maskGraphics=new Ks,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(){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,bt.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)),bt.to(this._content,{duration:.25,ease:"power1.out",y:e})}_applyInertia(){bt.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)bt.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);bt.to(this._content,{duration:.75,y:t,ease:"elastic.out"})}else bt.to(this._content,{duration:.25,y:0})}}class lI extends Ta{constructor(t){const{width:e,height:s,content:i,slideCallback:n,scrollCallback:o,pageNum:h,pageHeight:a}=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 Ks;l.beginFill(16777215),l.drawRect(0,0,this.width,this.height),l.endFill(),this.addChild(l),this.mask=l,this._scrollHeight=s,this._slideHeight=a,this._slideArea=i,this._slideCallback=n,this._scrollCallback=o,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?(bt.to(this._slideArea,{y:this._scrollHeight/2,duration:.25,onUpdate:()=>{var i;(i=this._scrollCallback)==null||i.call(this,this._slideArea.y,this._currentIndex)}}),this._currentIndex=0):t>this._pageNum?(bt.to(this._slideArea,{y:-this._pageNum*this._slideHeight+this._scrollHeight/2,duration:.5,onUpdate:()=>{var i;(i=this._scrollCallback)==null||i.call(this,this._slideArea.y,this._currentIndex)}}),this._currentIndex=this._pageNum):(this._currentIndex=t,bt.to(this._slideArea,{y:-this._currentIndex*this._slideHeight+this._scrollHeight/2,duration:e?.25:.01,onUpdate:()=>{var i;(i=this._scrollCallback)==null||i.call(this,this._slideArea.y,this._currentIndex)}})),(s=this._slideCallback)==null||s.call(this,this._currentIndex)}_onDragStart(t){this._isDragging=!0,this._startY=t.data.global.y,this._offsetY=this._slideArea.y,bt.killTweensOf(this._slideArea),this._startTime=new Date().getTime()}_onDragMove(t){var s;if(!this._isDragging)return;const e=t.pageY-this._startY;this._slideArea.y=this._offsetY+e,(s=this._scrollCallback)==null||s.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,i=Math.abs(s)/e,n=.275,o=this._slideHeight/2,h=Math.round(s/this._slideHeight);(Math.abs(s)>o||i>n)&&(this._currentIndex+=h),this._currentIndex<0?this._currentIndex=0:this._currentIndex>this._pageNum&&(this._currentIndex=this._pageNum),this.slideTo(this._currentIndex)}}const D_=r=>{const t=new Ks;return t.beginFill(16777215),t.drawRect(0,0,r.width,r.height),t.endFill(),r.addChild(t),r.mask=t,t};class cI extends Ta{constructor(t,e,s,i){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,D_(this),this._slideWidth=t,this._slideArea=s,this.slideCallback=i,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?(bt.to(this._slideArea,{x:0,duration:.25}),this._currentIndex=0):t>this._pageNum?(bt.to(this._slideArea,{x:-this._pageNum*this._slideWidth,duration:.5}),this._currentIndex=this._pageNum):(this._currentIndex=t,bt.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,bt.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,i=Math.abs(s)/e,n=this._slideWidth/2,o=.275;(Math.abs(s)>n||i>o)&&(s>0?this._currentIndex++:this._currentIndex--),this._slideTo(this._currentIndex)}}class uI{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 dI{constructor(t){this._betAmountListLength=0;const{initialBetIndex:e,betAmountListLength:s,onAmountIndex:i,onDisabled:n}=t;this._onAmountIndex=i,this._onDisabled=n,this._betAmountListLength=s,this._baseNumSteper=new uI(s,o=>{this._onAmountIndex(o),this.minMaxUpdateIndex(o)}),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 O_=(r,t,e)=>{const s=t/r.width*r.scale.x,i=e?e/r.height*r.scale.y:s,n=Math.min(s,i);r.scale.set(n>1?1:n)};class fI extends Bt{constructor(t){super();const{data:e,cellWidth:s=130,cellHeight:i=100,fontColor:n="#B4B4B8",fontSize:o=24,lineWidth:h=3,lineColor:a="#B4B4B8"}=t;this._data=e,this._rows=e.length,this._cols=e[0].length,this._cellWidth=s,this._cellHeight=i,this._fontColor=n,this._fontSize=o,this._lineWidth=h,this._lineColor=a,this._drawTable(),this.fillNumbers()}_drawTable(){const t=this._cellWidth*this._cols,e=this._cellHeight*this._rows,s=new Ks;s.lineStyle(this._lineWidth,this._lineColor),s.drawRect(0,0,t,e);for(let i=1;i<this._rows;i++)s.moveTo(0,i*this._cellHeight),s.lineTo(t,i*this._cellHeight);for(let i=1;i<this._cols;i++)s.moveTo(i*this._cellWidth,0),s.lineTo(i*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 i=new zo(t.toString(),{_fontSize:this._fontSize,fill:this._fontColor}),n=e*this._cellWidth+this._cellWidth/2,o=s*this._cellHeight+this._cellHeight/2;this.addChild(i),i.anchor.set(.5),i.position.set(n,o),O_(i,this._cellWidth*.9)}}let L_;function pI(r){return L_=r,r}function Fa(){return L_}let mI=0;const od=class extends Vs{constructor(r){super(),this.id=mI++,this.init(r)}set(r,t){if(this[r]===void 0)throw new Error(`Property with name ${r} does not exist.`);switch(r){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:r}=this._source;return r/this._duration}get paused(){return this._paused}set paused(r){this._paused=r,this.refreshPaused()}_onPlay(){this._playing=!0}_onPause(){this._playing=!1}init(r){this._playing=!1,this._duration=r.source.duration;const t=this._source=r.source.cloneNode(!1);t.src=r.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),r.context.on("refresh",this.refresh,this),r.context.on("refreshPaused",this.refreshPaused,this),this._media=r}_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(r){this._speed=r,this.refresh()}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh()}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh()}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh()}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(r){console.warn("HTML Audio does not support filters")}refresh(){const r=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;const e=r.volume*(r.muted?0:1),s=t.volume*(t.muted?0:1),i=this._volume*(this._muted?0:1);this._source.volume=i*e*s,this._source.playbackRate=this._speed*r.speed*t.speed}refreshPaused(){const r=this._media.context,t=this._media.parent,e=this._paused||t.paused||r.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(r){const{start:t,end:e,speed:s,loop:i,volume:n,muted:o}=r;e&&console.assert(e>t,"End time is before start time"),this._speed=s,this._volume=n,this._loop=!!i,this._muted=o,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-od.PADDING),this._end=Math.min(this._end+od.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t,this._duration),Tt.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(){Tt.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this)}destroy(){Tt.shared.remove(this._onUpdate,this),this.removeAllListeners();const r=this._source;r&&(r.onended=null,r.onplay=null,r.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 N_=od;N_.PADDING=.1;class gI extends Vs{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url)}create(){return new N_(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 a=s.autoPlayStart();t&&setTimeout(()=>{t(null,s,a)},0);return}if(!s.url){t(new Error("sound.url or sound.source must be set"));return}e.src=s.url;const i=()=>{h(),s.isLoaded=!0;const a=s.autoPlayStart();t&&t(null,s,a)},n=()=>{h(),t&&t(new Error("Sound loading has been aborted"))},o=()=>{h();const a=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(a)):console.error(a)},h=()=>{e.removeEventListener("canplaythrough",i),e.removeEventListener("load",i),e.removeEventListener("abort",n),e.removeEventListener("error",o)};e.addEventListener("canplaythrough",i,!1),e.addEventListener("load",i,!1),e.addEventListener("abort",n,!1),e.addEventListener("error",o,!1),e.load()}}class _I{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 yh=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],xI=["audio/mpeg","audio/ogg"],vh={};function yI(r){const t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...r||{}},e=document.createElement("audio"),s={},i=/^no$/;yh.forEach(n=>{const o=e.canPlayType(`audio/${n}`).replace(i,""),h=t[n]?e.canPlayType(t[n]).replace(i,""):"";s[n]=!!o||!!h}),Object.assign(vh,s)}yI();class hd{static setParamValue(t,e){if(t.setValueAtTime){const s=Fa().context;t.setValueAtTime(e,s.audioContext.currentTime)}else t.value=e;return e}}let vI=0;class bI extends Vs{constructor(t){super(),this.id=vI++,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),i=e.volume*(e.muted?0:1),n=this._volume*(this._muted?0:1);hd.setParamValue(this._gain.gain,n*i*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:i,loop:n,volume:o,muted:h,filters:a}=t;s&&console.assert(s>e,"End time is before start time"),this._paused=!1;const{source:l,gain:c}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=c,this._speed=i,this._volume=o,this._loop=!!n,this._muted=h,this._filters=a,this.refresh();const d=this._source.buffer.duration;this._duration=d,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){Tt.shared.remove(this._updateListener,this),t&&Tt.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 i=this._source.playbackRate.value;this._elapsed+=s*i,this._lastUpdate=e;const n=this._duration;let o;if(this._source.loopStart){const h=this._source.loopEnd-this._source.loopStart;o=(this._source.loopStart+this._elapsed%h)/n}else o=this._elapsed%n/n;this._progress=o,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 U_{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 V_=class extends U_{constructor(r){const t=r.audioContext,e=t.createBufferSource(),s=t.createGain(),i=t.createAnalyser();e.connect(i),i.connect(s),s.connect(r.destination),super(i,s),this.context=r,this.bufferSource=e,this.gain=s,this.analyser=i}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(V_.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 r=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=r.buffer,hd.setParamValue(t.playbackRate,r.playbackRate.value),t.loop=r.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 X_=V_;X_.BUFFER_SIZE=0;class wI{init(t){this.parent=t,this._nodes=new X_(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 bI(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=(i,n)=>{if(i)e&&e(i);else{this.parent.isLoaded=!0,this.buffer=n;const o=this.parent.autoPlayStart();e&&e(null,this.parent,o)}};t instanceof AudioBuffer?s(null,t):this.parent.context.decode(t,s)}}const Mn=class{static from(r){let t={};typeof r=="string"?t.url=r:r instanceof ArrayBuffer||r instanceof AudioBuffer||r instanceof HTMLAudioElement?t.source=r:Array.isArray(r)?t.url=r:t=r,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=Fa().useLegacy?new gI:new wI;return new Mn(e,t)}constructor(r,t){this.media=r,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(r){const[t]=r.map(e=>({url:e,ext:vt.extname(e).slice(1)})).filter(({ext:e})=>vh[e]).sort((e,s)=>yh.indexOf(e.ext)-yh.indexOf(s.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return Fa().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(r){this._paused=r,this.refreshPaused()}get speed(){return this._speed}set speed(r){this._speed=r,this.refresh()}get filters(){return this.media.filters}set filters(r){this.media.filters=r}addSprites(r,t){if(typeof r=="object"){const s={};for(const i in r)s[i]=this.addSprites(i,r[i]);return s}console.assert(!this._sprites[r],`Alias ${r} is already taken`);const e=new _I(this,t);return this._sprites[r]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null}removeSprites(r){if(r){const t=this._sprites[r];t!==void 0&&(t.destroy(),delete this._sprites[r])}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 r=this._instances.length-1;r>=0;r--)this._instances[r].stop();return this}play(r,t){let e;if(typeof r=="string"?e={sprite:r,loop:this.loop,complete:t}:typeof r=="function"?(e={},e.complete=r):e=r,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:!1,loop:!1,...e||{}},e.sprite){const i=e.sprite;console.assert(!!this._sprites[i],`Alias ${i} is not available`);const n=this._sprites[i];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(i=>{this._preloadQueue.push(()=>{i(this.play(e))})}):(this._preloadQueue=[],this.autoPlay=!0,this._autoPlayOptions=e,new Promise((i,n)=>{this._preload((o,h,a)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,o?n(o):(e.loaded&&e.loaded(o,h,a),i(a))})}));(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 r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refresh()}refreshPaused(){const r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refreshPaused()}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh()}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh()}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh()}_preload(r){this.media.load(r)}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let r;return this.autoPlay&&(r=this.play(this._autoPlayOptions)),r}_removeInstances(){for(let r=this._instances.length-1;r>=0;r--)this._poolInstance(this._instances[r]);this._instances.length=0}_onComplete(r){if(this._instances){const t=this._instances.indexOf(r);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0}this._poolInstance(r)}_createInstance(){if(Mn._pool.length>0){const r=Mn._pool.pop();return r.init(this.media),r}return this.media.create()}_poolInstance(r){r.destroy(),Mn._pool.indexOf(r)<0&&Mn._pool.push(r)}};let bh=Mn;bh._pool=[];class EI extends Vs{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 ka extends U_{constructor(){const t=window,e=new ka.AudioContext,s=e.createDynamicsCompressor(),i=e.createAnalyser();i.connect(s),s.connect(e.destination),super(i,s),this.autoPause=!0,this._ctx=e,this._offlineCtx=new ka.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=s,this.analyser=i,this.events=new Vs,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"))},i=this._offlineCtx.decodeAudioData(t,n=>{e(null,n)},s);i&&i.catch(s)}}class TI{constructor(){this.init()}init(){return this.supported&&(this._webAudioContext=new ka),this._htmlAudioContext=new EI,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 ka.AudioContext!==null}add(t,e){if(typeof t=="object"){const n={};for(const o in t){const h=this._getOptions(t[o],e);n[o]=this.add(o,h)}return n}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof bh)return this._sounds[t]=e,e;const s=this._getOptions(e),i=bh.from(s);return this._sounds[t]=i,i}_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 G_=r=>{var e;const t=r.src;return((e=r==null?void 0:r.alias)==null?void 0:e[0])??vt.basename(t,vt.extname(t))},AI={extension:Y.Asset,detection:{test:async()=>!0,add:async r=>[...r,...yh.filter(t=>vh[t])],remove:async r=>r.filter(t=>r.includes(t))},loader:{extension:{type:[Y.LoadParser],priority:Ne.High},test(r){const t=vt.extname(r).slice(1);return!!vh[t]||xI.some(e=>r.startsWith(`data:${e}`))},async load(r,t){const e=await new Promise((s,i)=>bh.from({...t.data,url:r,preload:!0,loaded(n,o){var h,a;n?i(n):s(o),(a=(h=t.data)==null?void 0:h.loaded)==null||a.call(h,n,o)}}));return Fa().add(G_(t),e),e},async unload(r,t){Fa().remove(G_(t))}}};Z.add(AI),pI(new TI);class SI{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(i=>{t?i.audio.play():i.audio.pause()})},this._musicPlayer=new Audio,document.addEventListener("visibilitychange",()=>{this._isBackground=document.hidden,this._setPlayStatus(!document.hidden)})}playEffect(t,e){return new Promise(s=>{const i=new Date().getTime(),n=Vi.get(t).url,o=new Audio(n);o.muted=this._isBackground||!this.effectEnabled,o.addEventListener("ended",()=>{this._playingList=this._playingList.filter(h=>h.id!==i),s()}),o.play().then(()=>{if(e){const a=o.duration-e;o.currentTime=Math.max(a,0)}this._playingList.push({id:i,audio:o,url:n})}).catch(()=>{})})}async playMusic(t){var i;this._musicPlayer&&(bt.killTweensOf(this._musicPlayer),await bt.to(this._musicPlayer,{volume:0,duration:1,ease:"linear"}),(i=this._musicPlayer)==null||i.pause());const e=Vi.get(t).url;this._musicPlayer.src=e,this._musicPlayer.loop=!0,this._musicPlayer.volume=0;const s=()=>{this._musicPlayer.play().then(()=>{this._isMusicPaused=!1,bt.killTweensOf(this._musicPlayer),bt.to(this._musicPlayer,{volume:1,duration:1,ease:"linear"})}).catch(()=>{requestAnimationFrame(s.bind(this))})};s()}pauseMusic(){var t;this._isMusicPaused=!0,(t=this._musicPlayer)==null||t.pause()}resumeMusic(){var t;this._isMusicPaused=!1,(t=this._musicPlayer)==null||t.play()}stopEffect(t){const e=Vi.get(t).url;this._playingList.forEach(s=>{s.url===e&&s.audio.pause()}),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){this._musicPlayer.muted=t||!this.musicEnabled}_setEffectMute(t){this._playingList.forEach(e=>{e.audio.muted=t||!this.effectEnabled})}}const CI=r=>{const{texture:t,dotWidth:e,width:s,height:i}=r;let n=[];Array.isArray(e)?n=e:n=[e,e,e,e];const o=new RT(t,n[0],n[1],n[2],n[3]);return o.width=s,o.height=i,o},II=(r,t,e)=>{let s=!1;return r.cursor="pointer",r.eventMode="static",r.on(t,i=>{s||i.button!==2&&e(i)}),()=>{s=!0}},PI=(r,t,e=0)=>parseFloat((Math.random()*(t-r)+r).toFixed(e)),RI=(r,t)=>{let e=0;const s=new Tt,i=n=>{e+=n*s.deltaMS;let o=0;Array.isArray(t)?o=PI(t[0],t[1],2):o=t,e>=o&&(r(),e=0)};return s.add(i),s.start(),()=>{s.remove(i),s.stop()}},MI=(r,t,e)=>{const s=i=>{const n=t.getBounds().contains(i.clientX,i.clientY),o=r.getBounds().contains(i.clientX,i.clientY);!n&&!o&&r.visible&&(e(),window.removeEventListener("pointerdown",s))};return window.addEventListener("pointerdown",s),()=>{window.removeEventListener("pointerdown",s)}},FI=(r=1,t)=>new Promise(e=>{let s=0;const i=new Tt,n=()=>{s+=i.deltaMS,s>=r&&(t==null||t(),i.destroy(),e())};i.add(n),i.start()}),kI=(r,t)=>{let e;if(r==="brightness")e=new hn,e.brightness(t,!1);else if(r==="blur")e=new nm;else if(r==="desaturate")e=new hn,e.desaturate();else if(r==="contrast")e=new hn,e.contrast(t,!1);else throw new Error("未知滤镜名称");return e.resolution=window.devicePixelRatio||1,e};var BI=`attribute vec2 aVertexPosition;
|
|
1170
1172
|
attribute vec2 aTextureCoord;
|
|
1171
1173
|
|
|
1172
1174
|
uniform mat3 projectionMatrix;
|
|
@@ -1177,7 +1179,7 @@ void main(void)
|
|
|
1177
1179
|
{
|
|
1178
1180
|
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
1179
1181
|
vTextureCoord = aTextureCoord;
|
|
1180
|
-
}`,
|
|
1182
|
+
}`,DI=`
|
|
1181
1183
|
varying vec2 vTextureCoord;
|
|
1182
1184
|
uniform sampler2D uSampler;
|
|
1183
1185
|
|
|
@@ -1203,7 +1205,7 @@ void main(void)
|
|
|
1203
1205
|
color *= 0.25;
|
|
1204
1206
|
|
|
1205
1207
|
gl_FragColor = color;
|
|
1206
|
-
}`,
|
|
1208
|
+
}`,OI=`
|
|
1207
1209
|
varying vec2 vTextureCoord;
|
|
1208
1210
|
uniform sampler2D uSampler;
|
|
1209
1211
|
|
|
@@ -1231,7 +1233,7 @@ void main(void)
|
|
|
1231
1233
|
|
|
1232
1234
|
gl_FragColor = color;
|
|
1233
1235
|
}
|
|
1234
|
-
`;let
|
|
1236
|
+
`;let $_=class extends pe{constructor(t=4,e=3,s=!1){super(BI,s?OI:DI),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,i){const n=this._pixelSize.x/e._frame.width,o=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*o,t.applyFilter(this,e,s,i);else{const a=t.getFilterTexture();let l=e,c=a,d;const u=this._quality-1;for(let f=0;f<u;f++)h=this._kernels[f]+.5,this.uniforms.uOffset[0]=h*n,this.uniforms.uOffset[1]=h*o,t.applyFilter(this,l,c,1),d=l,l=c,c=d;h=this._kernels[u]+.5,this.uniforms.uOffset[0]=h*n,this.uniforms.uOffset[1]=h*o,t.applyFilter(this,l,s,i),t.returnFilterTexture(a)}}_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 i=t;const n=t/e;for(let o=1;o<e;o++)i-=n,s.push(i)}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 LI=`attribute vec2 aVertexPosition;
|
|
1235
1237
|
attribute vec2 aTextureCoord;
|
|
1236
1238
|
|
|
1237
1239
|
uniform mat3 projectionMatrix;
|
|
@@ -1242,7 +1244,7 @@ void main(void)
|
|
|
1242
1244
|
{
|
|
1243
1245
|
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
1244
1246
|
vTextureCoord = aTextureCoord;
|
|
1245
|
-
}`,
|
|
1247
|
+
}`,NI=`varying vec2 vTextureCoord;
|
|
1246
1248
|
uniform sampler2D uSampler;
|
|
1247
1249
|
uniform float alpha;
|
|
1248
1250
|
uniform vec3 color;
|
|
@@ -1260,4 +1262,4 @@ void main(void){
|
|
|
1260
1262
|
sample *= alpha;
|
|
1261
1263
|
|
|
1262
1264
|
gl_FragColor = sample;
|
|
1263
|
-
}`,
|
|
1265
|
+
}`,UI=Object.defineProperty,Y_=Object.getOwnPropertySymbols,VI=Object.prototype.hasOwnProperty,XI=Object.prototype.propertyIsEnumerable,H_=(r,t,e)=>t in r?UI(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,W_=(r,t)=>{for(var e in t||(t={}))VI.call(t,e)&&H_(r,e,t[e]);if(Y_)for(var e of Y_(t))XI.call(t,e)&&H_(r,e,t[e]);return r};const ld=class extends pe{constructor(r){super(),this.angle=45,this._distance=5,this._resolution=z.FILTER_RESOLUTION;const t=r?W_(W_({},ld.defaults),r):ld.defaults,{kernels:e,blur:s,quality:i,pixelSize:n,resolution:o}=t;this._offset=new zs(this._updatePadding,this),this._tintFilter=new pe(LI,NI),this._tintFilter.uniforms.color=new Float32Array(4),this._tintFilter.uniforms.shift=this._offset,this._tintFilter.resolution=o,this._blurFilter=e?new $_(e):new $_(s,i),this.pixelSize=n,this.resolution=o;const{shadowOnly:h,rotation:a,distance:l,offset:c,alpha:d,color:u}=t;this.shadowOnly=h,a!==void 0&&l!==void 0?(this.rotation=a,this.distance=l):this.offset=c,this.alpha=d,this.color=u}apply(r,t,e,s){const i=r.getFilterTexture();this._tintFilter.apply(r,t,i,1),this._blurFilter.apply(r,i,e,s),this.shadowOnly!==!0&&r.applyFilter(this,t,e,0),r.returnFilterTexture(i)}_updatePadding(){const r=Math.max(Math.abs(this._offset.x),Math.abs(this._offset.y));this.padding=r+this.blur*2}_updateShift(){this._tintFilter.uniforms.shift.set(this.distance*Math.cos(this.angle),this.distance*Math.sin(this.angle))}set offset(r){this._offset.copyFrom(r),this._updatePadding()}get offset(){return this._offset}get resolution(){return this._resolution}set resolution(r){this._resolution=r,this._tintFilter&&(this._tintFilter.resolution=r),this._blurFilter&&(this._blurFilter.resolution=r)}get distance(){return this._distance}set distance(r){at("5.3.0","DropShadowFilter distance is deprecated, use offset"),this._distance=r,this._updatePadding(),this._updateShift()}get rotation(){return this.angle/kl}set rotation(r){at("5.3.0","DropShadowFilter rotation is deprecated, use offset"),this.angle=r*kl,this._updateShift()}get alpha(){return this._tintFilter.uniforms.alpha}set alpha(r){this._tintFilter.uniforms.alpha=r}get color(){return ea(this._tintFilter.uniforms.color)}set color(r){Kf(r,this._tintFilter.uniforms.color)}get kernels(){return this._blurFilter.kernels}set kernels(r){this._blurFilter.kernels=r}get blur(){return this._blurFilter.blur}set blur(r){this._blurFilter.blur=r,this._updatePadding()}get quality(){return this._blurFilter.quality}set quality(r){this._blurFilter.quality=r}get pixelSize(){return this._blurFilter.pixelSize}set pixelSize(r){this._blurFilter.pixelSize=r}};let z_=ld;z_.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=(r,t)=>{const{color:e="#000",alpha:s=.25,blur:i=1,distance:n=0,offset:o={x:0,y:0}}=t||{},h=new z_({color:e,alpha:s,blur:i,distance:n,offset:o});h.resolution=window.devicePixelRatio||1,r.filters=[h]},$I=(r,t=1)=>{let e=0;const s=new Tt,i=()=>{if(e+=s.deltaMS,e>=t){r==null||r();try{s.destroy()}catch{}}};return s.add(i),s.start(),()=>{try{s.destroy()}catch{}}};class YI{constructor(t){this._isDragging=!1,this._moveX=0,this._lastMoveX=0,this._progress=0;const{app:e,clickArea:s,maxMoveDistance:i,onChange:n,onDown:o,onUp:h,sideArea:a}=t;this._app=e,this._maxMoveDistance=i,this._onChange=n,this._onDown=o,this._onUp=h,this._sideArea=a,s.forEach(l=>{Ri(l,"pointerdown",this._onDragStart.bind(this))}),Ri(a,"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)}}const HI=Object.freeze(Object.defineProperty({__proto__:null,Components:{Base:{LibPixiBitText:lA,LibPixiContainer:Ta,LibPixiParticleMove:BS,LibPixiRectBgColor:lu,LibPixiSpine:sI,LibPixiText:Du},Custom:{LibPixiButtonHover:iI,LibPixiCloseBtn:rI,LibPixiDrawer:nI,LibPixiPerforMon:aI,LibPixiProgress:oI,LibPixiScrollContainer:hI,LibPixiScrollNum:lI,LibPixiSlider:cI,LibPixiSubAddMinMax:dI,LibPixiTable:fI}},Utils:{LibPixiAudio:SI,libPixiCreateNineGrid:CI,libPixiEvent:Ri,libPixiEventControlled:II,libPixiFilter:kI,libPixiIntervalTrigger:RI,libPixiOutsideClick:MI,libPixiOverflowHidden:D_,libPixiPromiseTickerTimeout:FI,libPixiScaleContainer:O_,libPixiShadow:GI,libPixiTickerTimeout:$I,LibPixiSlideInput:YI}},Symbol.toStringTag,{value:"Module"}));window.LibPixiJs=HI});
|