lyb-pixi-js 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +211 -0
- package/dist/Base/LibBitText/index.d.ts +18 -0
- package/dist/Base/LibBitText/index.js +26 -0
- package/dist/Base/LibContainer/index.d.ts +27 -0
- package/dist/Base/LibContainer/index.js +65 -0
- package/dist/Base/LibParticleMove/index.d.ts +37 -0
- package/dist/Base/LibParticleMove/index.js +127 -0
- package/dist/Base/LibRectBgColor/index.d.ts +27 -0
- package/dist/Base/LibRectBgColor/index.js +59 -0
- package/dist/Base/LibSpine/index.d.ts +56 -0
- package/dist/Base/LibSpine/index.js +151 -0
- package/dist/Base/LibText/index.d.ts +35 -0
- package/dist/Base/LibText/index.js +50 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/libPixiJs.d.ts +21 -0
- package/dist/libPixiJs.js +21 -0
- package/package.json +48 -0
- package/umd/lybPixi.js +1169 -0
- package/umd/particle/fly.json +1 -0
- package/umd/particle/fly.png +0 -0
- package/umd/pixi-spine.js +12 -0
- package/umd/pixi.min.js +1108 -0
- package/umd/spine/Bl_logo.atlas +342 -0
- package/umd/spine/Bl_logo.json +1 -0
- package/umd/spine/Bl_logo.png +0 -0
package/umd/lybPixi.js
ADDED
|
@@ -0,0 +1,1169 @@
|
|
|
1
|
+
(function(Ye){typeof define=="function"&&define.amd?define(Ye):Ye()})(function(){"use strict";var Ye=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Ye||{}),kc=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(kc||{}),co=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(co||{}),K=(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))(K||{}),Le=(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))(Le||{}),O=(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))(O||{}),kr=(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))(kr||{}),Z=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(Z||{}),V=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(V||{}),_i=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(_i||{}),Li=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Li||{}),je=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(je||{}),oe=(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))(oe||{}),qe=(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))(qe||{}),uo=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(uo||{}),Ae=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Ae||{}),Ut=(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))(Ut||{}),Nt=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Nt||{}),Ke=(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))(Ke||{});const H={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 fo=/iPhone/i,Uc=/iPod/i,Gc=/iPad/i,Vc=/\biOS-universal(?:.+)Mac\b/i,po=/\bAndroid(?:.+)Mobile\b/i,Hc=/Android/i,Ur=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Cn=/Silk/i,yi=/Windows Phone/i,Xc=/\bWindows(?:.+)ARM\b/i,Wc=/BlackBerry/i,$c=/BB10/i,zc=/Opera Mini/i,Yc=/\b(CriOS|Chrome)(?:.+)Mobile/i,jc=/Mobile(?:.+)Firefox\b/i,qc=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function Jm(r){return function(t){return t.test(r)}}function Kc(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,i=e.split("[FBAN");typeof i[1]<"u"&&(e=i[0]),i=e.split("Twitter"),typeof i[1]<"u"&&(e=i[0]);var s=Jm(e),n={apple:{phone:s(fo)&&!s(yi),ipod:s(Uc),tablet:!s(fo)&&(s(Gc)||qc(t))&&!s(yi),universal:s(Vc),device:(s(fo)||s(Uc)||s(Gc)||s(Vc)||qc(t))&&!s(yi)},amazon:{phone:s(Ur),tablet:!s(Ur)&&s(Cn),device:s(Ur)||s(Cn)},android:{phone:!s(yi)&&s(Ur)||!s(yi)&&s(po),tablet:!s(yi)&&!s(Ur)&&!s(po)&&(s(Cn)||s(Hc)),device:!s(yi)&&(s(Ur)||s(Cn)||s(po)||s(Hc))||s(/\bokhttp\b/i)},windows:{phone:s(yi),tablet:s(Xc),device:s(yi)||s(Xc)},other:{blackberry:s(Wc),blackberry10:s($c),opera:s(zc),firefox:s(jc),chrome:s(Yc),device:s(Wc)||s($c)||s(zc)||s(jc)||s(Yc)},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 tg=Kc.default??Kc,xi=tg(globalThis.navigator);H.RETINA_PREFIX=/@([0-9\.]+)x/,H.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Ms=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Zc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function eg(r){if(r.__esModule)return r;var t=r.default;if(typeof t=="function"){var e=function i(){return this instanceof i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var s=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return r[i]}})}),e}var Qc={exports:{}};(function(r){var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function s(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 s(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 g=this._events[m],y=arguments.length,v,_;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,v=new Array(y-1);_<y;_++)v[_-1]=arguments[_];g.fn.apply(g.context,v)}else{var x=g.length,b;for(_=0;_<x;_++)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,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: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,r.exports=o})(Qc);var ig=Qc.exports;const Ds=Zc(ig);var mo={exports:{}};mo.exports=Pn,mo.exports.default=Pn;function Pn(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,n=Jc(r,0,s,e,!0),a=[];if(!n||n.next===n.prev)return a;var o,h,l,c,d,u,f;if(i&&(n=og(r,t,n,e)),r.length>80*e){o=l=r[0],h=c=r[1];for(var p=e;p<s;p+=e)d=r[p],u=r[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 Bs(n,a,e,o,h,f,0),a}function Jc(r,t,e,i,s){var n,a;if(s===yo(r,t,e,i)>0)for(n=t;n<e;n+=i)a=iu(n,r[n],r[n+1],a);else for(n=e-i;n>=t;n-=i)a=iu(n,r[n],r[n+1],a);return a&&Rn(a,a.next)&&(Fs(a),a=a.next),a}function or(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(Rn(e,e.next)||bt(e.prev,e,e.next)===0)){if(Fs(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Bs(r,t,e,i,s,n,a){if(r){!a&&n&&dg(r,i,s,n);for(var o=r,h,l;r.prev!==r.next;){if(h=r.prev,l=r.next,n?sg(r,i,s,n):rg(r)){t.push(h.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),Fs(r),r=l.next,o=l.next;continue}if(r=l,r===o){a?a===1?(r=ng(or(r),t,e),Bs(r,t,e,i,s,n,2)):a===2&&ag(r,t,e,i,s,n):Bs(or(r),t,e,i,s,n,1);break}}}}function rg(r){var t=r.prev,e=r,i=r.next;if(bt(t,e,i)>=0)return!1;for(var s=t.x,n=e.x,a=i.x,o=t.y,h=e.y,l=i.y,c=s<n?s<a?s:a:n<a?n:a,d=o<h?o<l?o:l:h<l?h:l,u=s>n?s>a?s: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&&Gr(s,o,n,h,a,l,p.x,p.y)&&bt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function sg(r,t,e,i){var s=r.prev,n=r,a=r.next;if(bt(s,n,a)>=0)return!1;for(var o=s.x,h=n.x,l=a.x,c=s.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,g=c>d?c>u?c:u:d>u?d:u,y=go(f,p,t,e,i),v=go(m,g,t,e,i),_=r.prevZ,x=r.nextZ;_&&_.z>=y&&x&&x.z<=v;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==s&&_!==a&&Gr(o,c,h,d,l,u,_.x,_.y)&&bt(_.prev,_,_.next)>=0||(_=_.prevZ,x.x>=f&&x.x<=m&&x.y>=p&&x.y<=g&&x!==s&&x!==a&&Gr(o,c,h,d,l,u,x.x,x.y)&&bt(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;_&&_.z>=y;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==s&&_!==a&&Gr(o,c,h,d,l,u,_.x,_.y)&&bt(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;x&&x.z<=v;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=g&&x!==s&&x!==a&&Gr(o,c,h,d,l,u,x.x,x.y)&&bt(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function ng(r,t,e){var i=r;do{var s=i.prev,n=i.next.next;!Rn(s,n)&&tu(s,i,i.next,n)&&Os(s,n)&&Os(n,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),Fs(i),Fs(i.next),i=r=n),i=i.next}while(i!==r);return or(i)}function ag(r,t,e,i,s,n){var a=r;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&mg(a,o)){var h=eu(a,o);a=or(a,a.next),h=or(h,h.next),Bs(a,t,e,i,s,n,0),Bs(h,t,e,i,s,n,0);return}o=o.next}a=a.next}while(a!==r)}function og(r,t,e,i){var s=[],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:r.length,l=Jc(r,o,h,i,!1),l===l.next&&(l.steiner=!0),s.push(pg(l));for(s.sort(hg),n=0;n<s.length;n++)e=lg(s[n],e);return e}function hg(r,t){return r.x-t.x}function lg(r,t){var e=cg(r,t);if(!e)return t;var i=eu(e,r);return or(i,i.next),or(e,e.next)}function cg(r,t){var e=t,i=r.x,s=r.y,n=-1/0,a;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var o=e.x+(s-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&&Gr(s<c?i:n,s,l,c,s<c?n:i,s,e.x,e.y)&&(u=Math.abs(s-e.y)/(i-e.x),Os(e,r)&&(u<d||u===d&&(e.x>a.x||e.x===a.x&&ug(a,e)))&&(a=e,d=u)),e=e.next;while(e!==h);return a}function ug(r,t){return bt(r.prev,r,t.prev)<0&&bt(t.next,r,r.next)<0}function dg(r,t,e,i){var s=r;do s.z===0&&(s.z=go(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,fg(s)}function fg(r){var t,e,i,s,n,a,o,h,l=1;do{for(e=r,r=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)?(s=e,e=e.nextZ,o--):(s=i,i=i.nextZ,h--),n?n.nextZ=s:r=s,s.prevZ=n,n=s;e=i}n.nextZ=null,l*=2}while(a>1);return r}function go(r,t,e,i,s){return r=(r-e)*s|0,t=(t-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function pg(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 Gr(r,t,e,i,s,n,a,o){return(s-a)*(t-o)>=(r-a)*(n-o)&&(r-a)*(i-o)>=(e-a)*(t-o)&&(e-a)*(n-o)>=(s-a)*(i-o)}function mg(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!gg(r,t)&&(Os(r,t)&&Os(t,r)&&_g(r,t)&&(bt(r.prev,r,t.prev)||bt(r,t.prev,t))||Rn(r,t)&&bt(r.prev,r,r.next)>0&&bt(t.prev,t,t.next)>0)}function bt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Rn(r,t){return r.x===t.x&&r.y===t.y}function tu(r,t,e,i){var s=Mn(bt(r,t,e)),n=Mn(bt(r,t,i)),a=Mn(bt(e,i,r)),o=Mn(bt(e,i,t));return!!(s!==n&&a!==o||s===0&&In(r,e,t)||n===0&&In(r,i,t)||a===0&&In(e,r,i)||o===0&&In(e,t,i))}function In(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 Mn(r){return r>0?1:r<0?-1:0}function gg(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&&tu(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Os(r,t){return bt(r.prev,r,r.next)<0?bt(r,t,r.next)>=0&&bt(r,r.prev,t)>=0:bt(r,t,r.prev)<0||bt(r,r.next,t)<0}function _g(r,t){var e=r,i=!1,s=(r.x+t.x)/2,n=(r.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&s<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==r);return i}function eu(r,t){var e=new _o(r.i,r.x,r.y),i=new _o(t.i,t.x,t.y),s=r.next,n=t.prev;return r.next=t,t.prev=r,e.next=s,s.prev=e,i.next=e,e.prev=i,n.next=i,i.prev=n,i}function iu(r,t,e,i){var s=new _o(r,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function Fs(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 _o(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}Pn.deviation=function(r,t,e,i){var s=t&&t.length,n=s?t[0]*e:r.length,a=Math.abs(yo(r,0,n,e));if(s)for(var o=0,h=t.length;o<h;o++){var l=t[o]*e,c=o<h-1?t[o+1]*e:r.length;a-=Math.abs(yo(r,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((r[u]-r[p])*(r[f+1]-r[u+1])-(r[u]-r[f])*(r[p+1]-r[u+1]))}return a===0&&d===0?0:Math.abs((d-a)/a)};function yo(r,t,e,i){for(var s=0,n=t,a=e-i;n<e;n+=i)s+=(r[a]-r[n])*(r[n+1]+r[a+1]),a=n;return s}Pn.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,s=0;s<r.length;s++){for(var n=0;n<r[s].length;n++)for(var a=0;a<t;a++)e.vertices.push(r[s][n][a]);s>0&&(i+=r[s-1].length,e.holes.push(i))}return e};var yg=mo.exports;const xg=Zc(yg);var Dn={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */Dn.exports,function(r,t){(function(e){var i=t&&!t.nodeType&&t,s=r&&!r.nodeType&&r,n=typeof Ms=="object"&&Ms;(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="-",g=/^xn--/,y=/[^\x20-\x7E]/,v=/[\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"},x=h-l,b=Math.floor,E=String.fromCharCode,T;function w(I){throw new RangeError(_[I])}function A(I,D){for(var $=I.length,z=[];$--;)z[$]=D(I[$]);return z}function P(I,D){var $=I.split("@"),z="";$.length>1&&(z=$[0]+"@",I=$[1]),I=I.replace(v,".");var U=I.split("."),rt=A(U,D).join(".");return z+rt}function L(I){for(var D=[],$=0,z=I.length,U,rt;$<z;)U=I.charCodeAt($++),U>=55296&&U<=56319&&$<z?(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,$+=E(D>>>10&1023|55296),D=56320|D&1023),$+=E(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 z=0;for(I=$?b(I/u):I>>1,I+=b(I/D);I>x*c>>1;z+=h)I=b(I/x);return b(z+(x+1)*I/(I+d))}function k(I){var D=[],$=I.length,z,U=0,rt=p,ut=f,lt,yt,Rt,Bt,pt,It,vt,pe,Ee;for(lt=I.lastIndexOf(m),lt<0&&(lt=0),yt=0;yt<lt;++yt)I.charCodeAt(yt)>=128&&w("not-basic"),D.push(I.charCodeAt(yt));for(Rt=lt>0?lt+1:0;Rt<$;){for(Bt=U,pt=1,It=h;Rt>=$&&w("invalid-input"),vt=S(I.charCodeAt(Rt++)),(vt>=h||vt>b((o-U)/pt))&&w("overflow"),U+=vt*pt,pe=It<=ut?l:It>=ut+c?c:It-ut,!(vt<pe);It+=h)Ee=h-pe,pt>b(o/Ee)&&w("overflow"),pt*=Ee;z=D.length+1,ut=R(U-Bt,z,Bt==0),b(U/z)>o-rt&&w("overflow"),rt+=b(U/z),U%=z,D.splice(U++,0,rt)}return M(D)}function F(I){var D,$,z,U,rt,ut,lt,yt,Rt,Bt,pt,It=[],vt,pe,Ee,nr;for(I=L(I),vt=I.length,D=p,$=0,rt=f,ut=0;ut<vt;++ut)pt=I[ut],pt<128&&It.push(E(pt));for(z=U=It.length,U&&It.push(m);z<vt;){for(lt=o,ut=0;ut<vt;++ut)pt=I[ut],pt>=D&&pt<lt&&(lt=pt);for(pe=z+1,lt-D>b((o-$)/pe)&&w("overflow"),$+=(lt-D)*pe,D=lt,ut=0;ut<vt;++ut)if(pt=I[ut],pt<D&&++$>o&&w("overflow"),pt==D){for(yt=$,Rt=h;Bt=Rt<=rt?l:Rt>=rt+c?c:Rt-rt,!(yt<Bt);Rt+=h)nr=yt-Bt,Ee=h-Bt,It.push(E(C(Bt+nr%Ee,0))),yt=b(nr/Ee);It.push(E(C(yt,0))),rt=R($,pe,z==U),$=0,++z}++$,++D}return It.join("")}function B(I){return P(I,function(D){return g.test(D)?k(D.slice(4).toLowerCase()):D})}function X(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:k,encode:F,toASCII:X,toUnicode:B},i&&s)if(r.exports==i)s.exports=a;else for(T in a)a.hasOwnProperty(T)&&(i[T]=a[T]);else e.punycode=a})(Ms)}(Dn,Dn.exports);var vg=Dn.exports,Vr=TypeError;const bg=eg(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var xo=typeof Map=="function"&&Map.prototype,vo=Object.getOwnPropertyDescriptor&&xo?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Bn=xo&&vo&&typeof vo.get=="function"?vo.get:null,ru=xo&&Map.prototype.forEach,bo=typeof Set=="function"&&Set.prototype,To=Object.getOwnPropertyDescriptor&&bo?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,On=bo&&To&&typeof To.get=="function"?To.get:null,su=bo&&Set.prototype.forEach,Tg=typeof WeakMap=="function"&&WeakMap.prototype,Ls=Tg?WeakMap.prototype.has:null,Eg=typeof WeakSet=="function"&&WeakSet.prototype,Ns=Eg?WeakSet.prototype.has:null,wg=typeof WeakRef=="function"&&WeakRef.prototype,nu=wg?WeakRef.prototype.deref:null,Ag=Boolean.prototype.valueOf,Sg=Object.prototype.toString,Cg=Function.prototype.toString,Pg=String.prototype.match,Eo=String.prototype.slice,Ni=String.prototype.replace,Rg=String.prototype.toUpperCase,au=String.prototype.toLowerCase,ou=RegExp.prototype.test,hu=Array.prototype.concat,Ze=Array.prototype.join,Ig=Array.prototype.slice,lu=Math.floor,wo=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ao=Object.getOwnPropertySymbols,So=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Hr=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Zt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Hr||"symbol")?Symbol.toStringTag:null,cu=Object.prototype.propertyIsEnumerable,uu=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function du(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||ou.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-lu(-r):lu(r);if(i!==r){var s=String(i),n=Eo.call(t,s.length+1);return Ni.call(s,e,"$&_")+"."+Ni.call(Ni.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Ni.call(t,e,"$&_")}var Co=bg,fu=Co.custom,pu=yu(fu)?fu:null,mu={__proto__:null,double:'"',single:"'"},Mg={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},Fn=function r(t,e,i,s){var n=e||{};if(vi(n,"quoteStyle")&&!vi(mu,n.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(vi(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=vi(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(vi(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(vi(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 vu(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return o?du(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return o?du(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 Po(t)?"[Array]":"[Object]";var d=qg(n,i);if(typeof s>"u")s=[];else if(xu(s,t)>=0)return"[Circular]";function u(S,C,R){if(C&&(s=Ig.call(s),s.push(C)),R){var k={depth:n.depth};return vi(n,"quoteStyle")&&(k.quoteStyle=n.quoteStyle),r(S,k,i+1,s)}return r(S,n,i+1,s)}if(typeof t=="function"&&!_u(t)){var f=Gg(t),p=Ln(t,u);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+Ze.call(p,", ")+" }":"")}if(yu(t)){var m=Hr?Ni.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):So.call(t);return typeof t=="object"&&!Hr?ks(m):m}if(zg(t)){for(var g="<"+au.call(String(t.nodeName)),y=t.attributes||[],v=0;v<y.length;v++)g+=" "+y[v].name+"="+gu(Dg(y[v].value),"double",n);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+au.call(String(t.nodeName))+">",g}if(Po(t)){if(t.length===0)return"[]";var _=Ln(t,u);return d&&!jg(_)?"["+Io(_,d)+"]":"[ "+Ze.call(_,", ")+" ]"}if(Og(t)){var x=Ln(t,u);return!("cause"in Error.prototype)&&"cause"in t&&!cu.call(t,"cause")?"{ ["+String(t)+"] "+Ze.call(hu.call("[cause]: "+u(t.cause),x),", ")+" }":x.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Ze.call(x,", ")+" }"}if(typeof t=="object"&&a){if(pu&&typeof t[pu]=="function"&&Co)return Co(t,{depth:c-i});if(a!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(Vg(t)){var b=[];return ru&&ru.call(t,function(S,C){b.push(u(C,t,!0)+" => "+u(S,t))}),bu("Map",Bn.call(t),b,d)}if(Wg(t)){var E=[];return su&&su.call(t,function(S){E.push(u(S,t))}),bu("Set",On.call(t),E,d)}if(Hg(t))return Ro("WeakMap");if($g(t))return Ro("WeakSet");if(Xg(t))return Ro("WeakRef");if(Lg(t))return ks(u(Number(t)));if(kg(t))return ks(u(wo.call(t)));if(Ng(t))return ks(Ag.call(t));if(Fg(t))return ks(u(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof Ms<"u"&&t===Ms)return"{ [object globalThis] }";if(!Bg(t)&&!_u(t)){var T=Ln(t,u),w=uu?uu(t)===Object.prototype:t instanceof Object||t.constructor===Object,A=t instanceof Object?"":"null prototype",P=!w&&Zt&&Object(t)===t&&Zt in t?Eo.call(ki(t),8,-1):A?"Object":"",L=w||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",M=L+(P||A?"["+Ze.call(hu.call([],P||[],A||[]),": ")+"] ":"");return T.length===0?M+"{}":d?M+"{"+Io(T,d)+"}":M+"{ "+Ze.call(T,", ")+" }"}return String(t)};function gu(r,t,e){var i=e.quoteStyle||t,s=mu[i];return s+r+s}function Dg(r){return Ni.call(String(r),/"/g,""")}function Po(r){return ki(r)==="[object Array]"&&(!Zt||!(typeof r=="object"&&Zt in r))}function Bg(r){return ki(r)==="[object Date]"&&(!Zt||!(typeof r=="object"&&Zt in r))}function _u(r){return ki(r)==="[object RegExp]"&&(!Zt||!(typeof r=="object"&&Zt in r))}function Og(r){return ki(r)==="[object Error]"&&(!Zt||!(typeof r=="object"&&Zt in r))}function Fg(r){return ki(r)==="[object String]"&&(!Zt||!(typeof r=="object"&&Zt in r))}function Lg(r){return ki(r)==="[object Number]"&&(!Zt||!(typeof r=="object"&&Zt in r))}function Ng(r){return ki(r)==="[object Boolean]"&&(!Zt||!(typeof r=="object"&&Zt in r))}function yu(r){if(Hr)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!So)return!1;try{return So.call(r),!0}catch{}return!1}function kg(r){if(!r||typeof r!="object"||!wo)return!1;try{return wo.call(r),!0}catch{}return!1}var Ug=Object.prototype.hasOwnProperty||function(r){return r in this};function vi(r,t){return Ug.call(r,t)}function ki(r){return Sg.call(r)}function Gg(r){if(r.name)return r.name;var t=Pg.call(Cg.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function xu(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,i=r.length;e<i;e++)if(r[e]===t)return e;return-1}function Vg(r){if(!Bn||!r||typeof r!="object")return!1;try{Bn.call(r);try{On.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function Hg(r){if(!Ls||!r||typeof r!="object")return!1;try{Ls.call(r,Ls);try{Ns.call(r,Ns)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function Xg(r){if(!nu||!r||typeof r!="object")return!1;try{return nu.call(r),!0}catch{}return!1}function Wg(r){if(!On||!r||typeof r!="object")return!1;try{On.call(r);try{Bn.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function $g(r){if(!Ns||!r||typeof r!="object")return!1;try{Ns.call(r,Ns);try{Ls.call(r,Ls)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function zg(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function vu(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return vu(Eo.call(r,0,t.maxStringLength),t)+i}var s=Mg[t.quoteStyle||"single"];s.lastIndex=0;var n=Ni.call(Ni.call(r,s,"\\$1"),/[\x00-\x1f]/g,Yg);return gu(n,"single",t)}function Yg(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":"")+Rg.call(t.toString(16))}function ks(r){return"Object("+r+")"}function Ro(r){return r+" { ? }"}function bu(r,t,e,i){var s=i?Io(e,i):Ze.call(e,", ");return r+" ("+t+") {"+s+"}"}function jg(r){for(var t=0;t<r.length;t++)if(xu(r[t],`
|
|
2
|
+
`)>=0)return!1;return!0}function qg(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=Ze.call(Array(r.indent+1)," ");else return null;return{base:e,prev:Ze.call(Array(t+1),e)}}function Io(r,t){if(r.length===0)return"";var e=`
|
|
3
|
+
`+t.prev+t.base;return e+Ze.call(r,","+e)+`
|
|
4
|
+
`+t.prev}function Ln(r,t){var e=Po(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=vi(r,s)?t(r[s],r):""}var n=typeof Ao=="function"?Ao(r):[],a;if(Hr){a={};for(var o=0;o<n.length;o++)a["$"+n[o]]=n[o]}for(var h in r)vi(r,h)&&(e&&String(Number(h))===h&&h<r.length||Hr&&a["$"+h]instanceof Symbol||(ou.call(/[^\w$]/,h)?i.push(t(h,r)+": "+t(r[h],r)):i.push(h+": "+t(r[h],r))));if(typeof Ao=="function")for(var l=0;l<n.length;l++)cu.call(r,n[l])&&i.push("["+t(n[l])+"]: "+t(r[n[l]],r));return i}var Kg=Fn,Zg=Vr,Nn=function(r,t,e){for(var i=r,s;(s=i.next)!=null;i=s)if(s.key===t)return i.next=s.next,e||(s.next=r.next,r.next=s),s},Qg=function(r,t){if(r){var e=Nn(r,t);return e&&e.value}},Jg=function(r,t,e){var i=Nn(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},t_=function(r,t){return r?!!Nn(r,t):!1},e_=function(r,t){if(r)return Nn(r,t,!0)},i_=function(){var t,e={assert:function(i){if(!e.has(i))throw new Zg("Side channel does not contain "+Kg(i))},delete:function(i){var s=t&&t.next,n=e_(t,i);return n&&s&&s===n&&(t=void 0),!!n},get:function(i){return Qg(t,i)},has:function(i){return t_(t,i)},set:function(i,s){t||(t={next:void 0}),Jg(t,i,s)}};return e},Tu=Object,r_=Error,s_=EvalError,n_=RangeError,a_=ReferenceError,o_=SyntaxError,h_=URIError,l_=Math.abs,c_=Math.floor,u_=Math.max,d_=Math.min,f_=Math.pow,p_=Math.round,m_=Number.isNaN||function(t){return t!==t},g_=m_,__=function(t){return g_(t)||t===0?t:t<0?-1:1},y_=Object.getOwnPropertyDescriptor,kn=y_;if(kn)try{kn([],"length")}catch{kn=null}var Eu=kn,Un=Object.defineProperty||!1;if(Un)try{Un({},"a",{value:1})}catch{Un=!1}var x_=Un,Mo,wu;function v_(){return wu||(wu=1,Mo=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 s=42;t[e]=s;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!==s||o.enumerable!==!0)return!1}return!0}),Mo}var Do,Au;function b_(){if(Au)return Do;Au=1;var r=typeof Symbol<"u"&&Symbol,t=v_();return Do=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},Do}var Bo,Su;function Cu(){return Su||(Su=1,Bo=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Bo}var Oo,Pu;function Ru(){if(Pu)return Oo;Pu=1;var r=Tu;return Oo=r.getPrototypeOf||null,Oo}var Fo,Iu;function T_(){if(Iu)return Fo;Iu=1;var r="Function.prototype.bind called on incompatible ",t=Object.prototype.toString,e=Math.max,i="[object Function]",s=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 Fo=function(h){var l=this;if(typeof l!="function"||t.apply(l)!==i)throw new TypeError(r+l);for(var c=n(arguments,1),d,u=function(){if(this instanceof d){var y=l.apply(this,s(c,arguments));return Object(y)===y?y:this}return l.apply(h,s(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 g=function(){};g.prototype=l.prototype,d.prototype=new g,g.prototype=null}return d},Fo}var Lo,Mu;function Gn(){if(Mu)return Lo;Mu=1;var r=T_();return Lo=Function.prototype.bind||r,Lo}var No,Du;function ko(){return Du||(Du=1,No=Function.prototype.call),No}var Uo,Bu;function Ou(){return Bu||(Bu=1,Uo=Function.prototype.apply),Uo}var E_=typeof Reflect<"u"&&Reflect&&Reflect.apply,w_=Gn(),A_=Ou(),S_=ko(),C_=E_,P_=C_||w_.call(S_,A_),R_=Gn(),I_=Vr,M_=ko(),D_=P_,Fu=function(t){if(t.length<1||typeof t[0]!="function")throw new I_("a function is required");return D_(R_,M_,t)},Go,Lu;function B_(){if(Lu)return Go;Lu=1;var r=Fu,t=Eu,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__"),s=Object,n=s.getPrototypeOf;return Go=i&&typeof i.get=="function"?r([i.get]):typeof n=="function"?function(o){return n(o==null?o:s(o))}:!1,Go}var Vo,Nu;function O_(){if(Nu)return Vo;Nu=1;var r=Cu(),t=Ru(),e=B_();return Vo=r?function(s){return r(s)}:t?function(s){if(!s||typeof s!="object"&&typeof s!="function")throw new TypeError("getProto: not an object");return t(s)}:e?function(s){return e(s)}:null,Vo}var Ho,ku;function F_(){if(ku)return Ho;ku=1;var r=Function.prototype.call,t=Object.prototype.hasOwnProperty,e=Gn();return Ho=e.call(r,t),Ho}var nt,L_=Tu,N_=r_,k_=s_,U_=n_,G_=a_,Xr=o_,Wr=Vr,V_=h_,H_=l_,X_=c_,W_=u_,$_=d_,z_=f_,Y_=p_,j_=__,Uu=Function,Xo=function(r){try{return Uu('"use strict"; return ('+r+").constructor;")()}catch{}},Us=Eu,q_=x_,Wo=function(){throw new Wr},K_=Us?function(){try{return arguments.callee,Wo}catch{try{return Us(arguments,"callee").get}catch{return Wo}}}():Wo,$r=b_()(),Vt=O_(),Z_=Ru(),Q_=Cu(),Gu=Ou(),Gs=ko(),zr={},J_=typeof Uint8Array>"u"||!Vt?nt:Vt(Uint8Array),hr={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?nt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?nt:ArrayBuffer,"%ArrayIteratorPrototype%":$r&&Vt?Vt([][Symbol.iterator]()):nt,"%AsyncFromSyncIteratorPrototype%":nt,"%AsyncFunction%":zr,"%AsyncGenerator%":zr,"%AsyncGeneratorFunction%":zr,"%AsyncIteratorPrototype%":zr,"%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%":N_,"%eval%":eval,"%EvalError%":k_,"%Float32Array%":typeof Float32Array>"u"?nt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?nt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?nt:FinalizationRegistry,"%Function%":Uu,"%GeneratorFunction%":zr,"%Int8Array%":typeof Int8Array>"u"?nt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?nt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?nt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":$r&&Vt?Vt(Vt([][Symbol.iterator]())):nt,"%JSON%":typeof JSON=="object"?JSON:nt,"%Map%":typeof Map>"u"?nt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!$r||!Vt?nt:Vt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":L_,"%Object.getOwnPropertyDescriptor%":Us,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?nt:Promise,"%Proxy%":typeof Proxy>"u"?nt:Proxy,"%RangeError%":U_,"%ReferenceError%":G_,"%Reflect%":typeof Reflect>"u"?nt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?nt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!$r||!Vt?nt:Vt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?nt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":$r&&Vt?Vt(""[Symbol.iterator]()):nt,"%Symbol%":$r?Symbol:nt,"%SyntaxError%":Xr,"%ThrowTypeError%":K_,"%TypedArray%":J_,"%TypeError%":Wr,"%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%":V_,"%WeakMap%":typeof WeakMap>"u"?nt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?nt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?nt:WeakSet,"%Function.prototype.call%":Gs,"%Function.prototype.apply%":Gu,"%Object.defineProperty%":q_,"%Object.getPrototypeOf%":Z_,"%Math.abs%":H_,"%Math.floor%":X_,"%Math.max%":W_,"%Math.min%":$_,"%Math.pow%":z_,"%Math.round%":Y_,"%Math.sign%":j_,"%Reflect.getPrototypeOf%":Q_};if(Vt)try{null.error}catch(r){var t0=Vt(Vt(r));hr["%Error.prototype%"]=t0}var e0=function r(t){var e;if(t==="%AsyncFunction%")e=Xo("async function () {}");else if(t==="%GeneratorFunction%")e=Xo("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Xo("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&Vt&&(e=Vt(s.prototype))}return hr[t]=e,e},Vu={__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"]},Vs=Gn(),Vn=F_(),i0=Vs.call(Gs,Array.prototype.concat),r0=Vs.call(Gu,Array.prototype.splice),Hu=Vs.call(Gs,String.prototype.replace),Hn=Vs.call(Gs,String.prototype.slice),s0=Vs.call(Gs,RegExp.prototype.exec),n0=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,a0=/\\(\\)?/g,o0=function(t){var e=Hn(t,0,1),i=Hn(t,-1);if(e==="%"&&i!=="%")throw new Xr("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new Xr("invalid intrinsic syntax, expected opening `%`");var s=[];return Hu(t,n0,function(n,a,o,h){s[s.length]=o?Hu(h,a0,"$1"):a||n}),s},h0=function(t,e){var i=t,s;if(Vn(Vu,i)&&(s=Vu[i],i="%"+s[0]+"%"),Vn(hr,i)){var n=hr[i];if(n===zr&&(n=e0(i)),typeof n>"u"&&!e)throw new Wr("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:n}}throw new Xr("intrinsic "+t+" does not exist!")},$o=function(t,e){if(typeof t!="string"||t.length===0)throw new Wr("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Wr('"allowMissing" argument must be a boolean');if(s0(/^%?[^%]*%?$/,t)===null)throw new Xr("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=o0(t),s=i.length>0?i[0]:"",n=h0("%"+s+"%",e),a=n.name,o=n.value,h=!1,l=n.alias;l&&(s=l[0],r0(i,i0([0,1],l)));for(var c=1,d=!0;c<i.length;c+=1){var u=i[c],f=Hn(u,0,1),p=Hn(u,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new Xr("property names with quotes must have matching quotes");if((u==="constructor"||!d)&&(h=!0),s+="."+u,a="%"+s+"%",Vn(hr,a))o=hr[a];else if(o!=null){if(!(u in o)){if(!e)throw new Wr("base intrinsic for "+t+" exists, but the property is not available.");return}if(Us&&c+1>=i.length){var m=Us(o,u);d=!!m,d&&"get"in m&&!("originalValue"in m.get)?o=m.get:o=o[u]}else d=Vn(o,u),o=o[u];d&&!h&&(hr[a]=o)}}return o},Xu=$o,Wu=Fu,l0=Wu([Xu("%String.prototype.indexOf%")]),$u=function(t,e){var i=Xu(t,!!e);return typeof i=="function"&&l0(t,".prototype.")>-1?Wu([i]):i},c0=$o,Hs=$u,u0=Fn,d0=Vr,zu=c0("%Map%",!0),f0=Hs("Map.prototype.get",!0),p0=Hs("Map.prototype.set",!0),m0=Hs("Map.prototype.has",!0),g0=Hs("Map.prototype.delete",!0),_0=Hs("Map.prototype.size",!0),Yu=!!zu&&function(){var t,e={assert:function(i){if(!e.has(i))throw new d0("Side channel does not contain "+u0(i))},delete:function(i){if(t){var s=g0(t,i);return _0(t)===0&&(t=void 0),s}return!1},get:function(i){if(t)return f0(t,i)},has:function(i){return t?m0(t,i):!1},set:function(i,s){t||(t=new zu),p0(t,i,s)}};return e},y0=$o,Xn=$u,x0=Fn,Wn=Yu,v0=Vr,Yr=y0("%WeakMap%",!0),b0=Xn("WeakMap.prototype.get",!0),T0=Xn("WeakMap.prototype.set",!0),E0=Xn("WeakMap.prototype.has",!0),w0=Xn("WeakMap.prototype.delete",!0),A0=Yr?function(){var t,e,i={assert:function(s){if(!i.has(s))throw new v0("Side channel does not contain "+x0(s))},delete:function(s){if(Yr&&s&&(typeof s=="object"||typeof s=="function")){if(t)return w0(t,s)}else if(Wn&&e)return e.delete(s);return!1},get:function(s){return Yr&&s&&(typeof s=="object"||typeof s=="function")&&t?b0(t,s):e&&e.get(s)},has:function(s){return Yr&&s&&(typeof s=="object"||typeof s=="function")&&t?E0(t,s):!!e&&e.has(s)},set:function(s,n){Yr&&s&&(typeof s=="object"||typeof s=="function")?(t||(t=new Yr),T0(t,s,n)):Wn&&(e||(e=Wn()),e.set(s,n))}};return i}:Wn,S0=Vr,C0=Fn,P0=i_,R0=Yu,I0=A0,M0=I0||R0||P0,D0=function(){var t,e={assert:function(i){if(!e.has(i))throw new S0("Side channel does not contain "+C0(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,s){t||(t=M0()),t.set(i,s)}};return e},B0=String.prototype.replace,O0=/%20/g,zo={RFC1738:"RFC1738",RFC3986:"RFC3986"},Yo={default:zo.RFC3986,formatters:{RFC1738:function(r){return B0.call(r,O0,"+")},RFC3986:function(r){return String(r)}},RFC1738:zo.RFC1738,RFC3986:zo.RFC3986},F0=Yo,jo=Object.prototype.hasOwnProperty,lr=Array.isArray,Qe=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),L0=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(lr(i)){for(var s=[],n=0;n<i.length;++n)typeof i[n]<"u"&&s.push(i[n]);e.obj[e.prop]=s}}},ju=function(t,e){for(var i=e&&e.plainObjects?{__proto__:null}:{},s=0;s<t.length;++s)typeof t[s]<"u"&&(i[s]=t[s]);return i},N0=function r(t,e,i){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(lr(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!jo.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var s=t;return lr(t)&&!lr(e)&&(s=ju(t,i)),lr(t)&&lr(e)?(e.forEach(function(n,a){if(jo.call(t,a)){var o=t[a];o&&typeof o=="object"&&n&&typeof n=="object"?t[a]=r(o,n,i):t.push(n)}else t[a]=n}),t):Object.keys(e).reduce(function(n,a){var o=e[a];return jo.call(n,a)?n[a]=r(n[a],o,i):n[a]=o,n},s)},k0=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},U0=function(r,t,e){var i=r.replace(/\+/g," ");if(e==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},qo=1024,G0=function(t,e,i,s,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+=qo){for(var l=a.length>=qo?a.slice(h,h+qo):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===F0.RFC1738&&(u===40||u===41)){c[c.length]=l.charAt(d);continue}if(u<128){c[c.length]=Qe[u];continue}if(u<2048){c[c.length]=Qe[192|u>>6]+Qe[128|u&63];continue}if(u<55296||u>=57344){c[c.length]=Qe[224|u>>12]+Qe[128|u>>6&63]+Qe[128|u&63];continue}d+=1,u=65536+((u&1023)<<10|l.charCodeAt(d)&1023),c[c.length]=Qe[240|u>>18]+Qe[128|u>>12&63]+Qe[128|u>>6&63]+Qe[128|u&63]}o+=c.join("")}return o},V0=function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],s=0;s<e.length;++s)for(var n=e[s],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 L0(e),t},H0=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},X0=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},W0=function(t,e){return[].concat(t,e)},$0=function(t,e){if(lr(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)},qu={arrayToObject:ju,assign:k0,combine:W0,compact:V0,decode:U0,encode:G0,isBuffer:X0,isRegExp:H0,maybeMap:$0,merge:N0},Ku=D0,$n=qu,Xs=Yo,z0=Object.prototype.hasOwnProperty,Zu={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Je=Array.isArray,Y0=Array.prototype.push,Qu=function(r,t){Y0.apply(r,Je(t)?t:[t])},j0=Date.prototype.toISOString,Ju=Xs.default,Gt={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:$n.encode,encodeValuesOnly:!1,filter:void 0,format:Ju,formatter:Xs.formatters[Ju],indices:!1,serializeDate:function(t){return j0.call(t)},skipNulls:!1,strictNullHandling:!1},q0=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},Ko={},K0=function r(t,e,i,s,n,a,o,h,l,c,d,u,f,p,m,g,y,v){for(var _=t,x=v,b=0,E=!1;(x=x.get(Ko))!==void 0&&!E;){var T=x.get(t);if(b+=1,typeof T<"u"){if(T===b)throw new RangeError("Cyclic object value");E=!0}typeof x.get(Ko)>"u"&&(b=0)}if(typeof c=="function"?_=c(e,_):_ instanceof Date?_=f(_):i==="comma"&&Je(_)&&(_=$n.maybeMap(_,function(I){return I instanceof Date?f(I):I})),_===null){if(a)return l&&!g?l(e,Gt.encoder,y,"key",p):e;_=""}if(q0(_)||$n.isBuffer(_)){if(l){var w=g?e:l(e,Gt.encoder,y,"key",p);return[m(w)+"="+m(l(_,Gt.encoder,y,"value",p))]}return[m(e)+"="+m(String(_))]}var A=[];if(typeof _>"u")return A;var P;if(i==="comma"&&Je(_))g&&l&&(_=$n.maybeMap(_,l)),P=[{value:_.length>0?_.join(",")||null:void 0}];else if(Je(c))P=c;else{var L=Object.keys(_);P=d?L.sort(d):L}var M=h?String(e).replace(/\./g,"%2E"):String(e),S=s&&Je(_)&&_.length===1?M+"[]":M;if(n&&Je(_)&&_.length===0)return S+"[]";for(var C=0;C<P.length;++C){var R=P[C],k=typeof R=="object"&&R&&typeof R.value<"u"?R.value:_[R];if(!(o&&k===null)){var F=u&&h?String(R).replace(/\./g,"%2E"):String(R),B=Je(_)?typeof i=="function"?i(S,F):S:S+(u?"."+F:"["+F+"]");v.set(t,b);var X=Ku();X.set(Ko,v),Qu(A,r(k,B,i,s,n,a,o,h,i==="comma"&&g&&Je(_)?null:l,c,d,u,f,p,m,g,y,X))}}return A},Z0=function(t){if(!t)return Gt;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||Gt.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=Xs.default;if(typeof t.format<"u"){if(!z0.call(Xs.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=Xs.formatters[i],n=Gt.filter;(typeof t.filter=="function"||Je(t.filter))&&(n=t.filter);var a;if(t.arrayFormat in Zu?a=t.arrayFormat:"indices"in t?a=t.indices?"indices":"repeat":a=Gt.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:Gt.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Gt.addQueryPrefix,allowDots:o,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Gt.allowEmptyArrays,arrayFormat:a,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Gt.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Gt.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Gt.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Gt.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Gt.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Gt.encodeValuesOnly,filter:n,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Gt.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Gt.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Gt.strictNullHandling}},Q0=function(r,t){var e=r,i=Z0(t),s,n;typeof i.filter=="function"?(n=i.filter,e=n("",e)):Je(i.filter)&&(n=i.filter,s=n);var a=[];if(typeof e!="object"||e===null)return"";var o=Zu[i.arrayFormat],h=o==="comma"&&i.commaRoundTrip;s||(s=Object.keys(e)),i.sort&&s.sort(i.sort);for(var l=Ku(),c=0;c<s.length;++c){var d=s[c],u=e[d];i.skipNulls&&u===null||Qu(a,K0(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:""},jr=qu,Zo=Object.prototype.hasOwnProperty,J0=Array.isArray,Mt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:jr.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},ty=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},td=function(r,t){return r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1?r.split(","):r},ey="utf8=%26%2310003%3B",iy="utf8=%E2%9C%93",ry=function(t,e){var i={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var n=e.parameterLimit===1/0?void 0:e.parameterLimit,a=s.split(e.delimiter,n),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]===ey&&(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,Mt.decoder,l,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,u),Mt.decoder,l,"key"),p=jr.maybeMap(td(c.slice(u+1),e),function(g){return e.decoder(g,Mt.decoder,l,"value")})),p&&e.interpretNumericEntities&&l==="iso-8859-1"&&(p=ty(String(p))),c.indexOf("[]=")>-1&&(p=J0(p)?[p]:p);var m=Zo.call(i,f);m&&e.duplicates==="combine"?i[f]=jr.combine(i[f],p):(!m||e.duplicates==="last")&&(i[f]=p)}return i},sy=function(r,t,e,i){for(var s=i?t:td(t,e),n=r.length-1;n>=0;--n){var a,o=r[n];if(o==="[]"&&e.parseArrays)a=e.allowEmptyArrays&&(s===""||e.strictNullHandling&&s===null)?[]:[].concat(s);else{a=e.plainObjects?{__proto__:null}:{};var h=o.charAt(0)==="["&&o.charAt(o.length-1)==="]"?o.slice(1,-1):o,l=e.decodeDotInKeys?h.replace(/%2E/g,"."):h,c=parseInt(l,10);!e.parseArrays&&l===""?a={0:s}:!isNaN(c)&&o!==l&&String(c)===l&&c>=0&&e.parseArrays&&c<=e.arrayLimit?(a=[],a[c]=s):l!=="__proto__"&&(a[l]=s)}s=a}return s},ny=function(t,e,i,s){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&&Zo.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&&Zo.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 sy(c,e,i,s)}},ay=function(t){if(!t)return Mt;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");var e=typeof t.charset>"u"?Mt.charset:t.charset,i=typeof t.duplicates>"u"?Mt.duplicates:t.duplicates;if(i!=="combine"&&i!=="first"&&i!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:Mt.allowDots:!!t.allowDots;return{allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Mt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:Mt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:Mt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:Mt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Mt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:Mt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:Mt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:Mt.decoder,delimiter:typeof t.delimiter=="string"||jr.isRegExp(t.delimiter)?t.delimiter:Mt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:Mt.depth,duplicates:i,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:Mt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:Mt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:Mt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:Mt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Mt.strictNullHandling}},oy=function(r,t){var e=ay(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?{__proto__:null}:{};for(var i=typeof r=="string"?ry(r,e):r,s=e.plainObjects?{__proto__:null}:{},n=Object.keys(i),a=0;a<n.length;++a){var o=n[a],h=ny(o,i[o],e,typeof r=="string");s=jr.merge(s,h,e)}return e.allowSparse===!0?s:jr.compact(s)},hy=Q0,ly=oy,cy=Yo,uy={formats:cy,parse:ly,stringify:hy},dy=vg;function bi(){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 fy=/^([a-z0-9.+-]+:)/i,py=/:[0-9]*$/,my=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,gy=["<",">",'"',"`"," ","\r",`
|
|
5
|
+
`," "],_y=["{","}","|","\\","^","`"].concat(gy),Qo=["'"].concat(_y),ed=["%","/","?",";","#"].concat(Qo),id=["/","?","#"],yy=255,rd=/^[+a-z0-9A-Z_-]{0,63}$/,xy=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,vy={javascript:!0,"javascript:":!0},Jo={javascript:!0,"javascript:":!0},qr={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},th=uy;function by(r,t,e){if(r&&typeof r=="object"&&r instanceof bi)return r;var i=new bi;return i.parse(r,t,e),i}bi.prototype.parse=function(r,t,e){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),s=i!==-1&&i<r.indexOf("#")?"?":"#",n=r.split(s),a=/\\/g;n[0]=n[0].replace(a,"/"),r=n.join(s);var o=r;if(o=o.trim(),!e&&r.split("#").length===1){var h=my.exec(o);if(h)return this.path=o,this.href=o,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=th.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=fy.exec(o);if(l){l=l[0];var c=l.toLowerCase();this.protocol=c,o=o.substr(l.length)}if(e||l||o.match(/^\/\/[^@/]+@[^@/]+/)){var d=o.substr(0,2)==="//";d&&!(l&&Jo[l])&&(o=o.substr(2),this.slashes=!0)}if(!Jo[l]&&(d||l&&!qr[l])){for(var u=-1,f=0;f<id.length;f++){var p=o.indexOf(id[f]);p!==-1&&(u===-1||p<u)&&(u=p)}var m,g;u===-1?g=o.lastIndexOf("@"):g=o.lastIndexOf("@",u),g!==-1&&(m=o.slice(0,g),o=o.slice(g+1),this.auth=decodeURIComponent(m)),u=-1;for(var f=0;f<ed.length;f++){var p=o.indexOf(ed[f]);p!==-1&&(u===-1||p<u)&&(u=p)}u===-1&&(u=o.length),this.host=o.slice(0,u),o=o.slice(u),this.parseHost(),this.hostname=this.hostname||"";var y=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!y)for(var v=this.hostname.split(/\./),f=0,_=v.length;f<_;f++){var x=v[f];if(x&&!x.match(rd)){for(var b="",E=0,T=x.length;E<T;E++)x.charCodeAt(E)>127?b+="x":b+=x[E];if(!b.match(rd)){var w=v.slice(0,f),A=v.slice(f+1),P=x.match(xy);P&&(w.push(P[1]),A.unshift(P[2])),A.length&&(o="/"+A.join(".")+o),this.hostname=w.join(".");break}}}this.hostname.length>yy?this.hostname="":this.hostname=this.hostname.toLowerCase(),y||(this.hostname=dy.toASCII(this.hostname));var L=this.port?":"+this.port:"",M=this.hostname||"";this.host=M+L,this.href+=this.host,y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),o[0]!=="/"&&(o="/"+o))}if(!vy[c])for(var f=0,_=Qo.length;f<_;f++){var S=Qo[f];if(o.indexOf(S)!==-1){var C=encodeURIComponent(S);C===S&&(C=escape(S)),o=o.split(S).join(C)}}var R=o.indexOf("#");R!==-1&&(this.hash=o.substr(R),o=o.slice(0,R));var k=o.indexOf("?");if(k!==-1?(this.search=o.substr(k),this.query=o.substr(k+1),t&&(this.query=th.parse(this.query)),o=o.slice(0,k)):t&&(this.search="",this.query={}),o&&(this.pathname=o),qr[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var L=this.pathname||"",F=this.search||"";this.path=L+F}return this.href=this.format(),this},bi.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",i=this.hash||"",s=!1,n="";this.host?s=r+this.host:this.hostname&&(s=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(n=th.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var a=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||qr[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),a&&a.charAt(0)!=="?"&&(a="?"+a),e=e.replace(/[?#]/g,function(o){return encodeURIComponent(o)}),a=a.replace("#","%23"),t+s+e+a+i},bi.prototype.resolve=function(r){return this.resolveObject(by(r,!1,!0)).format()},bi.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new bi;t.parse(r,!1,!0),r=t}for(var e=new bi,i=Object.keys(this),s=0;s<i.length;s++){var n=i[s];e[n]=this[n]}if(e.hash=r.hash,r.href==="")return e.href=e.format(),e;if(r.slashes&&!r.protocol){for(var a=Object.keys(r),o=0;o<a.length;o++){var h=a[o];h!=="protocol"&&(e[h]=r[h])}return qr[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(!qr[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&&!Jo[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,v=e.pathname&&e.pathname.split("/")||[],_=r.pathname&&r.pathname.split("/")||[],x=e.protocol&&!qr[e.protocol];if(x&&(e.hostname="",e.port=null,e.host&&(v[0]===""?v[0]=e.host:v.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]===""||v[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,v=_;else if(_.length)v||(v=[]),v.pop(),v=v.concat(_),e.search=r.search,e.query=r.query;else if(r.search!=null){if(x){e.host=v.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(!v.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var E=v.slice(-1)[0],T=(e.host||r.host||v.length>1)&&(E==="."||E==="..")||E==="",w=0,A=v.length;A>=0;A--)E=v[A],E==="."?v.splice(A,1):E===".."?(v.splice(A,1),w++):w&&(v.splice(A,1),w--);if(!g&&!y)for(;w--;w)v.unshift("..");g&&v[0]!==""&&(!v[0]||v[0].charAt(0)!=="/")&&v.unshift(""),T&&v.join("/").substr(-1)!=="/"&&v.push("");var P=v[0]===""||v[0]&&v[0].charAt(0)==="/";if(x){e.hostname=P?"":v.length?v.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&&v.length,g&&!P&&v.unshift(""),v.length>0?e.pathname=v.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},bi.prototype.parseHost=function(){var r=this.host,t=py.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 sd={};function st(r,t,e=3){if(sd[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
6
|
+
Deprecated since v${r}`):(i=i.split(`
|
|
7
|
+
`).splice(e).join(`
|
|
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${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
10
|
+
Deprecated since v${r}`),console.warn(i))),sd[t]=!0}function Ne(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function Ws(r){return r.split("?")[0].split("#")[0]}function Ty(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ey(r,t,e){return r.replace(new RegExp(Ty(t),"g"),e)}function wy(r,t){let e="",i=0,s=-1,n=0,a=-1;for(let o=0;o<=r.length;++o){if(o<r.length)a=r.charCodeAt(o);else{if(a===47)break;a=47}if(a===47){if(!(s===o-1||n===1))if(s!==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("/")),s=o,n=0;continue}}else if(e.length===2||e.length===1){e="",i=0,s=o,n=0;continue}}t&&(e.length>0?e+="/..":e="..",i=2)}else e.length>0?e+=`/${r.slice(s+1,o)}`:e=r.slice(s+1,o),i=o-s-1;s=o,n=0}else a===46&&n!==-1?++n:n=-1}return e}const Ht={toPosix(r){return Ey(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){Ne(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(Ne(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const i=Ws(this.toPosix(t??H.ADAPTER.getBaseUrl())),s=Ws(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?Ht.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(Ne(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="";const e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));const i=r.endsWith("/");return r=wy(r,!1),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return Ne(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 i=r[e];if(Ne(i),i.length>0)if(t===void 0)t=i;else{const s=r[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(r){if(Ne(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0);const e=t===47;let i=-1,s=!0;const n=this.getProtocol(r),a=r;r=r.slice(n.length);for(let o=r.length-1;o>=1;--o)if(t=r.charCodeAt(o),t===47){if(!s){i=o;break}}else s=!1;return i===-1?e?"/":this.isUrl(a)?n+r:n:e&&i===1?"//":n+r.slice(0,i)},rootname(r){Ne(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){Ne(r),t&&Ne(t),r=Ws(this.toPosix(r));let e=0,i=-1,s=!0,n;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let a=t.length-1,o=-1;for(n=r.length-1;n>=0;--n){const h=r.charCodeAt(n);if(h===47){if(!s){e=n+1;break}}else o===-1&&(s=!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=r.length),r.slice(e,i)}for(n=r.length-1;n>=0;--n)if(r.charCodeAt(n)===47){if(!s){e=n+1;break}}else i===-1&&(s=!1,i=n+1);return i===-1?"":r.slice(e,i)},extname(r){Ne(r),r=Ws(this.toPosix(r));let t=-1,e=0,i=-1,s=!0,n=0;for(let a=r.length-1;a>=0;--a){const o=r.charCodeAt(a);if(o===47){if(!s){e=a+1;break}continue}i===-1&&(s=!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?"":r.slice(t,i)},parse(r){Ne(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=Ws(this.toPosix(r));let e=r.charCodeAt(0);const i=this.isAbsolute(r);let s;t.root=this.rootname(r),i||this.hasProtocol(r)?s=1:s=0;let n=-1,a=0,o=-1,h=!0,l=r.length-1,c=0;for(;l>=s;--l){if(e=r.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=r.slice(1,o):t.base=t.name=r.slice(a,o)):(a===0&&i?(t.name=r.slice(1,n),t.base=r.slice(1,o)):(t.name=r.slice(a,n),t.base=r.slice(a,o)),t.ext=r.slice(n,o)),t.dir=this.dirname(r),t},sep:"/",delimiter:":",joinExtensions:[".html"]};let eh;async function Ay(){return eh??(eh=(async()=>{var n;const r=document.createElement("canvas").getContext("webgl");if(!r)return oe.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 oe.UNPACK;const e=r.createTexture();r.bindTexture(r.TEXTURE_2D,e);const i=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,i),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 s=new Uint8Array(4);return r.readPixels(0,0,1,1,r.RGBA,r.UNSIGNED_BYTE,s),r.deleteFramebuffer(i),r.deleteTexture(e),(n=r.getExtension("WEBGL_lose_context"))==null||n.loseContext(),s[0]<=s[3]?oe.PMA:oe.UNPACK})()),eh}let ih;function Sy(){return typeof ih>"u"&&(ih=function(){var t;const r={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",r)||e.getContext("experimental-webgl",r);const s=!!((t=i==null?void 0:i.getContextAttributes())!=null&&t.stencil);if(i){const n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,s}catch{return!1}}()),ih}var Cy={grad:.9,turn:360,rad:360/(2*Math.PI)},Ti=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},Xt=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},Se=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},nd=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},ad=function(r){return{r:Se(r.r,0,255),g:Se(r.g,0,255),b:Se(r.b,0,255),a:Se(r.a)}},rh=function(r){return{r:Xt(r.r),g:Xt(r.g),b:Xt(r.b),a:Xt(r.a,3)}},Py=/^#([0-9a-f]{3,8})$/i,zn=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},od=function(r){var t=r.r,e=r.g,i=r.b,s=r.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:s}},hd=function(r){var t=r.h,e=r.s,i=r.v,s=r.a;t=t/360*6,e/=100,i/=100;var n=Math.floor(t),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:s}},ld=function(r){return{h:nd(r.h),s:Se(r.s,0,100),l:Se(r.l,0,100),a:Se(r.a)}},cd=function(r){return{h:Xt(r.h),s:Xt(r.s),l:Xt(r.l),a:Xt(r.a,3)}},ud=function(r){return hd((e=(t=r).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},$s=function(r){return{h:(t=od(r)).h,s:(s=(200-(e=t.s))*(i=t.v)/100)>0&&s<200?e*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,i,s},Ry=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Iy=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,My=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Dy=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,sh={string:[[function(r){var t=Py.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?Xt(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?Xt(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=My.exec(r)||Dy.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:ad({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=Ry.exec(r)||Iy.exec(r);if(!t)return null;var e,i,s=ld({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(Cy[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return ud(s)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,i=r.b,s=r.a,n=s===void 0?1:s;return Ti(t)&&Ti(e)&&Ti(i)?ad({r:Number(t),g:Number(e),b:Number(i),a:Number(n)}):null},"rgb"],[function(r){var t=r.h,e=r.s,i=r.l,s=r.a,n=s===void 0?1:s;if(!Ti(t)||!Ti(e)||!Ti(i))return null;var a=ld({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return ud(a)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,n=s===void 0?1:s;if(!Ti(t)||!Ti(e)||!Ti(i))return null;var a=function(o){return{h:nd(o.h),s:Se(o.s,0,100),v:Se(o.v,0,100),a:Se(o.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return hd(a)},"hsv"]]},dd=function(r,t){for(var e=0;e<t.length;e++){var i=t[e][0](r);if(i)return[i,t[e][1]]}return[null,void 0]},By=function(r){return typeof r=="string"?dd(r.trim(),sh.string):typeof r=="object"&&r!==null?dd(r,sh.object):[null,void 0]},nh=function(r,t){var e=$s(r);return{h:e.h,s:Se(e.s+100*t,0,100),l:e.l,a:e.a}},ah=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},fd=function(r,t){var e=$s(r);return{h:e.h,s:e.s,l:Se(e.l+100*t,0,100),a:e.a}},oh=function(){function r(t){this.parsed=By(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 Xt(ah(this.rgba),2)},r.prototype.isDark=function(){return ah(this.rgba)<.5},r.prototype.isLight=function(){return ah(this.rgba)>=.5},r.prototype.toHex=function(){return t=rh(this.rgba),e=t.r,i=t.g,s=t.b,a=(n=t.a)<1?zn(Xt(255*n)):"","#"+zn(e)+zn(i)+zn(s)+a;var t,e,i,s,n,a},r.prototype.toRgb=function(){return rh(this.rgba)},r.prototype.toRgbString=function(){return t=rh(this.rgba),e=t.r,i=t.g,s=t.b,(n=t.a)<1?"rgba("+e+", "+i+", "+s+", "+n+")":"rgb("+e+", "+i+", "+s+")";var t,e,i,s,n},r.prototype.toHsl=function(){return cd($s(this.rgba))},r.prototype.toHslString=function(){return t=cd($s(this.rgba)),e=t.h,i=t.s,s=t.l,(n=t.a)<1?"hsla("+e+", "+i+"%, "+s+"%, "+n+")":"hsl("+e+", "+i+"%, "+s+"%)";var t,e,i,s,n},r.prototype.toHsv=function(){return t=od(this.rgba),{h:Xt(t.h),s:Xt(t.s),v:Xt(t.v),a:Xt(t.a,3)};var t},r.prototype.invert=function(){return ti({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),ti(nh(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),ti(nh(this.rgba,-t))},r.prototype.grayscale=function(){return ti(nh(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),ti(fd(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),ti(fd(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"?ti({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):Xt(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=$s(this.rgba);return typeof t=="number"?ti({h:t,s:e.s,l:e.l,a:e.a}):Xt(e.h)},r.prototype.isEqual=function(t){return this.toHex()===ti(t).toHex()},r}(),ti=function(r){return r instanceof oh?r:new oh(r)},pd=[],Oy=function(r){r.forEach(function(t){pd.indexOf(t)<0&&(t(oh,sh),pd.push(t))})};function Fy(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var s in e)i[e[s]]=s;var n={};r.prototype.toName=function(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 r(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 r(h).toRgb():null},"name"])}Oy([Fy]);const Kr=class no{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 no)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((s,n)=>s===e[n]);if(t!==null&&e!==null){const s=Object.keys(t),n=Object.keys(e);return s.length!==n.length?!1:s.every(a=>t[a]===e[a])}return t===e}toRgba(){const[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,s]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toRgbArray(t){t=t??[];const[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,i,s,n]=no.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=s,this._components[3]*=n,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,n=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,n=n*t+.5|0),(t*255<<24)+(i<<16)+(s<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){const[e,i,s]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(i*t)/t,this._components[2]=Math.round(s*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];const[e,i,s,n]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=n,t}normalize(t){let e,i,s,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,s=(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,s,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,s,n=255]=t,e/=255,i/=255,s/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const o=no.HEX_PATTERN.exec(t);o&&(t=`#${o[2]}`)}const a=ti(t);a.isValid()&&({r:e,g:i,b:s,a:n}=a.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,n)=>{t[n]=Math.min(Math.max(s,e),i)}),t)}};Kr.shared=new Kr,Kr.temp=new Kr,Kr.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let dt=Kr;function Ly(r,t=[]){return st("7.2.0","utils.hex2rgb is deprecated, use Color#toRgbArray instead"),dt.shared.setValue(r).toRgbArray(t)}function Ny(r){return st("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),dt.shared.setValue(r).toHex()}function Yn(r){return st("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),dt.shared.setValue(r).toNumber()}function ky(){const r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;r[K.NORMAL_NPM]=K.NORMAL,r[K.ADD_NPM]=K.ADD,r[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(r),e}const md=ky();function gd(r,t){return md[t?1:0][r]}function Uy(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 i=0,s=0;i<e;i+=6,s+=4)t[i+0]=s+0,t[i+1]=s+1,t[i+2]=s+2,t[i+3]=s+0,t[i+4]=s+2,t[i+5]=s+3;return t}function _d(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 jn(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 yd(r){return!(r&r-1)&&!!r}function xd(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 Zr(r,t,e){const i=r.length;let s;if(t>=i||e===0)return;e=t+e>i?i-t:e;const n=i-e;for(s=t;s<n;++s)r[s]=r[s+e];r.length=n}function Ui(r){return r===0?0:r<0?-1:1}let Gy=0;function cr(){return++Gy}const hh=class{constructor(r,t,e,i){this.left=r,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}};hh.EMPTY=new hh(0,0,0,0);let vd=hh;const bd={},ei=Object.create(null),Gi=Object.create(null);class Vy{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 Td(r,t,e){for(let i=0,s=4*e*t;i<t;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function Ed(r,t,e,i,s){const n=4*t;for(let a=i,o=i*n+4*e;a<=s;++a,o+=n)if(r[o+3]!==0)return!1;return!0}function Hy(r){const{width:t,height:e}=r,i=r.getContext("2d",{willReadFrequently:!0});if(i===null)throw new TypeError("Failed to get canvas 2D context");const s=i.getImageData(0,0,t,e).data;let n=0,a=0,o=t-1,h=e-1;for(;a<e&&Td(s,t,a);)++a;if(a===e)return vd.EMPTY;for(;Td(s,t,h);)--h;for(;Ed(s,t,n,a,h);)++n;for(;Ed(s,t,o,a,h);)--o;return++o,++h,new vd(n,a,o,h)}function Xy(r){const t=Hy(r),{width:e,height:i}=t;let s=null;if(!t.isEmpty()){const n=r.getContext("2d");if(n===null)throw new TypeError("Failed to get canvas 2D context");s=n.getImageData(t.left,t.top,e,i)}return{width:e,height:i,data:s}}function Wy(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 Ei(r,t=1){var i;const e=(i=H.RETINA_PREFIX)==null?void 0:i.exec(r);return e?parseFloat(e[1]):t}var G=(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))(G||{});const lh=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},wd=(r,t)=>lh(r).priority??t,Y={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(lh).forEach(t=>{t.type.forEach(e=>{var i,s;return(s=(i=this._removeHandlers)[e])==null?void 0:s.call(i,t)})}),this},add(...r){return r.map(lh).forEach(t=>{t.type.forEach(e=>{var n,a;const i=this._addHandlers,s=this._queue;i[e]?(n=i[e])==null||n.call(i,t):(s[e]=s[e]||[],(a=s[e])==null||a.push(t))})}),this},handle(r,t,e){var a;const i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;const n=this._queue;return n[r]&&((a=n[r])==null||a.forEach(o=>t(o)),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,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,n)=>wd(n,e)-wd(s,e)))},i=>{const s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};class ch{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 $y=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
11
|
+
`);function zy(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 Yy(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);for(;;){const i=$y.replace(/%forloop%/gi,zy(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}const uh=0,dh=1,fh=2,ph=3,mh=4,gh=5;class ii{constructor(){this.data=0,this.blendMode=K.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<uh)}set blend(t){!!(this.data&1<<uh)!==t&&(this.data^=1<<uh)}get offsets(){return!!(this.data&1<<dh)}set offsets(t){!!(this.data&1<<dh)!==t&&(this.data^=1<<dh)}get culling(){return!!(this.data&1<<fh)}set culling(t){!!(this.data&1<<fh)!==t&&(this.data^=1<<fh)}get depthTest(){return!!(this.data&1<<ph)}set depthTest(t){!!(this.data&1<<ph)!==t&&(this.data^=1<<ph)}get depthMask(){return!!(this.data&1<<gh)}set depthMask(t){!!(this.data&1<<gh)!==t&&(this.data^=1<<gh)}get clockwiseFrontFace(){return!!(this.data&1<<mh)}set clockwiseFrontFace(t){!!(this.data&1<<mh)!==t&&(this.data^=1<<mh)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==K.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new ii;return t.depthTest=!1,t.blend=!0,t}}ii.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const _h=[];function Ad(r,t){if(!r)return null;let e="";if(typeof r=="string"){const i=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);i&&(e=i[1].toLowerCase())}for(let i=_h.length-1;i>=0;--i){const s=_h[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class ke{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,s,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,s,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(ke.prototype,{dispatch:{value:ke.prototype.emit},run:{value:ke.prototype.emit}});class zs{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new ke("setRealSize"),this.onUpdate=new ke("update"),this.onError=new ke("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 qn extends zs{constructor(t,e){const{width:i,height:s}=e||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,i){const s=t.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===oe.UNPACK);const n=e.realWidth,a=e.realHeight;return i.width===n&&i.height===a?s.texSubImage2D(e.target,0,0,0,n,a,e.format,i.type,this.data):(i.width=n,i.height=a,s.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 jy={scaleMode:_i.NEAREST,alphaMode:oe.NPM},yh=class Cs extends Ds{constructor(t=null,e=null){super(),e=Object.assign({},Cs.defaultOptions,e);const{alphaMode:i,mipmap:s,anisotropicLevel:n,scaleMode:a,width:o,height:h,wrapMode:l,format:c,type:d,target:u,resolution:f,resourceOptions:p}=e;t&&!(t instanceof zs)&&(t=Ad(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=s,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=a,this.format=c,this.type=d,this.target=u,this.alphaMode=i,this.uid=cr(),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=yd(this.realWidth)&&yd(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 Gi[this.cacheId],delete ei[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Cs.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 s=typeof t=="string";let n=null;if(s)n=t;else{if(!t._pixiId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${o}_${cr()}`}n=t._pixiId}let a=Gi[n];if(s&&i&&!a)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return a||(a=new Cs(t,e),a.cacheId=n,Cs.addToCache(a,n)),a}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);const n=new qn(t,{width:e,height:i,...s==null?void 0:s.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 Cs(n,Object.assign({},jy,{type:o,format:a},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Gi[e]&&Gi[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),Gi[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Gi[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Gi[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete Gi[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};yh.defaultOptions={mipmap:je.POW2,anisotropicLevel:0,scaleMode:_i.LINEAR,wrapMode:Li.CLAMP,alphaMode:oe.UNPACK,target:kr.TEXTURE_2D,format:O.RGBA,type:Z.UNSIGNED_BYTE},yh._globalBatch=0;let J=yh;class xh{constructor(){this.texArray=null,this.blend=0,this.type=Le.TRIANGLES,this.start=0,this.size=0,this.data=null}}let qy=0;class Ot{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=qy++,this.disposeRunner=new ke("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?Ke.ELEMENT_ARRAY_BUFFER:Ke.ARRAY_BUFFER}get index(){return this.type===Ke.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new Ot(t)}}class Kn{constructor(t,e=0,i=!1,s=Z.FLOAT,n,a,o,h=1){this.buffer=t,this.size=e,this.normalized=i,this.type=s,this.stride=n,this.start=a,this.instance=o,this.divisor=h}destroy(){this.buffer=null}static from(t,e,i,s,n){return new Kn(t,e,i,s,n)}}const Ky={Float32Array,Uint32Array,Int32Array,Uint8Array};function Zy(r,t){let e=0,i=0;const s={};for(let h=0;h<r.length;h++)i+=t[h],e+=r[h].length;const n=new ArrayBuffer(e*4);let a=null,o=0;for(let h=0;h<r.length;h++){const l=t[h],c=r[h],d=_d(c);s[d]||(s[d]=new Ky[d](n)),a=s[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 Sd={5126:4,5123:2,5121:1};let Qy=0;const Jy={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class Vi{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=Qy++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new ke("disposeGeometry"),this.refCount=0}addAttribute(t,e,i=0,s=!1,n,a,o,h=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof Ot||(e instanceof Array&&(e=new Float32Array(e)),e=new Ot(e));const l=t.split("|");if(l.length>1){for(let d=0;d<l.length;d++)this.addAttribute(l[d],e,i,s,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 Kn(c,i,s,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 Ot||(t instanceof Array&&(t=new Uint16Array(t)),t=new Ot(t)),t.type=Ke.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 Ot;let s;for(s in this.attributes){const n=this.attributes[s],a=this.buffers[n.buffer];t.push(a.data),e.push(n.size*Sd[n.type]/4),n.buffer=0}for(i.data=Zy(t,e),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].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 Vi;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new Ot(this.buffers[e].data.slice(0));for(const e in this.attributes){const i=this.attributes[e];t.attributes[e]=new Kn(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=Ke.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new Vi,i=[],s=[],n=[];let a;for(let o=0;o<t.length;o++){a=t[o];for(let h=0;h<a.buffers.length;h++)s[h]=s[h]||0,s[h]+=a.buffers[h].data.length,n[h]=0}for(let o=0;o<a.buffers.length;o++)i[o]=new Jy[_d(a.buffers[o].data)](s[o]),e.buffers[o]=new Ot(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=Ke.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*Sd[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 Cd extends Vi{constructor(t=!1){super(),this._buffer=new Ot(null,t,!1),this._indexBuffer=new Ot(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 Zn=Math.PI*2,tx=180/Math.PI,ex=Math.PI/180;var qt=(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))(qt||{});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 Qn=[new tt,new tt,new tt,new tt];let it=class Ic{constructor(t=0,e=0,i=0,s=0){this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(s),this.type=qt.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 Ic(0,0,0,0)}clone(){return new Ic(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 w=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=w)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,s=this.right,n=this.top,a=this.bottom;if(s<=i||a<=n)return!1;const o=Qn[0].set(t.left,t.top),h=Qn[1].set(t.left,t.bottom),l=Qn[2].set(t.right,t.top),c=Qn[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)>=s||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*s+f*n,g=u*i+f*a,y=u*s+f*a;if(Math.max(p,m,g,y)<=u*o.x+f*o.y||Math.min(p,m,g,y)>=u*c.x+f*c.y)return!1;const v=d*(o.y-l.y),_=d*(l.x-o.x),x=v*i+_*n,b=v*s+_*n,E=v*i+_*a,T=v*s+_*a;return!(Math.max(x,b,E,T)<=v*o.x+_*o.y||Math.min(x,b,E,T)>=v*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),i=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=s,this.height=Math.max(n-s,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=s-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=n-s,this}};it.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Jn{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=qt.CIRC}clone(){return new Jn(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let s=this.x-t,n=this.y-e;return s*=s,n*=n,s+n<=i}getBounds(){return new it(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}Jn.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class ta{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s,this.type=qt.ELIP}clone(){return new ta(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,s=(e-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new it(this.x-this.width,this.y-this.height,this.width,this.height)}}ta.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Hi{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const i=[];for(let s=0,n=e.length;s<n;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.type=qt.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new Hi(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let i=!1;const s=this.points.length/2;for(let n=0,a=s-1;n<s;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}}Hi.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};class ea{constructor(t=0,e=0,i=0,s=0,n=20){this.x=t,this.y=e,this.width=i,this.height=s,this.radius=n,this.type=qt.RREC}clone(){return new ea(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 s=t-(this.x+i),n=e-(this.y+i);const a=i*i;if(s*s+n*n<=a||(s=t-(this.x+this.width-i),s*s+n*n<=a)||(n=e-(this.y+this.height-i),s*s+n*n<=a)||(s=t-(this.x+i),s*s+n*n<=a))return!0}return!1}}ea.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class mt{constructor(t=1,e=0,i=0,s=1,n=0,a=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=s,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,s,n,a){return this.a=t,this.b=e,this.c=i,this.d=s,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,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new tt;const i=1/(this.a*this.d+this.c*-this.b),s=t.x,n=t.y;return e.x=this.d*i*s+-this.c*i*n+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*n+-this.b*i*s+(-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),s=this.a,n=this.c,a=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=a*e-this.ty*i,this.ty=a*i+this.ty*e,this}append(t){const e=this.a,i=this.b,s=this.c,n=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this}setTransform(t,e,i,s,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+s*this.c),this.ty=e-(i*this.b+s*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,i=this.b,s=this.c,n=this.d,a=t.pivot,o=-Math.atan2(-s,n),h=Math.atan2(i,e),l=Math.abs(o+h);return l<1e-5||Math.abs(Zn-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(s*s+n*n),t.position.x=this.tx+(a.x*e+a.y*s),t.position.y=this.ty+(a.x*i+a.y*n),t}invert(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.tx,a=t*s-e*i;return this.a=s/a,this.b=-e/a,this.c=-i/a,this.d=t/a,this.tx=(i*this.ty-s*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 mt;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 mt}static get TEMP_MATRIX(){return new mt}}mt.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 ur=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],dr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],fr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],pr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],vh=[],Pd=[],ia=Math.sign;function ix(){for(let r=0;r<16;r++){const t=[];vh.push(t);for(let e=0;e<16;e++){const i=ia(ur[r]*ur[e]+fr[r]*dr[e]),s=ia(dr[r]*ur[e]+pr[r]*dr[e]),n=ia(ur[r]*fr[e]+fr[r]*pr[e]),a=ia(dr[r]*fr[e]+pr[r]*pr[e]);for(let o=0;o<16;o++)if(ur[o]===i&&dr[o]===s&&fr[o]===n&&pr[o]===a){t.push(o);break}}}for(let r=0;r<16;r++){const t=new mt;t.set(ur[r],dr[r],fr[r],pr[r],0,0),Pd.push(t)}}ix();const Tt={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=>ur[r],uY:r=>dr[r],vX:r=>fr[r],vY:r=>pr[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>vh[r][t],sub:(r,t)=>vh[r][Tt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Tt.S:Tt.N:Math.abs(t)*2<=Math.abs(r)?r>0?Tt.E:Tt.W:t>0?r>0?Tt.SE:Tt.SW:r>0?Tt.NE:Tt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{const s=Pd[Tt.inv(t)];s.tx=e,s.ty=i,r.append(s)}};class wi{constructor(t,e,i=0,s=0){this._x=i,this._y=s,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new wi(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))}}wi.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const bh=class{constructor(){this.worldTransform=new mt,this.localTransform=new mt,this.position=new wi(this.onChange,this,0,0),this.scale=new wi(this.onChange,this,1,1),this.pivot=new wi(this.onChange,this,0,0),this.skew=new wi(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,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=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())}};bh.IDENTITY=new bh;let ra=bh;ra.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;
|
|
13
|
+
|
|
14
|
+
uniform sampler2D uSampler;
|
|
15
|
+
|
|
16
|
+
void main(void){
|
|
17
|
+
gl_FragColor *= texture2D(uSampler, vTextureCoord);
|
|
18
|
+
}`,sx=`attribute vec2 aVertexPosition;
|
|
19
|
+
attribute vec2 aTextureCoord;
|
|
20
|
+
|
|
21
|
+
uniform mat3 projectionMatrix;
|
|
22
|
+
|
|
23
|
+
varying vec2 vTextureCoord;
|
|
24
|
+
|
|
25
|
+
void main(void){
|
|
26
|
+
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
27
|
+
vTextureCoord = aTextureCoord;
|
|
28
|
+
}
|
|
29
|
+
`;function Rd(r,t,e){const i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}function Th(r){const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function Id(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 Th(2*t);case"bvec3":return Th(3*t);case"bvec4":return Th(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 Qr=[{test:r=>r.type==="float"&&r.size===1&&!r.isArray,code:r=>`
|
|
30
|
+
if(uv["${r}"] !== ud["${r}"].value)
|
|
31
|
+
{
|
|
32
|
+
ud["${r}"].value = uv["${r}"]
|
|
33
|
+
gl.uniform1f(ud["${r}"].location, uv["${r}"])
|
|
34
|
+
}
|
|
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
|
+
|
|
37
|
+
renderer.texture.bind(uv["${r}"], t);
|
|
38
|
+
|
|
39
|
+
if(ud["${r}"].value !== t)
|
|
40
|
+
{
|
|
41
|
+
ud["${r}"].value = t;
|
|
42
|
+
gl.uniform1i(ud["${r}"].location, t);
|
|
43
|
+
; // eslint-disable-line max-len
|
|
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
|
+
|
|
53
|
+
data[offset + 4] = ${r}_matrix[3];
|
|
54
|
+
data[offset + 5] = ${r}_matrix[4];
|
|
55
|
+
data[offset + 6] = ${r}_matrix[5];
|
|
56
|
+
|
|
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
|
+
|
|
64
|
+
if(cv[0] !== v.x || cv[1] !== v.y)
|
|
65
|
+
{
|
|
66
|
+
cv[0] = v.x;
|
|
67
|
+
cv[1] = v.y;
|
|
68
|
+
gl.uniform2f(ud["${r}"].location, v.x, v.y);
|
|
69
|
+
}`,codeUbo:r=>`
|
|
70
|
+
v = uv.${r};
|
|
71
|
+
|
|
72
|
+
data[offset] = v.x;
|
|
73
|
+
data[offset+1] = v.y;
|
|
74
|
+
`},{test:r=>r.type==="vec2"&&r.size===1&&!r.isArray,code:r=>`
|
|
75
|
+
cv = ud["${r}"].value;
|
|
76
|
+
v = uv["${r}"];
|
|
77
|
+
|
|
78
|
+
if(cv[0] !== v[0] || cv[1] !== v[1])
|
|
79
|
+
{
|
|
80
|
+
cv[0] = v[0];
|
|
81
|
+
cv[1] = v[1];
|
|
82
|
+
gl.uniform2f(ud["${r}"].location, v[0], v[1]);
|
|
83
|
+
}
|
|
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
|
+
|
|
88
|
+
if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)
|
|
89
|
+
{
|
|
90
|
+
cv[0] = v.x;
|
|
91
|
+
cv[1] = v.y;
|
|
92
|
+
cv[2] = v.width;
|
|
93
|
+
cv[3] = v.height;
|
|
94
|
+
gl.uniform4f(ud["${r}"].location, v.x, v.y, v.width, v.height)
|
|
95
|
+
}`,codeUbo:r=>`
|
|
96
|
+
v = uv.${r};
|
|
97
|
+
|
|
98
|
+
data[offset] = v.x;
|
|
99
|
+
data[offset+1] = v.y;
|
|
100
|
+
data[offset+2] = v.width;
|
|
101
|
+
data[offset+3] = v.height;
|
|
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
|
+
|
|
106
|
+
if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha)
|
|
107
|
+
{
|
|
108
|
+
cv[0] = v.red;
|
|
109
|
+
cv[1] = v.green;
|
|
110
|
+
cv[2] = v.blue;
|
|
111
|
+
cv[3] = v.alpha;
|
|
112
|
+
gl.uniform4f(ud["${r}"].location, v.red, v.green, v.blue, v.alpha)
|
|
113
|
+
}`,codeUbo:r=>`
|
|
114
|
+
v = uv.${r};
|
|
115
|
+
|
|
116
|
+
data[offset] = v.red;
|
|
117
|
+
data[offset+1] = v.green;
|
|
118
|
+
data[offset+2] = v.blue;
|
|
119
|
+
data[offset+3] = v.alpha;
|
|
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
|
+
|
|
124
|
+
if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a)
|
|
125
|
+
{
|
|
126
|
+
cv[0] = v.red;
|
|
127
|
+
cv[1] = v.green;
|
|
128
|
+
cv[2] = v.blue;
|
|
129
|
+
|
|
130
|
+
gl.uniform3f(ud["${r}"].location, v.red, v.green, v.blue)
|
|
131
|
+
}`,codeUbo:r=>`
|
|
132
|
+
v = uv.${r};
|
|
133
|
+
|
|
134
|
+
data[offset] = v.red;
|
|
135
|
+
data[offset+1] = v.green;
|
|
136
|
+
data[offset+2] = v.blue;
|
|
137
|
+
`},{test:r=>r.type==="vec4"&&r.size===1&&!r.isArray,code:r=>`
|
|
138
|
+
cv = ud["${r}"].value;
|
|
139
|
+
v = uv["${r}"];
|
|
140
|
+
|
|
141
|
+
if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
142
|
+
{
|
|
143
|
+
cv[0] = v[0];
|
|
144
|
+
cv[1] = v[1];
|
|
145
|
+
cv[2] = v[2];
|
|
146
|
+
cv[3] = v[3];
|
|
147
|
+
|
|
148
|
+
gl.uniform4f(ud["${r}"].location, v[0], v[1], v[2], v[3])
|
|
149
|
+
}`}],nx={float:`
|
|
150
|
+
if (cv !== v)
|
|
151
|
+
{
|
|
152
|
+
cu.value = v;
|
|
153
|
+
gl.uniform1f(location, v);
|
|
154
|
+
}`,vec2:`
|
|
155
|
+
if (cv[0] !== v[0] || cv[1] !== v[1])
|
|
156
|
+
{
|
|
157
|
+
cv[0] = v[0];
|
|
158
|
+
cv[1] = v[1];
|
|
159
|
+
|
|
160
|
+
gl.uniform2f(location, v[0], v[1])
|
|
161
|
+
}`,vec3:`
|
|
162
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
|
163
|
+
{
|
|
164
|
+
cv[0] = v[0];
|
|
165
|
+
cv[1] = v[1];
|
|
166
|
+
cv[2] = v[2];
|
|
167
|
+
|
|
168
|
+
gl.uniform3f(location, v[0], v[1], v[2])
|
|
169
|
+
}`,vec4:`
|
|
170
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
171
|
+
{
|
|
172
|
+
cv[0] = v[0];
|
|
173
|
+
cv[1] = v[1];
|
|
174
|
+
cv[2] = v[2];
|
|
175
|
+
cv[3] = v[3];
|
|
176
|
+
|
|
177
|
+
gl.uniform4f(location, v[0], v[1], v[2], v[3]);
|
|
178
|
+
}`,int:`
|
|
179
|
+
if (cv !== v)
|
|
180
|
+
{
|
|
181
|
+
cu.value = v;
|
|
182
|
+
|
|
183
|
+
gl.uniform1i(location, v);
|
|
184
|
+
}`,ivec2:`
|
|
185
|
+
if (cv[0] !== v[0] || cv[1] !== v[1])
|
|
186
|
+
{
|
|
187
|
+
cv[0] = v[0];
|
|
188
|
+
cv[1] = v[1];
|
|
189
|
+
|
|
190
|
+
gl.uniform2i(location, v[0], v[1]);
|
|
191
|
+
}`,ivec3:`
|
|
192
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
|
193
|
+
{
|
|
194
|
+
cv[0] = v[0];
|
|
195
|
+
cv[1] = v[1];
|
|
196
|
+
cv[2] = v[2];
|
|
197
|
+
|
|
198
|
+
gl.uniform3i(location, v[0], v[1], v[2]);
|
|
199
|
+
}`,ivec4:`
|
|
200
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
201
|
+
{
|
|
202
|
+
cv[0] = v[0];
|
|
203
|
+
cv[1] = v[1];
|
|
204
|
+
cv[2] = v[2];
|
|
205
|
+
cv[3] = v[3];
|
|
206
|
+
|
|
207
|
+
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
208
|
+
}`,uint:`
|
|
209
|
+
if (cv !== v)
|
|
210
|
+
{
|
|
211
|
+
cu.value = v;
|
|
212
|
+
|
|
213
|
+
gl.uniform1ui(location, v);
|
|
214
|
+
}`,uvec2:`
|
|
215
|
+
if (cv[0] !== v[0] || cv[1] !== v[1])
|
|
216
|
+
{
|
|
217
|
+
cv[0] = v[0];
|
|
218
|
+
cv[1] = v[1];
|
|
219
|
+
|
|
220
|
+
gl.uniform2ui(location, v[0], v[1]);
|
|
221
|
+
}`,uvec3:`
|
|
222
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
|
223
|
+
{
|
|
224
|
+
cv[0] = v[0];
|
|
225
|
+
cv[1] = v[1];
|
|
226
|
+
cv[2] = v[2];
|
|
227
|
+
|
|
228
|
+
gl.uniform3ui(location, v[0], v[1], v[2]);
|
|
229
|
+
}`,uvec4:`
|
|
230
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
231
|
+
{
|
|
232
|
+
cv[0] = v[0];
|
|
233
|
+
cv[1] = v[1];
|
|
234
|
+
cv[2] = v[2];
|
|
235
|
+
cv[3] = v[3];
|
|
236
|
+
|
|
237
|
+
gl.uniform4ui(location, v[0], v[1], v[2], v[3]);
|
|
238
|
+
}`,bool:`
|
|
239
|
+
if (cv !== v)
|
|
240
|
+
{
|
|
241
|
+
cu.value = v;
|
|
242
|
+
gl.uniform1i(location, v);
|
|
243
|
+
}`,bvec2:`
|
|
244
|
+
if (cv[0] != v[0] || cv[1] != v[1])
|
|
245
|
+
{
|
|
246
|
+
cv[0] = v[0];
|
|
247
|
+
cv[1] = v[1];
|
|
248
|
+
|
|
249
|
+
gl.uniform2i(location, v[0], v[1]);
|
|
250
|
+
}`,bvec3:`
|
|
251
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
|
252
|
+
{
|
|
253
|
+
cv[0] = v[0];
|
|
254
|
+
cv[1] = v[1];
|
|
255
|
+
cv[2] = v[2];
|
|
256
|
+
|
|
257
|
+
gl.uniform3i(location, v[0], v[1], v[2]);
|
|
258
|
+
}`,bvec4:`
|
|
259
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
260
|
+
{
|
|
261
|
+
cv[0] = v[0];
|
|
262
|
+
cv[1] = v[1];
|
|
263
|
+
cv[2] = v[2];
|
|
264
|
+
cv[3] = v[3];
|
|
265
|
+
|
|
266
|
+
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
267
|
+
}`,mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:`
|
|
268
|
+
if (cv !== v)
|
|
269
|
+
{
|
|
270
|
+
cu.value = v;
|
|
271
|
+
|
|
272
|
+
gl.uniform1i(location, v);
|
|
273
|
+
}`,samplerCube:`
|
|
274
|
+
if (cv !== v)
|
|
275
|
+
{
|
|
276
|
+
cu.value = v;
|
|
277
|
+
|
|
278
|
+
gl.uniform1i(location, v);
|
|
279
|
+
}`,sampler2DArray:`
|
|
280
|
+
if (cv !== v)
|
|
281
|
+
{
|
|
282
|
+
cu.value = v;
|
|
283
|
+
|
|
284
|
+
gl.uniform1i(location, v);
|
|
285
|
+
}`},ax={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 ox(r,t){var i;const e=[`
|
|
286
|
+
var v = null;
|
|
287
|
+
var cv = null;
|
|
288
|
+
var cu = null;
|
|
289
|
+
var t = 0;
|
|
290
|
+
var gl = renderer.gl;
|
|
291
|
+
`];for(const s in r.uniforms){const n=t[s];if(!n){((i=r.uniforms[s])==null?void 0:i.group)===!0&&(r.uniforms[s].ubo?e.push(`
|
|
292
|
+
renderer.shader.syncUniformBufferGroup(uv.${s}, '${s}');
|
|
293
|
+
`):e.push(`
|
|
294
|
+
renderer.shader.syncUniformGroup(uv.${s}, syncData);
|
|
295
|
+
`));continue}const a=r.uniforms[s];let o=!1;for(let h=0;h<Qr.length;h++)if(Qr[h].test(n,a)){e.push(Qr[h].code(s,a)),o=!0;break}if(!o){const h=(n.size===1&&!n.isArray?nx:ax)[n.type].replace("location",`ud["${s}"].location`);e.push(`
|
|
296
|
+
cu = ud["${s}"];
|
|
297
|
+
cv = cu.value;
|
|
298
|
+
v = uv["${s}"];
|
|
299
|
+
${h};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
|
|
300
|
+
`))}const Md={};let Jr=Md;function hx(){if(Jr===Md||Jr!=null&&Jr.isContextLost()){const r=H.ADAPTER.createCanvas();let t;H.PREFER_ENV>=Ye.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),Jr=t}return Jr}let sa;function lx(){if(!sa){sa=Ae.MEDIUM;const r=hx();if(r&&r.getShaderPrecisionFormat){const t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(sa=t.precision?Ae.HIGH:Ae.MEDIUM)}}return sa}function Dd(r,t){const e=r.getShaderSource(t).split(`
|
|
301
|
+
`).map((l,c)=>`${c}: ${l}`),i=r.getShaderInfoLog(t),s=i.split(`
|
|
302
|
+
`),n={},a=s.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!n[l]?(n[l]=!0,!0):!1),o=[""];a.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const h=e.join(`
|
|
303
|
+
`);o[0]=h,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}function cx(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||Dd(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||Dd(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}const ux={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 Bd(r){return ux[r]}let na=null;const Od={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 Fd(r,t){if(!na){const e=Object.keys(Od);na={};for(let i=0;i<e.length;++i){const s=e[i];na[r[s]]=Od[s]}}return na[t]}function Ld(r,t,e){if(r.substring(0,9)!=="precision"){let i=t;return t===Ae.HIGH&&e!==Ae.HIGH&&(i=Ae.MEDIUM),`precision ${i} float;
|
|
304
|
+
${r}`}else if(e!==Ae.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}let Ys;function dx(){if(typeof Ys=="boolean")return Ys;try{Ys=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Ys=!1}return Ys}let fx=0;const aa={},Eh=class Ps{constructor(t,e,i="pixi-shader",s={}){this.extra={},this.id=fx++,this.vertexSrc=t||Ps.defaultVertexSrc,this.fragmentSrc=e||Ps.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=s,this.vertexSrc.substring(0,8)!=="#version"&&(i=i.replace(/\s+/g,"-"),aa[i]?(aa[i]++,i+=`-${aa[i]}`):aa[i]=1,this.vertexSrc=`#define SHADER_NAME ${i}
|
|
305
|
+
${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${i}
|
|
306
|
+
${this.fragmentSrc}`,this.vertexSrc=Ld(this.vertexSrc,Ps.defaultVertexPrecision,Ae.HIGH),this.fragmentSrc=Ld(this.fragmentSrc,Ps.defaultFragmentPrecision,lx())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return sx}static get defaultFragmentSrc(){return rx}static from(t,e,i){const s=t+e;let n=bd[s];return n||(bd[s]=n=new Ps(t,e,i)),n}};Eh.defaultVertexPrecision=Ae.HIGH,Eh.defaultFragmentPrecision=xi.apple.device?Ae.HIGH:Ae.MEDIUM;let Ai=Eh,px=0;class Ue{constructor(t,e,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=px++,this.static=!!e,this.ubo=!!i,t instanceof Ot?(this.buffer=t,this.buffer.type=Ke.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new Ot(new Float32Array(1)),this.buffer.type=Ke.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,i){if(!this.ubo)this.uniforms[t]=new Ue(e,i);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(t,e,i){return new Ue(t,e,i)}static uboFrom(t,e){return new Ue(t,e??!0,!0)}}class ri{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof Ue?this.uniformGroup=e:this.uniformGroup=new Ue(e):this.uniformGroup=new Ue({}),this.disposeRunner=new ke("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(const i in e.uniforms){const s=e.uniforms[i];if(s.group===!0&&this.checkUniformExists(t,s))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,i){const s=Ai.from(t,e);return new ri(s,i)}}class mx{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 i=new Int32Array(t);for(let n=0;n<t;n++)i[n]=n;this.defaultGroupCache[t]=Ue.from({uSamplers:i},!0);let s=this.fragTemplate;s=s.replace(/%count%/gi,`${t}`),s=s.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new Ai(this.vertexSrc,s)}const e={tint:new Float32Array([1,1,1,1]),translationMatrix:new mt,default:this.defaultGroupCache[t]};return new ri(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
|
|
307
|
+
`,e+=`
|
|
308
|
+
`;for(let i=0;i<t;i++)i>0&&(e+=`
|
|
309
|
+
else `),i<t-1&&(e+=`if(vTextureId < ${i}.5)`),e+=`
|
|
310
|
+
{`,e+=`
|
|
311
|
+
color = texture2D(uSamplers[${i}], vTextureCoord);`,e+=`
|
|
312
|
+
}`;return e+=`
|
|
313
|
+
`,e+=`
|
|
314
|
+
`,e}}class wh{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 gx(){return!xi.apple.device}function _x(r){let t=!0;const e=H.ADAPTER.getNavigator();if(xi.tablet||xi.phone){if(xi.apple.device){const i=e.userAgent.match(/OS (\d+)_(\d+)?/);i&&parseInt(i[1],10)<11&&(t=!1)}if(xi.android.device){const i=e.userAgent.match(/Android\s([0-9.]*)/);i&&parseInt(i[1],10)<7&&(t=!1)}}return t?r:4}class oa{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}var yx=`varying vec2 vTextureCoord;
|
|
315
|
+
varying vec4 vColor;
|
|
316
|
+
varying float vTextureId;
|
|
317
|
+
uniform sampler2D uSamplers[%count%];
|
|
318
|
+
|
|
319
|
+
void main(void){
|
|
320
|
+
vec4 color;
|
|
321
|
+
%forloop%
|
|
322
|
+
gl_FragColor = color * vColor;
|
|
323
|
+
}
|
|
324
|
+
`,xx=`precision highp float;
|
|
325
|
+
attribute vec2 aVertexPosition;
|
|
326
|
+
attribute vec2 aTextureCoord;
|
|
327
|
+
attribute vec4 aColor;
|
|
328
|
+
attribute float aTextureId;
|
|
329
|
+
|
|
330
|
+
uniform mat3 projectionMatrix;
|
|
331
|
+
uniform mat3 translationMatrix;
|
|
332
|
+
uniform vec4 tint;
|
|
333
|
+
|
|
334
|
+
varying vec2 vTextureCoord;
|
|
335
|
+
varying vec4 vColor;
|
|
336
|
+
varying float vTextureId;
|
|
337
|
+
|
|
338
|
+
void main(void){
|
|
339
|
+
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
340
|
+
|
|
341
|
+
vTextureCoord = aTextureCoord;
|
|
342
|
+
vTextureId = aTextureId;
|
|
343
|
+
vColor = aColor * tint;
|
|
344
|
+
}
|
|
345
|
+
`;const js=class ze extends oa{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=Cd,this.vertexSize=6,this.state=ii.for2d(),this.size=ze.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??_x(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??gx(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return st("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return xx}static get defaultFragmentTemplate(){return yx}setShaderGenerator({vertex:t=ze.defaultVertexSrc,fragment:e=ze.defaultFragmentTemplate}={}){this.shaderGenerator=new mx(t,e)}contextChange(){const t=this.renderer.gl;H.PREFER_ENV===Ye.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),ze.defaultMaxTextures),this.maxTextures=Yy(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}=ze,i=this.size/4,s=Math.floor(i/this.maxTextures)+1;for(;t.length<i;)t.push(new xh);for(;e.length<s;)e.push(new wh);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,i=ze._textureArrayPool,s=this.renderer.batch,n=this._tempBoundTextures,a=this.renderer.textureGC.count;let o=++J._globalBatch,h=0,l=i[0],c=0;s.copyBoundTextures(n,e);for(let d=0;d<this._bufferSize;++d){const u=t[d];t[d]=null,u._batchEnabled!==o&&(l.count>=e&&(s.boundArray(l,n,o,e),this.buildDrawCalls(l,c,d),c=d,l=i[++h],++o),u._batchEnabled=o,u.touched=a,l.elements[l.count++]=u)}l.count>0&&(s.boundArray(l,n,o,e),this.buildDrawCalls(l,c,this._bufferSize),++h,++o);for(let d=0;d<n.length;d++)n[d]=null;J._globalBatch=o}buildDrawCalls(t,e,i){const{_bufferedElements:s,_attributeBuffer:n,_indexBuffer:a,vertexSize:o}=this,h=ze._drawCallPool;let l=this._dcIndex,c=this._aIndex,d=this._iIndex,u=h[l];u.start=this._iIndex,u.texArray=t;for(let f=e;f<i;++f){const p=s[f],m=p._texture.baseTexture,g=md[m.alphaMode?1:0][p.blendMode];s[f]=null,e<f&&u.blend!==g&&(u.size=d-u.start,e=f,u=h[++l],u.texArray=t,u.start=d),this.packInterleavedGeometry(p,n,a,c,d),c+=p.vertexData.length/2*o,d+=p.indices.length,u.blend=g}e<i&&(u.size=d-u.start,++l),this._dcIndex=l,this._aIndex=c,this._iIndex=d}bindAndClearTexArray(t){const e=this.renderer.texture;for(let i=0;i<t.count;i++)e.bind(t.elements[i],t.ids[i]),t.elements[i]=null;t.count=0}updateGeometry(){const{_packedGeometries:t,_attributeBuffer:e,_indexBuffer:i}=this;ze.canUploadSameBuffer?(t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(i),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(i),this.renderer.geometry.bind(t[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){const t=this._dcIndex,{gl:e,state:i}=this.renderer,s=ze._drawCallPool;let n=null;for(let a=0;a<t;a++){const{texArray:o,type:h,size:l,start:c,blend:d}=s[a];n!==o&&(n=o,this.bindAndClearTexArray(o)),this.state.blendMode=d,i.set(this.state),e.drawElements(h,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),ze.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=jn(Math.ceil(t/8)),i=xd(e),s=e*8;this._aBuffers.length<=i&&(this._iBuffers.length=i+1);let n=this._aBuffers[s];return n||(this._aBuffers[s]=n=new ch(s*this.vertexSize*4)),n}getIndexBuffer(t){const e=jn(Math.ceil(t/12)),i=xd(e),s=e*12;this._iBuffers.length<=i&&(this._iBuffers.length=i+1);let n=this._iBuffers[i];return n||(this._iBuffers[i]=n=new Uint16Array(s)),n}packInterleavedGeometry(t,e,i,s,n){const{uint32View:a,float32View:o}=e,h=s/this.vertexSize,l=t.uvs,c=t.indices,d=t.vertexData,u=t._texture.baseTexture._batchLocation,f=Math.min(t.worldAlpha,1),p=dt.shared.setValue(t._tintRGB).toPremultiplied(f,t._texture.baseTexture.alphaMode>0);for(let m=0;m<d.length;m+=2)o[s++]=d[m],o[s++]=d[m+1],o[s++]=l[m],o[s++]=l[m+1],a[s++]=p,o[s++]=u;for(let m=0;m<c.length;m++)i[n++]=h+c[m]}};js.defaultBatchSize=4096,js.extension={name:"batch",type:G.RendererPlugin},js._drawCallPool=[],js._textureArrayPool=[];let mr=js;Y.add(mr);var vx=`varying vec2 vTextureCoord;
|
|
346
|
+
|
|
347
|
+
uniform sampler2D uSampler;
|
|
348
|
+
|
|
349
|
+
void main(void){
|
|
350
|
+
gl_FragColor = texture2D(uSampler, vTextureCoord);
|
|
351
|
+
}
|
|
352
|
+
`,bx=`attribute vec2 aVertexPosition;
|
|
353
|
+
|
|
354
|
+
uniform mat3 projectionMatrix;
|
|
355
|
+
|
|
356
|
+
varying vec2 vTextureCoord;
|
|
357
|
+
|
|
358
|
+
uniform vec4 inputSize;
|
|
359
|
+
uniform vec4 outputFrame;
|
|
360
|
+
|
|
361
|
+
vec4 filterVertexPosition( void )
|
|
362
|
+
{
|
|
363
|
+
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
|
364
|
+
|
|
365
|
+
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
vec2 filterTextureCoord( void )
|
|
369
|
+
{
|
|
370
|
+
return aVertexPosition * (outputFrame.zw * inputSize.zw);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
void main(void)
|
|
374
|
+
{
|
|
375
|
+
gl_Position = filterVertexPosition();
|
|
376
|
+
vTextureCoord = filterTextureCoord();
|
|
377
|
+
}
|
|
378
|
+
`;const Ah=class Tn extends ri{constructor(t,e,i){const s=Ai.from(t||Tn.defaultVertexSrc,e||Tn.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=Tn.defaultResolution,this.multisample=Tn.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new ii}apply(t,e,i,s,n){t.applyFilter(this,e,i,s)}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 bx}static get defaultFragmentSrc(){return vx}};Ah.defaultResolution=1,Ah.defaultMultisample=Nt.NONE;let re=Ah;class ha{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new dt(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;const{backgroundColor:e,background:i,backgroundAlpha:s}=t,n=i??e;n!==void 0&&(this.color=n),this.alpha=s}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(){}}ha.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},ha.extension={type:[G.RendererSystem,G.CanvasRendererSystem],name:"background"},Y.add(ha);class Nd{constructor(t){this.renderer=t,this.emptyRenderer=new oa(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 s=e-1;s>=0;--s)t[s]=i[s]||null,t[s]&&(t[s]._batchLocation=s)}boundArray(t,e,i,s){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<s&&e[d]===c){a[l]=d;continue}for(;h<s;){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}}Nd.extension={type:G.RendererSystem,name:"batch"},Y.add(Nd);let kd=0;class la{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=kd++}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=kd++,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>=Ye.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 s=i||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}la.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},la.extension={type:G.RendererSystem,name:"context"},Y.add(la);class Sh{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 ke("disposeFramebuffer"),this.multisample=Nt.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new J(null,{scaleMode:_i.NEAREST,resolution:1,mipmap:je.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new J(null,{scaleMode:_i.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:je.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 s=this.colorTextures[i],n=s.resolution;s.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 Ud extends J{constructor(t={}){if(typeof t=="number"){const e=arguments[0],i=arguments[1],s=arguments[2],n=arguments[3];t={width:e,height:i,scaleMode:s,resolution:n}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=Nt.NONE),super(null,t),this.mipmap=je.OFF,this.valid=!0,this._clear=new dt([0,0,0,0]),this.framebuffer=new Sh(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 Si extends zs{constructor(t){const e=t,i=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,s=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(i,s),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,i){i===void 0&&!e.startsWith("data:")?t.crossOrigin=Wy(e):i!==!1&&(t.crossOrigin=typeof i=="string"?i:"anonymous")}upload(t,e,i,s){const n=t.gl,a=e.realWidth,o=e.realHeight;if(s=s||this.source,typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===oe.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,s):(i.width=a,i.height=o,n.texImage2D(e.target,0,i.internalFormat,e.format,i.type,s)),!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 Gd extends Si{constructor(t,e){if(e=e||{},typeof t=="string"){const i=new Image;Si.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 s=this.source;this.url=s.src;const n=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};s.complete&&s.src?n():(s.onload=n,s.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(s=>s.blob()).then(s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===oe.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,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 s=!0;const n=e._glTextures;for(const a in n){const o=n[a];if(o!==i&&o.dirtyId!==e.dirtyId){s=!1;break}}s&&(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 Ch{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,i){const s=e.width,n=e.height;if(i){const a=t.width/2/s,o=t.height/2/n,h=t.x/s+a,l=t.y/n+o;i=Tt.add(i,Tt.NW),this.x0=h+a*Tt.uX(i),this.y0=l+o*Tt.uY(i),i=Tt.add(i,2),this.x1=h+a*Tt.uX(i),this.y1=l+o*Tt.uY(i),i=Tt.add(i,2),this.x2=h+a*Tt.uX(i),this.y2=l+o*Tt.uY(i),i=Tt.add(i,2),this.x3=h+a*Tt.uX(i),this.y3=l+o*Tt.uY(i)}else this.x0=t.x/s,this.y0=t.y/n,this.x1=(t.x+t.width)/s,this.y1=t.y/n,this.x2=(t.x+t.width)/s,this.y2=(t.y+t.height)/n,this.x3=t.x/s,this.y3=(t.y+t.height)/n;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}}Ch.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 Vd=new Ch;function ca(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}class W extends Ds{constructor(t,e,i,s,n,a,o){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new it(0,0,1,1)),t instanceof W&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=Vd,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&&ei[e.url]&&W.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,W.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var s;const t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),i=new W(this.baseTexture,!this.noFrame&&t,e,(s=this.trim)==null?void 0:s.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=t),i}updateUvs(){this._uvs===Vd&&(this._uvs=new Ch),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=H.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else if(t instanceof J){if(!t.cacheId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${o}-${cr()}`,J.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${o}_${cr()}`}n=t._pixiId}let a=ei[n];if(s&&i&&!a)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!a&&!(t instanceof J)?(e.resolution||(e.resolution=Ei(t)),a=new W(new J(t,e)),a.baseTexture.cacheId=n,J.addToCache(a.baseTexture,n),W.addToCache(a,n)):!a&&t instanceof J&&(a=new W(t),W.addToCache(a,n)),a}static fromURL(t,e){const i=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),s=W.from(t,Object.assign({resourceOptions:i},e),!1),n=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):n.load().then(()=>Promise.resolve(s))}static fromBuffer(t,e,i,s){return new W(J.fromBuffer(t,e,i,s))}static fromLoader(t,e,i,s){const n=new J(t,Object.assign({scaleMode:J.defaultOptions.scaleMode,resolution:Ei(e)},s)),{resource:a}=n;a instanceof Gd&&(a.url=e);const o=new W(n);return i||(i=e),J.addToCache(o.baseTexture,i),W.addToCache(o,i),i!==e&&(J.addToCache(o.baseTexture,e),W.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),ei[e]&&ei[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),ei[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=ei[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete ei[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)ei[t.textureCacheIds[e]]===t&&delete ei[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:s,height:n}=t,a=e+s>this.baseTexture.width,o=i+n>this.baseTexture.height;if(a||o){const h=a&&o?"and":"or",l=`X: ${e} + ${s} = ${e+s} > ${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=s&&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 W._EMPTY||(W._EMPTY=new W(new J),ca(W._EMPTY),ca(W._EMPTY.baseTexture)),W._EMPTY}static get WHITE(){if(!W._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),W._WHITE=new W(J.from(t)),ca(W._WHITE),ca(W._WHITE.baseTexture)}return W._WHITE}}class gr extends W{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 s=this.baseTexture.resolution,n=Math.round(t*s)/s,a=Math.round(e*s)/s;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 gr(new Ud(t))}}class Hd{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=Nt.NONE){const s=new Ud(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new gr(s)}getOptimalTexture(t,e,i=1,s=Nt.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=jn(t),e=jn(e),n=((t&65535)<<16|e&65535)>>>0,s>1&&(n+=s*4294967296)):n=s>1?-s:-1,this.texturePool[n]||(this.texturePool[n]=[]);let a=this.texturePool[n].pop();return a||(a=this.createTexture(t,e,s)),a.filterPoolKey=n,a.setResolution(i),a}getFilterTexture(t,e,i){const s=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||Nt.NONE);return s.filterFrame=t.filterFrame,s}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 s=0;s<i.length;s++)i[s].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 s=0;s<i.length;s++)i[s].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}}Hd.SCREEN_KEY=-1;class Tx extends Vi{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class Xd extends Vi{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 Ot(this.vertices),this.uvBuffer=new Ot(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let i=0,s=0;return this.uvs[0]=i,this.uvs[1]=s,this.uvs[2]=i+e.width/t.width,this.uvs[3]=s,this.uvs[4]=i+e.width/t.width,this.uvs[5]=s+e.height/t.height,this.uvs[6]=i,this.uvs[7]=s+e.height/t.height,i=e.x,s=e.y,this.vertices[0]=i,this.vertices[1]=s,this.vertices[2]=i+e.width,this.vertices[3]=s,this.vertices[4]=i+e.width,this.vertices[5]=s+e.height,this.vertices[6]=i,this.vertices[7]=s+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class Ex{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Nt.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 ua=[new tt,new tt,new tt,new tt],Ph=new mt;class Wd{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new Hd,this.statePool=[],this.quad=new Tx,this.quadUv=new Xd,this.tempRect=new it,this.activeState={},this.globalUniforms=new Ue({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 i=this.renderer,s=this.defaultFilterStack,n=this.statePool.pop()||new Ex,a=i.renderTexture;let o,h;if(a.current){const g=a.current;o=g.resolution,h=g.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 g=1;g<e.length;g++){const y=e[g];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)}s.length===1&&(this.defaultFilterStack[0].renderTexture=a.current),s.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(Ph.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 s=this.globalUniforms.uniforms;s.outputFrame=e.sourceFrame,s.resolution=e.resolution;const n=s.inputSize,a=s.inputPixel,o=s.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=s.filterArea;l[0]=e.destinationFrame.width,l[1]=e.destinationFrame.height,l[2]=e.sourceFrame.x,l[3]=e.sourceFrame.y,s.filterClamp=s.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,qe.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,qe.CLEAR,e);const u=l;l=c,c=u}i[d].apply(this,l,h.renderTexture,qe.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=qe.CLEAR){const{renderTexture:i,state:s}=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=s.stateId&1||this.forceClear;(e===qe.CLEAR||e===qe.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,i,s){const n=this.renderer;n.state.set(t.state),this.bindAndClear(i,s),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(Le.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(Le.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:i,destinationFrame:s}=this.activeState,{orig:n}=e._texture,a=t.set(s.width,0,0,s.height,i.x,i.y),o=e.worldTransform.copyTo(mt.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,s=Nt.NONE){return this.texturePool.getOptimalTexture(t,e,i,s)}getFilterTexture(t,e,i){if(typeof t=="number"){const n=t;t=e,e=n}t=t||this.activeState.renderTexture;const s=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,i||Nt.NONE);return s.filterFrame=t.filterFrame,s}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const i=ua[0],s=ua[1],n=ua[2],a=ua[3];i.set(e.left,e.top),s.set(e.left,e.bottom),n.set(e.right,e.top),a.set(e.right,e.bottom),t.apply(i,i),t.apply(s,s),t.apply(n,n),t.apply(a,a);const o=Math.min(i.x,s.x,n.x,a.x),h=Math.min(i.y,s.y,n.y,a.y),l=Math.max(i.x,s.x,n.x,a.x),c=Math.max(i.y,s.y,n.y,a.y);e.x=o,e.y=h,e.width=l-o,e.height=c-h}roundFrame(t,e,i,s,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?Ph.copyFrom(n):Ph.identity(),n.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}}}Wd.extension={type:G.RendererSystem,name:"filter"},Y.add(Wd);class wx{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Nt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const Ax=new it;class $d{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Sh(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,i=this.renderer.context.extensions.depthTexture;H.PREFER_ENV===Ye.WEBGL_LEGACY&&(e=null,i=null),e?t.drawBuffers=s=>e.drawBuffersWEBGL(s):(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:s}=this;if(t){const n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,s.bindFramebuffer(s.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,s.bindFramebuffer(s.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,s){const n=this.viewport;t=Math.round(t),e=Math.round(e),i=Math.round(i),s=Math.round(s),(n.width!==i||n.height!==s||n.x!==t||n.y!==e)&&(n.x=t,n.y=e,n.width=i,n.height=s,this.gl.viewport(t,e,i,s))}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,s,n=co.COLOR|co.DEPTH){const{gl:a}=this;a.clearColor(t,e,i,s),a.clear(n)}initFramebuffer(t){const{gl:e}=this,i=new wx(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 s=t.colorTextures;let n=s.length;e.drawBuffers||(n=Math.min(n,1));for(let a=0;a<n;a++){const o=s[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,s=t.glFramebuffers[this.CONTEXT_UID],n=t.colorTextures;let a=n.length;i.drawBuffers||(a=Math.min(a,1)),s.multisample>1&&this.canMultisampleFramebuffer(t)?s.msaaBuffer=s.msaaBuffer||i.createRenderbuffer():s.msaaBuffer&&(i.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.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&&s.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,s.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,c._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,s.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)){s.stencil=s.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,s.stencil),s.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,l,t.width,t.height):i.renderbufferStorage(i.RENDERBUFFER,l,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,h,i.RENDERBUFFER,s.stencil)}else s.stencil&&(i.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let i=Nt.NONE;if(t<=1||e===null)return i;for(let s=0;s<e.length;s++)if(e[s]<=t){i=e[s];break}return i===1&&(i=Nt.NONE),i}blit(t,e,i){const{current:s,renderer:n,gl:a,CONTEXT_UID:o}=this;if(n.context.webGLVersion!==2||!s)return;const h=s.glFramebuffers[o];if(!h)return;if(!t){if(!h.msaaBuffer)return;const c=s.colorTextures[0];if(!c)return;h.blitFramebuffer||(h.blitFramebuffer=new Sh(s.width,s.height),h.blitFramebuffer.addColorTexture(0,c)),t=h.blitFramebuffer,t.colorTextures[0]!==c&&(t.colorTextures[0]=c,t.dirtyId++,t.dirtyFormat++),(t.width!==s.width||t.height!==s.height)&&(t.width=s.width,t.height=s.height,t.dirtyId++,t.dirtySize++)}e||(e=Ax,e.width=s.width,e.height=s.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],s=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||(s.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&s.deleteRenderbuffer(i.msaaBuffer),i.stencil&&s.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,s=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,s):n.renderbufferStorage(n.RENDERBUFFER,h,i,s),n.framebufferRenderbuffer(n.FRAMEBUFFER,o,n.RENDERBUFFER,a)}reset(){this.current=this.unknownFramebuffer,this.viewport=new it}destroy(){this.renderer=null}}$d.extension={type:G.RendererSystem,name:"framebuffer"},Y.add($d);const Rh={5126:4,5123:2,5121:1};class zd{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===Ye.WEBGL_LEGACY&&(i=null),i?(t.createVertexArray=()=>i.createVertexArrayOES(),t.bindVertexArray=s=>i.bindVertexArrayOES(s),t.deleteVertexArray=s=>i.deleteVertexArrayOES(s)):(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=(s,n)=>i.vertexAttribDivisorANGLE(s,n),t.drawElementsInstanced=(s,n,a,o,h)=>i.drawElementsInstancedANGLE(s,n,a,o,h),t.drawArraysInstanced=(s,n,a,o)=>i.drawArraysInstancedANGLE(s,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 s=t.glVertexArrayObjects[this.CONTEXT_UID],n=!1;s||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=s={},n=!0);const a=s[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 s=t.buffers[i];e.update(s)}}checkCompatibility(t,e){const i=t.attributes,s=e.attributeData;for(const n in s)if(!i[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(t,e){const i=t.attributes,s=e.attributeData,n=["g",t.id];for(const a in i)s[a]&&n.push(a,s[a].location);return n.join("-")}initGeometryVao(t,e,i=!0){const s=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*Rh[u[m].type];for(const m in u){const g=u[m],y=g.size;g.stride===void 0&&(f[g.buffer]===y*Rh[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=p[g.buffer],p[g.buffer]+=y*Rh[g.type])}c=s.createVertexArray(),s.bindVertexArray(c);for(let m=0;m<d.length;m++){const g=d[m];a.bind(g),i&&g._glBuffers[n].refCount++}return this.activateVao(t,o),l[o.id]=c,l[h]=c,s.bindVertexArray(null),a.unbind(Ke.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],s=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(),s.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,s=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[s];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,s){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,s||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(),s||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}}zd.extension={type:G.RendererSystem,name:"geometry"},Y.add(zd);const Yd=new mt;class jd{constructor(t,e){this._texture=t,this.mapCoord=new mt,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 s=0;s<t.length;s+=2){const n=t[s],a=t[s+1];e[s]=n*i.a+a*i.c+i.tx,e[s+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 s=e.orig,n=e.trim;n&&(Yd.set(s.width/n.width,0,0,s.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(Yd));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 Sx=`varying vec2 vMaskCoord;
|
|
379
|
+
varying vec2 vTextureCoord;
|
|
380
|
+
|
|
381
|
+
uniform sampler2D uSampler;
|
|
382
|
+
uniform sampler2D mask;
|
|
383
|
+
uniform float alpha;
|
|
384
|
+
uniform float npmAlpha;
|
|
385
|
+
uniform vec4 maskClamp;
|
|
386
|
+
|
|
387
|
+
void main(void)
|
|
388
|
+
{
|
|
389
|
+
float clip = step(3.5,
|
|
390
|
+
step(maskClamp.x, vMaskCoord.x) +
|
|
391
|
+
step(maskClamp.y, vMaskCoord.y) +
|
|
392
|
+
step(vMaskCoord.x, maskClamp.z) +
|
|
393
|
+
step(vMaskCoord.y, maskClamp.w));
|
|
394
|
+
|
|
395
|
+
vec4 original = texture2D(uSampler, vTextureCoord);
|
|
396
|
+
vec4 masky = texture2D(mask, vMaskCoord);
|
|
397
|
+
float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);
|
|
398
|
+
|
|
399
|
+
original *= (alphaMul * masky.r * alpha * clip);
|
|
400
|
+
|
|
401
|
+
gl_FragColor = original;
|
|
402
|
+
}
|
|
403
|
+
`,Cx=`attribute vec2 aVertexPosition;
|
|
404
|
+
attribute vec2 aTextureCoord;
|
|
405
|
+
|
|
406
|
+
uniform mat3 projectionMatrix;
|
|
407
|
+
uniform mat3 otherMatrix;
|
|
408
|
+
|
|
409
|
+
varying vec2 vMaskCoord;
|
|
410
|
+
varying vec2 vTextureCoord;
|
|
411
|
+
|
|
412
|
+
void main(void)
|
|
413
|
+
{
|
|
414
|
+
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
415
|
+
|
|
416
|
+
vTextureCoord = aTextureCoord;
|
|
417
|
+
vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
|
|
418
|
+
}
|
|
419
|
+
`;class Px extends re{constructor(t,e,i){let s=null;typeof t!="string"&&e===void 0&&i===void 0&&(s=t,t=void 0,e=void 0,i=void 0),super(t||Cx,e||Sx,i),this.maskSprite=s,this.maskMatrix=new mt}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,i,s){const n=this._maskSprite,a=n._texture;a.valid&&(a.uvMatrix||(a.uvMatrix=new jd(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,s))}}class Rx{constructor(t=null){this.type=Ut.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=re.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=Ut.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}}class qd{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 Rx;n.pooled=!0,n.maskObject=e,i=n}const s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(s),i._colorMask=s?s._colorMask:15,i.autoDetect&&this.detect(i),i._target=t,i.type!==Ut.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case Ut.SCISSOR:this.renderer.scissor.push(i);break;case Ut.STENCIL:this.renderer.stencil.push(i);break;case Ut.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case Ut.COLOR:this.pushColorMask(i);break}i.type===Ut.SPRITE&&this.maskStack.push(i)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case Ut.SCISSOR:this.renderer.scissor.pop(e);break;case Ut.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case Ut.SPRITE:this.popSpriteMask(e);break;case Ut.COLOR:this.popColorMask(e);break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){const i=this.maskStack[this.maskStack.length-1];i.type===Ut.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=Ut.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=Ut.SCISSOR:t.type=Ut.STENCIL:t.type=Ut.COLOR}pushSpriteMask(t){const{maskObject:e}=t,i=t._target;let s=t._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new Px])),s[0].resolution=t.resolution,s[0].multisample=t.multisample,s[0].maskSprite=e;const n=i.filterArea;i.filterArea=e.getBounds(!0),this.renderer.filter.push(i,s),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}}qd.extension={type:G.RendererSystem,name:"mask"},Y.add(qd);class Kd{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 s=this.getStackLength();s!==i&&(s===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const Zd=new mt,Qd=[],Jd=class ao extends Kd{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:s}=this,n=s.renderTexture,a=i.getBounds(!0,Qd.pop()??new it);this.roundFrameToPixels(a,n.current?n.current.resolution:s.resolution,n.sourceFrame,n.destinationFrame,s.projection.transform),e&&a.fit(e),t._scissorRectLocal=a}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:i,c:s,d:n}=t;return(Math.abs(i)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||ao.isMatrixRotated(e.worldTransform)||ao.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,s,n){ao.isMatrixRotated(n)||(n=n?Zd.copyFrom(n):Zd.identity(),n.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.renderer.filter.transformAABB(n,t),t.fit(s),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&&Qd.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)}};Jd.extension={type:G.RendererSystem,name:"scissor"};let Ix=Jd;Y.add(Ix);class tf extends Kd{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,s=t._stencilCounter;s===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,s,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,s=i?i._colorMask:15;s!==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,s!==0&&(i._colorMask=s,e.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&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)}}tf.extension={type:G.RendererSystem,name:"stencil"},Y.add(tf);class ef{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return st("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return st("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return st("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}}ef.extension={type:[G.RendererSystem,G.CanvasRendererSystem],name:"_plugin"},Y.add(ef);class rf{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new mt,this.transform=null}update(t,e,i,s){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,s),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,s){const n=this.projectionMatrix,a=s?-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}}rf.extension={type:G.RendererSystem,name:"projection"},Y.add(rf);const Mx=new ra,sf=new it;class nf{constructor(t){this.renderer=t,this._tempMatrix=new mt}generateTexture(t,e){const{region:i,...s}=e||{},n=(i==null?void 0:i.copyTo(sf))||t.getLocalBounds(sf,!0),a=s.resolution||this.renderer.resolution;n.width=Math.max(n.width,1/a),n.height=Math.max(n.height,1/a),s.width=n.width,s.height=n.height,s.resolution=a,s.multisample??(s.multisample=this.renderer.multisample);const o=gr.create(s);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const h=t.transform;return t.transform=Mx,this.renderer.render(t,{renderTexture:o,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=h,o}destroy(){}}nf.extension={type:[G.RendererSystem,G.CanvasRendererSystem],name:"textureGenerator"},Y.add(nf);const _r=new it,qs=new it;class af{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,i){const s=this.renderer;this.current=t;let n,a,o;t?(n=t.baseTexture,o=n.resolution,e||(_r.width=t.frame.width,_r.height=t.frame.height,e=_r),i||(qs.x=t.frame.x,qs.y=t.frame.y,qs.width=e.width,qs.height=e.height,i=qs),a=n.framebuffer):(o=s.resolution,e||(_r.width=s._view.screen.width,_r.height=s._view.screen.height,e=_r),i||(i=_r,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=s.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,s=dt.shared.setValue(t||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.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(s.red,s.green,s.blue,s.alpha,e),o&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}af.extension={type:G.RendererSystem,name:"renderTexture"},Y.add(af);class Dx{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 Bx(r,t){const e={},i=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){const n=t.getActiveAttrib(r,s);if(n.name.startsWith("gl_"))continue;const a=Fd(t,n.type),o={type:a,name:n.name,size:Bd(a),location:t.getAttribLocation(r,n.name)};e[n.name]=o}return e}function Ox(r,t){const e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){const n=t.getActiveUniform(r,s),a=n.name.replace(/\[.*?\]$/,""),o=!!n.name.match(/\[.*?\]$/),h=Fd(t,n.type);e[a]={name:a,index:s,type:h,size:n.size,isArray:o,value:Id(h,n.size)}}return e}function Fx(r,t){var o;const e=Rd(r,r.VERTEX_SHADER,t.vertexSrc),i=Rd(r,r.FRAGMENT_SHADER,t.fragmentSrc),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);const n=(o=t.extra)==null?void 0:o.transformFeedbackVaryings;if(n&&(typeof r.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,n.names,n.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||cx(r,s,e,i),t.attributeData=Bx(s,r),t.uniformData=Ox(s,r),!/^[ \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,r.bindAttribLocation(s,l,h[l]);r.linkProgram(s)}r.deleteShader(e),r.deleteShader(i);const a={};for(const h in t.uniformData){const l=t.uniformData[h];a[h]={location:r.getUniformLocation(s,h),value:Id(l.type,l.size)}}return new Dx(s,a)}function Lx(r,t,e,i,s){e.buffer.update(s)}const Nx={float:`
|
|
420
|
+
data[offset] = v;
|
|
421
|
+
`,vec2:`
|
|
422
|
+
data[offset] = v[0];
|
|
423
|
+
data[offset+1] = v[1];
|
|
424
|
+
`,vec3:`
|
|
425
|
+
data[offset] = v[0];
|
|
426
|
+
data[offset+1] = v[1];
|
|
427
|
+
data[offset+2] = v[2];
|
|
428
|
+
|
|
429
|
+
`,vec4:`
|
|
430
|
+
data[offset] = v[0];
|
|
431
|
+
data[offset+1] = v[1];
|
|
432
|
+
data[offset+2] = v[2];
|
|
433
|
+
data[offset+3] = v[3];
|
|
434
|
+
`,mat2:`
|
|
435
|
+
data[offset] = v[0];
|
|
436
|
+
data[offset+1] = v[1];
|
|
437
|
+
|
|
438
|
+
data[offset+4] = v[2];
|
|
439
|
+
data[offset+5] = v[3];
|
|
440
|
+
`,mat3:`
|
|
441
|
+
data[offset] = v[0];
|
|
442
|
+
data[offset+1] = v[1];
|
|
443
|
+
data[offset+2] = v[2];
|
|
444
|
+
|
|
445
|
+
data[offset + 4] = v[3];
|
|
446
|
+
data[offset + 5] = v[4];
|
|
447
|
+
data[offset + 6] = v[5];
|
|
448
|
+
|
|
449
|
+
data[offset + 8] = v[6];
|
|
450
|
+
data[offset + 9] = v[7];
|
|
451
|
+
data[offset + 10] = v[8];
|
|
452
|
+
`,mat4:`
|
|
453
|
+
for(var i = 0; i < 16; i++)
|
|
454
|
+
{
|
|
455
|
+
data[offset + i] = v[i];
|
|
456
|
+
}
|
|
457
|
+
`},of={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 kx(r){const t=r.map(n=>({data:n,offset:0,dataLen:0,dirty:0}));let e=0,i=0,s=0;for(let n=0;n<t.length;n++){const a=t[n];if(e=of[a.data.type],a.data.size>1&&(e=Math.max(e,16)*a.data.size),a.dataLen=e,i%e!==0&&i<16){const o=i%e%16;i+=o,s+=o}i+e>16?(s=Math.ceil(s/16)*16,a.offset=s,s+=e,i=e):(a.offset=s,i+=e,s+=e)}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}function Ux(r,t){const e=[];for(const i in r)t[i]&&e.push(t[i]);return e.sort((i,s)=>i.index-s.index),e}function Gx(r,t){if(!r.autoManage)return{size:0,syncFunc:Lx};const e=Ux(r.uniforms,t),{uboElements:i,size:s}=kx(e),n=[`
|
|
458
|
+
var v = null;
|
|
459
|
+
var v2 = null;
|
|
460
|
+
var cv = null;
|
|
461
|
+
var t = 0;
|
|
462
|
+
var gl = renderer.gl
|
|
463
|
+
var index = 0;
|
|
464
|
+
var data = buffer.data;
|
|
465
|
+
`];for(let a=0;a<i.length;a++){const o=i[a],h=r.uniforms[o.data.name],l=o.data.name;let c=!1;for(let d=0;d<Qr.length;d++){const u=Qr[d];if(u.codeUbo&&u.test(o.data,h)){n.push(`offset = ${o.offset/4};`,Qr[d].codeUbo(o.data.name,h)),c=!0;break}}if(!c)if(o.data.size>1){const d=Bd(o.data.type),u=Math.max(of[o.data.type]/16,1),f=d/u,p=(4-f%4)%4;n.push(`
|
|
466
|
+
cv = ud.${l}.value;
|
|
467
|
+
v = uv.${l};
|
|
468
|
+
offset = ${o.offset/4};
|
|
469
|
+
|
|
470
|
+
t = 0;
|
|
471
|
+
|
|
472
|
+
for(var i=0; i < ${o.data.size*u}; i++)
|
|
473
|
+
{
|
|
474
|
+
for(var j = 0; j < ${f}; j++)
|
|
475
|
+
{
|
|
476
|
+
data[offset++] = v[t++];
|
|
477
|
+
}
|
|
478
|
+
offset += ${p};
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
`)}else{const d=Nx[o.data.type];n.push(`
|
|
482
|
+
cv = ud.${l}.value;
|
|
483
|
+
v = uv.${l};
|
|
484
|
+
offset = ${o.offset/4};
|
|
485
|
+
${d};
|
|
486
|
+
`)}}return n.push(`
|
|
487
|
+
renderer.buffer.update(buffer);
|
|
488
|
+
`),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(`
|
|
489
|
+
`))}}let Vx=0;const da={textureCount:0,uboCount:0};class hf{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=Vx++}systemCheck(){if(!dx())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,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),e||(da.textureCount=0,da.uboCount=0,this.syncUniformGroup(t.uniformGroup,da)),s}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]=ox(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 s=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),s(i.uniformData,t.uniforms,this.renderer,da,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])}createSyncBufferGroup(t,e,i){const{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,s.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]=Gx(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 s=t.uniforms,n=[`${i}-`];for(const a in s)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,s=Fx(e,i);return i.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}hf.extension={type:G.RendererSystem,name:"shader"},Y.add(hf);class fa{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(){}}fa.defaultOptions={hello:!1},fa.extension={type:[G.RendererSystem,G.CanvasRendererSystem],name:"startup"},Y.add(fa);function Hx(r,t=[]){return t[K.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[K.ADD]=[r.ONE,r.ONE],t[K.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[K.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[K.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[K.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[K.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[K.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[K.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[K.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[K.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[K.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[K.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[K.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[K.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[K.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[K.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[K.NONE]=[0,0],t[K.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[K.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[K.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[K.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[K.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[K.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[K.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[K.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[K.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[K.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[K.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[K.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}const Xx=0,Wx=1,$x=2,zx=3,Yx=4,jx=5,lf=class Mc{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=K.NONE,this._blendEq=!1,this.map=[],this.map[Xx]=this.setBlend,this.map[Wx]=this.setOffset,this.map[$x]=this.setCullFace,this.map[zx]=this.setDepthTest,this.map[Yx]=this.setFrontFace,this.map[jx]=this.setDepthMask,this.checks=[],this.defaultState=new ii,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=Hx(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(Mc.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(Mc.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}};lf.extension={type:G.RendererSystem,name:"state"};let qx=lf;Y.add(qx);class Kx extends Ds{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);const e=(t.priority??[]).filter(s=>t.systems[s]),i=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(const s of i)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new ke(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 s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(t,e){const i=Object.keys(this._systemsHash);t.items.forEach(s=>{const n=i.find(a=>this._systemsHash[a]===s);s[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const Ks=class oo{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=oo.defaultMaxIdle,this.checkCountMax=oo.defaultCheckCountMax,this.mode=oo.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==uo.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 s=0;s<e.length;s++){const n=e[s];n.resource&&this.count-n.touched>this.maxIdle&&(t.destroyTexture(n,!0),e[s]=null,i=!0)}if(i){let s=0;for(let n=0;n<e.length;n++)e[n]!==null&&(e[s++]=e[n]);e.length=s}}unload(t){const e=this.renderer.texture,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};Ks.defaultMode=uo.AUTO,Ks.defaultMaxIdle=60*60,Ks.defaultCheckCountMax=60*10,Ks.extension={type:G.RendererSystem,name:"textureGC"};let yr=Ks;Y.add(yr);class Ih{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 Zx(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:V.FLOAT,[r.RGBA]:V.FLOAT,[r.ALPHA]:V.FLOAT,[r.LUMINANCE]:V.FLOAT,[r.LUMINANCE_ALPHA]:V.FLOAT,[r.R8]:V.FLOAT,[r.R8_SNORM]:V.FLOAT,[r.RG8]:V.FLOAT,[r.RG8_SNORM]:V.FLOAT,[r.RGB8]:V.FLOAT,[r.RGB8_SNORM]:V.FLOAT,[r.RGB565]:V.FLOAT,[r.RGBA4]:V.FLOAT,[r.RGB5_A1]:V.FLOAT,[r.RGBA8]:V.FLOAT,[r.RGBA8_SNORM]:V.FLOAT,[r.RGB10_A2]:V.FLOAT,[r.RGB10_A2UI]:V.FLOAT,[r.SRGB8]:V.FLOAT,[r.SRGB8_ALPHA8]:V.FLOAT,[r.R16F]:V.FLOAT,[r.RG16F]:V.FLOAT,[r.RGB16F]:V.FLOAT,[r.RGBA16F]:V.FLOAT,[r.R32F]:V.FLOAT,[r.RG32F]:V.FLOAT,[r.RGB32F]:V.FLOAT,[r.RGBA32F]:V.FLOAT,[r.R11F_G11F_B10F]:V.FLOAT,[r.RGB9_E5]:V.FLOAT,[r.R8I]:V.INT,[r.R8UI]:V.UINT,[r.R16I]:V.INT,[r.R16UI]:V.UINT,[r.R32I]:V.INT,[r.R32UI]:V.UINT,[r.RG8I]:V.INT,[r.RG8UI]:V.UINT,[r.RG16I]:V.INT,[r.RG16UI]:V.UINT,[r.RG32I]:V.INT,[r.RG32UI]:V.UINT,[r.RGB8I]:V.INT,[r.RGB8UI]:V.UINT,[r.RGB16I]:V.INT,[r.RGB16UI]:V.UINT,[r.RGB32I]:V.INT,[r.RGB32UI]:V.UINT,[r.RGBA8I]:V.INT,[r.RGBA8UI]:V.UINT,[r.RGBA16I]:V.INT,[r.RGBA16UI]:V.UINT,[r.RGBA32I]:V.INT,[r.RGBA32UI]:V.UINT,[r.DEPTH_COMPONENT16]:V.FLOAT,[r.DEPTH_COMPONENT24]:V.FLOAT,[r.DEPTH_COMPONENT32F]:V.FLOAT,[r.DEPTH_STENCIL]:V.FLOAT,[r.DEPTH24_STENCIL8]:V.FLOAT,[r.DEPTH32F_STENCIL8]:V.FLOAT}:t={[r.RGB]:V.FLOAT,[r.RGBA]:V.FLOAT,[r.ALPHA]:V.FLOAT,[r.LUMINANCE]:V.FLOAT,[r.LUMINANCE_ALPHA]:V.FLOAT,[r.DEPTH_STENCIL]:V.FLOAT},t}function Qx(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[Z.UNSIGNED_BYTE]:{[O.RGBA]:r.RGBA8,[O.RGB]:r.RGB8,[O.RG]:r.RG8,[O.RED]:r.R8,[O.RGBA_INTEGER]:r.RGBA8UI,[O.RGB_INTEGER]:r.RGB8UI,[O.RG_INTEGER]:r.RG8UI,[O.RED_INTEGER]:r.R8UI,[O.ALPHA]:r.ALPHA,[O.LUMINANCE]:r.LUMINANCE,[O.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[Z.BYTE]:{[O.RGBA]:r.RGBA8_SNORM,[O.RGB]:r.RGB8_SNORM,[O.RG]:r.RG8_SNORM,[O.RED]:r.R8_SNORM,[O.RGBA_INTEGER]:r.RGBA8I,[O.RGB_INTEGER]:r.RGB8I,[O.RG_INTEGER]:r.RG8I,[O.RED_INTEGER]:r.R8I},[Z.UNSIGNED_SHORT]:{[O.RGBA_INTEGER]:r.RGBA16UI,[O.RGB_INTEGER]:r.RGB16UI,[O.RG_INTEGER]:r.RG16UI,[O.RED_INTEGER]:r.R16UI,[O.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[Z.SHORT]:{[O.RGBA_INTEGER]:r.RGBA16I,[O.RGB_INTEGER]:r.RGB16I,[O.RG_INTEGER]:r.RG16I,[O.RED_INTEGER]:r.R16I},[Z.UNSIGNED_INT]:{[O.RGBA_INTEGER]:r.RGBA32UI,[O.RGB_INTEGER]:r.RGB32UI,[O.RG_INTEGER]:r.RG32UI,[O.RED_INTEGER]:r.R32UI,[O.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[Z.INT]:{[O.RGBA_INTEGER]:r.RGBA32I,[O.RGB_INTEGER]:r.RGB32I,[O.RG_INTEGER]:r.RG32I,[O.RED_INTEGER]:r.R32I},[Z.FLOAT]:{[O.RGBA]:r.RGBA32F,[O.RGB]:r.RGB32F,[O.RG]:r.RG32F,[O.RED]:r.R32F,[O.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[Z.HALF_FLOAT]:{[O.RGBA]:r.RGBA16F,[O.RGB]:r.RGB16F,[O.RG]:r.RG16F,[O.RED]:r.R16F},[Z.UNSIGNED_SHORT_5_6_5]:{[O.RGB]:r.RGB565},[Z.UNSIGNED_SHORT_4_4_4_4]:{[O.RGBA]:r.RGBA4},[Z.UNSIGNED_SHORT_5_5_5_1]:{[O.RGBA]:r.RGB5_A1},[Z.UNSIGNED_INT_2_10_10_10_REV]:{[O.RGBA]:r.RGB10_A2,[O.RGBA_INTEGER]:r.RGB10_A2UI},[Z.UNSIGNED_INT_10F_11F_11F_REV]:{[O.RGB]:r.R11F_G11F_B10F},[Z.UNSIGNED_INT_5_9_9_9_REV]:{[O.RGB]:r.RGB9_E5},[Z.UNSIGNED_INT_24_8]:{[O.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[Z.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[O.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[Z.UNSIGNED_BYTE]:{[O.RGBA]:r.RGBA,[O.RGB]:r.RGB,[O.ALPHA]:r.ALPHA,[O.LUMINANCE]:r.LUMINANCE,[O.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[Z.UNSIGNED_SHORT_5_6_5]:{[O.RGB]:r.RGB},[Z.UNSIGNED_SHORT_4_4_4_4]:{[O.RGBA]:r.RGBA},[Z.UNSIGNED_SHORT_5_5_5_1]:{[O.RGBA]:r.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=Qx(t),this.samplerTypes=Zx(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let s=0;s<e;s++)this.boundTextures[s]=null;this.emptyTextures={};const i=new Ih(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 Ih(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+s,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 s=0;s<this.boundTextures.length;s++)this.bind(null,s)}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 s=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,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)):s.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 s=0;s<i.length;s++)i[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<i.length;s++)i[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[s]=null)}ensureSamplerType(t){const{boundTextures:e,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let n=t-1;n>=0;--n){const a=e[n];a&&a._glTextures[s].samplerType!==V.FLOAT&&this.renderer.texture.unbind(a)}}initTexture(t){const e=new Ih(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 s;const e=t._glTextures[this.CONTEXT_UID];if(!e)return;const i=this.renderer;if(this.initTextureType(t,e),(s=t.resource)==null?void 0:s.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 s=this.managedTextures.indexOf(t);s!==-1&&Zr(this.managedTextures,s,1)}}updateTextureStyle(t){var i;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===je.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Li.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!==je.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===_i.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===_i.LINEAR){const n=Math.min(t.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===_i.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===_i.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}cf.extension={type:G.RendererSystem,name:"texture"},Y.add(cf);class uf{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,s=t._glTransformFeedbacks[i]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:i,renderer:s}=this;e&&s.shader.bind(e),i.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:i,CONTEXT_UID:s}=this,n=e.createTransformFeedback();t._glTransformFeedbacks[s]=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[s].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,a,o._glBuffers[s].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),n}disposeTransformFeedback(t,e){const i=t._glTransformFeedbacks[this.CONTEXT_UID],s=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||s.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}uf.extension={type:G.RendererSystem,name:"transformFeedback"},Y.add(uf);class pa{constructor(t){this.renderer=t}init(t){this.screen=new it(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,s=this.element.height/this.resolution;this.screen.width=i,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",i,s),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}}pa.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},pa.extension={type:[G.RendererSystem,G.CanvasRendererSystem],name:"_view"},Y.add(pa),H.PREFER_ENV=Ye.WEBGL2,H.STRICT_TEXTURE_CACHE=!1,H.RENDER_OPTIONS={...la.defaultOptions,...ha.defaultOptions,...pa.defaultOptions,...fa.defaultOptions},Object.defineProperties(H,{WRAP_MODE:{get(){return J.defaultOptions.wrapMode},set(r){st("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),J.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return J.defaultOptions.scaleMode},set(r){st("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),J.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return J.defaultOptions.mipmap},set(r){st("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),J.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return J.defaultOptions.anisotropicLevel},set(r){st("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),J.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return st("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),re.defaultResolution},set(r){re.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return st("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),re.defaultMultisample},set(r){re.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return mr.defaultMaxTextures},set(r){st("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),mr.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return mr.defaultBatchSize},set(r){st("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),mr.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return mr.canUploadSameBuffer},set(r){st("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),mr.canUploadSameBuffer=r}},GC_MODE:{get(){return yr.defaultMode},set(r){st("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),yr.defaultMode=r}},GC_MAX_IDLE:{get(){return yr.defaultMaxIdle},set(r){st("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),yr.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return yr.defaultCheckCountMax},set(r){st("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),yr.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return Ai.defaultVertexPrecision},set(r){st("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),Ai.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return Ai.defaultFragmentPrecision},set(r){st("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),Ai.defaultFragmentPrecision=r}}});var xr=(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))(xr||{});class Mh{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=s}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));const e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const df=class we{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 Mh(null,null,1/0),this.deltaMS=1/we.targetFPMS,this.elapsedMS=1/we.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=xr.NORMAL){return this._addListener(new Mh(t,e,i))}addOnce(t,e,i=xr.NORMAL){return this._addListener(new Mh(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*we.targetFPMS;const i=this._head;let s=i.next;for(;s;)s=s.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,we.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(!we._shared){const t=we._shared=new we;t.autoStart=!0,t._protected=!0}return we._shared}static get system(){if(!we._system){const t=we._system=new we;t.autoStart=!0,t._protected=!0}return we._system}};df.targetFPMS=.06;let Wt=df;Object.defineProperties(H,{TARGET_FPMS:{get(){return Wt.targetFPMS},set(r){st("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),Wt.targetFPMS=r}}});class ff{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,xr.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Wt.shared:new Wt,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}ff.extension=G.Application,Y.add(ff);const pf=[];Y.handleByList(G.Renderer,pf);function Jx(r){for(const t of pf)if(t.test(r))return new t(r);throw new Error("Unable to auto-detect a suitable renderer.")}var tv=`attribute vec2 aVertexPosition;
|
|
490
|
+
attribute vec2 aTextureCoord;
|
|
491
|
+
|
|
492
|
+
uniform mat3 projectionMatrix;
|
|
493
|
+
|
|
494
|
+
varying vec2 vTextureCoord;
|
|
495
|
+
|
|
496
|
+
void main(void)
|
|
497
|
+
{
|
|
498
|
+
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
499
|
+
vTextureCoord = aTextureCoord;
|
|
500
|
+
}`,ev=`attribute vec2 aVertexPosition;
|
|
501
|
+
|
|
502
|
+
uniform mat3 projectionMatrix;
|
|
503
|
+
|
|
504
|
+
varying vec2 vTextureCoord;
|
|
505
|
+
|
|
506
|
+
uniform vec4 inputSize;
|
|
507
|
+
uniform vec4 outputFrame;
|
|
508
|
+
|
|
509
|
+
vec4 filterVertexPosition( void )
|
|
510
|
+
{
|
|
511
|
+
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
|
512
|
+
|
|
513
|
+
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
vec2 filterTextureCoord( void )
|
|
517
|
+
{
|
|
518
|
+
return aVertexPosition * (outputFrame.zw * inputSize.zw);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
void main(void)
|
|
522
|
+
{
|
|
523
|
+
gl_Position = filterVertexPosition();
|
|
524
|
+
vTextureCoord = filterTextureCoord();
|
|
525
|
+
}
|
|
526
|
+
`;const iv=tv,mf=ev;class gf{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>=Nt.HIGH?this.multisample=Nt.HIGH:e>=Nt.MEDIUM?this.multisample=Nt.MEDIUM:e>=Nt.LOW?this.multisample=Nt.LOW:this.multisample=Nt.NONE}destroy(){}}gf.extension={type:G.RendererSystem,name:"_multisample"},Y.add(gf);class rv{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class _f{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,s=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,i){const{gl:s,CONTEXT_UID:n}=this;i=i||0;const a=t._glBuffers[n]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,a.buffer,i*256,256)}update(t){const{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);if(t._updateID!==s.updateID)if(s.updateID=t._updateID,e.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;s.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],s=this.gl;t.disposeRunner.remove(this),i&&(e||s.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]}}_f.extension={type:G.RendererSystem,name:"buffer"},Y.add(_f);class yf{constructor(t){this.renderer=t}render(t,e){const i=this.renderer;let s,n,a,o;if(e&&(s=e.renderTexture,n=e.clear,a=e.transform,o=e.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=a,!i.context.isLost){if(s||(this.lastObjectRendered=t),!o){const h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}i.renderTexture.bind(s),i.batch.currentRenderer.start(),(n??i.background.clearBeforeRender)&&i.renderTexture.clear(),t.render(i),i.batch.currentRenderer.flush(),s&&(e.blit&&i.framebuffer.blit(),s.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}yf.extension={type:G.RendererSystem,name:"objectRenderer"},Y.add(yf);const ma=class Dc extends Kx{constructor(t){super(),this.type=kc.WEBGL,t=Object.assign({},H.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new Ue({projectionMatrix:new mt},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:Dc.__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&&(st("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=Dc.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:Sy()}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 st("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return st("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return st("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return st("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){st("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return st("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){st("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return st("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)}};ma.extension={type:G.Renderer,priority:1},ma.__plugins={},ma.__systems={};let Dh=ma;Y.handleByMap(G.RendererPlugin,Dh.__plugins),Y.handleByMap(G.RendererSystem,Dh.__systems),Y.add(Dh);class xf extends zs{constructor(t,e){const{width:i,height:s}=e||{};super(i,s),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 zs?this.addResourceAt(t[i],i):this.addResourceAt(Ad(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 sv extends xf{constructor(t,e){const{width:i,height:s}=e||{};let n,a;Array.isArray(t)?(n=t,a=t.length):a=t,super(a,{width:i,height:s}),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=kr.TEXTURE_2D_ARRAY}upload(t,e,i){const{length:s,itemDirtyIds:n,items:a}=this,{gl:o}=t;i.dirtyId<0&&o.texImage3D(o.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,e.format,i.type,null);for(let h=0;h<s;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 nv extends Si{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const vf=class En extends xf{constructor(t,e){const{width:i,height:s,autoLoad:n,linkBaseTexture:a}=e||{};if(t&&t.length!==En.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let o=0;o<En.SIDES;o++)this.items[o].target=kr.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=kr.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=kr.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 s=this.itemDirtyIds;for(let n=0;n<En.SIDES;n++){const a=this.items[n];(s[n]<a.dirtyId||i.dirtyId<e.dirtyId)&&(a.valid&&a.resource?(a.resource.upload(t,a,i),s[n]=a.dirtyId):s[n]<-1&&(t.gl.texImage2D(a.target,0,i.internalFormat,e.realWidth,e.realHeight,0,e.format,i.type,null),s[n]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===En.SIDES}};vf.SIDES=6;let av=vf;class ts extends Si{constructor(t,e){e=e||{};let i,s,n;typeof t=="string"?(i=ts.EMPTY,s=t,n=!0):(i=t,s=null,n=!1),super(i),this.url=s,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 s=await i.blob();if(this.destroyed)return;const n=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===oe.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 ts._EMPTY=ts._EMPTY??H.ADAPTER.createCanvas(0,0),ts._EMPTY}}const Bh=class ho extends Si{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)},ho.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;Si.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 s=e*this.scale,n=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*e,n=this._overrideHeight||this._overrideWidth/e*i),s=Math.round(s),n=Math.round(n);const a=this.source;a.width=s,a.height=n,a._pixiId=`canvas_${cr()}`,a.getContext("2d").drawImage(t,0,0,e,i,0,0,s,n),this._resolve(),this._resolve=null}}static getSize(t){const e=ho.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"&&ho.SVG_XML.test(t)}};Bh.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Bh.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Oh=Bh;class ov extends Si{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}}const Fh=class Bc extends Si{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 s=t[0].src||t[0];Si.crossOrigin(i,s,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||Bc.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=Wt.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;const t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,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&&(Wt.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Wt.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Wt.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||Bc.TYPES.includes(e)}};Fh.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Fh.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let bf=Fh;_h.push(ts,Gd,nv,bf,ov,Oh,qn,av,sv);class ga{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:i,b:s,c:n,d:a,tx:o,ty:h}=t,l=i*e.x+n*e.y+o,c=s*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,s=this.maxX,n=this.maxY,a=t[0],o=t[1];e=a<e?a:e,i=o<i?o:i,s=a>s?a:s,n=o>n?o:n,a=t[2],o=t[3],e=a<e?a:e,i=o<i?o:i,s=a>s?a:s,n=o>n?o:n,a=t[4],o=t[5],e=a<e?a:e,i=o<i?o:i,s=a>s?a:s,n=o>n?o:n,a=t[6],o=t[7],e=a<e?a:e,i=o<i?o:i,s=a>s?a:s,n=o>n?o:n,this.minX=e,this.minY=i,this.maxX=s,this.maxY=n}addFrame(t,e,i,s,n){this.addFrameMatrix(t.worldTransform,e,i,s,n)}addFrameMatrix(t,e,i,s,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,g=a*e+h*i+c,y=o*e+l*i+d;u=g<u?g:u,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,g=a*s+h*i+c,y=o*s+l*i+d,u=g<u?g:u,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,g=a*e+h*n+c,y=o*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=a*s+h*n+c,y=o*s+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,i){let s=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];s=l<s?l:s,n=c<n?c:n,a=l>a?l:a,o=c>o?c:o}this.minX=s,this.minY=n,this.maxX=a,this.maxY=o}addVertices(t,e,i,s){this.addVerticesMatrix(t.worldTransform,e,i,s)}addVerticesMatrix(t,e,i,s,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,g=this.maxY;for(let y=i;y<s;y+=2){const v=e[y],_=e[y+1],x=o*v+l*_+d,b=c*_+h*v+u;f=Math.min(f,x-n),m=Math.max(m,x+n),p=Math.min(p,b-a),g=Math.max(g,b+a)}this.minX=f,this.minY=p,this.maxX=m,this.maxY=g}addBounds(t){const e=this.minX,i=this.minY,s=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>s?t.maxX:s,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,e){const i=t.minX>e.minX?t.minX:e.minX,s=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&&s<=a){const o=this.minX,h=this.minY,l=this.maxX,c=this.maxY;this.minX=i<o?i:o,this.minY=s<h?s: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,s=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&&s<=a){const o=this.minX,h=this.minY,l=this.maxX,c=this.maxY;this.minX=i<o?i:o,this.minY=s<h?s: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,s,n,a){t-=n,e-=a,i+=n,s+=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>s?this.maxY:s}}class Et extends Ds{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new ra,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 ga,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 s=e[i];Object.defineProperty(Et.prototype,s,Object.getOwnPropertyDescriptor(t,s))}}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 ga);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 s=this._bounds,n=this._boundsID;this._bounds=this._localBounds;const a=this.getBounds(!1,t);return this.parent=i,this.transform=e,this._bounds=s,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,s){return e&&(t=e.toGlobal(t,i,s)),s||(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,s=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=s||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 hv),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*tx}set angle(t){this.transform.rotation=t*ex}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 hv extends Et{constructor(){super(...arguments),this.sortDirty=null}}Et.prototype.displayObjectUpdateTransform=Et.prototype.updateTransform;const lv=new mt;function cv(r,t){return r.zIndex===t.zIndex?r._lastSortedIndex-t._lastSortedIndex:r.zIndex-t.zIndex}const Tf=class Oc extends Et{constructor(){super(),this.children=[],this.sortableChildren=Oc.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),s=this.getChildIndex(e);this.children[i]=e,this.children[s]=t,this.onChildrenChange(i<s?i:s)}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);Zr(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,Zr(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,Zr(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,s=e,n=s-i;let a;if(n>0&&n<=s){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 s=this.children[e];s._lastSortedIndex=e,!t&&s.zIndex!==0&&(t=!0)}t&&this.children.length>1&&this.children.sort(cv),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 s=0,n=this.children.length;s<n;++s){const a=this.children[s];a.visible&&a.updateTransform()}return i}_calculateBounds(){}_renderWithCulling(t){const e=t.renderTexture.sourceFrame;if(!(e.width>0&&e.height>0))return;let i,s;this.cullArea?(i=this.cullArea,s=this.worldTransform):this._render!==Oc.prototype._render&&(i=this.getBounds(!0));const n=t.projection.transform;if(n&&(s?(s=lv.copyFrom(s),s.prepend(n)):s=n),i&&e.intersects(i,s))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,s=this.children.length;i<s;++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 s=e&&((n=this._enabledFilters)==null?void 0:n.length)||i&&(!i.isMaskData||i.enabled&&(i.autoDetect||i.type!==Ut.NONE));if(s&&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)}s&&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 s=0;s<i.length;++s)i[s].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}};Tf.defaultSortableChildren=!1;let $t=Tf;$t.prototype.containerUpdateTransform=$t.prototype.updateTransform,Object.defineProperties(H,{SORTABLE_CHILDREN:{get(){return $t.defaultSortableChildren},set(r){st("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),$t.defaultSortableChildren=r}}});const Zs=new tt,uv=new Uint16Array([0,1,2,0,2,3]);class Ci extends $t{constructor(t){super(),this._anchor=new wi(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 dt(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=K.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||W.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=uv,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=Ui(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=Ui(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,s=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,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]=i*p+n*g+o,l[1]=a*g+s*p+h,l[2]=i*f+n*g+o,l[3]=a*g+s*f+h,l[4]=i*f+n*m+o,l[5]=a*m+s*f+h,l[6]=i*p+n*m+o,l[7]=a*m+s*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,s=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=-s._x*i.width,f=u+i.width,p=-s._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 g=H.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 ga),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,Zs);const e=this._texture.orig.width,i=this._texture.orig.height,s=-e*this.anchor.x;let n=0;return Zs.x>=s&&Zs.x<s+e&&(n=-i*this.anchor.y,Zs.y>=n&&Zs.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 W?t:W.from(t,e);return new Ci(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=Ui(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=Ui(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||W.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const Ef=new mt;Et.prototype._cacheAsBitmap=!1,Et.prototype._cacheData=null,Et.prototype._cacheAsBitmapResolution=null,Et.prototype._cacheAsBitmapMultisample=null;class dv{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(Et.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 dv),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)}}}),Et.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))},Et.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 i=this.cacheAsBitmapResolution||r.resolution;e.ceil(i),e.width=Math.max(e.width,1/i),e.height=Math.max(e.height,1/i);const s=r.renderTexture.current,n=r.renderTexture.sourceFrame.clone(),a=r.renderTexture.destinationFrame.clone(),o=r.projection.transform,h=gr.create({width:e.width,height:e.height,resolution:i,multisample:this.cacheAsBitmapMultisample??r.multisample}),l=`cacheAsBitmap_${cr()}`;this._cacheData.textureCacheId=l,J.addToCache(h.baseTexture,l),W.addToCache(h,l);const c=this.transform.localTransform.copyTo(Ef).invert().translate(-e.x,-e.y);this.render=this._cacheData.originalRender,r.render(this,{renderTexture:h,clear:!0,transform:c,skipUpdateTransform:!1}),r.framebuffer.blit(),r.projection.transform=o,r.renderTexture.bind(s,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 Ci(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)},Et.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))},Et.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 i=r.canvasContext.activeContext,s=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 a=gr.create({width:t.width,height:t.height,resolution:n}),o=`cacheAsBitmap_${cr()}`;this._cacheData.textureCacheId=o,J.addToCache(a.baseTexture,o),W.addToCache(a,o);const h=Ef;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=t.x,h.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,r.render(this,{renderTexture:a,clear:!0,transform:h,skipUpdateTransform:!1}),r.canvasContext.activeContext=i,r._projTransform=s,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 Ci(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=r._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)},Et.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Et.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Et.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,J.removeFromCache(this._cacheData.textureCacheId),W.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Et.prototype._cacheAsBitmapDestroy=function(r){this.cacheAsBitmap=!1,this.destroy(r)},Et.prototype.name=null,$t.prototype.getChildByName=function(r,t){for(let e=0,i=this.children.length;e<i;e++)if(this.children[e].name===r)return this.children[e];if(t)for(let e=0,i=this.children.length;e<i;e++){const s=this.children[e];if(!s.getChildByName)continue;const n=s.getChildByName(r,!0);if(n)return n}return null},Et.prototype.getGlobalPosition=function(r=new tt,t=!1){return this.parent?this.parent.toGlobal(this.position,r,t):(r.x=this.position.x,r.y=this.position.y),r};var fv=`varying vec2 vTextureCoord;
|
|
527
|
+
|
|
528
|
+
uniform sampler2D uSampler;
|
|
529
|
+
uniform float uAlpha;
|
|
530
|
+
|
|
531
|
+
void main(void)
|
|
532
|
+
{
|
|
533
|
+
gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;
|
|
534
|
+
}
|
|
535
|
+
`;class pv extends re{constructor(t=1){super(iv,fv,{uAlpha:1}),this.alpha=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}const mv={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]},gv=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
|
|
536
|
+
`);function _v(r){const t=mv[r],e=t.length;let i=gv,s="";const n="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;";let a;for(let o=0;o<r;o++){let h=n.replace("%index%",o.toString());a=o,o>=e&&(a=r-o-1),h=h.replace("%value%",t[a].toString()),s+=h,s+=`
|
|
537
|
+
`}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i}const yv=`
|
|
538
|
+
attribute vec2 aVertexPosition;
|
|
539
|
+
|
|
540
|
+
uniform mat3 projectionMatrix;
|
|
541
|
+
|
|
542
|
+
uniform float strength;
|
|
543
|
+
|
|
544
|
+
varying vec2 vBlurTexCoords[%size%];
|
|
545
|
+
|
|
546
|
+
uniform vec4 inputSize;
|
|
547
|
+
uniform vec4 outputFrame;
|
|
548
|
+
|
|
549
|
+
vec4 filterVertexPosition( void )
|
|
550
|
+
{
|
|
551
|
+
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
|
552
|
+
|
|
553
|
+
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
vec2 filterTextureCoord( void )
|
|
557
|
+
{
|
|
558
|
+
return aVertexPosition * (outputFrame.zw * inputSize.zw);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
void main(void)
|
|
562
|
+
{
|
|
563
|
+
gl_Position = filterVertexPosition();
|
|
564
|
+
|
|
565
|
+
vec2 textureCoord = filterTextureCoord();
|
|
566
|
+
%blur%
|
|
567
|
+
}`;function xv(r,t){const e=Math.ceil(r/2);let i=yv,s="",n;t?n="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":n="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let a=0;a<r;a++){let o=n.replace("%index%",a.toString());o=o.replace("%sampleIndex%",`${a-(e-1)}.0`),s+=o,s+=`
|
|
568
|
+
`}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i}class Lh extends re{constructor(t,e=8,i=4,s=re.defaultResolution,n=5){const a=xv(n,t),o=_v(n);super(a,o),this.horizontal=t,this.resolution=s,this._quality=0,this.quality=i,this.blur=e}apply(t,e,i,s){if(i?this.horizontal?this.uniforms.strength=1/i.width*(i.width/e.width):this.uniforms.strength=1/i.height*(i.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,i,s);else{const n=t.getFilterTexture(),a=t.renderer;let o=e,h=n;this.state.blend=!1,t.applyFilter(this,o,h,qe.CLEAR);for(let l=1;l<this.passes-1;l++){t.bindAndClear(o,qe.BLIT),this.uniforms.uSampler=h;const c=h;h=o,o=c,a.shader.bind(this),a.geometry.draw(5)}this.state.blend=!0,t.applyFilter(this,h,i,s),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 vv extends re{constructor(t=8,e=4,i=re.defaultResolution,s=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new Lh(!0,t,e,i,s),this.blurYFilter=new Lh(!1,t,e,i,s),this.resolution=i,this.quality=e,this.blur=t,this.repeatEdgePixels=!1}apply(t,e,i,s){const n=Math.abs(this.blurXFilter.strength),a=Math.abs(this.blurYFilter.strength);if(n&&a){const o=t.getFilterTexture();this.blurXFilter.apply(t,e,o,qe.CLEAR),this.blurYFilter.apply(t,o,i,s),t.returnFilterTexture(o)}else a?this.blurYFilter.apply(t,e,i,s):this.blurXFilter.apply(t,e,i,s)}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 bv=`varying vec2 vTextureCoord;
|
|
569
|
+
uniform sampler2D uSampler;
|
|
570
|
+
uniform float m[20];
|
|
571
|
+
uniform float uAlpha;
|
|
572
|
+
|
|
573
|
+
void main(void)
|
|
574
|
+
{
|
|
575
|
+
vec4 c = texture2D(uSampler, vTextureCoord);
|
|
576
|
+
|
|
577
|
+
if (uAlpha == 0.0) {
|
|
578
|
+
gl_FragColor = c;
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
// Un-premultiply alpha before applying the color matrix. See issue #3539.
|
|
583
|
+
if (c.a > 0.0) {
|
|
584
|
+
c.rgb /= c.a;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
vec4 result;
|
|
588
|
+
|
|
589
|
+
result.r = (m[0] * c.r);
|
|
590
|
+
result.r += (m[1] * c.g);
|
|
591
|
+
result.r += (m[2] * c.b);
|
|
592
|
+
result.r += (m[3] * c.a);
|
|
593
|
+
result.r += m[4];
|
|
594
|
+
|
|
595
|
+
result.g = (m[5] * c.r);
|
|
596
|
+
result.g += (m[6] * c.g);
|
|
597
|
+
result.g += (m[7] * c.b);
|
|
598
|
+
result.g += (m[8] * c.a);
|
|
599
|
+
result.g += m[9];
|
|
600
|
+
|
|
601
|
+
result.b = (m[10] * c.r);
|
|
602
|
+
result.b += (m[11] * c.g);
|
|
603
|
+
result.b += (m[12] * c.b);
|
|
604
|
+
result.b += (m[13] * c.a);
|
|
605
|
+
result.b += m[14];
|
|
606
|
+
|
|
607
|
+
result.a = (m[15] * c.r);
|
|
608
|
+
result.a += (m[16] * c.g);
|
|
609
|
+
result.a += (m[17] * c.b);
|
|
610
|
+
result.a += (m[18] * c.a);
|
|
611
|
+
result.a += m[19];
|
|
612
|
+
|
|
613
|
+
vec3 rgb = mix(c.rgb, result.rgb, uAlpha);
|
|
614
|
+
|
|
615
|
+
// Premultiply alpha again.
|
|
616
|
+
rgb *= result.a;
|
|
617
|
+
|
|
618
|
+
gl_FragColor = vec4(rgb, result.a);
|
|
619
|
+
}
|
|
620
|
+
`;class Nh extends re{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(mf,bv,t),this.alpha=1}_loadMatrix(t,e=!1){let i=t;e&&(this._multiply(i,this.uniforms.m,t),i=this._colorMatrix(i)),this.uniforms.m=i}_multiply(t,e,i){return t[0]=e[0]*i[0]+e[1]*i[5]+e[2]*i[10]+e[3]*i[15],t[1]=e[0]*i[1]+e[1]*i[6]+e[2]*i[11]+e[3]*i[16],t[2]=e[0]*i[2]+e[1]*i[7]+e[2]*i[12]+e[3]*i[17],t[3]=e[0]*i[3]+e[1]*i[8]+e[2]*i[13]+e[3]*i[18],t[4]=e[0]*i[4]+e[1]*i[9]+e[2]*i[14]+e[3]*i[19]+e[4],t[5]=e[5]*i[0]+e[6]*i[5]+e[7]*i[10]+e[8]*i[15],t[6]=e[5]*i[1]+e[6]*i[6]+e[7]*i[11]+e[8]*i[16],t[7]=e[5]*i[2]+e[6]*i[7]+e[7]*i[12]+e[8]*i[17],t[8]=e[5]*i[3]+e[6]*i[8]+e[7]*i[13]+e[8]*i[18],t[9]=e[5]*i[4]+e[6]*i[9]+e[7]*i[14]+e[8]*i[19]+e[9],t[10]=e[10]*i[0]+e[11]*i[5]+e[12]*i[10]+e[13]*i[15],t[11]=e[10]*i[1]+e[11]*i[6]+e[12]*i[11]+e[13]*i[16],t[12]=e[10]*i[2]+e[11]*i[7]+e[12]*i[12]+e[13]*i[17],t[13]=e[10]*i[3]+e[11]*i[8]+e[12]*i[13]+e[13]*i[18],t[14]=e[10]*i[4]+e[11]*i[9]+e[12]*i[14]+e[13]*i[19]+e[14],t[15]=e[15]*i[0]+e[16]*i[5]+e[17]*i[10]+e[18]*i[15],t[16]=e[15]*i[1]+e[16]*i[6]+e[17]*i[11]+e[18]*i[16],t[17]=e[15]*i[2]+e[16]*i[7]+e[17]*i[12]+e[18]*i[17],t[18]=e[15]*i[3]+e[16]*i[8]+e[17]*i[13]+e[18]*i[18],t[19]=e[15]*i[4]+e[16]*i[9]+e[17]*i[14]+e[18]*i[19]+e[19],t}_colorMatrix(t){const e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e}brightness(t,e){const i=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)}tint(t,e){const[i,s,n]=dt.shared.setValue(t).toArray(),a=[i,0,0,0,0,0,s,0,0,0,0,0,n,0,0,0,0,0,1,0];this._loadMatrix(a,e)}greyscale(t,e){const i=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)}blackAndWhite(t){const e=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(e,t)}hue(t,e){t=(t||0)/180*Math.PI;const i=Math.cos(t),s=Math.sin(t),n=Math.sqrt,a=1/3,o=n(a),h=i+(1-i)*a,l=a*(1-i)-o*s,c=a*(1-i)+o*s,d=a*(1-i)+o*s,u=i+a*(1-i),f=a*(1-i)-o*s,p=a*(1-i)-o*s,m=a*(1-i)+o*s,g=i+a*(1-i),y=[h,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 i=(t||0)+1,s=-.5*(i-1),n=[i,0,0,0,s,0,i,0,0,s,0,0,i,0,s,0,0,0,1,0];this._loadMatrix(n,e)}saturate(t=0,e){const i=t*2/3+1,s=(i-1)*-.5,n=[i,s,s,0,0,s,i,s,0,0,s,s,i,0,0,0,0,0,1,0];this._loadMatrix(n,e)}desaturate(){this.saturate(-1)}negative(t){const e=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(e,t)}sepia(t){const e=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(e,t)}technicolor(t){const e=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(e,t)}polaroid(t){const e=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(e,t)}toBGR(t){const e=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(e,t)}kodachrome(t){const e=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(e,t)}browni(t){const e=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(e,t)}vintage(t){const e=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(e,t)}colorTone(t,e,i,s,n){t=t||.2,e=e||.15,i=i||16770432,s=s||3375104;const a=dt.shared,[o,h,l]=a.setValue(i).toArray(),[c,d,u]=a.setValue(s).toArray(),f=[.3,.59,.11,0,0,o,h,l,t,0,c,d,u,e,0,o-c,h-d,l-u,0,0];this._loadMatrix(f,n)}night(t,e){t=t||.1;const i=[t*-2,-t,0,0,0,-t,0,t,0,0,0,t,t*2,0,0,0,0,0,1,0];this._loadMatrix(i,e)}predator(t,e){const i=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(i,e)}lsd(t){const e=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(e,t)}reset(){const t=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(t,!1)}get matrix(){return this.uniforms.m}set matrix(t){this.uniforms.m=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}Nh.prototype.grayscale=Nh.prototype.greyscale;var Tv=`varying vec2 vFilterCoord;
|
|
621
|
+
varying vec2 vTextureCoord;
|
|
622
|
+
|
|
623
|
+
uniform vec2 scale;
|
|
624
|
+
uniform mat2 rotation;
|
|
625
|
+
uniform sampler2D uSampler;
|
|
626
|
+
uniform sampler2D mapSampler;
|
|
627
|
+
|
|
628
|
+
uniform highp vec4 inputSize;
|
|
629
|
+
uniform vec4 inputClamp;
|
|
630
|
+
|
|
631
|
+
void main(void)
|
|
632
|
+
{
|
|
633
|
+
vec4 map = texture2D(mapSampler, vFilterCoord);
|
|
634
|
+
|
|
635
|
+
map -= 0.5;
|
|
636
|
+
map.xy = scale * inputSize.zw * (rotation * map.xy);
|
|
637
|
+
|
|
638
|
+
gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));
|
|
639
|
+
}
|
|
640
|
+
`,Ev=`attribute vec2 aVertexPosition;
|
|
641
|
+
|
|
642
|
+
uniform mat3 projectionMatrix;
|
|
643
|
+
uniform mat3 filterMatrix;
|
|
644
|
+
|
|
645
|
+
varying vec2 vTextureCoord;
|
|
646
|
+
varying vec2 vFilterCoord;
|
|
647
|
+
|
|
648
|
+
uniform vec4 inputSize;
|
|
649
|
+
uniform vec4 outputFrame;
|
|
650
|
+
|
|
651
|
+
vec4 filterVertexPosition( void )
|
|
652
|
+
{
|
|
653
|
+
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
|
654
|
+
|
|
655
|
+
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
vec2 filterTextureCoord( void )
|
|
659
|
+
{
|
|
660
|
+
return aVertexPosition * (outputFrame.zw * inputSize.zw);
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
void main(void)
|
|
664
|
+
{
|
|
665
|
+
gl_Position = filterVertexPosition();
|
|
666
|
+
vTextureCoord = filterTextureCoord();
|
|
667
|
+
vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;
|
|
668
|
+
}
|
|
669
|
+
`;class wv extends re{constructor(t,e){const i=new mt;t.renderable=!1,super(Ev,Tv,{mapSampler:t._texture,filterMatrix:i,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=t,this.maskMatrix=i,e==null&&(e=20),this.scale=new tt(e,e)}apply(t,e,i,s){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;const n=this.maskSprite.worldTransform,a=Math.sqrt(n.a*n.a+n.b*n.b),o=Math.sqrt(n.c*n.c+n.d*n.d);a!==0&&o!==0&&(this.uniforms.rotation[0]=n.a/a,this.uniforms.rotation[1]=n.b/a,this.uniforms.rotation[2]=n.c/o,this.uniforms.rotation[3]=n.d/o),t.applyFilter(this,e,i,s)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}}var Av=`varying vec2 v_rgbNW;
|
|
670
|
+
varying vec2 v_rgbNE;
|
|
671
|
+
varying vec2 v_rgbSW;
|
|
672
|
+
varying vec2 v_rgbSE;
|
|
673
|
+
varying vec2 v_rgbM;
|
|
674
|
+
|
|
675
|
+
varying vec2 vFragCoord;
|
|
676
|
+
uniform sampler2D uSampler;
|
|
677
|
+
uniform highp vec4 inputSize;
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
Basic FXAA implementation based on the code on geeks3d.com with the
|
|
682
|
+
modification that the texture2DLod stuff was removed since it's
|
|
683
|
+
unsupported by WebGL.
|
|
684
|
+
|
|
685
|
+
--
|
|
686
|
+
|
|
687
|
+
From:
|
|
688
|
+
https://github.com/mitsuhiko/webgl-meincraft
|
|
689
|
+
|
|
690
|
+
Copyright (c) 2011 by Armin Ronacher.
|
|
691
|
+
|
|
692
|
+
Some rights reserved.
|
|
693
|
+
|
|
694
|
+
Redistribution and use in source and binary forms, with or without
|
|
695
|
+
modification, are permitted provided that the following conditions are
|
|
696
|
+
met:
|
|
697
|
+
|
|
698
|
+
* Redistributions of source code must retain the above copyright
|
|
699
|
+
notice, this list of conditions and the following disclaimer.
|
|
700
|
+
|
|
701
|
+
* Redistributions in binary form must reproduce the above
|
|
702
|
+
copyright notice, this list of conditions and the following
|
|
703
|
+
disclaimer in the documentation and/or other materials provided
|
|
704
|
+
with the distribution.
|
|
705
|
+
|
|
706
|
+
* The names of the contributors may not be used to endorse or
|
|
707
|
+
promote products derived from this software without specific
|
|
708
|
+
prior written permission.
|
|
709
|
+
|
|
710
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
711
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
712
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
713
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
714
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
715
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
716
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
717
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
718
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
719
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
720
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
721
|
+
*/
|
|
722
|
+
|
|
723
|
+
#ifndef FXAA_REDUCE_MIN
|
|
724
|
+
#define FXAA_REDUCE_MIN (1.0/ 128.0)
|
|
725
|
+
#endif
|
|
726
|
+
#ifndef FXAA_REDUCE_MUL
|
|
727
|
+
#define FXAA_REDUCE_MUL (1.0 / 8.0)
|
|
728
|
+
#endif
|
|
729
|
+
#ifndef FXAA_SPAN_MAX
|
|
730
|
+
#define FXAA_SPAN_MAX 8.0
|
|
731
|
+
#endif
|
|
732
|
+
|
|
733
|
+
//optimized version for mobile, where dependent
|
|
734
|
+
//texture reads can be a bottleneck
|
|
735
|
+
vec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,
|
|
736
|
+
vec2 v_rgbNW, vec2 v_rgbNE,
|
|
737
|
+
vec2 v_rgbSW, vec2 v_rgbSE,
|
|
738
|
+
vec2 v_rgbM) {
|
|
739
|
+
vec4 color;
|
|
740
|
+
vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;
|
|
741
|
+
vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;
|
|
742
|
+
vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;
|
|
743
|
+
vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;
|
|
744
|
+
vec4 texColor = texture2D(tex, v_rgbM);
|
|
745
|
+
vec3 rgbM = texColor.xyz;
|
|
746
|
+
vec3 luma = vec3(0.299, 0.587, 0.114);
|
|
747
|
+
float lumaNW = dot(rgbNW, luma);
|
|
748
|
+
float lumaNE = dot(rgbNE, luma);
|
|
749
|
+
float lumaSW = dot(rgbSW, luma);
|
|
750
|
+
float lumaSE = dot(rgbSE, luma);
|
|
751
|
+
float lumaM = dot(rgbM, luma);
|
|
752
|
+
float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
|
|
753
|
+
float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
|
|
754
|
+
|
|
755
|
+
mediump vec2 dir;
|
|
756
|
+
dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
|
|
757
|
+
dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
|
|
758
|
+
|
|
759
|
+
float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *
|
|
760
|
+
(0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);
|
|
761
|
+
|
|
762
|
+
float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);
|
|
763
|
+
dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),
|
|
764
|
+
max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),
|
|
765
|
+
dir * rcpDirMin)) * inverseVP;
|
|
766
|
+
|
|
767
|
+
vec3 rgbA = 0.5 * (
|
|
768
|
+
texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +
|
|
769
|
+
texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);
|
|
770
|
+
vec3 rgbB = rgbA * 0.5 + 0.25 * (
|
|
771
|
+
texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +
|
|
772
|
+
texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);
|
|
773
|
+
|
|
774
|
+
float lumaB = dot(rgbB, luma);
|
|
775
|
+
if ((lumaB < lumaMin) || (lumaB > lumaMax))
|
|
776
|
+
color = vec4(rgbA, texColor.a);
|
|
777
|
+
else
|
|
778
|
+
color = vec4(rgbB, texColor.a);
|
|
779
|
+
return color;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
void main() {
|
|
783
|
+
|
|
784
|
+
vec4 color;
|
|
785
|
+
|
|
786
|
+
color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
|
|
787
|
+
|
|
788
|
+
gl_FragColor = color;
|
|
789
|
+
}
|
|
790
|
+
`,Sv=`
|
|
791
|
+
attribute vec2 aVertexPosition;
|
|
792
|
+
|
|
793
|
+
uniform mat3 projectionMatrix;
|
|
794
|
+
|
|
795
|
+
varying vec2 v_rgbNW;
|
|
796
|
+
varying vec2 v_rgbNE;
|
|
797
|
+
varying vec2 v_rgbSW;
|
|
798
|
+
varying vec2 v_rgbSE;
|
|
799
|
+
varying vec2 v_rgbM;
|
|
800
|
+
|
|
801
|
+
varying vec2 vFragCoord;
|
|
802
|
+
|
|
803
|
+
uniform vec4 inputSize;
|
|
804
|
+
uniform vec4 outputFrame;
|
|
805
|
+
|
|
806
|
+
vec4 filterVertexPosition( void )
|
|
807
|
+
{
|
|
808
|
+
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
|
809
|
+
|
|
810
|
+
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
void texcoords(vec2 fragCoord, vec2 inverseVP,
|
|
814
|
+
out vec2 v_rgbNW, out vec2 v_rgbNE,
|
|
815
|
+
out vec2 v_rgbSW, out vec2 v_rgbSE,
|
|
816
|
+
out vec2 v_rgbM) {
|
|
817
|
+
v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;
|
|
818
|
+
v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;
|
|
819
|
+
v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;
|
|
820
|
+
v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;
|
|
821
|
+
v_rgbM = vec2(fragCoord * inverseVP);
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
void main(void) {
|
|
825
|
+
|
|
826
|
+
gl_Position = filterVertexPosition();
|
|
827
|
+
|
|
828
|
+
vFragCoord = aVertexPosition * outputFrame.zw;
|
|
829
|
+
|
|
830
|
+
texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
|
|
831
|
+
}
|
|
832
|
+
`;class Cv extends re{constructor(){super(Sv,Av)}}var Pv=`precision highp float;
|
|
833
|
+
|
|
834
|
+
varying vec2 vTextureCoord;
|
|
835
|
+
varying vec4 vColor;
|
|
836
|
+
|
|
837
|
+
uniform float uNoise;
|
|
838
|
+
uniform float uSeed;
|
|
839
|
+
uniform sampler2D uSampler;
|
|
840
|
+
|
|
841
|
+
float rand(vec2 co)
|
|
842
|
+
{
|
|
843
|
+
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
void main()
|
|
847
|
+
{
|
|
848
|
+
vec4 color = texture2D(uSampler, vTextureCoord);
|
|
849
|
+
float randomValue = rand(gl_FragCoord.xy * uSeed);
|
|
850
|
+
float diff = (randomValue - 0.5) * uNoise;
|
|
851
|
+
|
|
852
|
+
// Un-premultiply alpha before applying the color matrix. See issue #3539.
|
|
853
|
+
if (color.a > 0.0) {
|
|
854
|
+
color.rgb /= color.a;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
color.r += diff;
|
|
858
|
+
color.g += diff;
|
|
859
|
+
color.b += diff;
|
|
860
|
+
|
|
861
|
+
// Premultiply alpha again.
|
|
862
|
+
color.rgb *= color.a;
|
|
863
|
+
|
|
864
|
+
gl_FragColor = color;
|
|
865
|
+
}
|
|
866
|
+
`;class Rv extends re{constructor(t=.5,e=Math.random()){super(mf,Pv,{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 wf={AlphaFilter:pv,BlurFilter:vv,BlurFilterPass:Lh,ColorMatrixFilter:Nh,DisplacementFilter:wv,FXAAFilter:Cv,NoiseFilter:Rv};Object.entries(wf).forEach(([r,t])=>{Object.defineProperty(wf,r,{get(){return st("7.1.0",`filters.${r} has moved to ${r}`),t}})});class Iv{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this.tickerAdded||!this.domElement||(Wt.system.add(this.tickerUpdate,this,xr.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(Wt.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY}))}tickerUpdate(t){this._deltaTime+=t,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())}}const Xi=new Iv;class Qs{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Qs.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,s,n){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}class _a extends Qs{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,s,n,a,o,h,l,c,d,u,f,p,m){throw new Error("Method not implemented.")}}class Ge extends _a{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 es extends _a{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}es.DOM_DELTA_PIXEL=0,es.DOM_DELTA_LINE=1,es.DOM_DELTA_PAGE=2;const Mv=2048,Dv=new tt,kh=new tt;class Bv{constructor(t){this.dispatch=new Ds,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((i,s)=>i.priority-s.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const e=this.mappingTable[t.type];if(e)for(let i=0,s=e.length;i<s;i++)e[i].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){Xi.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",s=this[i](this.rootTarget,this.rootTarget.eventMode,Dv.set(t,e),this.hitTestFn,this.hitPruneFn);return s&&s[0]}propagate(t,e){if(!t.target)return;const i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,n=i.length-1;s<n;s++)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=i.length-2;s>=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const s=Array.isArray(e)?e:[e];for(let n=i.length-1;n>=0;n--)s.forEach(a=>{t.currentTarget=i[n],this.notifyTarget(t,a)})}propagationPath(t){const e=[t];for(let i=0;i<Mv&&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,s,n,a=!1){let o=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Xi.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,s,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)&&s(t,i)?l?[t]:[]:null}hitTestRecursive(t,e,i,s,n){if(this._interactivePrune(t)||n(t,i))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Xi.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,s,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&&s(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,kh),!t.hitArea.contains(kh.x,kh.y)))return!0;if(t._mask){const s=t._mask.isMaskData?t._mask.maskObject:t._mask;if(s&&!((i=s.containsPoint)!=null&&i.call(s,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 s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Ge)){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 s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown")}const i=this.trackingData(t.pointerId);i.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var h,l;if(!(t instanceof Ge)){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",s=this.trackingData(t.pointerId),n=this.findMountedTarget(s.overTargets);if(((h=s.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,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){var a;if(!(t instanceof Ge)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),i=this.createPointerEvent(t),s=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),s&&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),s&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof Ge)){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",s=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(n),i&&this.dispatchEvent(n,"mouseout");const a=this.createPointerEvent(t,"pointerleave",s);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 Ge)){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 s=this.trackingData(t.pointerId),n=this.findMountedTarget(s.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 s.pressTargetsByButton[t.button],a=o}if(a){const o=this.clonePointerEvent(i,"click");o.target=a,o.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:o.target,timeStamp:e});const h=s.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 Ge)){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]),s=this.createPointerEvent(t);if(i){let n=i;for(;n;)s.currentTarget=n,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof es)){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 s=this.allocateEvent(Ge);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=i??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){const e=this.allocateEvent(es);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(Ge);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 Ge&&e instanceof Ge&&(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 _a&&e instanceof _a&&(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 s=0,n=i.length;s<n&&!t.propagationImmediatelyStopped;s++)i[s].once&&t.currentTarget.removeListener(e,i[s].fn,void 0,!0),i[s].fn.call(i[s].context,t)}}const Ov=1,Fv={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Uh=class Fc{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Bv(null),Xi.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new Ge(null),this.rootWheelEvent=new es(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Fc.defaultEventFeatures},{set:(e,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[i]=s,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){const{view:e,resolution:i}=this.renderer;this.setTargetElement(e),this.resolution=i,Fc._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,s=e.length;i<s;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,Xi.pointerMoved();const e=this.normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);const i=e!==this.domElement?"outside":"",s=this.normalizeToPointerData(t);for(let n=0,a=s.length;n<a;n++){const o=this.bootstrapEvent(this.rootPointerEvent,s[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,s=e.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;const e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this.removeEvents(),this.domElement=t,Xi.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;Xi.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;Xi.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 s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},n=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*n,t.y=(i-s.top)*(this.domElement.height/s.height)*n}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let i=0,s=t.changedTouches.length;i<s;i++){const n=t.changedTouches[i];typeof n.button>"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=Ov),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=Fv[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}};Uh.extension={name:"events",type:[G.RendererSystem,G.CanvasRendererSystem]},Uh.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let Gh=Uh;Y.add(Gh);function Af(r){return r==="dynamic"||r==="static"}const Lv={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??Af(Gh.defaultEventMode)},set interactive(r){st("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??Gh.defaultEventMode},set eventMode(r){this._internalInteractive=Af(r),this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof e=="object"?e.signal:void 0,n=typeof e=="object"?e.once===!0:!1,a=typeof t=="function"?void 0:t;r=i?`${r}capture`:r;const o=typeof t=="function"?t:t.handleEvent,h=this;s&&s.addEventListener("abort",()=>{h.off(r,o,a)}),n?h.once(r,o,a):h.on(r,o,a)},removeEventListener(r,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.off(r,t,s)},dispatchEvent(r){if(!(r instanceof Qs))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}};Et.mixin(Lv);const Nv={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Et.mixin(Nv);const kv=9,ya=100,Uv=0,Gv=0,Sf=2,Cf=1,Vv=-1e3,Hv=-1e3,Xv=2;class Pf{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,(xi.tablet||xi.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${ya}px`,e.style.height=`${ya}px`,e.style.position="absolute",e.style.top=`${Uv}px`,e.style.left=`${Gv}px`,e.style.zIndex=Sf.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=`${Cf}px`,t.style.height=`${Cf}px`,t.style.position="absolute",t.style.top=`${Vv}px`,t.style.left=`${Hv}px`,t.style.zIndex=Xv.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(xi.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:s,height:n}=this.renderer.view.getBoundingClientRect(),{width:a,height:o,resolution:h}=this.renderer,l=s/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,Zr(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=`${ya}px`,e.style.height=`${ya}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=Sf.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,s=this.renderer.events.rootBoundary,n=Object.assign(new Qs(s),{target:i});s.rootTarget=this.renderer.lastObjectRendered,e.forEach(a=>s.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===kv&&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}}Pf.extension={name:"accessibility",type:[G.RendererPlugin,G.CanvasRendererPlugin]},Y.add(Pf);const Rf=class Lc{constructor(t){this.stage=new $t,t=Object.assign({forceCanvas:!1},t),this.renderer=Jx(t),Lc._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=Lc._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};Rf._plugins=[];let Wv=Rf;Y.handleByList(G.Application,Wv._plugins);class If{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this.cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this.cancelResize();let e,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:s,clientHeight:n}=this._resizeTo;e=s,i=n}this.renderer.resize(e,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}If.extension=G.Application,Y.add(If);const Mf={loader:G.LoadParser,resolver:G.ResolveParser,cache:G.CacheParser,detection:G.DetectionParser};Y.handle(G.Asset,r=>{const t=r.ref;Object.entries(Mf).filter(([e])=>!!t[e]).forEach(([e,i])=>Y.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{const t=r.ref;Object.keys(Mf).filter(e=>!!t[e]).forEach(e=>Y.remove(t[e]))});class $v{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 is(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 Wi(r,t){const e=r.split("?")[0],i=Ht.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const Ve=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r),Vh=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};function Df(r,t,e,i,s){const n=t[e];for(let a=0;a<n.length;a++){const o=n[a];e<t.length-1?Df(r.replace(i[e],o),t,e+1,i,s):s.push(r.replace(i[e],o))}}function zv(r){const t=/\{(.*?)\}/g,e=r.match(t),i=[];if(e){const s=[];e.forEach(n=>{const a=n.substring(1,n.length-1).split(",");s.push(a)}),Df(r,s,0,e,i)}else i.push(r);return i}const xa=r=>!Array.isArray(r);class Yv{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=Ve(t);let s;for(let o=0;o<this.parsers.length;o++){const h=this.parsers[o];if(h.test(e)){s=h.getCacheableAssets(i,e);break}}s||(s={},i.forEach(o=>{s[o]=e}));const n=Object.keys(s),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,s[o])}),e instanceof W){const o=e;i.forEach(h=>{o.baseTexture!==W.EMPTY.baseTexture&&J.addToCache(o.baseTexture,h),W.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 vr=new Yv;class jv{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 s=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}s=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,s,e,this))&&(s=await l.parse(s,e,this)||s,i.parser=l)}return s})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0;const s={},n=xa(t),a=Ve(t,l=>({alias:[l],src:l})),o=a.length,h=a.map(async l=>{const c=Ht.toAbsolute(l.src);if(!s[l.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,l)),s[l.src]=await this.promiseCache[c].promise,e&&e(++i/o)}catch(d){throw delete this.promiseCache[c],delete s[l.src],new Error(`[Loader.load] Failed to load ${c}.
|
|
867
|
+
${d}`)}});return await Promise.all(h),n?s[a[0].src]:s}async unload(t){const e=Ve(t,i=>({alias:[i],src:i})).map(async i=>{var a,o;const s=Ht.toAbsolute(i.src),n=this.promiseCache[s];if(n){const h=await n.promise;delete this.promiseCache[s],(o=(a=n.parser)==null?void 0:a.unload)==null||o.call(a,h,i,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 He=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(He||{});const qv=".json",Kv="application/json",Zv={extension:{type:G.LoadParser,priority:He.Low},name:"loadJson",test(r){return is(r,Kv)||Wi(r,qv)},async load(r){return await(await H.ADAPTER.fetch(r)).json()}};Y.add(Zv);const Qv=".txt",Jv="text/plain",t1={name:"loadTxt",extension:{type:G.LoadParser,priority:He.Low},test(r){return is(r,Jv)||Wi(r,Qv)},async load(r){return await(await H.ADAPTER.fetch(r)).text()}};Y.add(t1);const e1=["normal","bold","100","200","300","400","500","600","700","800","900"],i1=[".ttf",".otf",".woff",".woff2"],r1=["font/ttf","font/otf","font/woff","font/woff2"],s1=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function n1(r){const t=Ht.extname(r),e=Ht.basename(r,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let i=e.length>0;for(const n of e)if(!n.match(s1)){i=!1;break}let s=e.join(" ");return i||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}const a1=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function o1(r){return a1.test(r)?r:encodeURI(r)}const h1={extension:{type:G.LoadParser,priority:He.Low},name:"loadWebFont",test(r){return is(r,r1)||Wi(r,i1)},async load(r,t){var i,s,n;const e=H.ADAPTER.getFontFaceSet();if(e){const a=[],o=((i=t.data)==null?void 0:i.family)??n1(r),h=((n=(s=t.data)==null?void 0:s.weights)==null?void 0:n.filter(c=>e1.includes(c)))??["normal"],l=t.data??{};for(let c=0;c<h.length;c++){const d=h[c],u=new FontFace(o,`url(${o1(r)})`,{...l,weight:d});await u.load(),e.add(u),a.push(u)}return a.length===1?a[0]:a}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(r){(Array.isArray(r)?r:[r]).forEach(t=>H.ADAPTER.getFontFaceSet().delete(t))}};Y.add(h1);const l1=`(function() {
|
|
868
|
+
"use strict";
|
|
869
|
+
const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
|
|
870
|
+
async function checkImageBitmap() {
|
|
871
|
+
try {
|
|
872
|
+
if (typeof createImageBitmap != "function")
|
|
873
|
+
return !1;
|
|
874
|
+
const imageBlob = await (await fetch(WHITE_PNG)).blob(), imageBitmap = await createImageBitmap(imageBlob);
|
|
875
|
+
return imageBitmap.width === 1 && imageBitmap.height === 1;
|
|
876
|
+
} catch {
|
|
877
|
+
return !1;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
checkImageBitmap().then((result) => {
|
|
881
|
+
self.postMessage(result);
|
|
882
|
+
});
|
|
883
|
+
})();
|
|
884
|
+
`;let rs=null,Hh=class{constructor(){rs||(rs=URL.createObjectURL(new Blob([l1],{type:"application/javascript"}))),this.worker=new Worker(rs)}};Hh.revokeObjectURL=function(){rs&&(URL.revokeObjectURL(rs),rs=null)};const c1=`(function() {
|
|
885
|
+
"use strict";
|
|
886
|
+
async function loadImageBitmap(url) {
|
|
887
|
+
const response = await fetch(url);
|
|
888
|
+
if (!response.ok)
|
|
889
|
+
throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \${response.status} \${response.statusText}\`);
|
|
890
|
+
const imageBlob = await response.blob();
|
|
891
|
+
return await createImageBitmap(imageBlob);
|
|
892
|
+
}
|
|
893
|
+
self.onmessage = async (event) => {
|
|
894
|
+
try {
|
|
895
|
+
const imageBitmap = await loadImageBitmap(event.data.data[0]);
|
|
896
|
+
self.postMessage({
|
|
897
|
+
data: imageBitmap,
|
|
898
|
+
uuid: event.data.uuid,
|
|
899
|
+
id: event.data.id
|
|
900
|
+
}, [imageBitmap]);
|
|
901
|
+
} catch (e) {
|
|
902
|
+
self.postMessage({
|
|
903
|
+
error: e,
|
|
904
|
+
uuid: event.data.uuid,
|
|
905
|
+
id: event.data.id
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
};
|
|
909
|
+
})();
|
|
910
|
+
`;let ss=null;class Bf{constructor(){ss||(ss=URL.createObjectURL(new Blob([c1],{type:"application/javascript"}))),this.worker=new Worker(ss)}}Bf.revokeObjectURL=function(){ss&&(URL.revokeObjectURL(ss),ss=null)};let Of=0,Xh;class u1{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 Hh;e.addEventListener("message",i=>{e.terminate(),Hh.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){Xh===void 0&&(Xh=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<Xh&&(this._createdWorkers++,t=new Bf().worker,t.addEventListener("message",e=>{this.complete(e.data),this.returnWorker(e.target),this.next()})),t}returnWorker(t){this.workerPool.push(t)}complete(t){t.error!==void 0?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const i=new Promise((s,n)=>{this.queue.push({id:t,arguments:e,resolve:s,reject:n})});return this.next(),i}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),i=e.id;this.resolveHash[Of]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Of++,id:i})}}const Ff=new u1;function Js(r,t,e){r.resource.internal=!0;const i=new W(r),s=()=>{delete t.promiseCache[e],vr.has(e)&&vr.remove(e)};return i.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."),s())}),i.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."),s())}),i}const d1=[".jpeg",".jpg",".png",".webp",".avif"],f1=["image/jpeg","image/png","image/webp","image/avif"];async function p1(r){const t=await H.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 va={name:"loadTextures",extension:{type:G.LoadParser,priority:He.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return is(r,f1)||Wi(r,d1)},async load(r,t,e){var o;const i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let s;i?this.config.preferWorkers&&await Ff.isImageBitmapSupported()?s=await Ff.loadImageBitmap(r):s=await p1(r):s=await new Promise((h,l)=>{const c=new Image;c.crossOrigin=this.config.crossOrigin,c.src=r,c.complete?h(c):(c.onload=()=>h(c),c.onerror=d=>l(d))});const n={...t.data};n.resolution??(n.resolution=Ei(r)),i&&((o=n.resourceOptions)==null?void 0:o.ownsImageBitmap)===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const a=new J(s,n);return a.resource.src=r,Js(a,e,r)},unload(r){r.destroy(!0)}};Y.add(va);const m1=".svg",g1="image/svg+xml",_1={extension:{type:G.LoadParser,priority:He.High},name:"loadSVG",test(r){return is(r,g1)||Wi(r,m1)},async testParse(r){return Oh.test(r)},async parse(r,t,e){var n;const i=new Oh(r,(n=t==null?void 0:t.data)==null?void 0:n.resourceOptions);await i.load();const s=new J(i,{resolution:Ei(r),...t==null?void 0:t.data});return s.resource.src=t.src,Js(s,e,t.src)},async load(r,t){return(await H.ADAPTER.fetch(r)).text()},unload:va.unload};Y.add(_1);const y1=[".mp4",".m4v",".webm",".ogv"],x1=["video/mp4","video/webm","video/ogg"],v1={name:"loadVideo",extension:{type:G.LoadParser,priority:He.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test(r){return is(r,x1)||Wi(r,y1)},async load(r,t,e){var a;let i;const s=await(await H.ADAPTER.fetch(r)).blob(),n=URL.createObjectURL(s);try{const o={autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline,...(a=t==null?void 0:t.data)==null?void 0:a.resourceOptions,autoLoad:!0},h=new bf(n,o);await h.load();const l=new J(h,{alphaMode:await Ay(),resolution:Ei(r),...t==null?void 0:t.data});l.resource.src=r,i=Js(l,e,r),i.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(o){throw URL.revokeObjectURL(n),o}return i},unload(r){r.destroy(!0)}};Y.add(v1);class b1{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(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){const{alias:e,name:i,src:s,srcs:n}=t;return Ve(e||i||s||n,a=>typeof a=="string"?a:Array.isArray(a)?a.map(o=>(o==null?void 0:o.src)??(o==null?void 0:o.srcs)??o):a!=null&&a.src||a!=null&&a.srcs?a.src??a.srcs:a,!0)}addManifest(t){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const i=[];Array.isArray(e)?e.forEach(s=>{const n=s.src??s.srcs,a=s.alias??s.name;let o;if(typeof a=="string"){const h=this._createBundleAssetId(t,a);i.push(h),o=[a,h]}else{const h=a.map(l=>this._createBundleAssetId(t,l));i.push(...h),o=[...a,...h]}this.add({...s,alias:o,src:n})}):Object.keys(e).forEach(s=>{const n=[s,this._createBundleAssetId(t,s)];if(typeof e[s]=="string")this.add({alias:n,src:e[s]});else if(Array.isArray(e[s]))this.add({alias:n,src:e[s]});else{const a=e[s],o=a.src??a.srcs;this.add({...a,alias:n,src:Array.isArray(o)?o:[o]})}i.push(...n)}),this._bundles[t]=i}add(t,e,i,s,n){const a=[];typeof t=="string"||Array.isArray(t)&&typeof t[0]=="string"?(st("7.2.0",`Assets.add now uses an object instead of individual parameters.
|
|
911
|
+
Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),a.push({alias:t,src:e,data:i,format:s,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`)},Ve(a).forEach(h=>{const{src:l,srcs:c}=h;let{data:d,format:u,loadParser:f}=h;const p=Ve(l||c).map(y=>typeof y=="string"?zv(y):Array.isArray(y)?y:[y]),m=this.getAlias(h);Array.isArray(m)?m.forEach(o):o(m);const g=[];p.forEach(y=>{y.forEach(v=>{let _={};if(typeof v!="object"){_.src=v;for(let x=0;x<this._parsers.length;x++){const b=this._parsers[x];if(b.test(v)){_=b.parse(v);break}}}else d=v.data??d,u=v.format??u,f=v.loadParser??f,_={..._,...v};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=xa(t);t=Ve(t);const i={};return t.forEach(s=>{const n=this._bundles[s];if(n){const a=this.resolve(n),o={};for(const h in a){const l=a[h];o[this._extractAssetIdFromBundle(s,h)]=l}i[s]=o}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const s in e)i[s]=e[s].src;return i}return e.src}resolve(t){const e=xa(t);t=Ve(t);const i={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let n=this._assetMap[s];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[s]=n[0]??a}else this._resolverHash[s]=this.buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const i=t[0],s=this._preferredOrder.find(n=>n.params.format.includes(i.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}buildResolvedAsset(t,e){const{aliases:i,data:s,loadParser:n,format:a}=e;return(this._basePath||this._rootPath)&&(t.src=Ht.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=n??t.loadParser,t.format=a??t.format??Ht.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class T1{constructor(){this._detections=[],this._initialized=!1,this.resolver=new b1,this.loader=new jv,this.cache=vr,this._backgroundLoader=new $v(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,s=await this._detectFormats({preferredFormats:(a=t.texturePreference)==null?void 0:a.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,i,s,n){this.resolver.add(t,e,i,s,n)}async load(t,e){this._initialized||await this.init();const i=xa(t),s=Ve(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(s),a=await this._mapLoadToResolve(n,e);return i?a[s[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 s=this.resolver.resolveBundle(t),n={},a=Object.keys(s);let o=0,h=0;const l=()=>{e==null||e(++o/h)},c=a.map(d=>{const u=s[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 vr.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=vr.get(t[i]);return e}async _mapLoadToResolve(t,e){const i=Object.values(t),s=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[s[h]]=l,vr.set(c,l)}),a}async unload(t){this._initialized||await this.init();const e=Ve(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Ve(t);const e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(i=>{vr.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}get preferWorkers(){return va.config.preferWorkers}set preferWorkers(t){st("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 ba=new T1;Y.handleByList(G.LoadParser,ba.loader.parsers).handleByList(G.ResolveParser,ba.resolver.parsers).handleByList(G.CacheParser,ba.cache.parsers).handleByList(G.DetectionParser,ba.detections);const E1={extension:G.CacheParser,test:r=>Array.isArray(r)&&r.every(t=>t instanceof W),getCacheableAssets:(r,t)=>{const e={};return r.forEach(i=>{t.forEach((s,n)=>{e[i+(n===0?"":n+1)]=s})}),e}};Y.add(E1);async function Lf(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 w1={extension:{type:G.DetectionParser,priority:1},test:async()=>Lf("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};Y.add(w1);const A1={extension:{type:G.DetectionParser,priority:0},test:async()=>Lf("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};Y.add(A1);const Nf=["png","jpg","jpeg"],S1={extension:{type:G.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...Nf],remove:async r=>r.filter(t=>!Nf.includes(t))};Y.add(S1);const C1="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Wh(r){return C1?!1:document.createElement("video").canPlayType(r)!==""}const P1={extension:{type:G.DetectionParser,priority:0},test:async()=>Wh("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};Y.add(P1);const R1={extension:{type:G.DetectionParser,priority:0},test:async()=>Wh("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};Y.add(R1);const I1={extension:{type:G.DetectionParser,priority:0},test:async()=>Wh("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};Y.add(I1);const M1={extension:G.ResolveParser,test:va.test,parse:r=>{var t;return{resolution:parseFloat(((t=H.RETINA_PREFIX.exec(r))==null?void 0:t[1])??"1"),format:Ht.extname(r).slice(1),src:r}}};Y.add(M1);var Kt=(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))(Kt||{});const Ta={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 si,ns;function kf(){ns={bptc:si.getExtension("EXT_texture_compression_bptc"),astc:si.getExtension("WEBGL_compressed_texture_astc"),etc:si.getExtension("WEBGL_compressed_texture_etc"),s3tc:si.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:si.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:si.getExtension("WEBGL_compressed_texture_pvrtc")||si.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:si.getExtension("WEBGL_compressed_texture_etc1"),atc:si.getExtension("WEBGL_compressed_texture_atc")}}const D1={extension:{type:G.DetectionParser,priority:2},test:async()=>{const r=H.ADAPTER.createCanvas().getContext("webgl");return r?(si=r,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async r=>{ns||kf();const t=[];for(const e in ns)ns[e]&&t.push(e);return[...t,...r]},remove:async r=>(ns||kf(),r.filter(t=>!(t in ns)))};Y.add(D1);class B1 extends qn{constructor(t,e={width:1,height:1,autoLoad:!0}){let i,s;typeof t=="string"?(i=t,s=new Uint8Array):(i=null,s=t),super(s,e),this.origin=i,this.buffer=s?new ch(s):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 ch(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class br extends B1{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=br._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||br._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,i){const s=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;s.pixelStorei(s.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];s.compressedTexImage2D(s.TEXTURE_2D,o,this.format,h,l,0,c)}return!0}onBlobLoaded(){this._levelBuffers=br._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,s,n,a,o){const h=new Array(i);let l=t.byteOffset,c=a,d=o,u=c+s-1&~(s-1),f=d+n-1&~(n-1),p=u*f*Ta[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+s-1&~(s-1),f=d+n-1&~(n-1),p=u*f*Ta[e];return h}}const $h=4,Ea=124,O1=32,Uf=20,F1=542327876,wa={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},L1={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},Aa={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},N1=1,k1=2,U1=4,G1=64,V1=512,H1=131072,X1=827611204,W1=861165636,$1=894720068,z1=808540228,Y1=4,j1={[X1]:Kt.COMPRESSED_RGBA_S3TC_DXT1_EXT,[W1]:Kt.COMPRESSED_RGBA_S3TC_DXT3_EXT,[$1]:Kt.COMPRESSED_RGBA_S3TC_DXT5_EXT},q1={70:Kt.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Kt.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Kt.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Kt.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Kt.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Kt.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Kt.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Kt.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Kt.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:Kt.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:Kt.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:Kt.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:Kt.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function K1(r){const t=new Uint32Array(r);if(t[0]!==F1)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(r,0,Ea/Uint32Array.BYTES_PER_ELEMENT),i=e[wa.HEIGHT],s=e[wa.WIDTH],n=e[wa.MIPMAP_COUNT],a=new Uint32Array(r,wa.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,O1/Uint32Array.BYTES_PER_ELEMENT),o=a[N1];if(o&U1){const h=a[L1.FOURCC];if(h!==z1){const v=j1[h],_=$h+Ea,x=new Uint8Array(r,_);return[new br(x,{format:v,width:s,height:i,levels:n})]}const l=$h+Ea,c=new Uint32Array(t.buffer,l,Uf/Uint32Array.BYTES_PER_ELEMENT),d=c[Aa.DXGI_FORMAT],u=c[Aa.RESOURCE_DIMENSION],f=c[Aa.MISC_FLAG],p=c[Aa.ARRAY_SIZE],m=q1[d];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${d}`);if(f===Y1)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=$h+Ea+Uf;if(p===1)g.push(new Uint8Array(r,y));else{const v=Ta[m];let _=0,x=s,b=i;for(let T=0;T<n;T++){const w=Math.max(1,x+3&-4),A=Math.max(1,b+3&-4),P=w*A*v;_+=P,x=x>>>1,b=b>>>1}let E=y;for(let T=0;T<p;T++)g.push(new Uint8Array(r,E,_)),E+=_}return g.map(v=>new br(v,{format:m,width:s,height:i,levels:n}))}throw o&G1?new Error("DDSParser does not support uncompressed texture data."):o&V1?new Error("DDSParser does not supported YUV uncompressed texture data."):o&H1?new Error("DDSParser does not support single-channel (lumninance) texture data!"):o&k1?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 Gf=[171,75,84,88,32,49,49,187,13,10,26,10],Z1=67305985,Xe={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},zh=64,Vf={[Z.UNSIGNED_BYTE]:1,[Z.UNSIGNED_SHORT]:2,[Z.INT]:4,[Z.UNSIGNED_INT]:4,[Z.FLOAT]:4,[Z.HALF_FLOAT]:8},Q1={[O.RGBA]:4,[O.RGB]:3,[O.RG]:2,[O.RED]:1,[O.LUMINANCE]:1,[O.LUMINANCE_ALPHA]:2,[O.ALPHA]:1},J1={[Z.UNSIGNED_SHORT_4_4_4_4]:2,[Z.UNSIGNED_SHORT_5_5_5_1]:2,[Z.UNSIGNED_SHORT_5_6_5]:2};function tb(r,t,e=!1){const i=new DataView(t);if(!eb(r,i))return null;const s=i.getUint32(Xe.ENDIANNESS,!0)===Z1,n=i.getUint32(Xe.GL_TYPE,s),a=i.getUint32(Xe.GL_FORMAT,s),o=i.getUint32(Xe.GL_INTERNAL_FORMAT,s),h=i.getUint32(Xe.PIXEL_WIDTH,s),l=i.getUint32(Xe.PIXEL_HEIGHT,s)||1,c=i.getUint32(Xe.PIXEL_DEPTH,s)||1,d=i.getUint32(Xe.NUMBER_OF_ARRAY_ELEMENTS,s)||1,u=i.getUint32(Xe.NUMBER_OF_FACES,s),f=i.getUint32(Xe.NUMBER_OF_MIPMAP_LEVELS,s),p=i.getUint32(Xe.BYTES_OF_KEY_VALUE_DATA,s);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=h+3&-4,v=l+3&-4,_=new Array(d);let x=h*l;n===0&&(x=y*v);let b;if(n!==0?Vf[n]?b=Vf[n]*Q1[a]:b=J1[n]:b=Ta[o],b===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const E=e?rb(i,p,s):null;let T=x*b,w=h,A=l,P=y,L=v,M=zh+p;for(let S=0;S<f;S++){const C=i.getUint32(M,s);let R=M+4;for(let k=0;k<d;k++){let F=_[k];F||(F=_[k]=new Array(f)),F[S]={levelID:S,levelWidth:f>1||n!==0?w: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,w=w>>1||1,A=A>>1||1,P=w+m-1&~(m-1),L=A+g-1&~(g-1),T=P*L*b}return n!==0?{uncompressed:_.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 qn(C,{width:S[0].levelWidth,height:S[0].levelHeight}),type:n,format:R?ib(a):a}}),kvData:E}:{compressed:_.map(S=>new br(null,{format:o,width:h,height:l,levels:f,levelBuffers:S})),kvData:E}}function eb(r,t){for(let e=0;e<Gf.length;e++)if(t.getUint8(e)!==Gf[e])return console.error(`${r} is not a valid *.ktx file!`),!1;return!0}function ib(r){switch(r){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 r}}function rb(r,t,e){const i=new Map;let s=0;for(;s<t;){const n=r.getUint32(zh+s,e),a=zh+s+4,o=3-(n+3)%4;if(n===0||n>t-s){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h<n&&r.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(r.buffer,a,h)),c=new DataView(r.buffer,a+h+1,n-h-1);i.set(l,c),s+=4+n+o}return i}const sb={extension:{type:G.LoadParser,priority:He.High},name:"loadDDS",test(r){return Wi(r,".dds")},async load(r,t,e){const i=await(await H.ADAPTER.fetch(r)).arrayBuffer(),s=K1(i).map(n=>{const a=new J(n,{mipmap:je.OFF,alphaMode:oe.NO_PREMULTIPLIED_ALPHA,resolution:Ei(r),...t.data});return Js(a,e,r)});return s.length===1?s[0]:s},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};Y.add(sb);const nb={extension:{type:G.LoadParser,priority:He.High},name:"loadKTX",test(r){return Wi(r,".ktx")},async load(r,t,e){const i=await(await H.ADAPTER.fetch(r)).arrayBuffer(),{compressed:s,uncompressed:n,kvData:a}=tb(r,i),o=s??n,h={mipmap:je.OFF,alphaMode:oe.NO_PREMULTIPLIED_ALPHA,resolution:Ei(r),...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,Js(u,e,r)});return l.length===1?l[0]:l},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};Y.add(nb);const ab=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],ob={extension:G.ResolveParser,test:r=>{const t=Ht.extname(r).slice(1);return["basis","ktx","dds"].includes(t)},parse:r=>{var i,s;const t=r.split("."),e=t.pop();if(["ktx","dds"].includes(e)){const n=t.pop();if(ab.includes(n))return{resolution:parseFloat(((i=H.RETINA_PREFIX.exec(r))==null?void 0:i[1])??"1"),format:n,src:r}}return{resolution:parseFloat(((s=H.RETINA_PREFIX.exec(r))==null?void 0:s[1])??"1"),format:e,src:r}}};Y.add(ob);const Sa=new it,hb=4,Hf=class wn{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,s){const n=new Image;return n.src=await this.base64(t,e,i,s),n}async base64(t,e,i,s){const n=this.canvas(t,s);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:s,height:n,flipY:a,premultipliedAlpha:o}=this._rawPixels(t,e);a&&wn._flipY(i,s,n),o&&wn._unpremultiplyAlpha(i);const h=new Vy(s,n,1),l=new ImageData(new Uint8ClampedArray(i.buffer),s,n);return h.context.putImageData(l,0,0),h.canvas}pixels(t,e){const{pixels:i,width:s,height:n,flipY:a,premultipliedAlpha:o}=this._rawPixels(t,e);return a&&wn._flipY(i,s,n),o&&wn._unpremultiplyAlpha(i),i}_rawPixels(t,e){const i=this.renderer;if(!i)throw new Error("The Extract has already been destroyed");let s,n=!1,a=!1,o,h=!1;t&&(t instanceof gr?o=t:(o=i.generateTexture(t,{region:e,resolution:i.resolution,multisample:i.multisample}),h=!0,e&&(Sa.width=e.width,Sa.height=e.height,e=Sa)));const l=i.gl;if(o){if(s=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 s=i.resolution,e||(e=Sa,e.width=i.width/s,e.height=i.height/s),n=!0,a=this._rendererPremultipliedAlpha,i.renderTexture.bind();const c=Math.max(Math.round(e.width*s),1),d=Math.max(Math.round(e.height*s),1),u=new Uint8Array(hb*c*d);return l.readPixels(Math.round(e.x*s),Math.round(e.y*s),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 s=e<<2,n=i>>1,a=new Uint8Array(s);for(let o=0;o<n;o++){const h=o*s,l=(i-o-1)*s;a.set(t.subarray(h,h+s)),t.copyWithin(h,l,l+s),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 s=t[i+3];if(s!==0){const n=255.001/s;t[i]=t[i]*n+.5,t[i+1]=t[i+1]*n+.5,t[i+2]=t[i+2]*n+.5}}}};Hf.extension={name:"extract",type:G.RendererSystem};let lb=Hf;Y.add(lb);const Ca={build(r){const t=r.points;let e,i,s,n,a,o;if(r.type===qt.CIRC){const p=r.shape;e=p.x,i=p.y,a=o=p.radius,s=n=0}else if(r.type===qt.ELIP){const p=r.shape;e=p.x,i=p.y,a=p.width,o=p.height,s=n=0}else{const p=r.shape,m=p.width/2,g=p.height/2;e=p.x+m,i=p.y+g,a=o=Math.max(0,Math.min(p.radius,Math.min(m,g))),s=m-a,n=g-o}if(!(a>=0&&o>=0&&s>=0&&n>=0)){t.length=0;return}const h=Math.ceil(2.3*Math.sqrt(a+o)),l=h*8+(s?4:0)+(n?4:0);if(t.length=l,l===0)return;if(h===0){t.length=8,t[0]=t[6]=e+s,t[1]=t[3]=i+n,t[2]=t[4]=e-s,t[5]=t[7]=i-n;return}let c=0,d=h*4+(s?2:0)+2,u=d,f=l;{const p=s+a,m=n,g=e+p,y=e-p,v=i+m;if(t[c++]=g,t[c++]=v,t[--d]=v,t[--d]=y,n){const _=i-m;t[u++]=y,t[u++]=_,t[--f]=_,t[--f]=g}}for(let p=1;p<h;p++){const m=Math.PI/2*(p/h),g=s+Math.cos(m)*a,y=n+Math.sin(m)*o,v=e+g,_=e-g,x=i+y,b=i-y;t[c++]=v,t[c++]=x,t[--d]=x,t[--d]=_,t[u++]=_,t[u++]=b,t[--f]=b,t[--f]=v}{const p=s,m=n+o,g=e+p,y=e-p,v=i+m,_=i-m;t[c++]=g,t[c++]=v,t[--f]=_,t[--f]=g,s&&(t[c++]=y,t[c++]=v,t[--f]=_,t[--f]=y)}},triangulate(r,t){const e=r.points,i=t.points,s=t.indices;if(e.length===0)return;let n=i.length/2;const a=n;let o,h;if(r.type!==qt.RREC){const c=r.shape;o=c.x,h=c.y}else{const c=r.shape;o=c.x+c.width/2,h=c.y+c.height/2}const l=r.matrix;i.push(r.matrix?l.a*o+l.c*h+l.tx:o,r.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]),s.push(n++,a,n);s.push(a+1,a,n)}};function Xf(r,t=!1){const e=r.length;if(e<6)return;let i=0;for(let s=0,n=r[e-2],a=r[e-1];s<e;s+=2){const o=r[s],h=r[s+1];i+=(o-n)*(h+a),n=o,a=h}if(!t&&i>0||t&&i<=0){const s=e/2;for(let n=s+s%2;n<e;n+=2){const a=e-n-2,o=e-n-1,h=n,l=n+1;[r[a],r[h]]=[r[h],r[a]],[r[o],r[l]]=[r[l],r[o]]}}}const Wf={build(r){r.points=r.shape.points.slice()},triangulate(r,t){let e=r.points;const i=r.holes,s=t.points,n=t.indices;if(e.length>=6){Xf(e,!1);const a=[];for(let l=0;l<i.length;l++){const c=i[l];Xf(c.points,!0),a.push(e.length/2),e=e.concat(c.points)}const o=xg(e,a,2);if(!o)return;const h=s.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++)s.push(e[l])}}},cb={build(r){const t=r.shape,e=t.x,i=t.y,s=t.width,n=t.height,a=r.points;a.length=0,s>=0&&n>=0&&a.push(e,i,e+s,i,e+s,i+n,e,i+n)},triangulate(r,t){const e=r.points,i=t.points;if(e.length===0)return;const s=i.length/2;i.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(s,s+1,s+2,s+1,s+2,s+3)}},ub={build(r){Ca.build(r)},triangulate(r,t){Ca.triangulate(r,t)}};var Ce=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(Ce||{}),$i=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))($i||{});const as={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 $f{static curveTo(t,e,i,s,n,a){const o=a[a.length-2],h=a[a.length-1]-e,l=o-t,c=s-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,g=n*Math.sqrt(f)/u,y=n*Math.sqrt(p)/u,v=g*m/f,_=y*m/p,x=g*d+y*l,b=g*c+y*h,E=l*(y+v),T=h*(y+v),w=d*(g+_),A=c*(g+_),P=Math.atan2(T-b,E-x),L=Math.atan2(A-b,w-x);return{cx:x+t,cy:b+e,radius:n,startAngle:P,endAngle:L,anticlockwise:l*c>d*h}}static arc(t,e,i,s,n,a,o,h,l){const c=o-a,d=as._segmentsCount(Math.abs(c)*n,Math.ceil(Math.abs(c)/Zn)*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 v=0;v<=g;++v){const _=v+y*v,x=u+a+f*_,b=Math.cos(x),E=-Math.sin(x);l.push((p*b+m*E)*n+i,(p*-E+m*b)*n+s)}}}class db{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 Yh{static curveLength(t,e,i,s,n,a,o,h){let l=0,c=0,d=0,u=0,f=0,p=0,m=0,g=0,y=0,v=0,_=0,x=t,b=e;for(let E=1;E<=10;++E)c=E/10,d=c*c,u=d*c,f=1-c,p=f*f,m=p*f,g=m*t+3*p*c*i+3*f*d*n+u*o,y=m*e+3*p*c*s+3*f*d*a+u*h,v=x-g,_=b-y,x=g,b=y,l+=Math.sqrt(v*v+_*_);return l}static curveTo(t,e,i,s,n,a,o){const h=o[o.length-2],l=o[o.length-1];o.length-=2;const c=as._segmentsCount(Yh.curveLength(h,l,t,e,i,s,n,a));let d=0,u=0,f=0,p=0,m=0;o.push(h,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,o.push(f*h+3*u*y*t+3*d*p*i+m*n,f*l+3*u*y*e+3*d*p*s+m*a)}}function zf(r,t,e,i,s,n,a,o){const h=r-e*s,l=t-i*s,c=r+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,g=c+u,y=d+f;return o.push(p,m,g,y),2}function Tr(r,t,e,i,s,n,a,o){const h=e-r,l=i-t;let c=Math.atan2(h,l),d=Math.atan2(s-r,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),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,y=f/g;if(u+=y,o){a.push(r,t,e,i);for(let v=1,_=u;v<g;v++,_+=y)a.push(r,t,r+Math.sin(_)*m,t+Math.cos(_)*m);a.push(r,t,s,n)}else{a.push(e,i,r,t);for(let v=1,_=u;v<g;v++,_+=y)a.push(r+Math.sin(_)*m,t+Math.cos(_)*m,r,t);a.push(s,n,r,t)}return g*2}function fb(r,t){const e=r.shape;let i=r.points||e.points.slice();const s=t.closePointEps;if(i.length===0)return;const n=r.lineStyle,a=new tt(i[0],i[1]),o=new tt(i[i.length-2],i[i.length-1]),h=e.type!==qt.POLY||e.closeStroke,l=Math.abs(a.x-o.x)<s&&Math.abs(a.y-o.y)<s;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,g=n.miterLimit*n.miterLimit;let y=i[0],v=i[1],_=i[2],x=i[3],b=0,E=0,T=-(v-x),w=y-_,A=0,P=0,L=Math.sqrt(T*T+w*w);T/=L,w/=L,T*=p,w*=p;const M=n.alignment,S=(1-M)*2,C=M*2;h||(n.cap===$i.ROUND?u+=Tr(y-T*(S-C)*.5,v-w*(S-C)*.5,y-T*S,v-w*S,y+T*C,v+w*C,c,!0)+2:n.cap===$i.SQUARE&&(u+=zf(y,v,T,w,S,C,!0,c))),c.push(y-T*S,v-w*S,y+T*C,v+w*C);for(let F=1;F<d-1;++F){y=i[(F-1)*2],v=i[(F-1)*2+1],_=i[F*2],x=i[F*2+1],b=i[(F+1)*2],E=i[(F+1)*2+1],T=-(v-x),w=y-_,L=Math.sqrt(T*T+w*w),T/=L,w/=L,T*=p,w*=p,A=-(x-E),P=_-b,L=Math.sqrt(A*A+P*P),A/=L,P/=L,A*=p,P*=p;const B=_-y,X=v-x,I=_-b,D=E-x,$=B*I+X*D,z=X*I-D*B,U=z<0;if(Math.abs(z)<.001*Math.abs($)){c.push(_-T*S,x-w*S,_+T*C,x+w*C),$>=0&&(n.join===Ce.ROUND?u+=Tr(_,x,_-T*S,x-w*S,_-A*S,x-P*S,c,!1)+4:u+=2,c.push(_-A*C,x-P*C,_+A*S,x+P*S));continue}const rt=(-T+y)*(-w+x)-(-T+_)*(-w+v),ut=(-A+b)*(-P+x)-(-A+_)*(-P+E),lt=(B*ut-I*rt)/z,yt=(D*rt-X*ut)/z,Rt=(lt-_)*(lt-_)+(yt-x)*(yt-x),Bt=_+(lt-_)*S,pt=x+(yt-x)*S,It=_-(lt-_)*C,vt=x-(yt-x)*C,pe=Math.min(B*B+X*X,I*I+D*D),Ee=U?S:C,nr=pe+Ee*Ee*m,ws=Rt<=nr;let ar=n.join;if(ar===Ce.MITER&&Rt/m>g&&(ar=Ce.BEVEL),ws)switch(ar){case Ce.MITER:{c.push(Bt,pt,It,vt);break}case Ce.BEVEL:{U?c.push(Bt,pt,_+T*C,x+w*C,Bt,pt,_+A*C,x+P*C):c.push(_-T*S,x-w*S,It,vt,_-A*S,x-P*S,It,vt),u+=2;break}case Ce.ROUND:{U?(c.push(Bt,pt,_+T*C,x+w*C),u+=Tr(_,x,_+T*C,x+w*C,_+A*C,x+P*C,c,!0)+4,c.push(Bt,pt,_+A*C,x+P*C)):(c.push(_-T*S,x-w*S,It,vt),u+=Tr(_,x,_-T*S,x-w*S,_-A*S,x-P*S,c,!1)+4,c.push(_-A*S,x-P*S,It,vt));break}}else{switch(c.push(_-T*S,x-w*S,_+T*C,x+w*C),ar){case Ce.MITER:{U?c.push(It,vt,It,vt):c.push(Bt,pt,Bt,pt),u+=2;break}case Ce.ROUND:{U?u+=Tr(_,x,_+T*C,x+w*C,_+A*C,x+P*C,c,!0)+2:u+=Tr(_,x,_-T*S,x-w*S,_-A*S,x-P*S,c,!1)+2;break}}c.push(_-A*S,x-P*S,_+A*C,x+P*C),u+=2}}y=i[(d-2)*2],v=i[(d-2)*2+1],_=i[(d-1)*2],x=i[(d-1)*2+1],T=-(v-x),w=y-_,L=Math.sqrt(T*T+w*w),T/=L,w/=L,T*=p,w*=p,c.push(_-T*S,x-w*S,_+T*C,x+w*C),h||(n.cap===$i.ROUND?u+=Tr(_-T*(S-C)*.5,x-w*(S-C)*.5,_-T*S,x-w*S,_+T*C,x+w*C,c,!1)+2:n.cap===$i.SQUARE&&(u+=zf(_,x,T,w,S,C,!1,c)));const R=t.indices,k=as.epsilon*as.epsilon;for(let F=f;F<u+f-2;++F)y=c[F*2],v=c[F*2+1],_=c[(F+1)*2],x=c[(F+1)*2+1],b=c[(F+2)*2],E=c[(F+2)*2+1],!(Math.abs(y*(x-E)+_*(E-v)+b*(v-x))<k)&&R.push(F,F+1,F+2)}function pb(r,t){let e=0;const i=r.shape,s=r.points||i.points,n=i.type!==qt.POLY||i.closeStroke;if(s.length===0)return;const a=t.points,o=t.indices,h=s.length/2,l=a.length/2;let c=l;for(a.push(s[0],s[1]),e=1;e<h;e++)a.push(s[e*2],s[e*2+1]),o.push(c,c+1),c++;n&&o.push(c,l)}function Yf(r,t){r.lineStyle.native?pb(r,t):fb(r,t)}class jh{static curveLength(t,e,i,s,n,a){const o=t-2*i+n,h=e-2*s+a,l=2*i-2*t,c=2*s-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),g=2*d*m,y=2*Math.sqrt(f),v=u/m;return(g*p+m*u*(p-y)+(4*f*d-u*u)*Math.log((2*m+v+p)/(v+y)))/(4*g)}static curveTo(t,e,i,s,n){const a=n[n.length-2],o=n[n.length-1],h=as._segmentsCount(jh.curveLength(a,o,t,e,i,s));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+(s-e)*u-c)*u)}}}const qh={[qt.POLY]:Wf,[qt.CIRC]:Ca,[qt.ELIP]:Ca,[qt.RECT]:cb,[qt.RREC]:ub},jf=[],Pa=[];class Ra{constructor(t,e=null,i=null,s=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=s,this.type=t.type}clone(){return new Ra(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 os=new tt,qf=class qm extends Cd{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 ga,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(),Pa.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),jf.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,s=null){const n=new Ra(t,e,i,s);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const i=new Ra(t,null,null,e),s=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=s.lineStyle,s.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 s=e[i];if(s.fillStyle.visible&&s.shape&&(s.matrix?s.matrix.applyInverse(t,os):os.copyFrom(t),s.shape.contains(os.x,os.y))){let n=!1;if(s.holes){for(let a=0;a<s.holes.length;a++)if(s.holes[a].shape.contains(os.x,os.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,s=null;this.batches.length>0&&(i=this.batches[this.batches.length-1],s=i.style);for(let h=this.shapeIndex;h<e.length;h++){this.shapeIndex++;const l=e[h],c=l.fillStyle,d=l.lineStyle;qh[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=Li.REPEAT,u===0?this.processFill(l):this.processLine(l);const y=this.points.length/2-g;y!==0&&(i&&!this._compareStyles(s,f)&&(i.end(m,g),i=null),i||(i=jf.pop()||new db,i.begin(f,m,g),this.batches.push(i),s=f),this.addUvs(this.points,t,f.texture,g,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],s=i.fillStyle,n=i.lineStyle;if(s&&!s.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 s=t[e];for(let n=0;n<s.size;n++){const a=s.start+n;this.indicesUint16[a]=this.indicesUint16[a]-s.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<qm.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++J._globalBatch;for(let d=0;d<this.drawCalls.length;d++)this.drawCalls[d].texArray.clear(),Pa.push(this.drawCalls[d]);this.drawCalls.length=0;const e=this.colors,i=this.textureIds;let s=Pa.pop();s||(s=new xh,s.texArray=new wh),s.texArray.count=0,s.start=0,s.size=0,s.type=Le.TRIANGLES;let n=0,a=null,o=0,h=!1,l=Le.TRIANGLES,c=0;this.drawCalls.push(s);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?Le.LINES:Le.TRIANGLES,a=null,n=f,t++),a!==m&&(a=m,m._batchEnabled!==t&&(n===f&&(t++,n=0,s.size>0&&(s=Pa.pop(),s||(s=new xh,s.texArray=new wh),this.drawCalls.push(s)),s.start=c,s.size=0,s.texArray.count=0,s.type=l),m.touched=1,m._batchEnabled=t,m._batchLocation=n,m.wrapMode=Li.REPEAT,s.texArray.elements[s.texArray.count++]=m,n++)),s.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,s=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++]=s[l];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?Wf.triangulate(t,this):qh[t.type].triangulate(t,this)}processLine(t){Yf(t,this);for(let e=0;e<t.holes.length;e++)Yf(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const i=t[e];qh[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 s=t[i*2],n=t[i*2+1];t[i*2]=e.a*s+e.c*n+e.tx,t[i*2+1]=e.b*s+e.d*n+e.ty}}addColors(t,e,i,s,n=0){const a=dt.shared.setValue(e).toLittleEndianNumber(),o=dt.shared.setValue(a).toPremultiplied(i);t.length=Math.max(t.length,n+s);for(let h=0;h<s;h++)t[n+h]=o}addTextureIds(t,e,i,s=0){t.length=Math.max(t.length,s+i);for(let n=0;n<i;n++)t[s+n]=e}addUvs(t,e,i,s,n,a=null){let o=0;const h=e.length,l=i.frame;for(;o<n;){let d=t[(s+o)*2],u=t[(s+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,s){const n=e.baseTexture,a=1e-6,o=i+s*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}};qf.BATCHABLE_SIZE=100;let mb=qf;class Ia{constructor(){this.color=16777215,this.alpha=1,this.texture=W.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new Ia;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=W.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class Kh extends Ia{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=$i.BUTT,this.join=Ce.MITER,this.miterLimit=10}clone(){const t=new Kh;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=$i.BUTT,this.join=Ce.MITER,this.miterLimit=10}}const Zh={},Qh=class lo extends $t{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 Ia,this._lineStyle=new Kh,this._matrix=null,this._holeMode=!1,this.state=ii.for2d(),this._geometry=t||new mb,this._geometry.refCount++,this._transformID=-1,this._tintColor=new dt(16777215),this.blendMode=K.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new lo(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,s=.5,n=!1){return typeof t=="number"&&(t={width:t,color:e,alpha:i,alignment:s,native:n}),this.lineTextureStyle(t)}lineTextureStyle(t){const e={width:0,texture:W.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:$i.BUTT,join:Ce.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 Hi,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Hi,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,s=i[i.length-2],n=i[i.length-1];return(s!==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,s){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),jh.curveTo(t,e,i,s,n),this}bezierCurveTo(t,e,i,s,n,a){return this._initCurve(),Yh.curveTo(t,e,i,s,n,a,this.currentPath.points),this}arcTo(t,e,i,s,n){this._initCurve(t,e);const a=this.currentPath.points,o=$f.curveTo(t,e,i,s,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,s,n,a=!1){if(s===n)return this;if(!a&&n<=s?n+=Zn:a&&s<=n&&(s+=Zn),n-s===0)return this;const o=t+Math.cos(s)*i,h=e+Math.sin(s)*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 $f.arc(o,h,t,e,i,s,n,a,c),this}beginFill(t=0,e){return this.beginTextureFill({texture:W.WHITE,color:t,alpha:e})}normalizeColor(t){const e=dt.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:W.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,s){return this.drawShape(new it(t,e,i,s))}drawRoundedRect(t,e,i,s,n){return this.drawShape(new ea(t,e,i,s,n))}drawCircle(t,e,i){return this.drawShape(new Jn(t,e,i))}drawEllipse(t,e,i,s){return this.drawShape(new ta(t,e,i,s))}drawPolygon(...t){let e,i=!0;const s=t[0];s.points?(i=s.closeStroke,e=s.points):Array.isArray(t[0])?e=t[0]:e=t;const n=new Hi(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===qt.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 s=0;s<i;s++){const n=t.batches[s],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:dt.shared.setValue(a).toRgbArray(),_tintRGB:a,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[s]=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 s=this.batches[e];s.worldAlpha=this.worldAlpha*s.alpha,t.plugins[this.pluginName].render(s)}}}_renderDirect(t){const e=this._resolveDirectShader(t),i=this._geometry,s=this.worldAlpha,n=e.uniforms,a=i.drawCalls;n.translationMatrix=this.transform.worldTransform,dt.shared.setValue(this._tintColor).premultiply(s).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:s,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(s,n,a)}_resolveDirectShader(t){let e=this.shader;const i=this.pluginName;if(!e){if(!Zh[i]){const{maxTextures:s}=t.plugins[i],n=new Int32Array(s);for(let h=0;h<s;h++)n[h]=h;const a={tint:new Float32Array([1,1,1,1]),translationMatrix:new mt,default:Ue.from({uSamplers:n},!0)},o=t.plugins[i]._shader.program;Zh[i]=new ri(o,a)}e=Zh[i]}return e}_calculateBounds(){this.finishPoly();const t=this._geometry;if(!t.graphicsData.length)return;const{minX:e,minY:i,maxX:s,maxY:n}=t.bounds;this._bounds.addFrame(this.transform,e,i,s,n)}containsPoint(t){return this.worldTransform.applyInverse(t,lo._TEMP_POINT),this._geometry.containsPoint(lo._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=dt.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,s=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+s*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)}};Qh.curves=as,Qh._TEMP_POINT=new tt;let tn=Qh;class gb{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 Jh=new tt,Kf=new Hi,Zf=class Km extends $t{constructor(t,e,i,s=Le.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=i||ii.for2d(),this.drawMode=s,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===Le.TRIANGLES&&e.length<Km.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 s=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[s]),t.plugins[s].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 s=this.transform.worldTransform,n=s.a,a=s.b,o=s.c,h=s.d,l=s.tx,c=s.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 gb(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,Jh);const e=this.geometry.getBuffer("aVertexPosition").data,i=Kf.points,s=this.geometry.getIndex().data,n=s.length,a=this.drawMode===4?3:1;for(let o=0;o+2<n;o+=a){const h=s[o]*2,l=s[o+1]*2,c=s[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],Kf.contains(Jh.x,Jh.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}};Zf.BATCHABLE_SIZE=100;let tl=Zf;class Qf extends Vi{constructor(t,e,i){super();const s=new Ot(t),n=new Ot(e,!0),a=new Ot(i,!0,!0);this.addAttribute("aVertexPosition",s,2,!1,Z.FLOAT).addAttribute("aTextureCoord",n,2,!1,Z.FLOAT).addIndex(a),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var _b=`varying vec2 vTextureCoord;
|
|
912
|
+
uniform vec4 uColor;
|
|
913
|
+
|
|
914
|
+
uniform sampler2D uSampler;
|
|
915
|
+
|
|
916
|
+
void main(void)
|
|
917
|
+
{
|
|
918
|
+
gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;
|
|
919
|
+
}
|
|
920
|
+
`,yb=`attribute vec2 aVertexPosition;
|
|
921
|
+
attribute vec2 aTextureCoord;
|
|
922
|
+
|
|
923
|
+
uniform mat3 projectionMatrix;
|
|
924
|
+
uniform mat3 translationMatrix;
|
|
925
|
+
uniform mat3 uTextureMatrix;
|
|
926
|
+
|
|
927
|
+
varying vec2 vTextureCoord;
|
|
928
|
+
|
|
929
|
+
void main(void)
|
|
930
|
+
{
|
|
931
|
+
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
932
|
+
|
|
933
|
+
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
|
|
934
|
+
}
|
|
935
|
+
`;class el extends ri{constructor(t,e){const i={uSampler:t,alpha:1,uTextureMatrix:mt.IDENTITY,uColor:new Float32Array([1,1,1,1])};e=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},e),e.uniforms&&Object.assign(i,e.uniforms),super(e.program||Ai.from(yb,_b),i),this._colorDirty=!1,this.uvMatrix=new jd(t),this.batchable=e.program===void 0,this.pluginName=e.pluginName,this._tintColor=new dt(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;dt.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class xb extends tl{constructor(t=W.EMPTY,e,i,s,n){const a=new Qf(e,i,s);a.getBuffer("aVertexPosition").static=!1;const o=new el(t);super(a,o,null,n),this.autoUpdate=!0}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(t){this.geometry.getBuffer("aVertexPosition").data=t}_render(t){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),super._render(t)}}class vb extends $t{constructor(t=1500,e,i=16384,s=!1){super();const n=16384;i>n&&(i=n),this._properties=[!1,!0,!1,!1,!1],this._maxSize=t,this._batchSize=i,this._buffers=null,this._bufferUpdateIDs=[],this._updateID=0,this.interactiveChildren=!1,this.blendMode=K.NORMAL,this.autoResize=s,this.roundPixels=!0,this.baseTexture=null,this.setProperties(e),this._tintColor=new dt(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 Jf{constructor(t,e,i){this.geometry=new Vi,this.indexBuffer=null,this.size=i,this.dynamicProperties=[],this.staticProperties=[];for(let s=0;s<t.length;++s){let n=t[s];n={attributeName:n.attributeName,size:n.size,uploadFunction:n.uploadFunction,type:n.type||Z.FLOAT,offset:n.offset},e[s]?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 Ot(Uy(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(let a=0;a<this.dynamicProperties.length;++a){const o=this.dynamicProperties[a];o.offset=e,e+=o.size,this.dynamicStride+=o.size}const i=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(i),this.dynamicDataUint32=new Uint32Array(i),this.dynamicBuffer=new Ot(this.dynamicData,!1,!1);let s=0;this.staticStride=0;for(let a=0;a<this.staticProperties.length;++a){const o=this.staticProperties[a];o.offset=s,s+=o.size,this.staticStride+=o.size}const n=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(n),this.staticDataUint32=new Uint32Array(n),this.staticBuffer=new Ot(this.staticData,!0,!1);for(let a=0;a<this.dynamicProperties.length;++a){const o=this.dynamicProperties[a];t.addAttribute(o.attributeName,this.dynamicBuffer,0,o.type===Z.UNSIGNED_BYTE,o.type,this.dynamicStride*4,o.offset*4)}for(let a=0;a<this.staticProperties.length;++a){const o=this.staticProperties[a];t.addAttribute(o.attributeName,this.staticBuffer,0,o.type===Z.UNSIGNED_BYTE,o.type,this.staticStride*4,o.offset*4)}}uploadDynamic(t,e,i){for(let s=0;s<this.dynamicProperties.length;s++){const n=this.dynamicProperties[s];n.uploadFunction(t,e,i,n.type===Z.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,n.offset)}this.dynamicBuffer._updateID++}uploadStatic(t,e,i){for(let s=0;s<this.staticProperties.length;s++){const n=this.staticProperties[s];n.uploadFunction(t,e,i,n.type===Z.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 bb=`varying vec2 vTextureCoord;
|
|
936
|
+
varying vec4 vColor;
|
|
937
|
+
|
|
938
|
+
uniform sampler2D uSampler;
|
|
939
|
+
|
|
940
|
+
void main(void){
|
|
941
|
+
vec4 color = texture2D(uSampler, vTextureCoord) * vColor;
|
|
942
|
+
gl_FragColor = color;
|
|
943
|
+
}`,Tb=`attribute vec2 aVertexPosition;
|
|
944
|
+
attribute vec2 aTextureCoord;
|
|
945
|
+
attribute vec4 aColor;
|
|
946
|
+
|
|
947
|
+
attribute vec2 aPositionCoord;
|
|
948
|
+
attribute float aRotation;
|
|
949
|
+
|
|
950
|
+
uniform mat3 translationMatrix;
|
|
951
|
+
uniform vec4 uColor;
|
|
952
|
+
|
|
953
|
+
varying vec2 vTextureCoord;
|
|
954
|
+
varying vec4 vColor;
|
|
955
|
+
|
|
956
|
+
void main(void){
|
|
957
|
+
float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);
|
|
958
|
+
float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);
|
|
959
|
+
|
|
960
|
+
vec2 v = vec2(x, y);
|
|
961
|
+
v = v + aPositionCoord;
|
|
962
|
+
|
|
963
|
+
gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
|
|
964
|
+
|
|
965
|
+
vTextureCoord = aTextureCoord;
|
|
966
|
+
vColor = aColor * uColor;
|
|
967
|
+
}
|
|
968
|
+
`;class tp extends oa{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new mt,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:Z.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=ri.from(Tb,bb,{}),this.state=ii.for2d()}render(t){const e=t.children,i=t._maxSize,s=t._batchSize,n=this.renderer;let a=e.length;if(a===0)return;a>i&&!t.autoResize&&(a=i);let o=t._buffers;o||(o=t._buffers=this.generateBuffers(t));const h=e[0]._texture.baseTexture,l=h.alphaMode>0;this.state.blendMode=gd(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=dt.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,l).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=h,this.renderer.shader.bind(this.shader);let u=!1;for(let f=0,p=0;f<a;f+=s,p+=1){let m=a-f;m>s&&(m=s),p>=o.length&&o.push(this._generateOneMoreBuffer(t));const g=o[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=[],i=t._maxSize,s=t._batchSize,n=t._properties;for(let a=0;a<i;a+=s)e.push(new Jf(this.properties,n,s));return e}_generateOneMoreBuffer(t){const e=t._batchSize,i=t._properties;return new Jf(this.properties,i,e)}uploadVertices(t,e,i,s,n,a){let o=0,h=0,l=0,c=0;for(let d=0;d<i;++d){const u=t[e+d],f=u._texture,p=u.scale.x,m=u.scale.y,g=f.trim,y=f.orig;g?(h=g.x-u.anchor.x*y.width,o=h+g.width,c=g.y-u.anchor.y*y.height,l=c+g.height):(o=y.width*(1-u.anchor.x),h=y.width*-u.anchor.x,l=y.height*(1-u.anchor.y),c=y.height*-u.anchor.y),s[a]=h*p,s[a+1]=c*m,s[a+n]=o*p,s[a+n+1]=c*m,s[a+n*2]=o*p,s[a+n*2+1]=l*m,s[a+n*3]=h*p,s[a+n*3+1]=l*m,a+=n*4}}uploadPosition(t,e,i,s,n,a){for(let o=0;o<i;o++){const h=t[e+o].position;s[a]=h.x,s[a+1]=h.y,s[a+n]=h.x,s[a+n+1]=h.y,s[a+n*2]=h.x,s[a+n*2+1]=h.y,s[a+n*3]=h.x,s[a+n*3+1]=h.y,a+=n*4}}uploadRotation(t,e,i,s,n,a){for(let o=0;o<i;o++){const h=t[e+o].rotation;s[a]=h,s[a+n]=h,s[a+n*2]=h,s[a+n*3]=h,a+=n*4}}uploadUvs(t,e,i,s,n,a){for(let o=0;o<i;++o){const h=t[e+o]._texture._uvs;h?(s[a]=h.x0,s[a+1]=h.y0,s[a+n]=h.x1,s[a+n+1]=h.y1,s[a+n*2]=h.x2,s[a+n*2+1]=h.y2,s[a+n*3]=h.x3,s[a+n*3+1]=h.y3,a+=n*4):(s[a]=0,s[a+1]=0,s[a+n]=0,s[a+n+1]=0,s[a+n*2]=0,s[a+n*2+1]=0,s[a+n*3]=0,s[a+n*3+1]=0,a+=n*4)}}uploadTint(t,e,i,s,n,a){for(let o=0;o<i;++o){const h=t[e+o],l=dt.shared.setValue(h._tintRGB).toPremultiplied(h.alpha,h.texture.baseTexture.alphaMode>0);s[a]=l,s[a+n]=l,s[a+n*2]=l,s[a+n*3]=l,a+=n*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}tp.extension={name:"particle",type:G.RendererPlugin},Y.add(tp);var Ma=(r=>(r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",r))(Ma||{});const Da={willReadFrequently:!0},ni=class q{static get experimentalLetterSpacingSupported(){let t=q._experimentalLetterSpacingSupported;if(t!==void 0){const e=H.ADAPTER.getCanvasRenderingContext2D().prototype;t=q._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,s,n,a,o,h,l){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=n,this.lineWidths=a,this.lineHeight=o,this.maxLineWidth=h,this.fontProperties=l}static measureText(t,e,i,s=q._canvas){i=i??e.wordWrap;const n=e.toFontString(),a=q.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);const o=s.getContext("2d",Da);o.font=n;const h=(i?q.wordWrap(t,e,s):t).split(/(?:\r\n|\r|\n)/),l=new Array(h.length);let c=0;for(let p=0;p<h.length;p++){const m=q._measureText(h[p],e.letterSpacing,o);l[p]=m,c=Math.max(c,m)}let d=c+e.strokeThickness;e.dropShadow&&(d+=e.dropShadowDistance);const u=e.lineHeight||a.fontSize+e.strokeThickness;let f=Math.max(u,a.fontSize+e.strokeThickness*2)+e.leading+(h.length-1)*(u+e.leading);return e.dropShadow&&(f+=e.dropShadowDistance),new q(t,e,d,f,h,l,u+e.leading,c,a)}static _measureText(t,e,i){let s=!1;q.experimentalLetterSpacingSupported&&(q.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let n=i.measureText(t).width;return n>0&&(s?n-=e:n+=(q.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,i=q._canvas){const s=i.getContext("2d",Da);let n=0,a="",o="";const h=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,d=q.collapseSpaces(c),u=q.collapseNewlines(c);let f=!d;const p=e.wordWrapWidth+l,m=q.tokenize(t);for(let g=0;g<m.length;g++){let y=m[g];if(q.isNewline(y)){if(!u){o+=q.addLine(a),f=!d,a="",n=0;continue}y=" "}if(d){const _=q.isBreakingSpace(y),x=q.isBreakingSpace(a[a.length-1]);if(_&&x)continue}const v=q.getFromCache(y,l,h,s);if(v>p)if(a!==""&&(o+=q.addLine(a),a="",n=0),q.canBreakWords(y,e.breakWords)){const _=q.wordWrapSplit(y);for(let x=0;x<_.length;x++){let b=_[x],E=b,T=1;for(;_[x+T];){const A=_[x+T];if(!q.canBreakChars(E,A,y,x,e.breakWords))b+=A;else break;E=A,T++}x+=T-1;const w=q.getFromCache(b,l,h,s);w+n>p&&(o+=q.addLine(a),f=!1,a="",n=0),a+=b,n+=w}}else{a.length>0&&(o+=q.addLine(a),a="",n=0);const _=g===m.length-1;o+=q.addLine(y,!_),f=!1,a="",n=0}else v+n>p&&(f=!1,o+=q.addLine(a),a="",n=0),(a.length>0||!q.isBreakingSpace(y)||f)&&(a+=y,n+=v)}return o+=q.addLine(a,!1),o}static addLine(t,e=!0){return t=q.trimRight(t),t=e?`${t}
|
|
969
|
+
`:t,t}static getFromCache(t,e,i,s){let n=i[t];return typeof n!="number"&&(n=q._measureText(t,e,s)+e,i[t]=n),n}static collapseSpaces(t){return t==="normal"||t==="pre-line"}static collapseNewlines(t){return t==="normal"}static trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const i=t[e];if(!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 s=0;s<t.length;s++){const n=t[s],a=t[s+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,s,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,s=q._context;s.font=t;const n=q.METRICS_STRING+q.BASELINE_SYMBOL,a=Math.ceil(s.measureText(n).width);let o=Math.ceil(s.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,s.fillStyle="#f00",s.fillRect(0,0,a,h),s.font=t,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(n,0,o);const l=s.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",Da))!=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",Da)),q.__context}};ni.METRICS_STRING="|ÉqÅ",ni.BASELINE_SYMBOL="M",ni.BASELINE_MULTIPLIER=1.4,ni.HEIGHT_MULTIPLIER=2,ni.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]})(),ni.experimentalLetterSpacing=!1,ni._fonts={},ni._newlines=[10,13],ni._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let zi=ni;const Eb=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],ep=class An{constructor(t){this.styleID=0,this.reset(),rl(this,t,t)}clone(){const t={};return rl(t,this,An.defaultStyle),new An(t)}reset(){rl(this,An.defaultStyle,An.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=il(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=il(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){wb(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=il(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 s=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!Eb.includes(s)&&(s=`"${s}"`),e[i]=s}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};ep.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Ma.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 Pi=ep;function il(r){const t=dt.shared,e=i=>{const s=t.setValue(i);return s.alpha===1?s.toHex():s.toRgbaString()};return Array.isArray(r)?r.map(e):e(r)}function wb(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 rl(r,t,e){for(const i in e)Array.isArray(t[i])?r[i]=t[i].slice():r[i]=t[i]}const Ab={texture:!0,children:!1,baseTexture:!0},ip=class Nc extends Ci{constructor(t,e,i){let s=!1;i||(i=H.ADAPTER.createCanvas(),s=!0),i.width=3,i.height=3;const n=W.from(i);n.orig=new it,n.trim=new it,super(n),this._ownCanvas=s,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=Nc.defaultResolution??H.RESOLUTION,this._autoResolution=Nc.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){st("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,s=zi.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=s.width,a=s.height,o=s.lines,h=s.lineHeight,l=s.lineWidths,c=s.maxLineWidth,d=s.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 g=e.dropShadow&&m===0,y=g?Math.ceil(Math.max(1,a)+e.padding*2):0,v=y*this._resolution;if(g){i.fillStyle="black",i.strokeStyle="black";const x=e.dropShadowColor,b=e.dropShadowBlur*this._resolution,E=e.dropShadowDistance*this._resolution;i.shadowColor=dt.shared.setValue(x).setAlpha(e.dropShadowAlpha).toRgbaString(),i.shadowBlur=b,i.shadowOffsetX=Math.cos(e.dropShadowAngle)*E,i.shadowOffsetY=Math.sin(e.dropShadowAngle)*E+v}else i.fillStyle=this._generateFillStyle(e,o,s),i.strokeStyle=e.stroke,i.shadowColor="black",i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0;let _=(h-d.fontSize)/2;h-d.fontSize<0&&(_=0);for(let x=0;x<o.length;x++)u=e.strokeThickness/2,f=e.strokeThickness/2+x*h+d.ascent+_,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,s=!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){s?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];s?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=Xy(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,s=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=-s,e.trim.y=-s,e.orig.width=e._frame.width-s*2,e.orig.height=e._frame.height-s*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 s=t.fill;if(Array.isArray(s)){if(s.length===1)return s[0]}else return s;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=s.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(s[0]),d.unshift(0),c.push(s[s.length-1]),d.push(1),t.fillGradientType===Ma.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 g=m;f>0&&p>m&&(g=(m+p)/2);const y=m+u,v=i.lineHeight*(f+1);let _=y;f+1<e.length&&v<y&&(_=(y+v)/2);const x=(_-g)/l;for(let b=0;b<c.length;b++){let E=0;typeof d[b]=="number"?E=d[b]:E=b/c.length;let T=Math.min(1,Math.max(0,g/l+E*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({},Ab,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=Ui(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=Ui(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 Pi?this._style=t:this._style=new Pi(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)}};ip.defaultAutoResolution=!0;let sl=ip;class Sb{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function Cb(r,t){var i;let e=!1;if((i=r==null?void 0:r._textures)!=null&&i.length){for(let s=0;s<r._textures.length;s++)if(r._textures[s]instanceof W){const n=r._textures[s].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function Pb(r,t){if(r.baseTexture instanceof J){const e=r.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function Rb(r,t){if(r._texture&&r._texture instanceof W){const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function Ib(r,t){return t instanceof sl?(t.updateText(!0),!0):!1}function Mb(r,t){if(t instanceof Pi){const e=t.toFontString();return zi.measureFont(e),!0}return!1}function Db(r,t){if(r instanceof sl){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 Bb(r,t){return r instanceof Pi?(t.includes(r)||t.push(r),!0):!1}const rp=class Zm{constructor(t){this.limiter=new Sb(Zm.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(Db),this.registerFindHook(Bb),this.registerFindHook(Cb),this.registerFindHook(Pb),this.registerFindHook(Rb),this.registerUploadHook(Ib),this.registerUploadHook(Mb)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,Wt.system.addOnce(this.tick,this,xr.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,s=this.uploadHooks.length;i<s;i++)if(this.uploadHooks[i](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}}e||this.queue.shift()}if(this.queue.length)Wt.system.addOnce(this.tick,this,xr.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 $t)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&Wt.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null}};rp.uploadsPerFrame=4;let nl=rp;Object.defineProperties(H,{UPLOADS_PER_FRAME:{get(){return nl.uploadsPerFrame},set(r){st("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),nl.uploadsPerFrame=r}}});function sp(r,t){return t instanceof J?(t._glTextures[r.CONTEXT_UID]||r.texture.bind(t),!0):!1}function Ob(r,t){if(!(t instanceof tn))return!1;const{geometry:e}=t;t.finishPoly(),e.updateBatches();const{batches:i}=e;for(let s=0;s<i.length;s++){const{texture:n}=i[s].style;n&&sp(r,n.baseTexture)}return e.batchable||r.geometry.bind(e,t._resolveDirectShader(r)),!0}function Fb(r,t){return r instanceof tn?(t.push(r),!0):!1}class np extends nl{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(Fb),this.registerUploadHook(sp),this.registerUploadHook(Ob)}}np.extension={name:"prepare",type:G.RendererSystem},Y.add(np);var Lb=`#version 300 es
|
|
970
|
+
#define SHADER_NAME Tiling-Sprite-100
|
|
971
|
+
|
|
972
|
+
precision lowp float;
|
|
973
|
+
|
|
974
|
+
in vec2 vTextureCoord;
|
|
975
|
+
|
|
976
|
+
out vec4 fragmentColor;
|
|
977
|
+
|
|
978
|
+
uniform sampler2D uSampler;
|
|
979
|
+
uniform vec4 uColor;
|
|
980
|
+
uniform mat3 uMapCoord;
|
|
981
|
+
uniform vec4 uClampFrame;
|
|
982
|
+
uniform vec2 uClampOffset;
|
|
983
|
+
|
|
984
|
+
void main(void)
|
|
985
|
+
{
|
|
986
|
+
vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
|
|
987
|
+
coord = (uMapCoord * vec3(coord, 1.0)).xy;
|
|
988
|
+
vec2 unclamped = coord;
|
|
989
|
+
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
|
|
990
|
+
|
|
991
|
+
vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0
|
|
992
|
+
|
|
993
|
+
fragmentColor = texSample * uColor;
|
|
994
|
+
}
|
|
995
|
+
`,Nb=`#version 300 es
|
|
996
|
+
#define SHADER_NAME Tiling-Sprite-300
|
|
997
|
+
|
|
998
|
+
precision lowp float;
|
|
999
|
+
|
|
1000
|
+
in vec2 aVertexPosition;
|
|
1001
|
+
in vec2 aTextureCoord;
|
|
1002
|
+
|
|
1003
|
+
uniform mat3 projectionMatrix;
|
|
1004
|
+
uniform mat3 translationMatrix;
|
|
1005
|
+
uniform mat3 uTransform;
|
|
1006
|
+
|
|
1007
|
+
out vec2 vTextureCoord;
|
|
1008
|
+
|
|
1009
|
+
void main(void)
|
|
1010
|
+
{
|
|
1011
|
+
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
1012
|
+
|
|
1013
|
+
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
|
|
1014
|
+
}
|
|
1015
|
+
`,kb=`#version 100
|
|
1016
|
+
#ifdef GL_EXT_shader_texture_lod
|
|
1017
|
+
#extension GL_EXT_shader_texture_lod : enable
|
|
1018
|
+
#endif
|
|
1019
|
+
#define SHADER_NAME Tiling-Sprite-100
|
|
1020
|
+
|
|
1021
|
+
precision lowp float;
|
|
1022
|
+
|
|
1023
|
+
varying vec2 vTextureCoord;
|
|
1024
|
+
|
|
1025
|
+
uniform sampler2D uSampler;
|
|
1026
|
+
uniform vec4 uColor;
|
|
1027
|
+
uniform mat3 uMapCoord;
|
|
1028
|
+
uniform vec4 uClampFrame;
|
|
1029
|
+
uniform vec2 uClampOffset;
|
|
1030
|
+
|
|
1031
|
+
void main(void)
|
|
1032
|
+
{
|
|
1033
|
+
vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
|
|
1034
|
+
coord = (uMapCoord * vec3(coord, 1.0)).xy;
|
|
1035
|
+
vec2 unclamped = coord;
|
|
1036
|
+
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
|
|
1037
|
+
|
|
1038
|
+
#ifdef GL_EXT_shader_texture_lod
|
|
1039
|
+
vec4 texSample = unclamped == coord
|
|
1040
|
+
? texture2D(uSampler, coord)
|
|
1041
|
+
: texture2DLodEXT(uSampler, coord, 0);
|
|
1042
|
+
#else
|
|
1043
|
+
vec4 texSample = texture2D(uSampler, coord);
|
|
1044
|
+
#endif
|
|
1045
|
+
|
|
1046
|
+
gl_FragColor = texSample * uColor;
|
|
1047
|
+
}
|
|
1048
|
+
`,ap=`#version 100
|
|
1049
|
+
#define SHADER_NAME Tiling-Sprite-100
|
|
1050
|
+
|
|
1051
|
+
precision lowp float;
|
|
1052
|
+
|
|
1053
|
+
attribute vec2 aVertexPosition;
|
|
1054
|
+
attribute vec2 aTextureCoord;
|
|
1055
|
+
|
|
1056
|
+
uniform mat3 projectionMatrix;
|
|
1057
|
+
uniform mat3 translationMatrix;
|
|
1058
|
+
uniform mat3 uTransform;
|
|
1059
|
+
|
|
1060
|
+
varying vec2 vTextureCoord;
|
|
1061
|
+
|
|
1062
|
+
void main(void)
|
|
1063
|
+
{
|
|
1064
|
+
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
1065
|
+
|
|
1066
|
+
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
|
|
1067
|
+
}
|
|
1068
|
+
`,Ub=`#version 100
|
|
1069
|
+
#define SHADER_NAME Tiling-Sprite-Simple-100
|
|
1070
|
+
|
|
1071
|
+
precision lowp float;
|
|
1072
|
+
|
|
1073
|
+
varying vec2 vTextureCoord;
|
|
1074
|
+
|
|
1075
|
+
uniform sampler2D uSampler;
|
|
1076
|
+
uniform vec4 uColor;
|
|
1077
|
+
|
|
1078
|
+
void main(void)
|
|
1079
|
+
{
|
|
1080
|
+
vec4 texSample = texture2D(uSampler, vTextureCoord);
|
|
1081
|
+
gl_FragColor = texSample * uColor;
|
|
1082
|
+
}
|
|
1083
|
+
`;const Ba=new mt;class op extends oa{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new Xd,this.state=ii.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=ri.from(ap,Ub,e),this.shader=t.context.webGLVersion>1?ri.from(Nb,Lb,e):ri.from(ap,kb,e)}render(t){const e=this.renderer,i=this.quad;let s=i.vertices;s[0]=s[6]=t._width*-t.anchor.x,s[1]=s[3]=t._height*-t.anchor.y,s[2]=s[4]=t._width*(1-t.anchor.x),s[5]=s[7]=t._height*(1-t.anchor.y);const n=t.uvRespectAnchor?t.anchor.x:0,a=t.uvRespectAnchor?t.anchor.y:0;s=i.uvs,s[0]=s[6]=-n,s[1]=s[3]=-a,s[2]=s[4]=1-n,s[5]=s[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!==Li.CLAMP:h.wrapMode===Li.CLAMP&&(h.wrapMode=Li.REPEAT));const f=u?this.simpleShader:this.shader,p=o.width,m=o.height,g=t._width,y=t._height;Ba.set(c.a*p/g,c.b*p/y,c.c*m/g,c.d*m/y,c.tx/g,c.ty/y),Ba.invert(),u?Ba.prepend(d.mapCoord):(f.uniforms.uMapCoord=d.mapCoord.toArray(!0),f.uniforms.uClampFrame=d.uClampFrame,f.uniforms.uClampOffset=d.uClampOffset),f.uniforms.uTransform=Ba.toArray(!0),f.uniforms.uColor=dt.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=gd(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}op.extension={name:"tilingSprite",type:G.RendererPlugin},Y.add(op);const hp=class Sn{constructor(t,e,i){this.linkedSheets=[],(t instanceof J||t instanceof W)&&(t={texture:t,data:e,resolutionFilename:i});const{texture:s,data:n,resolutionFilename:a=null,cachePrefix:o=""}=t;this.cachePrefix=o,this._texture=s instanceof W?s:null,this.baseTexture=s instanceof J?s: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=Ei(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<=Sn.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=Sn.BATCH_SIZE;for(;e-t<i&&e<this._frameKeys.length;){const s=this._frameKeys[e],n=this._frames[s],a=n.frame;if(a){let o=null,h=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?o=new it(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 it(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 it(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[s]=new W(this.baseTexture,o,c,h,n.rotated?2:0,n.anchor,n.borders),W.addToCache(this.textures[s],this.cachePrefix+s.toString())}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let i=0;i<t[e].length;i++){const s=t[e][i];this.animations[e].push(this.textures[s])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Sn.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Sn.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=[]}};hp.BATCH_SIZE=1e3;let lp=hp;const Gb=["jpg","png","jpeg","avif","webp","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"];function cp(r,t,e){const i={};if(r.forEach(s=>{i[s]=t}),Object.keys(t.textures).forEach(s=>{i[`${t.cachePrefix}${s}`]=t.textures[s]}),!e){const s=Ht.dirname(r[0]);t.linkedSheets.forEach((n,a)=>{Object.assign(i,cp([`${s}/${t.data.meta.related_multi_packs[a]}`],n,!0))})}return i}const Vb={extension:G.Asset,cache:{test:r=>r instanceof lp,getCacheableAssets:(r,t)=>cp(r,t,!1)},resolver:{test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),i=t.pop();return e==="json"&&Gb.includes(i)},parse:r=>{var e;const t=r.split(".");return{resolution:parseFloat(((e=H.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:G.LoadParser,priority:He.Normal},async testParse(r,t){return Ht.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var c,d;const{texture:i,imageFilename:s,cachePrefix:n}=(t==null?void 0:t.data)??{};let a=Ht.dirname(t.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let o;if(i&&i.baseTexture)o=i;else{const u=Vh(a+(s??r.meta.image),t.src);o=(await e.load([u]))[u]}const h=new lp({texture:o.baseTexture,data:r,resolutionFilename:t.src,cachePrefix:n});await h.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=a+p;(d=t.data)!=null&&d.ignoreMultiPack||(m=Vh(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(r){r.destroy(!0)}}};Y.add(Vb);class Oa{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Fa{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 s=new Oa;return i.info.forEach(n=>s.info.push({face:n.face,size:parseInt(n.size,10)})),i.common.forEach(n=>s.common.push({lineHeight:parseInt(n.lineHeight,10)})),i.page.forEach(n=>s.page.push({id:parseInt(n.id,10),file:n.file})),i.char.forEach(n=>s.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=>s.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),i.distanceField.forEach(n=>s.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),s}}class al{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 Oa,i=t.getElementsByTagName("info"),s=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<s.length;l++)e.common.push({lineHeight:parseInt(s[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 ol{static test(t){return typeof t=="string"&&t.includes("<font>")?al.test(H.ADAPTER.parseXML(t)):!1}static parse(t){return al.parse(H.ADAPTER.parseXML(t))}}const hl=[Fa,al,ol];function Hb(r){for(let t=0;t<hl.length;t++)if(hl[t].test(r))return hl[t];return null}function Xb(r,t,e,i,s,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=r.width/i-h-l*2,d=r.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===Ma.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 g=0;g<s.length;g++){const y=n.lineHeight*g;for(let v=0;v<u.length;v++){let _=0;typeof f[v]=="number"?_=f[v]:_=v/u.length;const x=y/d+_*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 g=0;g<u.length;g++){let y;typeof f[g]=="number"?y=f[g]:y=m/p,o.addColorStop(y,u[g]),m++}}return o}function Wb(r,t,e,i,s,n,a){const o=e.text,h=e.fontProperties;t.translate(i,s),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=Xb(r,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=dt.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 La(r){return r.codePointAt?r.codePointAt(0):r.charCodeAt(0)}function up(r){return Array.from?Array.from(r):r.split("")}function $b(r){typeof r=="string"&&(r=[r]);const t=[];for(let e=0,i=r.length;e<i;e++){const s=r[e];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);const n=s[0].charCodeAt(0),a=s[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(...up(s))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const Yi=class gi{constructor(t,e,i){var c;const[s]=t.info,[n]=t.common,[a]=t.page,[o]=t.distanceField,h=Ei(a.file),l={};this._ownsTextures=i,this.font=s.face,this.size=s.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=oe.NO_PREMULTIPLIED_ALPHA,l[u].baseTexture.mipmap=je.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:v,yoffset:_,xadvance:x}=t.char[d];p/=h,m/=h,g/=h,y/=h,v/=h,_/=h,x/=h;const b=new it(p+l[f].frame.x/h,m+l[f].frame.y/h,g,y);this.chars[u]={xOffset:v,yOffset:_,xAdvance:x,kerning:{},texture:new W(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 s;if(t instanceof Oa)s=t;else{const a=Hb(t);if(!a)throw new Error("Unrecognized data format for font.");s=a.parse(t)}e instanceof W&&(e=[e]);const n=new gi(s,e,i);return gi.available[n.font]=n,n}static uninstall(t){const e=gi.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete gi.available[t]}static from(t,e,i){if(!t)throw new Error("[BitmapFont] Property `name` is required.");const{chars:s,padding:n,resolution:a,textureWidth:o,textureHeight:h,...l}=Object.assign({},gi.defaultOptions,i),c=$b(s),d=e instanceof Pi?e:new Pi(e),u=o,f=new Oa;f.info[0]={face:d.fontFamily,size:d.fontSize},f.common[0]={lineHeight:d.fontSize};let p=0,m=0,g,y,v,_=0;const x=[];for(let E=0;E<c.length;E++){g||(g=H.ADAPTER.createCanvas(),g.width=o,g.height=h,y=g.getContext("2d"),v=new J(g,{resolution:a,...l}),x.push(new W(v)),f.page.push({id:x.length-1,file:""}));const T=c[E],w=zi.measureText(T,d,!1,g),A=w.width,P=Math.ceil(w.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}')`);--E,g=null,y=null,v=null,m=0,p=0,_=0;continue}if(_=Math.max(P+w.fontProperties.descent,_),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}')`);--E,m+=_*a,m=Math.ceil(m),p=0,_=0;continue}Wb(g,y,w,p,m,a,d);const M=La(w.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 E=0,T=c.length;E<T;E++){const w=c[E];for(let A=0;A<T;A++){const P=c[A],L=y.measureText(w).width,M=y.measureText(P).width,S=y.measureText(w+P).width-(L+M);S&&f.kerning.push({first:La(w),second:La(P),amount:S})}}const b=new gi(f,x,!0);return gi.available[t]!==void 0&&gi.uninstall(t),gi.available[t]=b,b}};Yi.ALPHA=[["a","z"],["A","Z"]," "],Yi.NUMERIC=[["0","9"]],Yi.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Yi.ASCII=[[" ","~"]],Yi.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Yi.ALPHANUMERIC},Yi.available={};let ji=Yi;var zb=`// Pixi texture info\r
|
|
1084
|
+
varying vec2 vTextureCoord;\r
|
|
1085
|
+
uniform sampler2D uSampler;\r
|
|
1086
|
+
\r
|
|
1087
|
+
// Tint\r
|
|
1088
|
+
uniform vec4 uColor;\r
|
|
1089
|
+
\r
|
|
1090
|
+
// on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r
|
|
1091
|
+
uniform float uFWidth;\r
|
|
1092
|
+
\r
|
|
1093
|
+
void main(void) {\r
|
|
1094
|
+
\r
|
|
1095
|
+
// To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r
|
|
1096
|
+
vec4 texColor = texture2D(uSampler, vTextureCoord);\r
|
|
1097
|
+
\r
|
|
1098
|
+
// MSDF\r
|
|
1099
|
+
float median = texColor.r + texColor.g + texColor.b -\r
|
|
1100
|
+
min(texColor.r, min(texColor.g, texColor.b)) -\r
|
|
1101
|
+
max(texColor.r, max(texColor.g, texColor.b));\r
|
|
1102
|
+
// SDF\r
|
|
1103
|
+
median = min(median, texColor.a);\r
|
|
1104
|
+
\r
|
|
1105
|
+
float screenPxDistance = uFWidth * (median - 0.5);\r
|
|
1106
|
+
float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r
|
|
1107
|
+
if (median < 0.01) {\r
|
|
1108
|
+
alpha = 0.0;\r
|
|
1109
|
+
} else if (median > 0.99) {\r
|
|
1110
|
+
alpha = 1.0;\r
|
|
1111
|
+
}\r
|
|
1112
|
+
\r
|
|
1113
|
+
// Gamma correction for coverage-like alpha\r
|
|
1114
|
+
float luma = dot(uColor.rgb, vec3(0.299, 0.587, 0.114));\r
|
|
1115
|
+
float gamma = mix(1.0, 1.0 / 2.2, luma);\r
|
|
1116
|
+
float coverage = pow(uColor.a * alpha, gamma); \r
|
|
1117
|
+
\r
|
|
1118
|
+
// NPM Textures, NPM outputs\r
|
|
1119
|
+
gl_FragColor = vec4(uColor.rgb, coverage);\r
|
|
1120
|
+
}\r
|
|
1121
|
+
`,Yb=`// Mesh material default fragment\r
|
|
1122
|
+
attribute vec2 aVertexPosition;\r
|
|
1123
|
+
attribute vec2 aTextureCoord;\r
|
|
1124
|
+
\r
|
|
1125
|
+
uniform mat3 projectionMatrix;\r
|
|
1126
|
+
uniform mat3 translationMatrix;\r
|
|
1127
|
+
uniform mat3 uTextureMatrix;\r
|
|
1128
|
+
\r
|
|
1129
|
+
varying vec2 vTextureCoord;\r
|
|
1130
|
+
\r
|
|
1131
|
+
void main(void)\r
|
|
1132
|
+
{\r
|
|
1133
|
+
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r
|
|
1134
|
+
\r
|
|
1135
|
+
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r
|
|
1136
|
+
}\r
|
|
1137
|
+
`;const dp=[],fp=[],pp=[],mp=class Qm extends $t{constructor(t,e={}){super();const{align:i,tint:s,maxWidth:n,letterSpacing:a,fontName:o,fontSize:h}=Object.assign({},Qm.styleDefaults,e);if(!ji.available[o])throw new Error(`Missing BitmapFont "${o}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=i,this._tintColor=new dt(s),this._font=void 0,this._fontName=o,this._fontSize=h,this.text=t,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=a,this._anchor=new wi(()=>{this.dirty=!0},this,0,0),this._roundPixels=H.ROUND_PIXELS,this.dirty=!0,this._resolution=H.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var L;const t=ji.available[this._fontName],e=this.fontSize,i=e/t.size,s=new tt,n=[],a=[],o=[],h=this._text.replace(/(?:\r\n|\r)/g,`
|
|
1138
|
+
`)||" ",l=up(h),c=this._maxWidth*t.size/e,d=t.distanceFieldType==="none"?dp:fp;let u=null,f=0,p=0,m=0,g=-1,y=0,v=0,_=0,x=0;for(let M=0;M<l.length;M++){const S=l[M],C=La(S);if(/(?:\s)/.test(S)&&(g=M,y=f,x++),S==="\r"||S===`
|
|
1139
|
+
`){a.push(f),o.push(-1),p=Math.max(p,f),++m,++v,s.x=0,s.y+=t.lineHeight,u=null,x=0;continue}const R=t.chars[C];if(!R)continue;u&&R.kerning[u]&&(s.x+=R.kerning[u]);const k=pp.pop()||{texture:W.EMPTY,line:0,charCode:0,prevSpaces:0,position:new tt};k.texture=R.texture,k.line=m,k.charCode=C,k.position.x=Math.round(s.x+R.xOffset+this._letterSpacing/2),k.position.y=Math.round(s.y+R.yOffset),k.prevSpaces=x,n.push(k),f=k.position.x+Math.max(R.xAdvance-R.xOffset,R.texture.orig.width),s.x+=R.xAdvance+this._letterSpacing,_=Math.max(_,R.yOffset+R.texture.height),u=C,g!==-1&&c>0&&s.x>c&&(++v,Zr(n,1+g-v,1+M-g),M=g,g=-1,a.push(y),o.push(n.length>0?n[n.length-1].prevSpaces:0),p=Math.max(p,y),m++,s.x=0,s.y+=t.lineHeight,u=null,x=0)}const b=l[l.length-1];b!=="\r"&&b!==`
|
|
1140
|
+
`&&(/(?:\s)/.test(b)&&(f=y),a.push(f),p=Math.max(p,f),o.push(-1));const E=[];for(let M=0;M<=m;M++){let S=0;this._align==="right"?S=p-a[M]:this._align==="center"?S=(p-a[M])/2:this._align==="justify"&&(S=o[M]<0?0:(p-a[M])/o[M]),E.push(S)}const T=n.length,w={},A=[],P=this._activePagesMeshData;d.push(...P);for(let M=0;M<T;M++){const S=n[M].texture,C=S.baseTexture.uid;if(!w[C]){let R=d.pop();if(!R){const F=new Qf;let B,X;t.distanceFieldType==="none"?(B=new el(W.EMPTY),X=K.NORMAL):(B=new el(W.EMPTY,{program:Ai.from(Yb,zb),uniforms:{uFWidth:0}}),X=K.NORMAL_NPM);const I=new tl(F,B);I.blendMode=X,R={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:I,vertices:null,uvs:null,indices:null}}R.index=0,R.indexCount=0,R.vertexCount=0,R.uvsCount=0,R.total=0;const{_textureCache:k}=this;k[C]=k[C]||new W(S.baseTexture),R.mesh.texture=k[C],R.mesh.tint=this._tintColor.value,A.push(R),w[C]=R}w[C].total++}for(let M=0;M<P.length;M++)A.includes(P[M])||this.removeChild(P[M].mesh);for(let M=0;M<A.length;M++)A[M].mesh.parent!==this&&this.addChild(A[M].mesh);this._activePagesMeshData=A;for(const M in w){const S=w[M],C=S.total;if(!(((L=S.indices)==null?void 0:L.length)>6*C)||S.vertices.length<tl.BATCHABLE_SIZE*2)S.vertices=new Float32Array(4*2*C),S.uvs=new Float32Array(4*2*C),S.indices=new Uint16Array(6*C);else{const R=S.total,k=S.vertices;for(let F=R*4*2;F<k.length;F++)k[F]=0}S.mesh.size=6*C}for(let M=0;M<T;M++){const S=n[M];let C=S.position.x+E[S.line]*(this._align==="justify"?S.prevSpaces:1);this._roundPixels&&(C=Math.round(C));const R=C*i,k=S.position.y*i,F=S.texture,B=w[F.baseTexture.uid],X=F.frame,I=F._uvs,D=B.index++;B.indices[D*6+0]=0+D*4,B.indices[D*6+1]=1+D*4,B.indices[D*6+2]=2+D*4,B.indices[D*6+3]=0+D*4,B.indices[D*6+4]=2+D*4,B.indices[D*6+5]=3+D*4,B.vertices[D*8+0]=R,B.vertices[D*8+1]=k,B.vertices[D*8+2]=R+X.width*i,B.vertices[D*8+3]=k,B.vertices[D*8+4]=R+X.width*i,B.vertices[D*8+5]=k+X.height*i,B.vertices[D*8+6]=R,B.vertices[D*8+7]=k+X.height*i,B.uvs[D*8+0]=I.x0,B.uvs[D*8+1]=I.y0,B.uvs[D*8+2]=I.x1,B.uvs[D*8+3]=I.y1,B.uvs[D*8+4]=I.x2,B.uvs[D*8+5]=I.y2,B.uvs[D*8+6]=I.x3,B.uvs[D*8+7]=I.y3}this._textWidth=p*i,this._textHeight=(s.y+t.lineHeight)*i;for(const M in w){const S=w[M];if(this.anchor.x!==0||this.anchor.y!==0){let F=0;const B=this._textWidth*this.anchor.x,X=this._textHeight*this.anchor.y;for(let I=0;I<S.total;I++)S.vertices[F++]-=B,S.vertices[F++]-=X,S.vertices[F++]-=B,S.vertices[F++]-=X,S.vertices[F++]-=B,S.vertices[F++]-=X,S.vertices[F++]-=B,S.vertices[F++]-=X}this._maxLineHeight=_*i;const C=S.mesh.geometry.getBuffer("aVertexPosition"),R=S.mesh.geometry.getBuffer("aTextureCoord"),k=S.mesh.geometry.getIndex();C.data=S.vertices,R.data=S.uvs,k.data=S.indices,C.update(),R.update(),k.update()}for(let M=0;M<n.length;M++)pp.push(n[M]);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:i,size:s}=ji.available[this._fontName];if(i!=="none"){const{a:n,b:a,c:o,d:h}=this.worldTransform,l=Math.sqrt(n*n+a*a),c=Math.sqrt(o*o+h*h),d=(Math.abs(l)+Math.abs(c))/2,u=this.fontSize/s,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=ji.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(!ji.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??ji.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,i=ji.available[this._fontName].distanceFieldType==="none"?dp:fp;i.push(...this._activePagesMeshData);for(const s of this._activePagesMeshData)this.removeChild(s.mesh);this._activePagesMeshData=[],i.filter(s=>e[s.mesh.texture.baseTexture.uid]).forEach(s=>{s.mesh.texture=W.EMPTY});for(const s in e)e[s].destroy(),delete e[s];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};mp.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let jb=mp;const qb=[".xml",".fnt"],Kb={extension:{type:G.LoadParser,priority:He.Normal},name:"loadBitmapFont",test(r){return qb.includes(Ht.extname(r).toLowerCase())},async testParse(r){return Fa.test(r)||ol.test(r)},async parse(r,t,e){const i=Fa.test(r)?Fa.parse(r):ol.parse(r),{src:s}=t,{page:n}=i,a=[];for(let l=0;l<n.length;++l){const c=n[l].file;let d=Ht.join(Ht.dirname(s),c);d=Vh(d,s),a.push(d)}const o=await e.load(a),h=a.map(l=>o[l]);return ji.install(i,h,!0)},async load(r,t){return(await H.ADAPTER.fetch(r)).text()},unload(r){r.destroy()}};Y.add(Kb);const ll=class Rs extends Pi{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new Rs(Object.keys(Rs.defaultOptions).reduce((e,i)=>({...e,[i]:t[i]}),{}))}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 Rs.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:i}=Rs;if(i[t]){const s=i[t];return this._fonts.push(s),s.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return H.ADAPTER.fetch(t).then(s=>s.blob()).then(async s=>new Promise((n,a)=>{const o=URL.createObjectURL(s),h=new FileReader;h.onload=()=>n([o,h.result]),h.onerror=a,h.readAsDataURL(s)})).then(async([s,n])=>{const a=Object.assign({family:Ht.basename(t,Ht.extname(t)),weight:"normal",style:"normal",display:"auto",src:s,dataSrc:n,refs:1,originalUrl:t,fontFace:null},e);i[t]=a,this._fonts.push(a),this.styleID++;const o=new FontFace(a.family,`url(${a.src})`,{weight:a.weight,style:a.style,display:a.display});a.fontFace=o,await o.load(),document.fonts.add(o),await document.fonts.ready,this.styleID++,this.fontsDirty=!0})}addOverride(...t){const e=t.filter(i=>!this._overrides.includes(i));e.length>0&&(this._overrides.push(...e),this.styleID++)}removeOverride(...t){const e=t.filter(i=>this._overrides.includes(i));e.length>0&&(this._overrides=this._overrides.filter(i=>!e.includes(i)),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
|
+
@font-face {
|
|
1142
|
+
font-family: "${e.family}";
|
|
1143
|
+
src: url('${e.dataSrc}');
|
|
1144
|
+
font-weight: ${e.weight};
|
|
1145
|
+
font-style: ${e.style};
|
|
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=Yn(t)),typeof t=="number"?Ny(t):t}dropShadowToCSS(){let t=this.normalizeColor(this.dropShadowColor);const e=this.dropShadowAlpha,i=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),s=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);t.startsWith("#")&&e<1&&(t+=(e*255|0).toString(16).padStart(2,"0"));const n=`${i}px ${s}px`;return this.dropShadowBlur>0?`text-shadow: ${n} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${n} ${t}`}reset(){Object.assign(this,Rs.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}=H.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}};ll.availableFonts={},ll.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 cl=ll;const Na=class Is extends Ci{constructor(t="",e={}){super(W.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const i=new Image,s=W.from(i,{scaleMode:H.SCALE_MODE,resourceOptions:{autoLoad:!1}});s.orig=new it,s.trim=new it,this.texture=s;const n="http://www.w3.org/2000/svg",a="http://www.w3.org/1999/xhtml",o=document.createElementNS(n,"svg"),h=document.createElementNS(n,"foreignObject"),l=document.createElementNS(a,"div"),c=document.createElementNS(a,"style");h.setAttribute("width","10000"),h.setAttribute("height","10000"),h.style.overflow="hidden",o.appendChild(h),this.maxWidth=Is.defaultMaxWidth,this.maxHeight=Is.defaultMaxHeight,this._domElement=l,this._styleElement=c,this._svgRoot=o,this._foreignObject=h,this._foreignObject.appendChild(c),this._foreignObject.appendChild(l),this._image=i,this._loadImage=new Image,this._autoResolution=Is.defaultAutoResolution,this._resolution=Is.defaultResolution??H.RESOLUTION,this.text=t,this.style=e}measureText(t){var c,d;const{text:e,style:i,resolution:s}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:e,style:i.toCSS(s)}),this._styleElement.textContent=i.toGlobalCSS(),document.body.appendChild(this._svgRoot);const n=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:a,height:o}=n;(a>this.maxWidth||o>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");const h=Math.min(this.maxWidth,Math.ceil(a)),l=Math.min(this.maxHeight,Math.ceil(o));return this._svgRoot.setAttribute("width",h.toString()),this._svgRoot.setAttribute("height",l.toString()),e!==this._text&&(this._domElement.innerHTML=this._text),i!==this._style&&(Object.assign(this._domElement,{style:(c=this._style)==null?void 0:c.toCSS(s)}),this._styleElement.textContent=(d=this._style)==null?void 0:d.toGlobalCSS()),{width:h+i.padding*2,height:l+i.padding*2}}async updateText(t=!0){const{style:e,_image:i,_loadImage:s}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;const{width:n,height:a}=this.measureText();i.width=s.width=Math.ceil(Math.max(1,n)),i.height=s.height=Math.ceil(Math.max(1,a)),this._updateID++;const o=this._updateID;await new Promise(h=>{s.onload=async()=>{if(o<this._updateID){h();return}await e.onBeforeDraw(),i.src=s.src,s.onload=null,s.src="",this.updateTexture(),h()};const l=new XMLSerializer().serializeToString(this._svgRoot);s.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(l)}`})}get source(){return this._image}updateTexture(){const{style:t,texture:e,_image:i,resolution:s}=this,{padding:n}=t,{baseTexture:a}=e;e.trim.width=e._frame.width=i.width/s,e.trim.height=e._frame.height=i.height/s,e.trim.x=-n,e.trim.y=-n,e.orig.width=e._frame.width-n*2,e.orig.height=e._frame.height-n*2,this._onTextureUpdate(),a.setRealSize(i.width,i.height,s),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 i,s,n,a,o;typeof t=="boolean"&&(t={children:t}),t=Object.assign({},Is.defaultDestroyOptions,t),super.destroy(t);const e=null;this.ownsStyle&&((i=this._style)==null||i.cleanFonts()),this._style=e,(s=this._svgRoot)==null||s.remove(),this._svgRoot=e,(n=this._domElement)==null||n.remove(),this._domElement=e,(a=this._foreignObject)==null||a.remove(),this._foreignObject=e,(o=this._styleElement)==null||o.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=Ui(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=Ui(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 cl?(this.ownsStyle=!1,this._style=t):t instanceof Pi?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=cl.from(t)):(this.ownsStyle=!0,this._style=new cl(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," ")}};Na.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Na.defaultMaxWidth=2024,Na.defaultMaxHeight=2024,Na.defaultAutoResolution=!0;class Zb{constructor(t,e){this._fontName=t,this._defaultFontSize=e}createText(t,e){return new jb(t.toString(),{fontName:this._fontName,fontSize:this._defaultFontSize||e})}}function Ri(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function gp(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,r.__proto__=t}/*!
|
|
1148
|
+
* GSAP 3.12.5
|
|
1149
|
+
* https://gsap.com
|
|
1150
|
+
*
|
|
1151
|
+
* @license Copyright 2008-2024, GreenSock. All rights reserved.
|
|
1152
|
+
* Subject to the terms at https://gsap.com/standard-license or for
|
|
1153
|
+
* Club GSAP members, the agreement issued with that membership.
|
|
1154
|
+
* @author: Jack Doyle, jack@greensock.com
|
|
1155
|
+
*/var me={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},hs={duration:.5,overwrite:!1,delay:0},ul,Qt,xt,Pe=1e8,gt=1/Pe,dl=Math.PI*2,Qb=dl/4,Jb=0,_p=Math.sqrt,tT=Math.cos,eT=Math.sin,zt=function(t){return typeof t=="string"},Dt=function(t){return typeof t=="function"},Ii=function(t){return typeof t=="number"},fl=function(t){return typeof t>"u"},ai=function(t){return typeof t=="object"},he=function(t){return t!==!1},pl=function(){return typeof window<"u"},ka=function(t){return Dt(t)||zt(t)},yp=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},Jt=Array.isArray,ml=/(?:-?\.?\d|\.)+/gi,xp=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,ls=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,gl=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,vp=/[+-]=-?[.\d]+/,bp=/[^,'"\[\]\s]+/gi,iT=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,wt,oi,_l,yl,ge={},Ua={},Tp,Ep=function(t){return(Ua=wr(t,ge))&&ue},xl=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},en=function(t,e){return!e&&console.warn(t)},wp=function(t,e){return t&&(ge[t]=e)&&Ua&&(Ua[t]=e)||ge},rn=function(){return 0},rT={suppressEvents:!0,isStart:!0,kill:!1},Ga={suppressEvents:!0,kill:!1},sT={suppressEvents:!0},vl={},qi=[],bl={},Ap,_e={},Tl={},Sp=30,Va=[],El="",wl=function(t){var e=t[0],i,s;if(ai(e)||Dt(e)||(t=[t]),!(i=(e._gsap||{}).harness)){for(s=Va.length;s--&&!Va[s].targetTest(e););i=Va[s]}for(s=t.length;s--;)t[s]&&(t[s]._gsap||(t[s]._gsap=new em(t[s],i)))||t.splice(s,1);return t},Er=function(t){return t._gsap||wl(Me(t))[0]._gsap},Cp=function(t,e,i){return(i=t[e])&&Dt(i)?t[e]():fl(i)&&t.getAttribute&&t.getAttribute(e)||i},le=function(t,e){return(t=t.split(",")).forEach(e)||t},Ft=function(t){return Math.round(t*1e5)/1e5||0},Yt=function(t){return Math.round(t*1e7)/1e7||0},cs=function(t,e){var i=e.charAt(0),s=parseFloat(e.substr(2));return t=parseFloat(t),i==="+"?t+s:i==="-"?t-s:i==="*"?t*s:t/s},nT=function(t,e){for(var i=e.length,s=0;t.indexOf(e[s])<0&&++s<i;);return s<i},Ha=function(){var t=qi.length,e=qi.slice(0),i,s;for(bl={},qi.length=0,i=0;i<t;i++)s=e[i],s&&s._lazy&&(s.render(s._lazy[0],s._lazy[1],!0)._lazy=0)},Pp=function(t,e,i,s){qi.length&&!Qt&&Ha(),t.render(e,i,s||Qt&&e<0&&(t._initted||t._startAt)),qi.length&&!Qt&&Ha()},Rp=function(t){var e=parseFloat(t);return(e||e===0)&&(t+"").match(bp).length<2?e:zt(t)?t.trim():t},Ip=function(t){return t},Re=function(t,e){for(var i in e)i in t||(t[i]=e[i]);return t},aT=function(t){return function(e,i){for(var s in i)s in e||s==="duration"&&t||s==="ease"||(e[s]=i[s])}},wr=function(t,e){for(var i in e)t[i]=e[i];return t},Mp=function r(t,e){for(var i in e)i!=="__proto__"&&i!=="constructor"&&i!=="prototype"&&(t[i]=ai(e[i])?r(t[i]||(t[i]={}),e[i]):e[i]);return t},Xa=function(t,e){var i={},s;for(s in t)s in e||(i[s]=t[s]);return i},sn=function(t){var e=t.parent||wt,i=t.keyframes?aT(Jt(t.keyframes)):Re;if(he(t.inherit))for(;e;)i(t,e.vars.defaults),e=e.parent||e._dp;return t},oT=function(t,e){for(var i=t.length,s=i===e.length;s&&i--&&t[i]===e[i];);return i<0},Dp=function(t,e,i,s,n){i===void 0&&(i="_first"),s===void 0&&(s="_last");var a=t[s],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[s]=e,e._prev=a,e.parent=e._dp=t,e},Wa=function(t,e,i,s){i===void 0&&(i="_first"),s===void 0&&(s="_last");var n=e._prev,a=e._next;n?n._next=a:t[i]===e&&(t[i]=a),a?a._prev=n:t[s]===e&&(t[s]=n),e._next=e._prev=e.parent=null},Ki=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},Ar=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},hT=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},Al=function(t,e,i,s){return t._startAt&&(Qt?t._startAt.revert(Ga):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,s))},lT=function r(t){return!t||t._ts&&r(t.parent)},Bp=function(t){return t._repeat?us(t._tTime,t=t.duration()+t._rDelay)*t:0},us=function(t,e){var i=Math.floor(t/=e);return t&&i===t?i-1:i},$a=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},za=function(t){return t._end=Yt(t._start+(t._tDur/Math.abs(t._ts||t._rts||gt)||0))},Ya=function(t,e){var i=t._dp;return i&&i.smoothChildTiming&&t._ts&&(t._start=Yt(i._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),za(t),i._dirty||Ar(i,t)),t},Op=function(t,e){var i;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(i=$a(t.rawTime(),e),(!e._dur||an(0,e.totalDuration(),i)-e._tTime>gt)&&e.render(i,!0)),Ar(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=-gt}},hi=function(t,e,i,s){return e.parent&&Ki(e),e._start=Yt((Ii(i)?i:i||t!==wt?Ie(t,i,e):t._time)+e._delay),e._end=Yt(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),Dp(t,e,"_first","_last",t._sort?"_start":0),Sl(e)||(t._recent=e),s||Op(t,e),t._ts<0&&Ya(t,t._tTime),t},Fp=function(t,e){return(ge.ScrollTrigger||xl("scrollTrigger",e))&&ge.ScrollTrigger.create(e,t)},Lp=function(t,e,i,s,n){if(Fl(t,e,n),!t._initted)return 1;if(!i&&t._pt&&!Qt&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&Ap!==xe.frame)return qi.push(t),t._lazy=[n,s],1},cT=function r(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||r(e))},Sl=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},uT=function(t,e,i,s){var n=t.ratio,a=e<0||!e&&(!t._start&&cT(t)&&!(!t._initted&&Sl(t))||(t._ts<0||t._dp._ts<0)&&!Sl(t))?0:1,o=t._rDelay,h=0,l,c,d;if(o&&t._repeat&&(h=an(0,t._tDur,e),c=us(h,o),t._yoyo&&c&1&&(a=1-a),c!==us(t._tTime,o)&&(n=1-a,t.vars.repeatRefresh&&t._initted&&t.invalidate())),a!==n||Qt||s||t._zTime===gt||!e&&t._zTime){if(!t._initted&&Lp(t,e,s,i,h))return;for(d=t._zTime,t._zTime=e||(i?gt: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&&Al(t,e,i,!0),t._onUpdate&&!i&&ye(t,"onUpdate"),h&&t._repeat&&!i&&t.parent&&ye(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===a&&(a&&Ki(t,1),!i&&!Qt&&(ye(t,a?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},dT=function(t,e,i){var s;if(i>e)for(s=t._first;s&&s._start<=i;){if(s.data==="isPause"&&s._start>e)return s;s=s._next}else for(s=t._last;s&&s._start>=i;){if(s.data==="isPause"&&s._start<e)return s;s=s._prev}},ds=function(t,e,i,s){var n=t._repeat,a=Yt(e)||0,o=t._tTime/t._tDur;return o&&!s&&(t._time*=a/t._dur),t._dur=a,t._tDur=n?n<0?1e10:Yt(a*(n+1)+t._rDelay*n):a,o>0&&!s&&Ya(t,t._tTime=t._tDur*o),t.parent&&za(t),i||Ar(t.parent,t),t},Np=function(t){return t instanceof se?Ar(t):ds(t,t._dur)},fT={_start:0,endTime:rn,totalDuration:rn},Ie=function r(t,e,i){var s=t.labels,n=t._recent||fT,a=t.duration()>=Pe?n.endTime(!1):t._dur,o,h,l;return zt(e)&&(isNaN(e)||e in s)?(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 s||(s[e]=a),s[e]):(h=parseFloat(e.charAt(o-1)+e.substr(o+1)),l&&i&&(h=h/100*(Jt(i)?i[0]:i).totalDuration()),o>1?r(t,e.substr(0,o-1),i)+h:a+h)):e==null?a:+e},nn=function(t,e,i){var s=Ii(e[1]),n=(s?2:1)+(t<2?0:1),a=e[n],o,h;if(s&&(a.duration=e[1]),a.parent=i,t){for(o=a,h=i;h&&!("immediateRender"in o);)o=h.vars.defaults||{},h=he(h.vars.inherit)&&h.parent;a.immediateRender=he(o.immediateRender),t<2?a.runBackwards=1:a.startAt=e[n-1]}return new kt(e[0],a,e[n+1])},Zi=function(t,e){return t||t===0?e(t):e},an=function(t,e,i){return i<t?t:i>e?e:i},te=function(t,e){return!zt(t)||!(e=iT.exec(t))?"":e[1]},pT=function(t,e,i){return Zi(i,function(s){return an(t,e,s)})},Cl=[].slice,kp=function(t,e){return t&&ai(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&ai(t[0]))&&!t.nodeType&&t!==oi},mT=function(t,e,i){return i===void 0&&(i=[]),t.forEach(function(s){var n;return zt(s)&&!e||kp(s,1)?(n=i).push.apply(n,Me(s)):i.push(s)})||i},Me=function(t,e,i){return xt&&!e&&xt.selector?xt.selector(t):zt(t)&&!i&&(_l||!ps())?Cl.call((e||yl).querySelectorAll(t),0):Jt(t)?mT(t,i):kp(t)?Cl.call(t,0):t?[t]:[]},Pl=function(t){return t=Me(t)[0]||en("Invalid scope")||{},function(e){var i=t.current||t.nativeElement||t;return Me(e,i.querySelectorAll?i:i===t?en("Invalid scope")||yl.createElement("div"):t)}},Up=function(t){return t.sort(function(){return .5-Math.random()})},Gp=function(t){if(Dt(t))return t;var e=ai(t)?t:{each:t},i=Sr(e.ease),s=e.from||0,n=parseFloat(e.base)||0,a={},o=s>0&&s<1,h=isNaN(s)||o,l=e.axis,c=s,d=s;return zt(s)?c=d={center:.5,edges:.5,end:1}[s]||0:!o&&h&&(c=s[0],d=s[1]),function(u,f,p){var m=(p||e).length,g=a[m],y,v,_,x,b,E,T,w,A;if(!g){if(A=e.grid==="auto"?0:(e.grid||[1,Pe])[1],!A){for(T=-Pe;T<(T=p[A++].getBoundingClientRect().left)&&A<m;);A<m&&A--}for(g=a[m]=[],y=h?Math.min(A,m)*c-.5:s%A,v=A===Pe?0:h?m*d/A-.5:s/A|0,T=0,w=Pe,E=0;E<m;E++)_=E%A-y,x=v-(E/A|0),g[E]=b=l?Math.abs(l==="y"?x:_):_p(_*_+x*x),b>T&&(T=b),b<w&&(w=b);s==="random"&&Up(g),g.max=T-w,g.min=w,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)*(s==="edges"?-1:1),g.b=m<0?n-m:n,g.u=te(e.amount||e.each)||0,i=i&&m<0?Qp(i):i}return m=(g[u]-g.min)/g.max||0,Yt(g.b+(i?i(m):m)*g.v)+g.u}},Rl=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(i){var s=Yt(Math.round(parseFloat(i)/t)*t*e);return(s-s%1)/e+(Ii(i)?0:te(i))}},Vp=function(t,e){var i=Jt(t),s,n;return!i&&ai(t)&&(s=i=t.radius||Pe,t.values?(t=Me(t.values),(n=!Ii(t[0]))&&(s*=s)):t=Rl(t.increment)),Zi(e,i?Dt(t)?function(a){return n=t(a),Math.abs(n-a)<=s?n:a}:function(a){for(var o=parseFloat(n?a.x:a),h=parseFloat(n?a.y:0),l=Pe,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=!s||l<=s?t[c]:a,n||c===a||Ii(a)?c:c+te(a)}:Rl(t))},Hp=function(t,e,i,s){return Zi(Jt(t)?!e:i===!0?!!(i=0):!s,function(){return Jt(t)?t[~~(Math.random()*t.length)]:(i=i||1e-5)&&(s=i<1?Math.pow(10,(i+"").length-2):1)&&Math.floor(Math.round((t-i/2+Math.random()*(e-t+i*.99))/i)*i*s)/s})},gT=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return function(s){return e.reduce(function(n,a){return a(n)},s)}},_T=function(t,e){return function(i){return t(parseFloat(i))+(e||te(i))}},yT=function(t,e,i){return Wp(t,e,0,1,i)},Xp=function(t,e,i){return Zi(i,function(s){return t[~~e(s)]})},xT=function r(t,e,i){var s=e-t;return Jt(t)?Xp(t,r(0,t.length),e):Zi(i,function(n){return(s+(n-t)%s)%s+t})},vT=function r(t,e,i){var s=e-t,n=s*2;return Jt(t)?Xp(t,r(0,t.length-1),e):Zi(i,function(a){return a=(n+(a-t)%n)%n||0,t+(a>s?n-a:a)})},on=function(t){for(var e=0,i="",s,n,a,o;~(s=t.indexOf("random(",e));)a=t.indexOf(")",s),o=t.charAt(s+7)==="[",n=t.substr(s+7,a-s-7).match(o?bp:ml),i+=t.substr(e,s-e)+Hp(o?n:+n[0],o?0:+n[1],+n[2]||1e-5),e=a+1;return i+t.substr(e,t.length-e)},Wp=function(t,e,i,s,n){var a=e-t,o=s-i;return Zi(n,function(h){return i+((h-t)/a*o||0)})},bT=function r(t,e,i,s){var n=isNaN(t+e)?0:function(f){return(1-f)*t+f*e};if(!n){var a=zt(t),o={},h,l,c,d,u;if(i===!0&&(s=1)&&(i=null),a)t={p:t},e={p:e};else if(Jt(t)&&!Jt(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)},i=e}else s||(t=wr(Jt(t)?[]:{},t));if(!c){for(h in e)Bl.call(o,t,h,"get",e[h]);n=function(p){return kl(p,o)||(a?t.p:t)}}}return Zi(i,n)},$p=function(t,e,i){var s=t.labels,n=Pe,a,o,h;for(a in s)o=s[a]-e,o<0==!!i&&o&&n>(o=Math.abs(o))&&(h=a,n=o);return h},ye=function(t,e,i){var s=t.vars,n=s[e],a=xt,o=t._ctx,h,l,c;if(n)return h=s[e+"Params"],l=s.callbackScope||t,i&&qi.length&&Ha(),o&&(xt=o),c=h?n.apply(l,h):n.call(l),xt=a,c},hn=function(t){return Ki(t),t.scrollTrigger&&t.scrollTrigger.kill(!!Qt),t.progress()<1&&ye(t,"onInterrupt"),t},fs,zp=[],Yp=function(t){if(t)if(t=!t.name&&t.default||t,pl()||t.headless){var e=t.name,i=Dt(t),s=e&&!i&&t.init?function(){this._props=[]}:t,n={init:rn,render:kl,add:Bl,kill:NT,modifier:LT,rawVars:0},a={targetTest:0,get:0,getSetter:Nl,aliases:{},register:0};if(ps(),t!==s){if(_e[e])return;Re(s,Re(Xa(t,n),a)),wr(s.prototype,wr(n,Xa(t,a))),_e[s.prop=e]=s,t.targetTest&&(Va.push(s),vl[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}wp(e,s),t.register&&t.register(ue,s,ce)}else zp.push(t)},ft=255,ln={aqua:[0,ft,ft],lime:[0,ft,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,ft],navy:[0,0,128],white:[ft,ft,ft],olive:[128,128,0],yellow:[ft,ft,0],orange:[ft,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[ft,0,0],pink:[ft,192,203],cyan:[0,ft,ft],transparent:[ft,ft,ft,0]},Il=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)*ft+.5|0},jp=function(t,e,i){var s=t?Ii(t)?[t>>16,t>>8&ft,t&ft]:0:ln.black,n,a,o,h,l,c,d,u,f,p;if(!s){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),ln[t])s=ln[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 s=parseInt(t.substr(1,6),16),[s>>16,s>>8&ft,s&ft,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),s=[t>>16,t>>8&ft,t&ft]}else if(t.substr(0,3)==="hsl"){if(s=p=t.match(ml),!e)h=+s[0]%360/360,l=+s[1]/100,c=+s[2]/100,a=c<=.5?c*(l+1):c+l-c*l,n=c*2-a,s.length>3&&(s[3]*=1),s[0]=Il(h+1/3,n,a),s[1]=Il(h,n,a),s[2]=Il(h-1/3,n,a);else if(~t.indexOf("="))return s=t.match(xp),i&&s.length<4&&(s[3]=1),s}else s=t.match(ml)||ln.transparent;s=s.map(Number)}return e&&!p&&(n=s[0]/ft,a=s[1]/ft,o=s[2]/ft,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),s[0]=~~(h+.5),s[1]=~~(l*100+.5),s[2]=~~(c*100+.5)),i&&s.length<4&&(s[3]=1),s},qp=function(t){var e=[],i=[],s=-1;return t.split(Qi).forEach(function(n){var a=n.match(ls)||[];e.push.apply(e,a),i.push(s+=a.length+1)}),e.c=i,e},Kp=function(t,e,i){var s="",n=(t+s).match(Qi),a=e?"hsla(":"rgba(",o=0,h,l,c,d;if(!n)return t;if(n=n.map(function(u){return(u=jp(u,e,1))&&a+(e?u[0]+","+u[1]+"%,"+u[2]+"%,"+u[3]:u.join(","))+")"}),i&&(c=qp(t),h=i.c,h.join(s)!==c.c.join(s)))for(l=t.replace(Qi,"1").split(ls),d=l.length-1;o<d;o++)s+=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(Qi),d=l.length-1;o<d;o++)s+=l[o]+n[o];return s+l[d]},Qi=function(){var r="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in ln)r+="|"+t+"\\b";return new RegExp(r+")","gi")}(),TT=/hsl[a]?\(/,Zp=function(t){var e=t.join(" "),i;if(Qi.lastIndex=0,Qi.test(e))return i=TT.test(e),t[1]=Kp(t[1],i),t[0]=Kp(t[0],i,qp(t[1])),!0},cn,xe=function(){var r=Date.now,t=500,e=33,i=r(),s=i,n=1e3/240,a=n,o=[],h,l,c,d,u,f,p=function m(g){var y=r()-s,v=g===!0,_,x,b,E;if((y>t||y<0)&&(i+=y-e),s+=y,b=s-i,_=b-a,(_>0||v)&&(E=++d.frame,u=b-d.time*1e3,d.time=b=b/1e3,a+=_+(_>=n?4:n-_),x=1),v||(h=l(m)),x)for(f=0;f<o.length;f++)o[f](b,u,E,g)};return d={time:0,frame:0,tick:function(){p(!0)},deltaRatio:function(g){return u/(1e3/(g||60))},wake:function(){Tp&&(!_l&&pl()&&(oi=_l=window,yl=oi.document||{},ge.gsap=ue,(oi.gsapVersions||(oi.gsapVersions=[])).push(ue.version),Ep(Ua||oi.GreenSockGlobals||!oi.gsap&&oi||{}),zp.forEach(Yp)),c=typeof requestAnimationFrame<"u"&&requestAnimationFrame,h&&d.sleep(),l=c||function(g){return setTimeout(g,a-d.time*1e3+1|0)},cn=1,p(2))},sleep:function(){(c?cancelAnimationFrame:clearTimeout)(h),cn=0,l=rn},lagSmoothing:function(g,y){t=g||1/0,e=Math.min(y||33,t)},fps:function(g){n=1e3/(g||240),a=d.time*1e3+n},add:function(g,y,v){var _=y?function(x,b,E,T){g(x,b,E,T),d.remove(_)}:g;return d.remove(g),o[v?"unshift":"push"](_),ps(),_},remove:function(g,y){~(y=o.indexOf(g))&&o.splice(y,1)&&f>=y&&f--},_listeners:o},d}(),ps=function(){return!cn&&xe.wake()},at={},ET=/^[\d.\-M][\d.\-,\s]/,wT=/["']/g,AT=function(t){for(var e={},i=t.substr(1,t.length-3).split(":"),s=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[s]=isNaN(l)?l.replace(wT,"").trim():+l,s=h.substr(o+1).trim();return e},ST=function(t){var e=t.indexOf("(")+1,i=t.indexOf(")"),s=t.indexOf("(",e);return t.substring(e,~s&&s<i?t.indexOf(")",i+1):i)},CT=function(t){var e=(t+"").split("("),i=at[e[0]];return i&&e.length>1&&i.config?i.config.apply(null,~t.indexOf("{")?[AT(e[1])]:ST(t).split(",").map(Rp)):at._CE&&ET.test(t)?at._CE("",t):i},Qp=function(t){return function(e){return 1-t(1-e)}},Jp=function r(t,e){for(var i=t._first,s;i;)i instanceof se?r(i,e):i.vars.yoyoEase&&(!i._yoyo||!i._repeat)&&i._yoyo!==e&&(i.timeline?r(i.timeline,e):(s=i._ease,i._ease=i._yEase,i._yEase=s,i._yoyo=e)),i=i._next},Sr=function(t,e){return t&&(Dt(t)?t:at[t]||CT(t))||e},Cr=function(t,e,i,s){i===void 0&&(i=function(h){return 1-e(1-h)}),s===void 0&&(s=function(h){return h<.5?e(h*2)/2:1-e((1-h)*2)/2});var n={easeIn:e,easeOut:i,easeInOut:s},a;return le(t,function(o){at[o]=ge[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},tm=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},Ml=function r(t,e,i){var s=e>=1?e:1,n=(i||(t?.3:.45))/(e<1?e:1),a=n/dl*(Math.asin(1/s)||0),o=function(c){return c===1?1:s*Math.pow(2,-10*c)*eT((c-a)*n)+1},h=t==="out"?o:t==="in"?function(l){return 1-o(1-l)}:tm(o);return n=dl/n,h.config=function(l,c){return r(t,l,c)},h},Dl=function r(t,e){e===void 0&&(e=1.70158);var i=function(a){return a?--a*a*((e+1)*a+e)+1:0},s=t==="out"?i:t==="in"?function(n){return 1-i(1-n)}:tm(i);return s.config=function(n){return r(t,n)},s};le("Linear,Quad,Cubic,Quart,Quint,Strong",function(r,t){var e=t<5?t+1:t;Cr(r+",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,Cr("Elastic",Ml("in"),Ml("out"),Ml()),function(r,t){var e=1/t,i=2*e,s=2.5*e,n=function(o){return o<e?r*o*o:o<i?r*Math.pow(o-1.5/t,2)+.75:o<s?r*(o-=2.25/t)*o+.9375:r*Math.pow(o-2.625/t,2)+.984375};Cr("Bounce",function(a){return 1-n(1-a)},n)}(7.5625,2.75),Cr("Expo",function(r){return r?Math.pow(2,10*(r-1)):0}),Cr("Circ",function(r){return-(_p(1-r*r)-1)}),Cr("Sine",function(r){return r===1?1:-tT(r*Qb)+1}),Cr("Back",Dl("in"),Dl("out"),Dl()),at.SteppedEase=at.steps=ge.SteppedEase={config:function(t,e){t===void 0&&(t=1);var i=1/t,s=t+(e?0:1),n=e?1:0,a=1-gt;return function(o){return((s*an(0,a,o)|0)+n)*i}}},hs.ease=at["quad.out"],le("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(r){return El+=r+","+r+"Params,"});var em=function(t,e){this.id=Jb++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:Cp,this.set=e?e.getSetter:Nl},un=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,ds(this,+e.duration,1,1),this.data=e.data,xt&&(this._ctx=xt,xt.data.push(this)),cn||xe.wake()}var t=r.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,ds(this,this._repeat<0?i:(i-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(i,s){if(ps(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(Ya(this,i),!n._dp||n.parent||Op(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)&&hi(this._dp,this,this._start-this._delay)}return(this._tTime!==i||!this._dur&&!s||this._initted&&Math.abs(this._zTime)===gt||!i&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=i),Pp(this,i,s)),this},t.time=function(i,s){return arguments.length?this.totalTime(Math.min(this.totalDuration(),i+Bp(this))%(this._dur+this._rDelay)||(i?this._dur:0),s):this._time},t.totalProgress=function(i,s){return arguments.length?this.totalTime(this.totalDuration()*i,s):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>0?1:0},t.progress=function(i,s){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-i:i)+Bp(this),s):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},t.iteration=function(i,s){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(i-1)*n,s):this._repeat?us(this._tTime,n)+1:1},t.timeScale=function(i,s){if(!arguments.length)return this._rts===-gt?0:this._rts;if(this._rts===i)return this;var n=this.parent&&this._ts?$a(this.parent._time,this):this._tTime;return this._rts=+i||0,this._ts=this._ps||i===-gt?0:this._rts,this.totalTime(an(-Math.abs(this._delay),this._tDur,n),s!==!1),za(this),hT(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):(ps(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==gt&&(this._tTime-=gt)))),this):this._ps},t.startTime=function(i){if(arguments.length){this._start=i;var s=this.parent||this._dp;return s&&(s._sort||!this.parent)&&hi(s,this,i-this._delay),this}return this._start},t.endTime=function(i){return this._start+(he(i)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},t.rawTime=function(i){var s=this.parent||this._dp;return s?i&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?$a(s.rawTime(i),this):this._tTime:this._tTime},t.revert=function(i){i===void 0&&(i=sT);var s=Qt;return Qt=i,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(i),this.totalTime(-.01,i.suppressEvents)),this.data!=="nested"&&i.kill!==!1&&this.kill(),Qt=s,this},t.globalTime=function(i){for(var s=this,n=arguments.length?i:s.rawTime();s;)n=s._start+n/(Math.abs(s._ts)||1),s=s._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,Np(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(i){if(arguments.length){var s=this._time;return this._rDelay=i,Np(this),s?this.time(s):this}return this._rDelay},t.yoyo=function(i){return arguments.length?(this._yoyo=i,this):this._yoyo},t.seek=function(i,s){return this.totalTime(Ie(this,i),he(s))},t.restart=function(i,s){return this.play().totalTime(i?-this._delay:0,he(s))},t.play=function(i,s){return i!=null&&this.seek(i,s),this.reversed(!1).paused(!1)},t.reverse=function(i,s){return i!=null&&this.seek(i||this.totalDuration(),s),this.reversed(!0).paused(!1)},t.pause=function(i,s){return i!=null&&this.seek(i,s),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?-gt:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-gt,this},t.isActive=function(){var i=this.parent||this._dp,s=this._start,n;return!!(!i||this._ts&&this._initted&&i.isActive()&&(n=i.rawTime(!0))>=s&&n<this.endTime(!0)-gt)},t.eventCallback=function(i,s,n){var a=this.vars;return arguments.length>1?(s?(a[i]=s,n&&(a[i+"Params"]=n),i==="onUpdate"&&(this._onUpdate=s)):delete a[i],this):a[i]},t.then=function(i){var s=this;return new Promise(function(n){var a=Dt(i)?i:Ip,o=function(){var l=s.then;s.then=null,Dt(a)&&(a=a(s))&&(a.then||a===s)&&(s.then=l),n(a),s.then=l};s._initted&&s.totalProgress()===1&&s._ts>=0||!s._tTime&&s._ts<0?o():s._prom=o})},t.kill=function(){hn(this)},r}();Re(un.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:-gt,_prom:0,_ps:!1,_rts:1});var se=function(r){gp(t,r);function t(i,s){var n;return i===void 0&&(i={}),n=r.call(this,i)||this,n.labels={},n.smoothChildTiming=!!i.smoothChildTiming,n.autoRemoveChildren=!!i.autoRemoveChildren,n._sort=he(i.sortChildren),wt&&hi(i.parent||wt,Ri(n),s),i.reversed&&n.reverse(),i.paused&&n.paused(!0),i.scrollTrigger&&Fp(Ri(n),i.scrollTrigger),n}var e=t.prototype;return e.to=function(s,n,a){return nn(0,arguments,this),this},e.from=function(s,n,a){return nn(1,arguments,this),this},e.fromTo=function(s,n,a,o){return nn(2,arguments,this),this},e.set=function(s,n,a){return n.duration=0,n.parent=this,sn(n).repeatDelay||(n.repeat=0),n.immediateRender=!!n.immediateRender,new kt(s,n,Ie(this,a),1),this},e.call=function(s,n,a){return hi(this,kt.delayedCall(0,s,n),a)},e.staggerTo=function(s,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 kt(s,a,Ie(this,h)),this},e.staggerFrom=function(s,n,a,o,h,l,c){return a.runBackwards=1,sn(a).immediateRender=he(a.immediateRender),this.staggerTo(s,n,a,o,h,l,c)},e.staggerFromTo=function(s,n,a,o,h,l,c,d){return o.startAt=a,sn(o).immediateRender=he(o.immediateRender),this.staggerTo(s,n,o,h,l,c,d)},e.render=function(s,n,a){var o=this._time,h=this._dirty?this.totalDuration():this._tDur,l=this._dur,c=s<=0?0:Yt(s),d=this._zTime<0!=s<0&&(this._initted||!l),u,f,p,m,g,y,v,_,x,b,E,T;if(this!==wt&&c>h&&s>=0&&(c=h),c!==this._tTime||a||d){if(o!==this._time&&l&&(c+=this._time-o,s+=this._time-o),u=c,x=this._start,_=this._ts,y=!_,d&&(l||(o=this._zTime),(s||!n)&&(this._zTime=s)),this._repeat){if(E=this._yoyo,g=l+this._rDelay,this._repeat<-1&&s<0)return this.totalTime(g*100+s,n,a);if(u=Yt(c%g),c===h?(m=this._repeat,u=l):(m=~~(c/g),m&&m===c/g&&(u=l,m--),u>l&&(u=l)),b=us(this._tTime,g),!o&&this._tTime&&b!==m&&this._tTime-b*g-this._dur<=0&&(b=m),E&&m&1&&(u=l-u,T=1),m!==b&&!this._lock){var w=E&&b&1,A=w===(E&&m&1);if(m<b&&(w=!w),o=w?0:c%l?l:c,this._lock=1,this.render(o||(T?0:Yt(m*g)),n,!l)._lock=0,this._tTime=c,!n&&this.parent&&ye(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=w?l:-1e-4,this.render(o,!0),this.vars.repeatRefresh&&!T&&this.invalidate()),this._lock=0,!this._ts&&!y)return this;Jp(this,T)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(v=dT(this,Yt(o),Yt(u)),v&&(c-=u-(u=v._start))),this._tTime=c,this._time=u,this._act=!_,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=s,o=0),!o&&u&&!n&&!m&&(ye(this,"onStart"),this._tTime!==c))return this;if(u>=o&&s>=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(s,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=-gt);break}}f=p}else{f=this._last;for(var P=s<0?s:u;f;){if(p=f._prev,(f._act||P<=f._end)&&f._ts&&v!==f){if(f.parent!==this)return this.render(s,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||Qt&&(f._initted||f._startAt)),u!==this._time||!this._ts&&!y){v=0,p&&(c+=this._zTime=P?-gt:gt);break}}f=p}}if(v&&!n&&(this.pause(),v.render(u>=o?0:-gt)._zTime=u>=o?1:-1,this._ts))return this._start=x,za(this),this.render(s,n,a);this._onUpdate&&!n&&ye(this,"onUpdate",!0),(c===h&&this._tTime>=this.totalDuration()||!c&&o)&&(x===this._start||Math.abs(_)!==Math.abs(this._ts))&&(this._lock||((s||!l)&&(c===h&&this._ts>0||!c&&this._ts<0)&&Ki(this,1),!n&&!(s<0&&!o)&&(c||o||!h)&&(ye(this,c===h&&s>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(c<h&&this.timeScale()>0)&&this._prom())))}return this},e.add=function(s,n){var a=this;if(Ii(n)||(n=Ie(this,n,s)),!(s instanceof un)){if(Jt(s))return s.forEach(function(o){return a.add(o,n)}),this;if(zt(s))return this.addLabel(s,n);if(Dt(s))s=kt.delayedCall(0,s);else return this}return this!==s?hi(this,s,n):this},e.getChildren=function(s,n,a,o){s===void 0&&(s=!0),n===void 0&&(n=!0),a===void 0&&(a=!0),o===void 0&&(o=-Pe);for(var h=[],l=this._first;l;)l._start>=o&&(l instanceof kt?n&&h.push(l):(a&&h.push(l),s&&h.push.apply(h,l.getChildren(!0,n,a)))),l=l._next;return h},e.getById=function(s){for(var n=this.getChildren(1,1,1),a=n.length;a--;)if(n[a].vars.id===s)return n[a]},e.remove=function(s){return zt(s)?this.removeLabel(s):Dt(s)?this.killTweensOf(s):(Wa(this,s),s===this._recent&&(this._recent=this._last),Ar(this))},e.totalTime=function(s,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=Yt(xe.time-(this._ts>0?s/this._ts:(this.totalDuration()-s)/-this._ts))),r.prototype.totalTime.call(this,s,n),this._forcing=0,this):this._tTime},e.addLabel=function(s,n){return this.labels[s]=Ie(this,n),this},e.removeLabel=function(s){return delete this.labels[s],this},e.addPause=function(s,n,a){var o=kt.delayedCall(0,n||rn,a);return o.data="isPause",this._hasPause=1,hi(this,o,Ie(this,s))},e.removePause=function(s){var n=this._first;for(s=Ie(this,s);n;)n._start===s&&n.data==="isPause"&&Ki(n),n=n._next},e.killTweensOf=function(s,n,a){for(var o=this.getTweensOf(s,a),h=o.length;h--;)Ji!==o[h]&&o[h].kill(s,n);return this},e.getTweensOf=function(s,n){for(var a=[],o=Me(s),h=this._first,l=Ii(n),c;h;)h instanceof kt?nT(h._targets,o)&&(l?(!Ji||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(s,n){n=n||{};var a=this,o=Ie(a,s),h=n,l=h.startAt,c=h.onStart,d=h.onStartParams,u=h.immediateRender,f,p=kt.to(a,Re({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())||gt,onStart:function(){if(a.pause(),!f){var g=n.duration||Math.abs((o-(l&&"time"in l?l.time:a._time))/a.timeScale());p._dur!==g&&ds(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(s,n,a){return this.tweenTo(n,Re({startAt:{time:Ie(this,s)}},a))},e.recent=function(){return this._recent},e.nextLabel=function(s){return s===void 0&&(s=this._time),$p(this,Ie(this,s))},e.previousLabel=function(s){return s===void 0&&(s=this._time),$p(this,Ie(this,s),1)},e.currentLabel=function(s){return arguments.length?this.seek(s,!0):this.previousLabel(this._time+gt)},e.shiftChildren=function(s,n,a){a===void 0&&(a=0);for(var o=this._first,h=this.labels,l;o;)o._start>=a&&(o._start+=s,o._end+=s),o=o._next;if(n)for(l in h)h[l]>=a&&(h[l]+=s);return Ar(this)},e.invalidate=function(s){var n=this._first;for(this._lock=0;n;)n.invalidate(s),n=n._next;return r.prototype.invalidate.call(this,s)},e.clear=function(s){s===void 0&&(s=!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),s&&(this.labels={}),Ar(this)},e.totalDuration=function(s){var n=0,a=this,o=a._last,h=Pe,l,c,d;if(arguments.length)return a.timeScale((a._repeat<0?a.duration():a.totalDuration())/(a.reversed()?-s:s));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,hi(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;ds(a,a===wt&&a._time>n?a._time:n,1,1),a._dirty=0}return a._tDur},t.updateRoot=function(s){if(wt._ts&&(Pp(wt,$a(s,wt)),Ap=xe.frame),xe.frame>=Sp){Sp+=me.autoSleep||120;var n=wt._first;if((!n||!n._ts)&&me.autoSleep&&xe._listeners.length<2){for(;n&&!n._ts;)n=n._next;n||xe.sleep()}}},t}(un);Re(se.prototype,{_lock:0,_hasPause:0,_forcing:0});var PT=function(t,e,i,s,n,a,o){var h=new ce(this._pt,t,e,0,1,om,null,n),l=0,c=0,d,u,f,p,m,g,y,v;for(h.b=i,h.e=s,i+="",s+="",(y=~s.indexOf("random("))&&(s=on(s)),a&&(v=[i,s],a(v,t,e),i=v[0],s=v[1]),u=i.match(gl)||[];d=gl.exec(s);)p=d[0],m=s.substring(l,d.index),f?f=(f+1)%5:m.substr(-5)==="rgba("&&(f=1),p!==u[c++]&&(g=parseFloat(u[c-1])||0,h._pt={_next:h._pt,p:m||c===1?m:",",s:g,c:p.charAt(1)==="="?cs(g,p)-g:parseFloat(p)-g,m:f&&f<4?Math.round:0},l=gl.lastIndex);return h.c=l<s.length?s.substring(l,s.length):"",h.fp=o,(vp.test(s)||y)&&(h.e=0),this._pt=h,h},Bl=function(t,e,i,s,n,a,o,h,l,c){Dt(s)&&(s=s(n||0,t,a));var d=t[e],u=i!=="get"?i:Dt(d)?l?t[e.indexOf("set")||!Dt(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():d,f=Dt(d)?l?BT:nm:Ll,p;if(zt(s)&&(~s.indexOf("random(")&&(s=on(s)),s.charAt(1)==="="&&(p=cs(u,s)+(te(u)||0),(p||p===0)&&(s=p))),!c||u!==s||Ol)return!isNaN(u*s)&&s!==""?(p=new ce(this._pt,t,e,+u||0,s-(u||0),typeof d=="boolean"?FT:am,0,f),l&&(p.fp=l),o&&p.modifier(o,this,t),this._pt=p):(!d&&!(e in t)&&xl(e,s),PT.call(this,t,e,u,s,f,h||me.stringFilter,l))},RT=function(t,e,i,s,n){if(Dt(t)&&(t=dn(t,n,e,i,s)),!ai(t)||t.style&&t.nodeType||Jt(t)||yp(t))return zt(t)?dn(t,n,e,i,s):t;var a={},o;for(o in t)a[o]=dn(t[o],n,e,i,s);return a},im=function(t,e,i,s,n,a){var o,h,l,c;if(_e[t]&&(o=new _e[t]).init(n,o.rawVars?e[t]:RT(e[t],s,n,a,i),i,s,a)!==!1&&(i._pt=h=new ce(i._pt,n,t,0,1,o.render,o,0,o.priority),i!==fs))for(l=i._ptLookup[i._targets.indexOf(n)],c=o._props.length;c--;)l[o._props[c]]=h;return o},Ji,Ol,Fl=function r(t,e,i){var s=t.vars,n=s.ease,a=s.startAt,o=s.immediateRender,h=s.lazy,l=s.onUpdate,c=s.runBackwards,d=s.yoyoEase,u=s.keyframes,f=s.autoRevert,p=t._dur,m=t._startAt,g=t._targets,y=t.parent,v=y&&y.data==="nested"?y.vars.targets:g,_=t._overwrite==="auto"&&!ul,x=t.timeline,b,E,T,w,A,P,L,M,S,C,R,k,F;if(x&&(!u||!n)&&(n="none"),t._ease=Sr(n,hs.ease),t._yEase=d?Qp(Sr(d===!0?n:d,hs.ease)):0,d&&t._yoyo&&!t._repeat&&(d=t._yEase,t._yEase=t._ease,t._ease=d),t._from=!x&&!!s.runBackwards,!x||u&&!s.stagger){if(M=g[0]?Er(g[0]).harness:0,k=M&&s[M.prop],b=Xa(s,vl),m&&(m._zTime<0&&m.progress(1),e<0&&c&&o&&!f?m.render(-1,!0):m.revert(c&&p?Ga:rT),m._lazy=0),a){if(Ki(t._startAt=kt.set(g,Re({data:"isStart",overwrite:!1,parent:y,immediateRender:!0,lazy:!m&&he(h),startAt:null,delay:0,onUpdate:l&&function(){return ye(t,"onUpdate")},stagger:0},a))),t._startAt._dp=0,t._startAt._sat=t,e<0&&(Qt||!o&&!f)&&t._startAt.revert(Ga),o&&p&&e<=0&&i<=0){e&&(t._zTime=e);return}}else if(c&&p&&!m){if(e&&(o=!1),T=Re({overwrite:!1,data:"isFromStart",lazy:o&&!m&&he(h),immediateRender:o,stagger:0,parent:y},b),k&&(T[M.prop]=k),Ki(t._startAt=kt.set(g,T)),t._startAt._dp=0,t._startAt._sat=t,e<0&&(Qt?t._startAt.revert(Ga):t._startAt.render(-1,!0)),t._zTime=e,!o)r(t._startAt,gt,gt);else if(!e)return}for(t._pt=t._ptCache=0,h=p&&he(h)||h&&!p,E=0;E<g.length;E++){if(A=g[E],L=A._gsap||wl(g)[E]._gsap,t._ptLookup[E]=C={},bl[L.id]&&qi.length&&Ha(),R=v===g?E:v.indexOf(A),M&&(S=new M).init(A,k||b,t,R,v)!==!1&&(t._pt=w=new ce(t._pt,A,S.name,0,1,S.render,S,0,S.priority),S._props.forEach(function(B){C[B]=w}),S.priority&&(P=1)),!M||k)for(T in b)_e[T]&&(S=im(T,b,t,R,A,v))?S.priority&&(P=1):C[T]=w=Bl.call(t,A,T,"get",b[T],R,v,0,s.stringFilter);t._op&&t._op[E]&&t.kill(A,t._op[E]),_&&t._pt&&(Ji=t,wt.killTweensOf(A,C,t.globalTime(e)),F=!t.parent,Ji=0),t._pt&&h&&(bl[L.id]=1)}P&&hm(t),t._onInit&&t._onInit(t)}t._onUpdate=l,t._initted=(!t._op||t._pt)&&!F,u&&e<=0&&x.render(Pe,!0,!0)},IT=function(t,e,i,s,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 Ol=1,t.vars[e]="+=0",Fl(t,o),Ol=0,h?en(e+" not eligible for reset"):1;l.push(c)}for(f=l.length;f--;)d=l[f],c=d._pt||d,c.s=(s||s===0)&&!n?s:c.s+(s||0)+a*c.c,c.c=i-c.s,d.e&&(d.e=Ft(i)+te(d.e)),d.b&&(d.b=c.s+te(d.b))},MT=function(t,e){var i=t[0]?Er(t[0]).harness:0,s=i&&i.aliases,n,a,o,h;if(!s)return e;n=wr({},e);for(a in s)if(a in n)for(h=s[a].split(","),o=h.length;o--;)n[h[o]]=n[a];return n},DT=function(t,e,i,s){var n=e.ease||s||"power1.inOut",a,o;if(Jt(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})},dn=function(t,e,i,s,n){return Dt(t)?t.call(e,i,s,n):zt(t)&&~t.indexOf("random(")?on(t):t},rm=El+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",sm={};le(rm+",id,stagger,delay,duration,paused,scrollTrigger",function(r){return sm[r]=1});var kt=function(r){gp(t,r);function t(i,s,n,a){var o;typeof s=="number"&&(n.duration=s,s=n,n=null),o=r.call(this,a?s:sn(s))||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,g=h.scrollTrigger,y=h.yoyoEase,v=s.parent||wt,_=(Jt(i)||yp(i)?Ii(i[0]):"length"in s)?[i]:Me(i),x,b,E,T,w,A,P,L;if(o._targets=_.length?wl(_):en("GSAP target "+i+" not found. https://gsap.com",!me.nullTargetWarn)||[],o._ptLookup=[],o._overwrite=f,p||u||ka(l)||ka(c)){if(s=o.vars,x=o.timeline=new se({data:"nested",defaults:m||{},targets:v&&v.data==="nested"?v.vars.targets:_}),x.kill(),x.parent=x._dp=Ri(o),x._start=0,u||ka(l)||ka(c)){if(T=_.length,P=u&&Gp(u),ai(u))for(w in u)~rm.indexOf(w)&&(L||(L={}),L[w]=u[w]);for(b=0;b<T;b++)E=Xa(s,sm),E.stagger=0,y&&(E.yoyoEase=y),L&&wr(E,L),A=_[b],E.duration=+dn(l,Ri(o),b,A,_),E.delay=(+dn(c,Ri(o),b,A,_)||0)-o._delay,!u&&T===1&&E.delay&&(o._delay=c=E.delay,o._start+=c,E.delay=0),x.to(A,E,P?P(b,A,_):0),x._ease=at.none;x.duration()?l=c=0:o.timeline=0}else if(p){sn(Re(x.vars.defaults,{ease:"none"})),x._ease=Sr(p.ease||s.ease||"none");var M=0,S,C,R;if(Jt(p))p.forEach(function(k){return x.to(_,k,">")}),x.duration();else{E={};for(w in p)w==="ease"||w==="easeEach"||DT(w,p[w],E,p.easeEach);for(w in E)for(S=E[w].sort(function(k,F){return k.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[w]=C.v,x.to(_,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&&!ul&&(Ji=Ri(o),wt.killTweensOf(_),Ji=0),hi(v,Ri(o),n),s.reversed&&o.reverse(),s.paused&&o.paused(!0),(d||!l&&!p&&o._start===Yt(v._time)&&he(d)&&lT(Ri(o))&&v.data!=="nested")&&(o._tTime=-gt,o.render(Math.max(0,-c)||0)),g&&Fp(Ri(o),g),o}var e=t.prototype;return e.render=function(s,n,a){var o=this._time,h=this._tDur,l=this._dur,c=s<0,d=s>h-gt&&!c?h:s<gt?0:s,u,f,p,m,g,y,v,_,x;if(!l)uT(this,s,n,a);else if(d!==this._tTime||!s||a||!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+s,n,a);if(u=Yt(d%m),d===h?(p=this._repeat,u=l):(p=~~(d/m),p&&p===Yt(d/m)&&(u=l,p--),u>l&&(u=l)),y=this._yoyo&&p&1,y&&(x=this._yEase,u=l-u),g=us(this._tTime,m),u===o&&!a&&this._initted&&p===g)return this._tTime=d,this;p!==g&&(_&&this._yEase&&Jp(_,y),this.vars.repeatRefresh&&!y&&!this._lock&&this._time!==m&&this._initted&&(this._lock=a=1,this.render(Yt(m*p),!0).invalidate()._lock=0))}if(!this._initted){if(Lp(this,c?s:u,a,n,d))return this._tTime=0,this;if(o!==this._time&&!(a&&this.vars.repeatRefresh&&p!==g))return this;if(l!==this._dur)return this.render(s,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&&(ye(this,"onStart"),this._tTime!==d))return this;for(f=this._pt;f;)f.r(v,f.d),f=f._next;_&&_.render(s<0?s:_._dur*_._ease(u/this._dur),n,a)||this._startAt&&(this._zTime=s),this._onUpdate&&!n&&(c&&Al(this,s,n,a),ye(this,"onUpdate")),this._repeat&&p!==g&&this.vars.onRepeat&&!n&&this.parent&&ye(this,"onRepeat"),(d===this._tDur||!d)&&this._tTime===d&&(c&&!this._onUpdate&&Al(this,s,!0,!0),(s||!l)&&(d===this._tDur&&this._ts>0||!d&&this._ts<0)&&Ki(this,1),!n&&!(c&&!o)&&(d||o||y)&&(ye(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(s){return(!s||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(s),r.prototype.invalidate.call(this,s)},e.resetTo=function(s,n,a,o,h){cn||xe.wake(),this._ts||this.play();var l=Math.min(this._dur,(this._dp._time-this._start)*this._ts),c;return this._initted||Fl(this,l),c=this._ease(l/this._dur),IT(this,s,n,a,o,c,l,h)?this.resetTo(s,n,a,o,1):(Ya(this,0),this.parent||Dp(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},e.kill=function(s,n){if(n===void 0&&(n="all"),!s&&(!n||n==="all"))return this._lazy=this._pt=0,this.parent?hn(this):this;if(this.timeline){var a=this.timeline.totalDuration();return this.timeline.killTweensOf(s,n,Ji&&Ji.vars.overwrite!==!0)._first||hn(this),this.parent&&a!==this.timeline.totalDuration()&&ds(this,this._dur*this.timeline._tDur/a,0,1),this}var o=this._targets,h=s?Me(s):o,l=this._ptLookup,c=this._pt,d,u,f,p,m,g,y;if((!n||n==="all")&&oT(o,h))return n==="all"&&(this._pt=0),hn(this);for(d=this._op=this._op||[],n!=="all"&&(zt(n)&&(m={},le(n,function(v){return m[v]=1}),n=m),n=MT(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)g=u&&u[m],g&&((!("kill"in g.d)||g.d.kill(m)===!0)&&Wa(this,g,"_pt"),delete u[m]),f!=="all"&&(f[m]=1)}return this._initted&&!this._pt&&c&&hn(this),this},t.to=function(s,n){return new t(s,n,arguments[2])},t.from=function(s,n){return nn(1,arguments)},t.delayedCall=function(s,n,a,o){return new t(n,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:s,onComplete:n,onReverseComplete:n,onCompleteParams:a,onReverseCompleteParams:a,callbackScope:o})},t.fromTo=function(s,n,a){return nn(2,arguments)},t.set=function(s,n){return n.duration=0,n.repeatDelay||(n.repeat=0),new t(s,n)},t.killTweensOf=function(s,n,a){return wt.killTweensOf(s,n,a)},t}(un);Re(kt.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),le("staggerTo,staggerFrom,staggerFromTo",function(r){kt[r]=function(){var t=new se,e=Cl.call(arguments,0);return e.splice(r==="staggerFromTo"?5:4,0,0),t[r].apply(t,e)}});var Ll=function(t,e,i){return t[e]=i},nm=function(t,e,i){return t[e](i)},BT=function(t,e,i,s){return t[e](s.fp,i)},OT=function(t,e,i){return t.setAttribute(e,i)},Nl=function(t,e){return Dt(t[e])?nm:fl(t[e])&&t.setAttribute?OT:Ll},am=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},FT=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},om=function(t,e){var i=e._pt,s="";if(!t&&e.b)s=e.b;else if(t===1&&e.e)s=e.e;else{for(;i;)s=i.p+(i.m?i.m(i.s+i.c*t):Math.round((i.s+i.c*t)*1e4)/1e4)+s,i=i._next;s+=e.c}e.set(e.t,e.p,s,e)},kl=function(t,e){for(var i=e._pt;i;)i.r(t,i.d),i=i._next},LT=function(t,e,i,s){for(var n=this._pt,a;n;)a=n._next,n.p===s&&n.modifier(t,e,i),n=a},NT=function(t){for(var e=this._pt,i,s;e;)s=e._next,e.p===t&&!e.op||e.op===t?Wa(this,e,"_pt"):e.dep||(i=1),e=s;return!i},kT=function(t,e,i,s){s.mSet(t,e,s.m.call(s.tween,i,s.mt),s)},hm=function(t){for(var e=t._pt,i,s,n,a;e;){for(i=e._next,s=n;s&&s.pr>e.pr;)s=s._next;(e._prev=s?s._prev:a)?e._prev._next=e:n=e,(e._next=s)?s._prev=e:a=e,e=i}t._pt=n},ce=function(){function r(e,i,s,n,a,o,h,l,c){this.t=i,this.s=n,this.c=a,this.p=s,this.r=o||am,this.d=h||this,this.set=l||Ll,this.pr=c||0,this._next=e,e&&(e._prev=this)}var t=r.prototype;return t.modifier=function(i,s,n){this.mSet=this.mSet||this.set,this.set=kT,this.m=i,this.mt=n,this.tween=s},r}();le(El+"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 vl[r]=1}),ge.TweenMax=ge.TweenLite=kt,ge.TimelineLite=ge.TimelineMax=se,wt=new se({sortChildren:!1,defaults:hs,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),me.stringFilter=Zp;var Pr=[],ja={},UT=[],lm=0,GT=0,Ul=function(t){return(ja[t]||UT).map(function(e){return e()})},Gl=function(){var t=Date.now(),e=[];t-lm>2&&(Ul("matchMediaInit"),Pr.forEach(function(i){var s=i.queries,n=i.conditions,a,o,h,l;for(o in s)a=oi.matchMedia(s[o]).matches,a&&(h=1),a!==n[o]&&(n[o]=a,l=1);l&&(i.revert(),h&&e.push(i))}),Ul("matchMediaRevert"),e.forEach(function(i){return i.onMatch(i,function(s){return i.add(null,s)})}),lm=t,Ul("matchMedia"))},cm=function(){function r(e,i){this.selector=i&&Pl(i),this.data=[],this._r=[],this.isReverted=!1,this.id=GT++,e&&this.add(e)}var t=r.prototype;return t.add=function(i,s,n){Dt(i)&&(n=s,s=i,i=Dt);var a=this,o=function(){var l=xt,c=a.selector,d;return l&&l!==a&&l.data.push(a),n&&(a.selector=Pl(n)),xt=a,d=s.apply(a,arguments),Dt(d)&&a._r.push(d),xt=l,a.selector=c,a.isReverted=!1,d};return a.last=o,i===Dt?o(a,function(h){return a.add(null,h)}):i?a[i]=o:o},t.ignore=function(i){var s=xt;xt=null,i(this),xt=s},t.getTweens=function(){var i=[];return this.data.forEach(function(s){return s instanceof r?i.push.apply(i,s.getTweens()):s instanceof kt&&!(s.parent&&s.parent.data==="nested")&&i.push(s)}),i},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(i,s){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 se?l.data!=="nested"&&(l.scrollTrigger&&l.scrollTrigger.revert(),l.kill()):!(l instanceof kt)&&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(),s)for(var a=Pr.length;a--;)Pr[a].id===this.id&&Pr.splice(a,1)},t.revert=function(i){this.kill(i||{})},r}(),VT=function(){function r(e){this.contexts=[],this.scope=e,xt&&xt.data.push(this)}var t=r.prototype;return t.add=function(i,s,n){ai(i)||(i={matches:i});var a=new cm(0,n||this.scope),o=a.conditions={},h,l,c;xt&&!a.selector&&(a.selector=xt.selector),this.contexts.push(a),s=a.add("onMatch",s),a.queries=i;for(l in i)l==="all"?c=1:(h=oi.matchMedia(i[l]),h&&(Pr.indexOf(a)<0&&Pr.push(a),(o[l]=h.matches)&&(c=1),h.addListener?h.addListener(Gl):h.addEventListener("change",Gl)));return c&&s(a,function(d){return a.add(null,d)}),this},t.revert=function(i){this.kill(i||{})},t.kill=function(i){this.contexts.forEach(function(s){return s.kill(i,!0)})},r}(),qa={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];e.forEach(function(s){return Yp(s)})},timeline:function(t){return new se(t)},getTweensOf:function(t,e){return wt.getTweensOf(t,e)},getProperty:function(t,e,i,s){zt(t)&&(t=Me(t)[0]);var n=Er(t||{}).get,a=i?Ip:Rp;return i==="native"&&(i=""),t&&(e?a((_e[e]&&_e[e].get||n)(t,e,i,s)):function(o,h,l){return a((_e[o]&&_e[o].get||n)(t,o,h,l))})},quickSetter:function(t,e,i){if(t=Me(t),t.length>1){var s=t.map(function(c){return ue.quickSetter(c,e,i)}),n=s.length;return function(c){for(var d=n;d--;)s[d](c)}}t=t[0]||{};var a=_e[e],o=Er(t),h=o.harness&&(o.harness.aliases||{})[e]||e,l=a?function(c){var d=new a;fs._pt=0,d.init(t,i?c+i:c,fs,0,[t]),d.render(1,d),fs._pt&&kl(1,fs)}: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 s,n=ue.to(t,wr((s={},s[e]="+=0.1",s.paused=!0,s),i||{})),a=function(h,l,c){return n.resetTo(e,h,l,c)};return a.tween=n,a},isTweening:function(t){return wt.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=Sr(t.ease,hs.ease)),Mp(hs,t||{})},config:function(t){return Mp(me,t||{})},registerEffect:function(t){var e=t.name,i=t.effect,s=t.plugins,n=t.defaults,a=t.extendTimeline;(s||"").split(",").forEach(function(o){return o&&!_e[o]&&!ge[o]&&en(e+" effect requires "+o+" plugin.")}),Tl[e]=function(o,h,l){return i(Me(o),Re(h||{},n),l)},a&&(se.prototype[e]=function(o,h,l){return this.add(Tl[e](o,ai(h)?h:(l=h)&&{},this),l)})},registerEase:function(t,e){at[t]=Sr(e)},parseEase:function(t,e){return arguments.length?Sr(t,e):at},getById:function(t){return wt.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var i=new se(t),s,n;for(i.smoothChildTiming=he(t.smoothChildTiming),wt.remove(i),i._dp=0,i._time=i._tTime=wt._time,s=wt._first;s;)n=s._next,(e||!(!s._dur&&s instanceof kt&&s.vars.onComplete===s._targets[0]))&&hi(i,s,s._start-s._delay),s=n;return hi(wt,i,0),i},context:function(t,e){return t?new cm(t,e):xt},matchMedia:function(t){return new VT(t)},matchMediaRefresh:function(){return Pr.forEach(function(t){var e=t.conditions,i,s;for(s in e)e[s]&&(e[s]=!1,i=1);i&&t.revert()})||Gl()},addEventListener:function(t,e){var i=ja[t]||(ja[t]=[]);~i.indexOf(e)||i.push(e)},removeEventListener:function(t,e){var i=ja[t],s=i&&i.indexOf(e);s>=0&&i.splice(s,1)},utils:{wrap:xT,wrapYoyo:vT,distribute:Gp,random:Hp,snap:Vp,normalize:yT,getUnit:te,clamp:pT,splitColor:jp,toArray:Me,selector:Pl,mapRange:Wp,pipe:gT,unitize:_T,interpolate:bT,shuffle:Up},install:Ep,effects:Tl,ticker:xe,updateRoot:se.updateRoot,plugins:_e,globalTimeline:wt,core:{PropTween:ce,globals:wp,Tween:kt,Timeline:se,Animation:un,getCache:Er,_removeLinkedListItem:Wa,reverting:function(){return Qt},context:function(t){return t&&xt&&(xt.data.push(t),t._ctx=xt),xt},suppressOverwrites:function(t){return ul=t}}};le("to,from,fromTo,delayedCall,set,killTweensOf",function(r){return qa[r]=kt[r]}),xe.add(se.updateRoot),fs=qa.to({},{duration:0});var HT=function(t,e){for(var i=t._pt;i&&i.p!==e&&i.op!==e&&i.fp!==e;)i=i._next;return i},XT=function(t,e){var i=t._targets,s,n,a;for(s in e)for(n=i.length;n--;)a=t._ptLookup[n][s],a&&(a=a.d)&&(a._pt&&(a=HT(a,s)),a&&a.modifier&&a.modifier(e[s],t,i[n],s))},Vl=function(t,e){return{name:t,rawVars:1,init:function(s,n,a){a._onInit=function(o){var h,l;if(zt(n)&&(h={},le(n,function(c){return h[c]=1}),n=h),e){h={};for(l in n)h[l]=e(n[l]);n=h}XT(o,n)}}}},ue=qa.registerPlugin({name:"attr",init:function(t,e,i,s,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],s,n,0,0,a),o.op=a,o.b=h,this._props.push(a)},render:function(t,e){for(var i=e._pt;i;)Qt?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)}},Vl("roundProps",Rl),Vl("modifiers"),Vl("snap",Vp))||qa;kt.version=se.version=ue.version="3.12.5",Tp=1,pl()&&ps(),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;/*!
|
|
1156
|
+
* CSSPlugin 3.12.5
|
|
1157
|
+
* https://gsap.com
|
|
1158
|
+
*
|
|
1159
|
+
* Copyright 2008-2024, GreenSock. All rights reserved.
|
|
1160
|
+
* Subject to the terms at https://gsap.com/standard-license or for
|
|
1161
|
+
* Club GSAP members, the agreement issued with that membership.
|
|
1162
|
+
* @author: Jack Doyle, jack@greensock.com
|
|
1163
|
+
*/var um,tr,ms,Hl,Rr,dm,Xl,WT=function(){return typeof window<"u"},Mi={},Ir=180/Math.PI,gs=Math.PI/180,_s=Math.atan2,fm=1e8,Wl=/([A-Z])/g,$T=/(left|right|width|margin|padding|x)/i,zT=/[\s,\(]\S/,li={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},$l=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},YT=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)},jT=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)},qT=function(t,e){var i=e.s+e.c*t;e.set(e.t,e.p,~~(i+(i<0?-.5:.5))+e.u,e)},pm=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},mm=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},KT=function(t,e,i){return t.style[e]=i},ZT=function(t,e,i){return t.style.setProperty(e,i)},QT=function(t,e,i){return t._gsap[e]=i},JT=function(t,e,i){return t._gsap.scaleX=t._gsap.scaleY=i},tE=function(t,e,i,s,n){var a=t._gsap;a.scaleX=a.scaleY=i,a.renderTransform(n,a)},eE=function(t,e,i,s,n){var a=t._gsap;a[e]=i,a.renderTransform(n,a)},At="transform",de=At+"Origin",iE=function r(t,e){var i=this,s=this.target,n=s.style,a=s._gsap;if(t in Mi&&n){if(this.tfm=this.tfm||{},t!=="transform")t=li[t]||t,~t.indexOf(",")?t.split(",").forEach(function(o){return i.tfm[o]=Di(s,o)}):this.tfm[t]=a.x?a[t]:Di(s,t),t===de&&(this.tfm.zOrigin=a.zOrigin);else return li.transform.split(",").forEach(function(o){return r.call(i,o,e)});if(this.props.indexOf(At)>=0)return;a.svg&&(this.svgo=s.getAttribute("data-svg-origin"),this.props.push(de,e,"")),t=At}(n||e)&&this.props.push(t,e,n[t])},gm=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},rE=function(){var t=this.props,e=this.target,i=e.style,s=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(Wl,"-$1").toLowerCase());if(this.tfm){for(a in this.tfm)s[a]=this.tfm[a];s.svg&&(s.renderTransform(),e.setAttribute("data-svg-origin",this.svgo||"")),n=Xl(),(!n||!n.isStart)&&!i[At]&&(gm(i),s.zOrigin&&i[de]&&(i[de]+=" "+s.zOrigin+"px",s.zOrigin=0,s.renderTransform()),s.uncache=1)}},_m=function(t,e){var i={target:t,props:[],revert:rE,save:iE};return t._gsap||ue.core.getCache(t),e&&e.split(",").forEach(function(s){return i.save(s)}),i},ym,zl=function(t,e){var i=tr.createElementNS?tr.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):tr.createElement(t);return i&&i.style?i:tr.createElement(t)},ci=function r(t,e,i){var s=getComputedStyle(t);return s[e]||s.getPropertyValue(e.replace(Wl,"-$1").toLowerCase())||s.getPropertyValue(e)||!i&&r(t,ys(e)||e,1)||""},xm="O,Moz,ms,Ms,Webkit".split(","),ys=function(t,e,i){var s=e||Rr,n=s.style,a=5;if(t in n&&!i)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);a--&&!(xm[a]+t in n););return a<0?null:(a===3?"ms":a>=0?xm[a]:"")+t},Yl=function(){WT()&&window.document&&(um=window,tr=um.document,ms=tr.documentElement,Rr=zl("div")||{style:{}},zl("div"),At=ys(At),de=At+"Origin",Rr.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",ym=!!ys("perspective"),Xl=ue.core.reverting,Hl=1)},jl=function r(t){var e=zl("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=this.parentNode,s=this.nextSibling,n=this.style.cssText,a;if(ms.appendChild(e),e.appendChild(this),this.style.display="block",t)try{a=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=r}catch{}else this._gsapBBox&&(a=this._gsapBBox());return i&&(s?i.insertBefore(this,s):i.appendChild(this)),ms.removeChild(e),this.style.cssText=n,a},vm=function(t,e){for(var i=e.length;i--;)if(t.hasAttribute(e[i]))return t.getAttribute(e[i])},bm=function(t){var e;try{e=t.getBBox()}catch{e=jl.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===jl||(e=jl.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+vm(t,["x","cx","x1"])||0,y:+vm(t,["y","cy","y1"])||0,width:0,height:0}:e},Tm=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&bm(t))},Mr=function(t,e){if(e){var i=t.style,s;e in Mi&&e!==de&&(e=At),i.removeProperty?(s=e.substr(0,2),(s==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),i.removeProperty(s==="--"?e:e.replace(Wl,"-$1").toLowerCase())):i.removeAttribute(e)}},er=function(t,e,i,s,n,a){var o=new ce(t._pt,e,i,0,1,a?mm:pm);return t._pt=o,o.b=s,o.e=n,t._props.push(i),o},Em={deg:1,rad:1,turn:1},sE={grid:1,flex:1},ir=function r(t,e,i,s){var n=parseFloat(i)||0,a=(i+"").trim().substr((n+"").length)||"px",o=Rr.style,h=$T.test(e),l=t.tagName.toLowerCase()==="svg",c=(l?"client":"offset")+(h?"Width":"Height"),d=100,u=s==="px",f=s==="%",p,m,g,y;if(s===a||!n||Em[s]||Em[a])return n;if(a!=="px"&&!u&&(n=r(t,e,i,"px")),y=t.getCTM&&Tm(t),(f||a==="%")&&(Mi[e]||~e.indexOf("adius")))return p=y?t.getBBox()[h?"width":"height"]:t[c],Ft(f?n/p*d:n/100*p);if(o[h?"width":"height"]=d+(u?a:s),m=~e.indexOf("adius")||s==="em"&&t.appendChild&&!l?t:t.parentNode,y&&(m=(t.ownerSVGElement||{}).parentNode),(!m||m===tr||!m.appendChild)&&(m=tr.body),g=m._gsap,g&&f&&g.width&&h&&g.time===xe.time&&!g.uncache)return Ft(n/g.width*d);if(f&&(e==="height"||e==="width")){var v=t.style[e];t.style[e]=d+s,p=t[c],v?t.style[e]=v:Mr(t,e)}else(f||a==="%")&&!sE[ci(m,"display")]&&(o.position=ci(t,"position")),m===t&&(o.position="static"),m.appendChild(Rr),p=Rr[c],m.removeChild(Rr),o.position="absolute";return h&&f&&(g=Er(m),g.time=xe.time,g.width=m[c]),Ft(u?p*n/d:p&&n?d/p*n:0)},Di=function(t,e,i,s){var n;return Hl||Yl(),e in li&&e!=="transform"&&(e=li[e],~e.indexOf(",")&&(e=e.split(",")[0])),Mi[e]&&e!=="transform"?(n=pn(t,s),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:Za(ci(t,de))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||s||~(n+"").indexOf("calc("))&&(n=Ka[e]&&Ka[e](t,e,i)||ci(t,e)||Cp(t,e)||(e==="opacity"?1:0))),i&&!~(n+"").trim().indexOf(" ")?ir(t,e,n,i)+i:n},nE=function(t,e,i,s){if(!i||i==="none"){var n=ys(e,t,1),a=n&&ci(t,n,1);a&&a!==i?(e=n,i=a):e==="borderColor"&&(i=ci(t,"borderTopColor"))}var o=new ce(this._pt,t.style,e,0,1,om),h=0,l=0,c,d,u,f,p,m,g,y,v,_,x,b;if(o.b=i,o.e=s,i+="",s+="",s==="auto"&&(m=t.style[e],t.style[e]=s,s=ci(t,e)||s,m?t.style[e]=m:Mr(t,e)),c=[i,s],Zp(c),i=c[0],s=c[1],u=i.match(ls)||[],b=s.match(ls)||[],b.length){for(;d=ls.exec(s);)g=d[0],v=s.substring(h,d.index),p?p=(p+1)%5:(v.substr(-5)==="rgba("||v.substr(-5)==="hsla(")&&(p=1),g!==(m=u[l++]||"")&&(f=parseFloat(m)||0,x=m.substr((f+"").length),g.charAt(1)==="="&&(g=cs(f,g)+x),y=parseFloat(g),_=g.substr((y+"").length),h=ls.lastIndex-_.length,_||(_=_||me.units[e]||x,h===s.length&&(s+=_,o.e+=_)),x!==_&&(f=ir(t,e,m,_)||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<s.length?s.substring(h,s.length):""}else o.r=e==="display"&&s==="none"?mm:pm;return vp.test(s)&&(o.e=0),this._pt=o,o},wm={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},aE=function(t){var e=t.split(" "),i=e[0],s=e[1]||"50%";return(i==="top"||i==="bottom"||s==="left"||s==="right")&&(t=i,i=s,s=t),e[0]=wm[i]||i,e[1]=wm[s]||s,e.join(" ")},oE=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var i=e.t,s=i.style,n=e.u,a=i._gsap,o,h,l;if(n==="all"||n===!0)s.cssText="",h=1;else for(n=n.split(","),l=n.length;--l>-1;)o=n[l],Mi[o]&&(h=1,o=o==="transformOrigin"?de:At),Mr(i,o);h&&(Mr(i,At),a&&(a.svg&&i.removeAttribute("transform"),pn(i,1),a.uncache=1,gm(s)))}},Ka={clearProps:function(t,e,i,s,n){if(n.data!=="isFromStart"){var a=t._pt=new ce(t._pt,e,i,0,0,oE);return a.u=s,a.pr=-10,a.tween=n,t._props.push(i),1}}},fn=[1,0,0,1,0,0],Am={},Sm=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},Cm=function(t){var e=ci(t,At);return Sm(e)?fn:e.substr(7).match(xp).map(Ft)},ql=function(t,e){var i=t._gsap||Er(t),s=t.style,n=Cm(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"?fn:n):(n===fn&&!t.offsetParent&&t!==ms&&!i.svg&&(h=s.display,s.display="block",a=t.parentNode,(!a||!t.offsetParent)&&(l=1,o=t.nextElementSibling,ms.appendChild(t)),n=Cm(t),h?s.display=h:Mr(t,"display"),l&&(o?a.insertBefore(t,o):a?a.appendChild(t):ms.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},Kl=function(t,e,i,s,n,a){var o=t._gsap,h=n||ql(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],g=h[3],y=h[4],v=h[5],_=e.split(" "),x=parseFloat(_[0])||0,b=parseFloat(_[1])||0,E,T,w,A;i?h!==fn&&(T=f*g-p*m)&&(w=x*(g/T)+b*(-m/T)+(m*v-g*y)/T,A=x*(-p/T)+b*(f/T)-(f*v-p*y)/T,x=w,b=A):(E=bm(t),x=E.x+(~_[0].indexOf("%")?x/100*E.width:x),b=E.y+(~(_[1]||_[0]).indexOf("%")?b/100*E.height:b)),s||s!==!1&&o.smooth?(y=x-l,v=b-c,o.xOffset=d+(y*f+v*m)-y,o.yOffset=u+(y*p+v*g)-v):o.xOffset=o.yOffset=0,o.xOrigin=x,o.yOrigin=b,o.smooth=!!s,o.origin=e,o.originIsAbsolute=!!i,t.style[de]="0px 0px",a&&(er(a,o,"xOrigin",l,x),er(a,o,"yOrigin",c,b),er(a,o,"xOffset",d,o.xOffset),er(a,o,"yOffset",u,o.yOffset)),t.setAttribute("data-svg-origin",x+" "+b)},pn=function(t,e){var i=t._gsap||new em(t);if("x"in i&&!e&&!i.uncache)return i;var s=t.style,n=i.scaleX<0,a="px",o="deg",h=getComputedStyle(t),l=ci(t,de)||"0",c,d,u,f,p,m,g,y,v,_,x,b,E,T,w,A,P,L,M,S,C,R,k,F,B,X,I,D,$,z,U,rt;return c=d=u=m=g=y=v=_=x=0,f=p=1,i.svg=!!(t.getCTM&&Tm(t)),h.translate&&((h.translate!=="none"||h.scale!=="none"||h.rotate!=="none")&&(s[At]=(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[At]!=="none"?h[At]:"")),s.scale=s.rotate=s.translate="none"),T=ql(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"),Kl(t,F||l,!!F||i.originIsAbsolute,i.smooth!==!1,T)),b=i.xOrigin||0,E=i.yOrigin||0,T!==fn&&(L=T[0],M=T[1],S=T[2],C=T[3],c=R=T[4],d=k=T[5],T.length===6?(f=Math.sqrt(L*L+M*M),p=Math.sqrt(C*C+S*S),m=L||M?_s(M,L)*Ir:0,v=S||C?_s(S,C)*Ir+m:0,v&&(p*=Math.abs(Math.cos(v*gs))),i.svg&&(c-=b-(b*L+E*S),d-=E-(b*M+E*C))):(rt=T[6],z=T[7],I=T[8],D=T[9],$=T[10],U=T[11],c=T[12],d=T[13],u=T[14],w=_s(rt,$),g=w*Ir,w&&(A=Math.cos(-w),P=Math.sin(-w),F=R*A+I*P,B=k*A+D*P,X=rt*A+$*P,I=R*-P+I*A,D=k*-P+D*A,$=rt*-P+$*A,U=z*-P+U*A,R=F,k=B,rt=X),w=_s(-S,$),y=w*Ir,w&&(A=Math.cos(-w),P=Math.sin(-w),F=L*A-I*P,B=M*A-D*P,X=S*A-$*P,U=C*P+U*A,L=F,M=B,S=X),w=_s(M,L),m=w*Ir,w&&(A=Math.cos(w),P=Math.sin(w),F=L*A+M*P,B=R*A+k*P,M=M*A-L*P,k=k*A-R*P,L=F,R=B),g&&Math.abs(g)+Math.abs(m)>359.9&&(g=m=0,y=180-y),f=Ft(Math.sqrt(L*L+M*M+S*S)),p=Ft(Math.sqrt(k*k+rt*rt)),w=_s(R,k),v=Math.abs(w)>2e-4?w*Ir:0,x=U?1/(U<0?-U:U):0),i.svg&&(F=t.getAttribute("transform"),i.forceCSS=t.setAttribute("transform","")||!Sm(ci(t,At)),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=Ft(f),i.scaleY=Ft(p),i.rotation=Ft(m)+o,i.rotationX=Ft(g)+o,i.rotationY=Ft(y)+o,i.skewX=v+o,i.skewY=_+o,i.transformPerspective=x+a,(i.zOrigin=parseFloat(l.split(" ")[2])||!e&&i.zOrigin||0)&&(s[de]=Za(l)),i.xOffset=i.yOffset=0,i.force3D=me.force3D,i.renderTransform=i.svg?lE:ym?Pm:hE,i.uncache=0,i},Za=function(t){return(t=t.split(" "))[0]+" "+t[1]},Zl=function(t,e,i){var s=te(e);return Ft(parseFloat(e)+parseFloat(ir(t,"x",i+"px",s)))+s},hE=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,Pm(t,e)},Dr="0deg",mn="0px",Br=") ",Pm=function(t,e){var i=e||this,s=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,g=i.transformPerspective,y=i.force3D,v=i.target,_=i.zOrigin,x="",b=y==="auto"&&t&&t!==1||y===!0;if(_&&(d!==Dr||c!==Dr)){var E=parseFloat(c)*gs,T=Math.sin(E),w=Math.cos(E),A;E=parseFloat(d)*gs,A=Math.cos(E),a=Zl(v,a,T*A*-_),o=Zl(v,o,-Math.sin(E)*-_),h=Zl(v,h,w*A*-_+_)}g!==mn&&(x+="perspective("+g+Br),(s||n)&&(x+="translate("+s+"%, "+n+"%) "),(b||a!==mn||o!==mn||h!==mn)&&(x+=h!==mn||b?"translate3d("+a+", "+o+", "+h+") ":"translate("+a+", "+o+Br),l!==Dr&&(x+="rotate("+l+Br),c!==Dr&&(x+="rotateY("+c+Br),d!==Dr&&(x+="rotateX("+d+Br),(u!==Dr||f!==Dr)&&(x+="skew("+u+", "+f+Br),(p!==1||m!==1)&&(x+="scale("+p+", "+m+Br),v.style[At]=x||"translate(0, 0)"},lE=function(t,e){var i=e||this,s=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,g=i.xOffset,y=i.yOffset,v=i.forceCSS,_=parseFloat(a),x=parseFloat(o),b,E,T,w,A;h=parseFloat(h),l=parseFloat(l),c=parseFloat(c),c&&(c=parseFloat(c),l+=c,h+=c),h||l?(h*=gs,l*=gs,b=Math.cos(h)*d,E=Math.sin(h)*d,T=Math.sin(h-l)*-u,w=Math.cos(h-l)*u,l&&(c*=gs,A=Math.tan(l-c),A=Math.sqrt(1+A*A),T*=A,w*=A,c&&(A=Math.tan(c),A=Math.sqrt(1+A*A),b*=A,E*=A)),b=Ft(b),E=Ft(E),T=Ft(T),w=Ft(w)):(b=d,w=u,E=T=0),(_&&!~(a+"").indexOf("px")||x&&!~(o+"").indexOf("px"))&&(_=ir(f,"x",a,"px"),x=ir(f,"y",o,"px")),(p||m||g||y)&&(_=Ft(_+p-(p*b+m*T)+g),x=Ft(x+m-(p*E+m*w)+y)),(s||n)&&(A=f.getBBox(),_=Ft(_+s/100*A.width),x=Ft(x+n/100*A.height)),A="matrix("+b+","+E+","+T+","+w+","+_+","+x+")",f.setAttribute("transform",A),v&&(f.style[At]=A)},cE=function(t,e,i,s,n){var a=360,o=zt(n),h=parseFloat(n)*(o&&~n.indexOf("rad")?Ir:1),l=h-s,c=s+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*fm)%a-~~(l/a)*a:d==="ccw"&&l>0&&(l=(l-a*fm)%a-~~(l/a)*a)),t._pt=u=new ce(t._pt,e,i,s,l,YT),u.e=c,u.u="deg",t._props.push(i),u},Rm=function(t,e){for(var i in e)t[i]=e[i];return t},uE=function(t,e,i){var s=Rm({},i._gsap),n="perspective,force3D,transformOrigin,svgOrigin",a=i.style,o,h,l,c,d,u,f,p;s.svg?(l=i.getAttribute("transform"),i.setAttribute("transform",""),a[At]=e,o=pn(i,1),Mr(i,At),i.setAttribute("transform",l)):(l=getComputedStyle(i)[At],a[At]=e,o=pn(i,1),a[At]=l);for(h in Mi)l=s[h],c=o[h],l!==c&&n.indexOf(h)<0&&(f=te(l),p=te(c),d=f!==p?ir(i,h,l,p):parseFloat(l),u=parseFloat(c),t._pt=new ce(t._pt,o,h,d,u-d,$l),t._pt.u=p||0,t._props.push(h));Rm(o,s)};le("padding,margin,Width,Radius",function(r,t){var e="Top",i="Right",s="Bottom",n="Left",a=(t<3?[e,i,s,n]:[e+n,e+i,s+i,s+n]).map(function(o){return t<2?r+o:"border"+o+r});Ka[t>1?"border"+r:r]=function(o,h,l,c,d){var u,f;if(arguments.length<4)return u=a.map(function(p){return Di(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 Im={name:"css",register:Yl,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,i,s,n){var a=this._props,o=t.style,h=i.vars.startAt,l,c,d,u,f,p,m,g,y,v,_,x,b,E,T,w;Hl||Yl(),this.styles=this.styles||_m(t),w=this.styles.props,this.tween=i;for(m in e)if(m!=="autoRound"&&(c=e[m],!(_e[m]&&im(m,e,i,s,t,n)))){if(f=typeof c,p=Ka[m],f==="function"&&(c=c.call(i,s,t,n),f=typeof c),f==="string"&&~c.indexOf("random(")&&(c=on(c)),p)p(this,t,m,c,i)&&(T=1);else if(m.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(m)+"").trim(),c+="",Qi.lastIndex=0,Qi.test(l)||(g=te(l),y=te(c)),y?g!==y&&(l=ir(t,m,l,y)+y):g&&(c+=g),this.add(o,"setProperty",l,c,s,n,0,0,m),a.push(m),w.push(m,0,o[m]);else if(f!=="undefined"){if(h&&m in h?(l=typeof h[m]=="function"?h[m].call(i,s,t,n):h[m],zt(l)&&~l.indexOf("random(")&&(l=on(l)),te(l+"")||l==="auto"||(l+=me.units[m]||te(Di(t,m))||""),(l+"").charAt(1)==="="&&(l=Di(t,m))):l=Di(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 li&&(m==="autoAlpha"&&(u===1&&Di(t,"visibility")==="hidden"&&d&&(u=0),w.push("visibility",0,o.visibility),er(this,o,"visibility",u?"inherit":"hidden",d?"inherit":"hidden",!d)),m!=="scale"&&m!=="transform"&&(m=li[m],~m.indexOf(",")&&(m=m.split(",")[0]))),_=m in Mi,_){if(this.styles.save(m),x||(b=t._gsap,b.renderTransform&&!e.parseTransform||pn(t,e.parseTransform),E=e.smoothOrigin!==!1&&b.smooth,x=this._pt=new ce(this._pt,o,At,0,1,b.renderTransform,b,0,-1),x.dep=1),m==="scale")this._pt=new ce(this._pt,b,"scaleY",b.scaleY,(v?cs(b.scaleY,v+d):d)-b.scaleY||0,$l),this._pt.u=0,a.push("scaleY",m),m+="X";else if(m==="transformOrigin"){w.push(de,0,o[de]),c=aE(c),b.svg?Kl(t,c,0,E,0,this):(y=parseFloat(c.split(" ")[2])||0,y!==b.zOrigin&&er(this,b,"zOrigin",b.zOrigin,y),er(this,o,m,Za(l),Za(c)));continue}else if(m==="svgOrigin"){Kl(t,c,1,E,0,this);continue}else if(m in Am){cE(this,b,m,u,v?cs(u,v+c):c);continue}else if(m==="smoothOrigin"){er(this,b,"smooth",b.smooth,c);continue}else if(m==="force3D"){b[m]=c;continue}else if(m==="transform"){uE(this,c,t);continue}}else m in o||(m=ys(m)||m);if(_||(d||d===0)&&(u||u===0)&&!zT.test(c)&&m in o)g=(l+"").substr((u+"").length),d||(d=0),y=te(c)||(m in me.units?me.units[m]:g),g!==y&&(u=ir(t,m,l,y)),this._pt=new ce(this._pt,_?b:o,m,u,(v?cs(u,v+d):d)-u,!_&&(y==="px"||m==="zIndex")&&e.autoRound!==!1?qT:$l),this._pt.u=y||0,g!==y&&y!=="%"&&(this._pt.b=l,this._pt.r=jT);else if(m in o)nE.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,s,n);else if(m!=="parseTransform"){xl(m,c);continue}_||(m in o?w.push(m,0,o[m]):w.push(m,1,l||t[m])),a.push(m)}}T&&hm(this)},render:function(t,e){if(e.tween._time||!Xl())for(var i=e._pt;i;)i.r(t,i.d),i=i._next;else e.styles.revert()},get:Di,aliases:li,getSetter:function(t,e,i){var s=li[e];return s&&s.indexOf(",")<0&&(e=s),e in Mi&&e!==de&&(t._gsap.x||Di(t,"x"))?i&&dm===i?e==="scale"?JT:QT:(dm=i||{})&&(e==="scale"?tE:eE):t.style&&!fl(t.style[e])?KT:~e.indexOf("-")?ZT:Nl(t,e)},core:{_removeProperty:Mr,_getMatrix:ql}};ue.utils.checkPrefix=ys,ue.core.getStyleSaver=_m,function(r,t,e,i){var s=le(r+","+t+","+e,function(n){Mi[n]=1});le(t,function(n){me.units[n]="deg",Am[n]=1}),li[s[13]]=r+","+t,le(i,function(n){var a=n.split(":");li[a[1]]=s[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"),le("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){me.units[r]="px"}),ue.registerPlugin(Im);var gn=ue.registerPlugin(Im)||ue;gn.core.Tween;class Ql extends tn{constructor(t){super(),this.enableTint=!0,this.bgColor="#fff";const{x:e=0,y:i=0,width:s=0,height:n=0,bgColor:a="#fff",enableTint:o=!0}=t;this.x=e,this.y=i,this.enableTint=o,this.bgColor=a,this.renderBg(s,n)}updateColor(t){gn.to(this,{tint:t,duration:.25})}renderBg(t,e){this.clear(),this.enableTint?(this.beginFill("#fff"),this.tint=this.bgColor):this.beginFill(this.bgColor),this.drawRect(0,0,t,e),this.endFill()}}new Ql({width:100,height:100,bgColor:"red"});class dE extends $t{constructor(t){super();const{width:e,height:i,overHidden:s,bgColor:n}=t;if(s){const a=new tn;a.beginFill(16777215),a.drawRect(0,0,e,i),a.endFill(),this.addChild(a),this.mask=a}n?(this._bgColorFill=new Ql({width:e,height:i,bgColor:n}),this.addChild(this._bgColorFill)):(this._fill=new Ci,this._fill.width=e,this._fill.height=i,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
|
+
* @pixi/particle-emitter - v5.0.8
|
|
1165
|
+
* Compiled Mon, 28 Nov 2022 04:01:38 UTC
|
|
1166
|
+
*
|
|
1167
|
+
* @pixi/particle-emitter is licensed under the MIT License.
|
|
1168
|
+
* http://www.opensource.org/licenses/mit-license
|
|
1169
|
+
*/class ui{constructor(t,e,i){this.value=t,this.time=e,this.next=null,this.isStepped=!1,i?this.ease=typeof i=="function"?i:Bm(i):this.ease=null}static createList(t){if("list"in t){const i=t.list;let s;const{value:n,time:a}=i[0],o=s=new ui(typeof n=="string"?Ja(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];s.next=new ui(typeof l=="string"?Ja(l):l,c),s=s.next}return o.isStepped=!!t.isStepped,o}const e=new ui(typeof t.start=="string"?Ja(t.start):t.start,0);return t.end!==t.start&&(e.next=new ui(typeof t.end=="string"?Ja(t.end):t.end,1)),e}}let _n=W.from;const di=Math.PI/180;function Bi(r,t){if(!r)return;const e=Math.sin(r),i=Math.cos(r),s=t.x*i-t.y*e,n=t.x*e+t.y*i;t.x=s,t.y=n}function Qa(r,t,e){return r<<16|t<<8|e}function Mm(r){return Math.sqrt(r.x*r.x+r.y*r.y)}function fE(r){const t=1/Mm(r);r.x*=t,r.y*=t}function Dm(r,t){r.x*=t,r.y*=t}function Ja(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 Bm(r){const t=r.length,e=1/t;return function(i){const s=t*i|0,n=(i-s*e)*t,a=r[s]||r[t-1];return a.s+n*(2*(1-n)*(a.cp-a.s)+n*(a.e-a.s))}}function pE(r){return r?(r=r.toUpperCase().replace(/ /g,"_"),K[r]||K.NORMAL):K.NORMAL}class Jl extends Ci{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 _t;(function(r){r[r.Spawn=0]="Spawn",r[r.Normal=2]="Normal",r[r.Late=5]="Late"})(_t||(_t={}));const tc=Wt.shared,Or=Symbol("Position particle per emitter position");class ct{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){ct.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:Bm(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 s=ct.knownBehaviors[i.type];return s?new s(i.config):(console.error(`Unknown behavior: ${i.type}`),null)}).filter(i=>!!i);e.push(Or),e.sort((i,s)=>i===Or?s.order===_t.Spawn?1:-1:s===Or?i.order===_t.Spawn?-1:1:i.order-s.order),this.initBehaviors=e.slice(),this.updateBehaviors=e.filter(i=>i!==Or&&i.updateParticle),this.recycleBehaviors=e.filter(i=>i!==Or&&i.recycleParticle)}getBehavior(t){return ct.knownBehaviors[t]&&this.initBehaviors.find(e=>e instanceof ct.knownBehaviors[t])||null}fillPool(t){for(;t>0;--t){const e=new Jl(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,Bi(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?tc.remove(this.update,this):!this._autoUpdate&&t&&tc.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=tc.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 s=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=(s-e)*c+e,o=(n-i)*c+i}else a=s,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 Jl(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===Or)for(let u=h,f;u;u=f){f=u.next,this.rotation!==0&&(Bi(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=s,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,s=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 Jl(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?(s.next=o,o.prev=s,s=o):s=i=o,++this.particleCount}if(i){this._activeParticlesLast?(this._activeParticlesLast.next=i,i.prev=this._activeParticlesLast,this._activeParticlesLast=s):(this._activeParticlesFirst=i,this._activeParticlesLast=s);for(let n=0;n<this.initBehaviors.length;++n){const a=this.initBehaviors[n];if(a===Or)for(let o=i,h;o;o=h)h=o.next,this.rotation!==0&&(Bi(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}}ct.knownBehaviors={};class ec{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}}ec.type="rect",ec.editorConfig=null;class to{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),Bi(e,t.position),t.position.x+=this.x,t.position.y+=this.y}}to.type="torus",to.editorConfig=null;class ic{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 s=i[0];for(let n=1;n<i.length;++n){const a=i[n];this.segments.push({p1:s,p2:a,l:0}),s=a}}else{let e=t[0];for(let i=1;i<t.length;++i){const s=t[i];this.segments.push({p1:e,p2:s,l:0}),e=s}}for(let e=0;e<this.segments.length;++e){const{p1:i,p2:s}=this.segments[e],n=Math.sqrt((s.x-i.x)*(s.x-i.x)+(s.y-i.y)*(s.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,s;if(this.segments.length===1)i=this.segments[0],s=e;else for(let o=0;o<this.countingLengths.length;++o)if(e<this.countingLengths[o]){i=this.segments[o],s=o===0?e:e-this.countingLengths[o-1];break}s/=i.l||1;const{p1:n,p2:a}=i;t.x=n.x+s*(a.x-n.x),t.y=n.y+s*(a.y-n.y)}}ic.type="polygonalChain",ic.editorConfig=null;class rc{constructor(t){var e;this.order=_t.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),Bi(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const i=t.config.velocity,s=i.x,n=i.y;if(i.x+=this.accel.x*e,i.y+=this.accel.y*e,this.maxSpeed){const a=Mm(i);a>this.maxSpeed&&Dm(i,this.maxSpeed/a)}t.x+=(s+i.x)/2*e,t.y+=(n+i.y)/2*e,this.rotate&&(t.rotation=Math.atan2(i.y,i.x))}}rc.type="moveAcceleration",rc.editorConfig=null;function mE(r){return this.ease&&(r=this.ease(r)),(this.first.next.value-this.first.value)*r+this.first.value}function gE(r){this.ease&&(r=this.ease(r));const t=this.first.value,e=this.first.next.value,i=(e.r-t.r)*r+t.r,s=(e.g-t.g)*r+t.g,n=(e.b-t.b)*r+t.b;return Qa(i,s,n)}function _E(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 yE(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 i=t.value,s=e.value,n=(s.r-i.r)*r+i.r,a=(s.g-i.g)*r+i.g,o=(s.b-i.b)*r+i.b;return Qa(n,a,o)}function xE(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 vE(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 Qa(e.r,e.g,e.b)}class yn{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?gE:mE:t.isStepped?this.interpolate=this.isColor?vE:xE:this.interpolate=this.isColor?yE:_E,this.ease=this.first.ease}}class sc{constructor(t){this.order=_t.Normal,this.list=new yn(!1),this.list.reset(ui.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)}}sc.type="alpha",sc.editorConfig=null;class nc{constructor(t){this.order=_t.Normal,this.value=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.value,e=e.next}}nc.type="alphaStatic",nc.editorConfig=null;function Om(r){const t=[];for(let e=0;e<r.length;++e){let i=r[e];if(typeof i=="string")t.push(_n(i));else if(i instanceof W)t.push(i);else{let s=i.count||1;for(typeof i.texture=="string"?i=_n(i.texture):i=i.texture;s>0;--s)t.push(i)}}return t}class ac{constructor(t){this.order=_t.Normal,this.anims=[];for(let e=0;e<t.anims.length;++e){const i=t.anims[e],s=Om(i.textures),n=i.framerate<0?-1:i.framerate>0?i.framerate:60,a={textures:s,duration:n>0?s.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),s=e.config.anim=this.anims[i];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 i=t.config,s=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=s.textures[n]||s.textures[s.textures.length-1]||W.EMPTY}}ac.type="animatedRandom",ac.editorConfig=null;class oc{constructor(t){this.order=_t.Normal;const e=t.anim,i=Om(e.textures),s=e.framerate<0?-1:e.framerate>0?e.framerate:60;this.anim={textures:i,duration:s>0?i.length/s:0,framerate:s,loop:s>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,s=t.config;s.animElapsed+=e,s.animElapsed>=s.animDuration&&(i.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]||W.EMPTY}}oc.type="animatedSingle",oc.editorConfig=null;class hc{constructor(t){this.order=_t.Normal,this.value=t.blendMode}initParticles(t){let e=t;for(;e;)e.blendMode=pE(this.value),e=e.next}}hc.type="blendMode",hc.editorConfig=null;class lc{constructor(t){this.order=_t.Spawn,this.spacing=t.spacing*di,this.start=t.start*di,this.distance=t.distance}initParticles(t){let e=0,i=t;for(;i;){let s;this.spacing?s=this.start+this.spacing*e:s=Math.random()*Math.PI*2,i.rotation=s,this.distance&&(i.position.x=this.distance,Bi(s,i.position)),i=i.next,++e}}}lc.type="spawnBurst",lc.editorConfig=null;class cc{constructor(t){this.order=_t.Normal,this.list=new yn(!0),this.list.reset(ui.createList(t.color))}initParticles(t){let e=t;const i=this.list.first.value,s=Qa(i.r,i.g,i.b);for(;e;)e.tint=s,e=e.next}updateParticle(t){t.tint=this.list.interpolate(t.agePercent)}}cc.type="color",cc.editorConfig=null;class uc{constructor(t){this.order=_t.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}}uc.type="colorStatic",uc.editorConfig=null;class dc{constructor(t){this.order=_t.Normal,this.index=0,this.textures=t.textures.map(e=>typeof e=="string"?_n(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}}dc.type="textureOrdered",dc.editorConfig=null;const xs=new tt,Fm=["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"],bE=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(Fm).join("|"),"g");function TE(r){const t=r.match(bE);for(let e=t.length-1;e>=0;--e)Fm.indexOf(t[e])>=0&&(t[e]=`Math.${t[e]}`);return r=t.join(""),new Function("x",`return ${r};`)}class fc{constructor(t){var e;if(this.order=_t.Late,t.path)if(typeof t.path=="function")this.path=t.path;else try{this.path=TE(t.path)}catch{this.path=null}else this.path=i=>i;this.list=new yn(!1),this.list.reset(ui.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,xs.x=t.config.movement,xs.y=this.path(xs.x),Bi(t.config.initRotation,xs),t.position.x=t.config.initPosition.x+xs.x,t.position.y=t.config.initPosition.y+xs.y}}fc.type="movePath",fc.editorConfig=null;class pc{constructor(){this.order=_t.Spawn}initParticles(t){}}pc.type="spawnPoint",pc.editorConfig=null;class mc{constructor(t){this.order=_t.Normal,this.textures=t.textures.map(e=>typeof e=="string"?_n(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}}}mc.type="textureRandom",mc.editorConfig=null;class gc{constructor(t){this.order=_t.Normal,this.minStart=t.minStart*di,this.maxStart=t.maxStart*di,this.minSpeed=t.minSpeed*di,this.maxSpeed=t.maxSpeed*di,this.accel=t.accel*di}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}}gc.type="rotation",gc.editorConfig=null;class _c{constructor(t){this.order=_t.Normal,this.min=t.min*di,this.max=t.max*di}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}}_c.type="rotationStatic",_c.editorConfig=null;class yc{constructor(t){this.order=_t.Late+1,this.rotation=(t.rotation||0)*di}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}}yc.type="noRotation",yc.editorConfig=null;class xc{constructor(t){var e;this.order=_t.Normal,this.list=new yn(!1),this.list.reset(ui.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}}xc.type="scale",xc.editorConfig=null;class vc{constructor(t){this.order=_t.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}}}vc.type="scaleStatic",vc.editorConfig=null;class We{constructor(t){this.order=_t.Spawn;const e=We.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){We.shapes[e||t.type]=t}initParticles(t){let e=t;for(;e;)this.shape.getRandPos(e),e=e.next}}We.type="spawnShape",We.editorConfig=null,We.shapes={},We.registerShape(ic),We.registerShape(ec),We.registerShape(to),We.registerShape(to,"circle");class bc{constructor(t){this.order=_t.Normal,this.texture=typeof t.texture=="string"?_n(t.texture):t.texture}initParticles(t){let e=t;for(;e;)e.texture=this.texture,e=e.next}}bc.type="textureSingle",bc.editorConfig=null;class Tc{constructor(t){var e;this.order=_t.Late,this.list=new yn(!1),this.list.reset(ui.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),Bi(e.rotation,e.config.velocity),e=e.next}}updateParticle(t,e){const i=this.list.interpolate(t.agePercent)*t.config.speedMult,s=t.config.velocity;fE(s),Dm(s,i),t.x+=s.x*e,t.y+=s.y*e}}Tc.type="moveSpeed",Tc.editorConfig=null;class Ec{constructor(t){this.order=_t.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),Bi(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}}Ec.type="moveSpeedStatic",Ec.editorConfig=null,ct.registerBehavior(rc),ct.registerBehavior(sc),ct.registerBehavior(nc),ct.registerBehavior(ac),ct.registerBehavior(oc),ct.registerBehavior(hc),ct.registerBehavior(lc),ct.registerBehavior(cc),ct.registerBehavior(uc),ct.registerBehavior(dc),ct.registerBehavior(fc),ct.registerBehavior(pc),ct.registerBehavior(mc),ct.registerBehavior(gc),ct.registerBehavior(_c),ct.registerBehavior(yc),ct.registerBehavior(xc),ct.registerBehavior(vc),ct.registerBehavior(We),ct.registerBehavior(bc),ct.registerBehavior(Tc),ct.registerBehavior(Ec);class Lm extends sl{constructor(t){const{text:e,fontSize:i=36,fontColor:s=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,g=new Pi({fontSize:i,wordWrap:c,wordWrapWidth:d,fontWeight:l,lineHeight:u*i,breakWords:c,fill:s,align:f,fontFamily:h,stroke:n?a:"transparent",strokeThickness:n?o: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*i}}class EE extends $t{constructor(t){super();const{start:e,control:i,end:s,json:n,duration:a,ease:o="power1.out",showControl:h=!1,loop:l=!1}=t;this._particleContainer=new vb,this.addChild(this._particleContainer);const c=new ct(this._particleContainer,n),d=this._createBezierPoints([e,...i,s],100,h),u={pathThrough:0};gn.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:()=>{gn.to(this,{alpha:0,duration:.5,onComplete:()=>{c.emit=!1,f.destroy(),this.removeFromParent()}})}});const f=new Wt;f.add(()=>{c.update(1/75)}),f.start()}_createBezierPoints(t,e,i){const s=[];i&&t.forEach((n,a)=>{const o=new Lm({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);s.push(a)}return s}_multiPointBezier(t,e){const i=t.length;let s=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);s+=h.x*d*c*l,n+=h.y*d*c*l}return{x:s,y:n}}_binomial(t,e){if(e===0||e===t)return 1;let i=1;for(let s=1;s<=e;s++)i=i*(t-s+1)/s;return i}}var fi=(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))(fi||{}),j=(r=>(r[r.setup=0]="setup",r[r.first=1]="first",r[r.replace=2]="replace",r[r.add=3]="add",r))(j||{}),ve=(r=>(r[r.mixIn=0]="mixIn",r[r.mixOut=1]="mixOut",r))(ve||{}),eo=(r=>(r[r.Fixed=0]="Fixed",r[r.Percent=1]="Percent",r))(eo||{}),Fr=(r=>(r[r.Tangent=0]="Tangent",r[r.Chain=1]="Chain",r[r.ChainScale=2]="ChainScale",r))(Fr||{}),ee=(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))(ee||{});class Nm{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 wE{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 Lr=class{constructor(r=0,t=0,e=0,i=0){this.r=r,this.g=t,this.b=e,this.a=i}set(r,t,e,i){return this.r=r,this.g=t,this.b=e,this.a=i,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,i){return this.r+=r,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(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 Lr().setFromString(r)}};let be=Lr;be.WHITE=new Lr(1,1,1,1),be.RED=new Lr(1,0,0,1),be.GREEN=new Lr(0,1,0,1),be.BLUE=new Lr(0,0,1,1),be.MAGENTA=new Lr(1,0,1,1);const Oi=class{static clamp(r,t,e){return r<t?t:r>e?e:r}static cosDeg(r){return Math.cos(r*Oi.degRad)}static sinDeg(r){return Math.sin(r*Oi.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 Oi.randomTriangularWith(r,t,(r+t)*.5)}static randomTriangularWith(r,t,e){const i=Math.random(),s=t-r;return i<=(e-r)/s?r+Math.sqrt(i*s*(e-r)):t-Math.sqrt((1-i)*s*(t-e))}static isPowerOfTwo(r){return r&&(r&r-1)===0}};let N=Oi;N.PI=3.1415927,N.PI2=Oi.PI*2,N.radiansToDegrees=180/Oi.PI,N.radDeg=Oi.radiansToDegrees,N.degreesToRadians=Oi.PI/180,N.degRad=Oi.degreesToRadians;class AE{apply(t,e,i){return t+(e-t)*this.applyInternal(i)}}class SE extends AE{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 CE extends SE{applyInternal(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1}}const vs=class{static arrayCopy(r,t,e,i,s){for(let n=t,a=i;n<t+s;n++,a++)e[a]=r[n]}static arrayFill(r,t,e,i){for(let s=t;s<e;s++)r[s]=i}static setArraySize(r,t,e=0){const i=r.length;if(i==t)return r;if(r.length=t,i<t)for(let s=i;s<t;s++)r[s]=e;return r}static ensureArrayCapacity(r,t,e=0){return r.length>=t?r:vs.setArraySize(r,t,e)}static newArray(r,t){const e=new Array(r);for(let i=0;i<r;i++)e[i]=t;return e}static newFloatArray(r){if(vs.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(vs.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 vs.SUPPORTS_TYPED_ARRAYS?new Float32Array(r):r}static toSinglePrecision(r){return vs.SUPPORTS_TYPED_ARRAYS?Math.fround(r):r}static webkit602BugfixHelper(r,t){}static contains(r,t,e=!0){for(let i=0;i<r.length;i++)if(r[i]==t)return!0;return!1}static enumValue(r,t){return r[t[0].toUpperCase()+t.slice(1)]}};let Q=vs;Q.SUPPORTS_TYPED_ARRAYS=typeof Float32Array<"u";class PE{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 RE{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 IE={yDown:!0,FAIL_ON_NON_EXISTING_SKIN:!1,GLOBAL_AUTO_UPDATE:!0,GLOBAL_DELAY_LIMIT:0},rr=[0,0,0];class ME extends Ci{constructor(){super(...arguments),this.region=null,this.attachment=null}}class DE extends xb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.region=null,this.attachment=null}}const km=class extends $t{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 i=this.skeleton.slots[t],s=i.getAttachment(),n=this.newContainer();if(this.slotContainers.push(n),this.addChild(n),this.tempClipContainers.push(null),!!s)if(s.type===fi.Region){const a=s.name,o=this.createSprite(i,s,a);i.currentSprite=o,i.currentSpriteName=a,n.addChild(o)}else if(s.type===fi.Mesh){const a=this.createMesh(i,s);i.currentMesh=a,i.currentMeshId=s.id,i.currentMeshName=s.name,n.addChild(a)}else s.type===fi.Clipping&&(this.createGraphics(i,s),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(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?km.prototype.autoUpdateTransform:$t.prototype.updateTransform)}get tint(){return Yn(this.tintRgb)}set tint(r){this.tintRgb=Ly(r,this.tintRgb)}get delayLimit(){return(typeof this.localDelayLimit<"u"?this.localDelayLimit:IE.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,i=this.color;let s=null,n=null;i?(s=i.light,n=i.dark):s=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 fi.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 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,g),u.currentSprite.color?m=u.currentSprite.color:(rr[0]=s[0]*u.color.r*y.r,rr[1]=s[1]*u.color.g*y.g,rr[2]=s[2]*u.color.b*y.b,u.currentSprite.tint=Yn(rr)),u.currentSprite.blendMode=u.blendMode;break;case fi.Mesh:if(u.currentSprite){u.currentSprite.visible=!1,u.currentSprite=null,u.currentSpriteName=void 0;const x=new ra;x._parentID=-1,x._worldID=p.transform._worldID,p.transform=x}if(!g){u.currentMesh&&(u.currentMesh.renderable=!1);break}const _=f.id;if(u.currentMeshId===void 0||u.currentMeshId!==_){const x=_;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:(rr[0]=s[0]*u.color.r*y.r,rr[1]=s[1]*u.color.g*y.g,rr[2]=s[2]*u.color.b*y.b,u.currentMesh.tint=Yn(rr)),u.currentMesh.blendMode=u.blendMode,u.hackRegion||this.setMeshRegion(f,u.currentMesh,g);break;case fi.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,_=u.color.g*y.g,x=u.color.b*y.b;m.setLight(s[0]*v+n[0]*(1-v),s[1]*_+n[1]*(1-_),s[2]*x+n[2]*(1-x)),u.darkColor?(v=u.darkColor.r,_=u.darkColor.g,x=u.darkColor.b):(v=0,_=0,x=0),m.setDark(s[0]*v+n[0]*(1-v),s[1]*_+n[1]*(1-_),s[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(r,t,e){t.attachment===r&&t.region===e||(t.region=e,t.attachment=r,t.texture=e.texture,t.rotation=r.rotation*N.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)}$t.prototype.updateTransform.call(this)}createSprite(r,t,e){let i=t.region;r.hackAttachment===t&&(i=r.hackRegion);const s=i?i.texture:null,n=this.newSprite(s);return n.anchor.set(.5),i&&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 i=this.newMesh(e?e.texture:null,new Float32Array(t.regionUVs.length),t.regionUVs,new Uint16Array(t.triangles),Le.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),r.meshes=r.meshes||{},r.meshes[t.id]=i,i}createGraphics(r,t){const e=this.newGraphics(),i=new Hi([]);return e.clear(),e.beginFill(16777215,1),e.drawPolygon(i),e.renderable=!1,r.currentGraphics=e,r.clippingContainer=this.newContainer(),r.clippingContainer.mask=r.currentGraphics,e}updateGraphics(r,t){const e=r.currentGraphics.geometry,i=e.graphicsData[0].shape.points,s=t.worldVerticesLength;i.length=s,t.computeWorldVertices(r,0,s,i,0,2),e.invalidate()}hackTextureBySlotIndex(r,t=null,e=null){const i=this.skeleton.slots[r];if(!i)return!1;const s=i.getAttachment();let n=s.region;return t?(n=new Nm,n.texture=t,n.size=e,i.hackRegion=n,i.hackAttachment=s):(i.hackRegion=null,i.hackAttachment=null),i.currentSprite?this.setSpriteRegion(s,i.currentSprite,n):i.currentMesh&&this.setMeshRegion(s,i.currentMesh,n),!0}hackTextureBySlotName(r,t=null,e=null){const i=this.skeleton.findSlotIndex(r);return i==-1?!1:this.hackTextureBySlotIndex(i,t,e)}hackTextureAttachment(r,t,e,i=null){const s=this.skeleton.findSlotIndex(r),n=this.skeleton.getAttachmentByName(r,t);n.region.texture=e;const a=this.skeleton.slots[s];if(!a)return!1;const o=a.getAttachment();if(t===o.name){let h=n.region;return e?(h=new Nm,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 $t}newSprite(r){return new ME(r)}newGraphics(){return new tn}newMesh(r,t,e,i,s){return new DE(r,t,e,i,s)}transformHack(){return 1}hackAttachmentGroups(r,t,e){if(!r)return;const i=[],s=[];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(r)?(l.parentGroup=t,s.push(l)):e&&l&&(l.parentGroup=e,i.push(l))}return[i,s]}destroy(r){this.debug=null;for(let t=0,e=this.skeleton.slots.length;t<e;t++){const i=this.skeleton.slots[t];for(const s in i.meshes)i.meshes[s].destroy(r);i.meshes=null;for(const s in i.sprites)i.sprites[s].destroy(r);i.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 wc=km;wc.clippingPolygon=[],Object.defineProperty(wc.prototype,"visible",{get(){return this._visible},set(r){r!==this._visible&&(this._visible=r,r&&(this.lastTime=0))}});class Um{constructor(t){if(t==null)throw new Error("name cannot be null.");this.name=t}}const Gm=class extends Um{constructor(r){super(r),this.id=(Gm.nextID++&65535)<<11,this.worldVerticesLength=0,this.deformAttachment=this}computeWorldVerticesOld(r,t){this.computeWorldVertices(r,0,this.worldVerticesLength,t,0,2)}computeWorldVertices(r,t,e,i,s,n){e=s+(e>>1)*n;const a=r.bone.skeleton,o=r.deform;let h=this.vertices;const l=this.bones;if(l==null){o.length>0&&(h=o);const f=r.bone.matrix,p=f.tx,m=f.ty,g=f.a,y=f.c,v=f.b,_=f.d;for(let x=t,b=s;b<e;x+=2,b+=n){const E=h[x],T=h[x+1];i[b]=E*g+T*y+p,i[b+1]=E*v+T*_+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=s,p=d*3;f<e;f+=n){let m=0,g=0,y=l[c++];for(y+=c;c<y;c++,p+=3){const v=u[l[c]].matrix,_=h[p],x=h[p+1],b=h[p+2];m+=(_*v.a+x*v.c+v.tx)*b,g+=(_*v.b+x*v.d+v.ty)*b}i[f]=m,i[f+1]=g}else{const f=o;for(let p=s,m=d*3,g=d<<1;p<e;p+=n){let y=0,v=0,_=l[c++];for(_+=c;c<_;c++,m+=3,g+=2){const x=u[l[c]].matrix,b=h[m]+f[g],E=h[m+1]+f[g+1],T=h[m+2];y+=(b*x.a+E*x.c+x.tx)*T,v+=(b*x.b+E*x.d+x.ty)*T}i[p]=y,i[p+1]=v}}}copyTo(r){this.bones!=null?(r.bones=new Array(this.bones.length),Q.arrayCopy(this.bones,0,r.bones,0,this.bones.length)):r.bones=null,this.vertices!=null?(r.vertices=Q.newFloatArray(this.vertices.length),Q.arrayCopy(this.vertices,0,r.vertices,0,this.vertices.length)):r.vertices=null,r.worldVerticesLength=this.worldVerticesLength,r.deformAttachment=this.deformAttachment}};let Ac=Gm;Ac.nextID=0;class io extends Ac{constructor(t){super(t),this.type=fi.Mesh,this.color=new be(1,1,1,1),this.tempColor=new be(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 io(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 io(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 xn extends Ac{constructor(t){super(t),this.type=fi.Path,this.closed=!1,this.constantSpeed=!1,this.color=new be(1,1,1,1)}copy(){const t=new xn(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 Vm{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 be,this.darkColor=t.darkColor==null?null:new be,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 jt=class extends Um{constructor(r){super(r),this.type=fi.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 be(1,1,1,1),this.offset=Q.newFloatArray(8),this.uvs=Q.newFloatArray(8),this.tempColor=new be(1,1,1,1)}updateOffset(){const r=this.width/this.region.originalWidth*this.scaleX,t=this.height/this.region.originalHeight*this.scaleY,e=-this.width/2*this.scaleX+this.region.offsetX*r,i=-this.height/2*this.scaleY+this.region.offsetY*t,s=e+this.region.width*r,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=s*o+this.x,p=s*h,m=n*o+this.y,g=n*h,y=this.offset;y[jt.OX1]=l-u,y[jt.OY1]=d+c,y[jt.OX2]=l-g,y[jt.OY2]=m+c,y[jt.OX3]=f-g,y[jt.OY3]=m+p,y[jt.OX4]=f-u,y[jt.OY4]=d+p}setRegion(r){this.region=r;const t=this.uvs;r.rotate?(t[2]=r.u,t[3]=r.v2,t[4]=r.u,t[5]=r.v,t[6]=r.u2,t[7]=r.v,t[0]=r.u2,t[1]=r.v2):(t[0]=r.u,t[1]=r.v2,t[2]=r.u,t[3]=r.v,t[4]=r.u2,t[5]=r.v,t[6]=r.u2,t[7]=r.v2)}computeWorldVertices(r,t,e,i){const s=this.offset,n=r instanceof Vm?r.bone.matrix:r.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=s[jt.OX1],f=s[jt.OY1],t[e]=u*h+f*l+a,t[e+1]=u*c+f*d+o,e+=i,u=s[jt.OX2],f=s[jt.OY2],t[e]=u*h+f*l+a,t[e+1]=u*c+f*d+o,e+=i,u=s[jt.OX3],f=s[jt.OY3],t[e]=u*h+f*l+a,t[e+1]=u*c+f*d+o,e+=i,u=s[jt.OX4],f=s[jt.OY4],t[e]=u*h+f*l+a,t[e+1]=u*c+f*d+o}copy(){const r=new jt(this.name);return r.region=this.region,r.rendererObject=this.rendererObject,r.path=this.path,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,Q.arrayCopy(this.uvs,0,r.uvs,0,8),Q.arrayCopy(this.offset,0,r.offset,0,8),r.color.setFromColor(this.color),r}};let et=jt;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 CE(2);class fe{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 s=0;s<e.length;s++)this.timelineIds[e[s].getPropertyId()]=!0;this.duration=i}hasTimeline(t){return this.timelineIds[t]==!0}apply(t,e,i,s,n,a,o,h){if(t==null)throw new Error("skeleton cannot be null.");s&&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 s=0,n=t.length/i-2;if(n==0)return i;let a=n>>>1;for(;;){if(t[(a+1)*i]<=e?s=a+1:n=a,s==n)return(s+1)*i;a=s+n>>>1}}static linearSearch(t,e,i){for(let s=0,n=t.length-i;s<=n;s+=i)if(t[s]>e)return s;return-1}}const Lt=class{constructor(r){if(r<=0)throw new Error(`frameCount must be > 0: ${r}`);this.curves=Q.newFloatArray((r-1)*Lt.BEZIER_SIZE)}getFrameCount(){return this.curves.length/Lt.BEZIER_SIZE+1}setLinear(r){this.curves[r*Lt.BEZIER_SIZE]=Lt.LINEAR}setStepped(r){this.curves[r*Lt.BEZIER_SIZE]=Lt.STEPPED}getCurveType(r){const t=r*Lt.BEZIER_SIZE;if(t==this.curves.length)return Lt.LINEAR;const e=this.curves[t];return e==Lt.LINEAR?Lt.LINEAR:e==Lt.STEPPED?Lt.STEPPED:Lt.BEZIER}setCurve(r,t,e,i,s){const n=(-t*2+i)*.03,a=(-e*2+s)*.03,o=((t-i)*3+1)*.006,h=((e-s)*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=r*Lt.BEZIER_SIZE;const p=this.curves;p[f++]=Lt.BEZIER;let m=d,g=u;for(let y=f+Lt.BEZIER_SIZE-1;f<y;f+=2)p[f]=m,p[f+1]=g,d+=l,u+=c,l+=o,c+=h,m+=d,g+=u}getCurvePercent(r,t){t=N.clamp(t,0,1);const e=this.curves;let i=r*Lt.BEZIER_SIZE;const s=e[i];if(s==Lt.LINEAR)return t;if(s==Lt.STEPPED)return 0;i++;let n=0;for(let o=i,h=i+Lt.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 De=Lt;De.LINEAR=0,De.STEPPED=1,De.BEZIER=2,De.BEZIER_SIZE=10*2-1;const sr=class extends De{constructor(r){super(r),this.frames=Q.newFloatArray(r<<1)}getPropertyId(){return 0+this.boneIndex}setFrame(r,t,e){r<<=1,this.frames[r]=t,this.frames[r+sr.ROTATION]=e}apply(r,t,e,i,s,n,a){const o=this.frames,h=r.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)*s}return}if(e>=o[o.length-sr.ENTRIES]){let p=o[o.length+sr.PREV_ROTATION];switch(n){case j.setup:h.rotation=h.data.rotation+p*s;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*s}return}const l=fe.binarySearch(o,e,sr.ENTRIES),c=o[l+sr.PREV_ROTATION],d=o[l],u=this.getCurvePercent((l>>1)-1,1-(e-d)/(o[l+sr.PREV_TIME]-d));let f=o[l+sr.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)*s;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)*s}}};let Be=sr;Be.ENTRIES=2,Be.PREV_TIME=-2,Be.PREV_ROTATION=-1,Be.ROTATION=1;const ne=class extends De{constructor(r){super(r),this.frames=Q.newFloatArray(r*ne.ENTRIES)}getPropertyId(){return(1<<24)+this.boneIndex}setFrame(r,t,e,i){r*=ne.ENTRIES,this.frames[r]=t,this.frames[r+ne.X]=e,this.frames[r+ne.Y]=i}apply(r,t,e,i,s,n,a){const o=this.frames,h=r.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)*s,h.y+=(h.data.y-h.y)*s}return}let l=0,c=0;if(e>=o[o.length-ne.ENTRIES])l=o[o.length+ne.PREV_X],c=o[o.length+ne.PREV_Y];else{const d=fe.binarySearch(o,e,ne.ENTRIES);l=o[d+ne.PREV_X],c=o[d+ne.PREV_Y];const u=o[d],f=this.getCurvePercent(d/ne.ENTRIES-1,1-(e-u)/(o[d+ne.PREV_TIME]-u));l+=(o[d+ne.X]-l)*f,c+=(o[d+ne.Y]-c)*f}switch(n){case j.setup:h.x=h.data.x+l*s,h.y=h.data.y+c*s;break;case j.first:case j.replace:h.x+=(h.data.x+l-h.x)*s,h.y+=(h.data.y+c-h.y)*s;break;case j.add:h.x+=l*s,h.y+=c*s}}};let bs=ne;bs.ENTRIES=3,bs.PREV_TIME=-3,bs.PREV_X=-2,bs.PREV_Y=-1,bs.X=1,bs.Y=2;const St=class extends De{constructor(r){super(r),this.frames=Q.newFloatArray(r*St.ENTRIES)}getPropertyId(){return(5<<24)+this.slotIndex}setFrame(r,t,e,i,s,n){r*=St.ENTRIES,this.frames[r]=t,this.frames[r+St.R]=e,this.frames[r+St.G]=i,this.frames[r+St.B]=s,this.frames[r+St.A]=n}apply(r,t,e,i,s,n,a){const o=r.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)*s,(p.g-f.g)*s,(p.b-f.b)*s,(p.a-f.a)*s)}return}let l=0,c=0,d=0,u=0;if(e>=h[h.length-St.ENTRIES]){const f=h.length;l=h[f+St.PREV_R],c=h[f+St.PREV_G],d=h[f+St.PREV_B],u=h[f+St.PREV_A]}else{const f=fe.binarySearch(h,e,St.ENTRIES);l=h[f+St.PREV_R],c=h[f+St.PREV_G],d=h[f+St.PREV_B],u=h[f+St.PREV_A];const p=h[f],m=this.getCurvePercent(f/St.ENTRIES-1,1-(e-p)/(h[f+St.PREV_TIME]-p));l+=(h[f+St.R]-l)*m,c+=(h[f+St.G]-c)*m,d+=(h[f+St.B]-d)*m,u+=(h[f+St.A]-u)*m}if(s==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)*s,(c-f.g)*s,(d-f.b)*s,(u-f.a)*s)}}};let pi=St;pi.ENTRIES=5,pi.PREV_TIME=-5,pi.PREV_R=-4,pi.PREV_G=-3,pi.PREV_B=-2,pi.PREV_A=-1,pi.R=1,pi.G=2,pi.B=3,pi.A=4;const ot=class extends De{constructor(r){super(r),this.frames=Q.newFloatArray(r*ot.ENTRIES)}getPropertyId(){return(14<<24)+this.slotIndex}setFrame(r,t,e,i,s,n,a,o,h){r*=ot.ENTRIES,this.frames[r]=t,this.frames[r+ot.R]=e,this.frames[r+ot.G]=i,this.frames[r+ot.B]=s,this.frames[r+ot.A]=n,this.frames[r+ot.R2]=a,this.frames[r+ot.G2]=o,this.frames[r+ot.B2]=h}apply(r,t,e,i,s,n,a){const o=r.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 g=o.color,y=o.darkColor,v=o.data.color,_=o.data.darkColor;g.add((v.r-g.r)*s,(v.g-g.g)*s,(v.b-g.b)*s,(v.a-g.a)*s),y.add((_.r-y.r)*s,(_.g-y.g)*s,(_.b-y.b)*s,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 g=h.length;l=h[g+ot.PREV_R],c=h[g+ot.PREV_G],d=h[g+ot.PREV_B],u=h[g+ot.PREV_A],f=h[g+ot.PREV_R2],p=h[g+ot.PREV_G2],m=h[g+ot.PREV_B2]}else{const g=fe.binarySearch(h,e,ot.ENTRIES);l=h[g+ot.PREV_R],c=h[g+ot.PREV_G],d=h[g+ot.PREV_B],u=h[g+ot.PREV_A],f=h[g+ot.PREV_R2],p=h[g+ot.PREV_G2],m=h[g+ot.PREV_B2];const y=h[g],v=this.getCurvePercent(g/ot.ENTRIES-1,1-(e-y)/(h[g+ot.PREV_TIME]-y));l+=(h[g+ot.R]-l)*v,c+=(h[g+ot.G]-c)*v,d+=(h[g+ot.B]-d)*v,u+=(h[g+ot.A]-u)*v,f+=(h[g+ot.R2]-f)*v,p+=(h[g+ot.G2]-p)*v,m+=(h[g+ot.B2]-m)*v}if(s==1)o.color.set(l,c,d,u),o.darkColor.set(f,p,m,1);else{const g=o.color,y=o.darkColor;n==j.setup&&(g.setFromColor(o.data.color),y.setFromColor(o.data.darkColor)),g.add((l-g.r)*s,(c-g.g)*s,(d-g.b)*s,(u-g.a)*s),y.add((f-y.r)*s,(p-y.g)*s,(m-y.b)*s,0)}}};let ie=ot;ie.ENTRIES=8,ie.PREV_TIME=-8,ie.PREV_R=-7,ie.PREV_G=-6,ie.PREV_B=-5,ie.PREV_A=-4,ie.PREV_R2=-3,ie.PREV_G2=-2,ie.PREV_B2=-1,ie.R=1,ie.G=2,ie.B=3,ie.A=4,ie.R2=5,ie.G2=6,ie.B2=7;class ro{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,s,n,a,o){const h=t.slots[this.slotIndex];if(!h.bone.active)return;if(o==ve.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=fe.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 BE{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,s,n,a,o){if(s==null)return;const h=this.frames,l=this.frames.length;if(e>i)this.apply(t,e,Number.MAX_VALUE,s,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=fe.binarySearch(h,e);const d=h[c];for(;c>0&&h[c-1]==d;)c--}for(;c<l&&i>=h[c];c++)s.push(this.events[c])}}class Sc{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,s,n,a,o){const h=t.drawOrder,l=t.slots;if(o==ve.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=fe.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 De{constructor(r){super(r),this.frames=Q.newFloatArray(r*ht.ENTRIES)}getPropertyId(){return(9<<24)+this.ikConstraintIndex}setFrame(r,t,e,i,s,n,a){r*=ht.ENTRIES,this.frames[r]=t,this.frames[r+ht.MIX]=e,this.frames[r+ht.SOFTNESS]=i,this.frames[r+ht.BEND_DIRECTION]=s,this.frames[r+ht.COMPRESS]=n?1:0,this.frames[r+ht.STRETCH]=a?1:0}apply(r,t,e,i,s,n,a){const o=this.frames,h=r.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)*s,h.softness+=(h.data.softness-h.softness)*s,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)*s,h.softness=h.data.softness+(o[o.length+ht.PREV_SOFTNESS]-h.data.softness)*s,a==ve.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)*s,h.softness+=(o[o.length+ht.PREV_SOFTNESS]-h.softness)*s,a==ve.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=fe.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)*s,h.softness=h.data.softness+(d+(o[l+ht.SOFTNESS]-d)*f-h.data.softness)*s,a==ve.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)*s,h.softness+=(d+(o[l+ht.SOFTNESS]-d)*f-h.softness)*s,a==ve.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 Oe=ht;Oe.ENTRIES=6,Oe.PREV_TIME=-6,Oe.PREV_MIX=-5,Oe.PREV_SOFTNESS=-4,Oe.PREV_BEND_DIRECTION=-3,Oe.PREV_COMPRESS=-2,Oe.PREV_STRETCH=-1,Oe.MIX=1,Oe.SOFTNESS=2,Oe.BEND_DIRECTION=3,Oe.COMPRESS=4,Oe.STRETCH=5;const Ct=class extends De{constructor(r){super(r),this.frames=Q.newFloatArray(r*Ct.ENTRIES)}getPropertyId(){return(10<<24)+this.transformConstraintIndex}setFrame(r,t,e,i,s,n){r*=Ct.ENTRIES,this.frames[r]=t,this.frames[r+Ct.ROTATE]=e,this.frames[r+Ct.TRANSLATE]=i,this.frames[r+Ct.SCALE]=s,this.frames[r+Ct.SHEAR]=n}apply(r,t,e,i,s,n,a){const o=this.frames,h=r.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)*s,h.translateMix+=(f.translateMix-h.translateMix)*s,h.scaleMix+=(f.scaleMix-h.scaleMix)*s,h.shearMix+=(f.shearMix-h.shearMix)*s}return}let l=0,c=0,d=0,u=0;if(e>=o[o.length-Ct.ENTRIES]){const f=o.length;l=o[f+Ct.PREV_ROTATE],c=o[f+Ct.PREV_TRANSLATE],d=o[f+Ct.PREV_SCALE],u=o[f+Ct.PREV_SHEAR]}else{const f=fe.binarySearch(o,e,Ct.ENTRIES);l=o[f+Ct.PREV_ROTATE],c=o[f+Ct.PREV_TRANSLATE],d=o[f+Ct.PREV_SCALE],u=o[f+Ct.PREV_SHEAR];const p=o[f],m=this.getCurvePercent(f/Ct.ENTRIES-1,1-(e-p)/(o[f+Ct.PREV_TIME]-p));l+=(o[f+Ct.ROTATE]-l)*m,c+=(o[f+Ct.TRANSLATE]-c)*m,d+=(o[f+Ct.SCALE]-d)*m,u+=(o[f+Ct.SHEAR]-u)*m}if(n==j.setup){const f=h.data;h.rotateMix=f.rotateMix+(l-f.rotateMix)*s,h.translateMix=f.translateMix+(c-f.translateMix)*s,h.scaleMix=f.scaleMix+(d-f.scaleMix)*s,h.shearMix=f.shearMix+(u-f.shearMix)*s}else h.rotateMix+=(l-h.rotateMix)*s,h.translateMix+=(c-h.translateMix)*s,h.scaleMix+=(d-h.scaleMix)*s,h.shearMix+=(u-h.shearMix)*s}};let mi=Ct;mi.ENTRIES=5,mi.PREV_TIME=-5,mi.PREV_ROTATE=-4,mi.PREV_TRANSLATE=-3,mi.PREV_SCALE=-2,mi.PREV_SHEAR=-1,mi.ROTATE=1,mi.TRANSLATE=2,mi.SCALE=3,mi.SHEAR=4;const $e=class extends De{constructor(r){super(r),this.frames=Q.newFloatArray(r*$e.ENTRIES)}getPropertyId(){return(11<<24)+this.pathConstraintIndex}setFrame(r,t,e){r*=$e.ENTRIES,this.frames[r]=t,this.frames[r+$e.VALUE]=e}apply(r,t,e,i,s,n,a){const o=this.frames,h=r.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)*s}return}let l=0;if(e>=o[o.length-$e.ENTRIES])l=o[o.length+$e.PREV_VALUE];else{const c=fe.binarySearch(o,e,$e.ENTRIES);l=o[c+$e.PREV_VALUE];const d=o[c],u=this.getCurvePercent(c/$e.ENTRIES-1,1-(e-d)/(o[c+$e.PREV_TIME]-d));l+=(o[c+$e.VALUE]-l)*u}n==j.setup?h.position=h.data.position+(l-h.data.position)*s:h.position+=(l-h.position)*s}};let so=$e;so.ENTRIES=2,so.PREV_TIME=-2,so.PREV_VALUE=-1,so.VALUE=1;const ae=class extends De{constructor(r){super(r),this.frames=Q.newFloatArray(r*ae.ENTRIES)}getPropertyId(){return(13<<24)+this.pathConstraintIndex}setFrame(r,t,e,i){r*=ae.ENTRIES,this.frames[r]=t,this.frames[r+ae.ROTATE]=e,this.frames[r+ae.TRANSLATE]=i}apply(r,t,e,i,s,n,a){const o=this.frames,h=r.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)*s,h.translateMix+=(h.data.translateMix-h.translateMix)*s}return}let l=0,c=0;if(e>=o[o.length-ae.ENTRIES])l=o[o.length+ae.PREV_ROTATE],c=o[o.length+ae.PREV_TRANSLATE];else{const d=fe.binarySearch(o,e,ae.ENTRIES);l=o[d+ae.PREV_ROTATE],c=o[d+ae.PREV_TRANSLATE];const u=o[d],f=this.getCurvePercent(d/ae.ENTRIES-1,1-(e-u)/(o[d+ae.PREV_TIME]-u));l+=(o[d+ae.ROTATE]-l)*f,c+=(o[d+ae.TRANSLATE]-c)*f}n==j.setup?(h.rotateMix=h.data.rotateMix+(l-h.data.rotateMix)*s,h.translateMix=h.data.translateMix+(c-h.data.translateMix)*s):(h.rotateMix+=(l-h.rotateMix)*s,h.translateMix+=(c-h.translateMix)*s)}};let Ts=ae;Ts.ENTRIES=3,Ts.PREV_TIME=-3,Ts.PREV_ROTATE=-2,Ts.PREV_TRANSLATE=-1,Ts.ROTATE=1,Ts.TRANSLATE=2;const Pt=class{constructor(r){this.tracks=new Array,this.timeScale=1,this.unkeyedState=0,this.events=new Array,this.listeners=new Array,this.queue=new Hm(this),this.propertyIDs=new wE,this.animationsChanged=!1,this.trackEntryPool=new PE(()=>new Cc),this.data=r}update(r){r*=this.timeScale;const t=this.tracks;for(let e=0,i=t.length;e<i;e++){const s=t[e];if(s==null)continue;s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast;let n=r*s.timeScale;if(s.delay>0){if(s.delay-=n,s.delay>0)continue;n=-s.delay,s.delay=0}let a=s.next;if(a!=null){const o=s.trackLast-a.delay;if(o>=0){for(a.delay=0,a.trackTime+=s.timeScale==0?0:(o/s.timeScale+r)*a.timeScale,s.trackTime+=n,this.setCurrent(e,a,!0);a.mixingFrom!=null;)a.mixTime+=r,a=a.mixingFrom;continue}}else if(s.trackLast>=s.trackEnd&&s.mixingFrom==null){t[e]=null,this.queue.end(s),this.disposeNext(s);continue}if(s.mixingFrom!=null&&this.updateMixingFrom(s,r)){let o=s.mixingFrom;for(s.mixingFrom=null,o!=null&&(o.mixingTo=null);o!=null;)this.queue.end(o),o=o.mixingFrom}s.trackTime+=n}this.queue.drain()}updateMixingFrom(r,t){const e=r.mixingFrom;if(e==null)return!0;const i=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)),i):(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 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,r,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 g=p[m];g instanceof ro?this.applyAttachmentTimeline(g,r,u,l,!0):g.apply(r,d,u,t,c,l,ve.mixIn)}else{const m=h.timelineMode,g=h.timelinesRotation.length==0;g&&Q.setArraySize(h.timelinesRotation,f<<1,null);const y=h.timelinesRotation;for(let v=0;v<f;v++){const _=p[v],x=m[v]==Pt.SUBSEQUENT?l:j.setup;_ instanceof Be?this.applyRotateTimeline(_,r,u,c,x,y,v<<1,g):_ instanceof ro?this.applyAttachmentTimeline(_,r,u,l,!0):_.apply(r,d,u,t,c,x,ve.mixIn)}}this.queueEvents(h,u),t.length=0,h.nextAnimationLast=u,h.nextTrackLast=h.trackTime}const s=this.unkeyedState+Pt.SETUP,n=r.slots;for(let a=0,o=r.slots.length;a<o;a++){const h=n[a];if(h.attachmentState==s){const l=h.data.attachmentName;h.setAttachment(l==null?null:r.getAttachment(h.data.index,l))}}return this.unkeyedState+=2,this.queue.drain(),i}applyMixingFrom(r,t,e){const i=r.mixingFrom;i.mixingFrom!=null&&this.applyMixingFrom(i,t,e);let s=0;r.mixDuration==0?(s=1,e==j.first&&(e=j.setup)):(s=r.mixTime/r.mixDuration,s>1&&(s=1),e!=j.first&&(e=i.mixBlend));const n=s<i.eventThreshold?this.events:null,a=s<i.attachmentThreshold,o=s<i.drawOrderThreshold,h=i.animationLast,l=i.getAnimationTime(),c=i.animation.timelines.length,d=i.animation.timelines,u=i.alpha*r.interruptAlpha,f=u*(1-s);if(e==j.add)for(let p=0;p<c;p++)d[p].apply(t,h,l,n,f,e,ve.mixOut);else{const p=i.timelineMode,m=i.timelineHoldMix,g=i.timelinesRotation.length==0;g&&Q.setArraySize(i.timelinesRotation,c<<1,null);const y=i.timelinesRotation;i.totalAlpha=0;for(let v=0;v<c;v++){const _=d[v];let x=ve.mixOut,b,E=0;switch(p[v]){case Pt.SUBSEQUENT:if(!o&&_ instanceof Sc)continue;b=e,E=f;break;case Pt.FIRST:b=j.setup,E=f;break;case Pt.HOLD_SUBSEQUENT:b=e,E=u;break;case Pt.HOLD_FIRST:b=j.setup,E=u;break;default:b=j.setup;const T=m[v];E=u*Math.max(0,1-T.mixTime/T.mixDuration);break}i.totalAlpha+=E,_ instanceof Be?this.applyRotateTimeline(_,t,l,E,b,y,v<<1,g):_ instanceof ro?this.applyAttachmentTimeline(_,t,l,b,a):(o&&_ instanceof Sc&&b==j.setup&&(x=ve.mixIn),_.apply(t,h,l,n,E,b,x))}}return r.mixDuration>0&&this.queueEvents(i,l),this.events.length=0,i.nextAnimationLast=l,i.nextTrackLast=i.trackTime,s}applyAttachmentTimeline(r,t,e,i,s){const n=t.slots[r.slotIndex];if(!n.bone.active)return;const a=r.frames;if(e<a[0])(i==j.setup||i==j.first)&&this.setAttachment(t,n,n.data.attachmentName,s);else{let o;e>=a[a.length-1]?o=a.length-1:o=fe.binarySearch(a,e)-1,this.setAttachment(t,n,r.attachmentNames[o],s)}n.attachmentState<=this.unkeyedState&&(n.attachmentState=this.unkeyedState+Pt.SETUP)}setAttachment(r,t,e,i){t.setAttachment(e==null?null:r.getAttachment(t.data.index,e)),i&&(t.attachmentState=this.unkeyedState+Pt.CURRENT)}applyRotateTimeline(r,t,e,i,s,n,a,o){if(o&&(n[a]=0),i==1){r.apply(t,0,e,null,1,s,ve.mixIn);return}const h=r,l=h.frames,c=t.bones[h.boneIndex];if(!c.active)return;let d=0,u=0;if(e<l[0])switch(s){case j.setup:c.rotation=c.data.rotation;default:return;case j.first:d=c.rotation,u=c.data.rotation}else if(d=s==j.setup?c.data.rotation:c.rotation,e>=l[l.length-Be.ENTRIES])u=c.data.rotation+l[l.length+Be.PREV_ROTATION];else{const m=fe.binarySearch(l,e,Be.ENTRIES),g=l[m+Be.PREV_ROTATION],y=l[m],v=h.getCurvePercent((m>>1)-1,1-(e-y)/(l[m+Be.PREV_TIME]-y));u=l[m+Be.ROTATION]-g,u-=(16384-(16384.499999999996-u/360|0))*360,u=g+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,g=0;o?(m=0,g=p):(m=n[a],g=n[a+1]);const y=p>0;let v=m>=0;N.signum(g)!=N.signum(p)&&Math.abs(g)<=90&&(Math.abs(m)>180&&(m+=360*N.signum(m)),v=y),f=p+m-m%360,v!=y&&(f+=360*N.signum(m)),n[a]=f}n[a+1]=p,d+=f*i,c.rotation=d-(16384-(16384.499999999996-d/360|0))*360}queueEvents(r,t){const e=r.animationStart,i=r.animationEnd,s=i-e,n=r.trackLast%s,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(r,c)}let l=!1;for(r.loop?l=s==0||n>r.trackTime%s:l=t>=i&&r.animationLast<i,l&&this.queue.complete(r);o<h;o++)a[o].time<e||this.queue.event(r,a[o])}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 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(r,t,e){const i=this.expandToIndex(r);this.tracks[r]=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(r,t,e){const i=this.data.skeletonData.findAnimation(t);if(i==null)throw new Error(`Animation not found: ${t}`);return this.setAnimationWith(r,i,e)}setAnimationWith(r,t,e){if(t==null)throw new Error("animation cannot be null.");let i=!0,s=this.expandToIndex(r);s!=null&&(s.nextTrackLast==-1?(this.tracks[r]=s.mixingFrom,this.queue.interrupt(s),this.queue.end(s),this.disposeNext(s),s=s.mixingFrom,i=!1):this.disposeNext(s));const n=this.trackEntry(r,t,e,s);return this.setCurrent(r,n,i),this.queue.drain(),n}addAnimation(r,t,e,i){const s=this.data.skeletonData.findAnimation(t);if(s==null)throw new Error(`Animation not found: ${t}`);return this.addAnimationWith(r,s,e,i)}addAnimationWith(r,t,e,i){if(t==null)throw new Error("animation cannot be null.");let s=this.expandToIndex(r);if(s!=null)for(;s.next!=null;)s=s.next;const n=this.trackEntry(r,t,e,s);if(s==null)this.setCurrent(r,n,!0),this.queue.drain();else if(s.next=n,i<=0){const a=s.animationEnd-s.animationStart;a!=0?(s.loop?i+=a*(1+(s.trackTime/a|0)):i+=Math.max(a,s.trackTime),i-=this.data.getMix(s.animation,t)):i=s.trackTime}return n.delay=i,n}setEmptyAnimation(r,t){const e=this.setAnimationWith(r,Pt.emptyAnimation,!1);return e.mixDuration=t,e.trackEnd=t,e}addEmptyAnimation(r,t,e){e<=0&&(e-=t);const i=this.addAnimationWith(r,Pt.emptyAnimation,!1,e);return i.mixDuration=t,i.trackEnd=t,i}setEmptyAnimations(r){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let e=0,i=this.tracks.length;e<i;e++){const s=this.tracks[e];s!=null&&this.setEmptyAnimation(s.trackIndex,r)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(r){return r<this.tracks.length?this.tracks[r]:(Q.ensureArrayCapacity(this.tracks,r+1,null),this.tracks.length=r+1,null)}trackEntry(r,t,e,i){const s=this.trackEntryPool.obtain();return s.trackIndex=r,s.animation=t,s.loop=e,s.holdPrevious=!1,s.eventThreshold=0,s.attachmentThreshold=0,s.drawOrderThreshold=0,s.animationStart=0,s.animationEnd=t.duration,s.animationLast=-1,s.nextAnimationLast=-1,s.delay=0,s.trackTime=0,s.trackLast=-1,s.nextTrackLast=-1,s.trackEnd=Number.MAX_VALUE,s.timeScale=1,s.alpha=1,s.interruptAlpha=1,s.mixTime=0,s.mixDuration=i==null?0:this.data.getMix(i.animation,t),s.mixBlend=j.replace,s}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!=j.add)&&this.computeHold(e),e=e.mixingTo;while(e!=null)}}}computeHold(r){const t=r.mixingTo,e=r.animation.timelines,i=r.animation.timelines.length,s=Q.setArraySize(r.timelineMode,i);r.timelineHoldMix.length=0;const n=Q.setArraySize(r.timelineHoldMix,i),a=this.propertyIDs;if(t!=null&&t.holdPrevious){for(let o=0;o<i;o++)s[o]=a.add(e[o].getPropertyId())?Pt.HOLD_FIRST:Pt.HOLD_SUBSEQUENT;return}t:for(let o=0;o<i;o++){const h=e[o],l=h.getPropertyId();if(!a.add(l))s[o]=Pt.SUBSEQUENT;else if(t==null||h instanceof ro||h instanceof Sc||h instanceof BE||!t.animation.hasTimeline(l))s[o]=Pt.FIRST;else{for(let c=t.mixingTo;c!=null;c=c.mixingTo)if(!c.animation.hasTimeline(l)){if(r.mixDuration>0){s[o]=Pt.HOLD_MIX,n[o]=c;continue t}break}s[o]=Pt.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){Pt.deprecatedWarning1||(Pt.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,i){Pt.deprecatedWarning2||(Pt.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: AnimationState.addAnimationByName is deprecated, please use addAnimation from now on.")),this.addAnimation(r,t,e,i)}hasAnimation(r){return this.data.skeletonData.findAnimation(r)!==null}hasAnimationByName(r){return Pt.deprecatedWarning3||(Pt.deprecatedWarning3=!0,console.warn("Spine Deprecation Warning: AnimationState.hasAnimationByName is deprecated, please use hasAnimation from now on.")),this.hasAnimation(r)}};let Fe=Pt;Fe.emptyAnimation=new fe("<empty>",[],0),Fe.SUBSEQUENT=0,Fe.FIRST=1,Fe.HOLD_SUBSEQUENT=2,Fe.HOLD_FIRST=3,Fe.HOLD_MIX=4,Fe.SETUP=1,Fe.CURRENT=2,Fe.deprecatedWarning1=!1,Fe.deprecatedWarning2=!1,Fe.deprecatedWarning3=!1;const Fi=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 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 Fi.deprecatedWarning1||(Fi.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime}set time(r){Fi.deprecatedWarning1||(Fi.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: TrackEntry.time is deprecated, please use trackTime from now on.")),this.trackTime=r}get endTime(){return Fi.deprecatedWarning2||(Fi.deprecatedWarning2=!0,console.warn("Spine Deprecation Warning: TrackEntry.endTime is deprecated, please use trackEnd from now on.")),this.trackTime}set endTime(r){Fi.deprecatedWarning2||(Fi.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 Cc=Fi;Cc.deprecatedWarning1=!1,Cc.deprecatedWarning2=!1;const Pc=class{constructor(r){this.objects=[],this.drainDisabled=!1,this.animState=r}start(r){this.objects.push(Te.start),this.objects.push(r),this.animState.animationsChanged=!0}interrupt(r){this.objects.push(Te.interrupt),this.objects.push(r)}end(r){this.objects.push(Te.end),this.objects.push(r),this.animState.animationsChanged=!0}dispose(r){this.objects.push(Te.dispose),this.objects.push(r)}complete(r){this.objects.push(Te.complete),this.objects.push(r)}event(r,t){this.objects.push(Te.event),this.objects.push(r),this.objects.push(t)}deprecateStuff(){return Pc.deprecatedWarning1||(Pc.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 i=r[e],s=r[e+1];switch(i){case Te.start:s.listener!=null&&s.listener.start&&s.listener.start(s);for(let o=0;o<t.length;o++)t[o].start&&t[o].start(s);s.onStart&&this.deprecateStuff()&&s.onStart(s.trackIndex),this.animState.onStart&&this.deprecateStuff()&&this.deprecateStuff&&this.animState.onStart(s.trackIndex);break;case Te.interrupt:s.listener!=null&&s.listener.interrupt&&s.listener.interrupt(s);for(let o=0;o<t.length;o++)t[o].interrupt&&t[o].interrupt(s);break;case Te.end:s.listener!=null&&s.listener.end&&s.listener.end(s);for(let o=0;o<t.length;o++)t[o].end&&t[o].end(s);s.onEnd&&this.deprecateStuff()&&s.onEnd(s.trackIndex),this.animState.onEnd&&this.deprecateStuff()&&this.animState.onEnd(s.trackIndex);case Te.dispose:s.listener!=null&&s.listener.dispose&&s.listener.dispose(s);for(let o=0;o<t.length;o++)t[o].dispose&&t[o].dispose(s);this.animState.trackEntryPool.free(s);break;case Te.complete:s.listener!=null&&s.listener.complete&&s.listener.complete(s);for(let o=0;o<t.length;o++)t[o].complete&&t[o].complete(s);const n=N.toInt(s.loopsCount());s.onComplete&&this.deprecateStuff()&&s.onComplete(s.trackIndex,n),this.animState.onComplete&&this.deprecateStuff()&&this.animState.onComplete(s.trackIndex,n);break;case Te.event:const a=r[e+++2];s.listener!=null&&s.listener.event&&s.listener.event(s,a);for(let o=0;o<t.length;o++)t[o].event&&t[o].event(s,a);s.onEvent&&this.deprecateStuff()&&s.onEvent(s.trackIndex,a),this.animState.onEvent&&this.deprecateStuff()&&this.animState.onEvent(s.trackIndex,a);break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}};let Hm=Pc;Hm.deprecatedWarning1=!1;var Te=(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))(Te||{});const Rc=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 i=this.skeletonData.findAnimation(r);if(i==null)throw new Error(`Animation not found: ${r}`);const s=this.skeletonData.findAnimation(t);if(s==null)throw new Error(`Animation not found: ${t}`);this.setMixWith(i,s,e)}setMixByName(r,t,e){Rc.deprecatedWarning1||(Rc.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 i=`${r.name}.${t.name}`;this.animationToMixTime[i]=e}getMix(r,t){const e=`${r.name}.${t.name}`,i=this.animationToMixTime[e];return i===void 0?this.defaultMix:i}};let Xm=Rc;Xm.deprecatedWarning1=!1;class Wm{constructor(t,e,i){if(this.matrix=new mt,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,s,n,a,o){this.ax=t,this.ay=e,this.arotation=i,this.ascaleX=s,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 g=this.skeleton,y=i+90+o;l.a=N.cosDeg(i+a)*s*c,l.c=N.cosDeg(y)*n*c,l.b=N.sinDeg(i+a)*s*d,l.d=N.sinDeg(y)*n*d,l.tx=t*c+g.x,l.ty=e*d+g.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 ee.Normal:{const g=i+90+o,y=N.cosDeg(i+a)*s,v=N.cosDeg(g)*n,_=N.sinDeg(i+a)*s,x=N.sinDeg(g)*n;l.a=u*y+f*_,l.c=u*v+f*x,l.b=p*y+m*_,l.d=p*v+m*x;return}case ee.OnlyTranslation:{const g=i+90+o;l.a=N.cosDeg(i+a)*s,l.c=N.cosDeg(g)*n,l.b=N.sinDeg(i+a)*s,l.d=N.sinDeg(g)*n;break}case ee.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)*N.radDeg):(u=0,p=0,y=90-Math.atan2(m,f)*N.radDeg);const v=i+a-y,_=i+o-y+90,x=N.cosDeg(v)*s,b=N.cosDeg(_)*n,E=N.sinDeg(v)*s,T=N.sinDeg(_)*n;l.a=u*x-f*E,l.c=u*b-f*T,l.b=p*x+m*E,l.d=p*b+m*T;break}case ee.NoScale:case ee.NoScaleOrReflection:{const g=N.cosDeg(i),y=N.sinDeg(i);let v=(u*g+f*y)/c,_=(p*g+m*y)/d,x=Math.sqrt(v*v+_*_);x>1e-5&&(x=1/x),v*=x,_*=x,x=Math.sqrt(v*v+_*_),this.data.transformMode==ee.NoScale&&u*m-f*p<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY>0)&&(x=-x);const b=Math.PI/2+Math.atan2(_,v),E=Math.cos(b)*x,T=Math.sin(b)*x,w=N.cosDeg(a)*s,A=N.cosDeg(90+o)*n,P=N.sinDeg(a)*s,L=N.sinDeg(90+o)*n;l.a=v*w+E*P,l.c=v*A+E*L,l.b=_*w+T*P,l.d=_*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)*N.radDeg}getWorldRotationY(){return Math.atan2(this.matrix.d,this.matrix.c)*N.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)*N.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)*N.radDeg;return}const i=t.matrix,s=1/(i.a*i.d-i.b*i.c),n=e.tx-i.tx,a=e.ty-i.ty;this.ax=n*i.d*s-a*i.c*s,this.ay=a*i.a*s-n*i.b*s;const o=s*i.d,h=s*i.a,l=s*i.c,c=s*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)*N.radDeg,this.arotation=Math.atan2(f,d)*N.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(u*u+p*p),this.ashearY=0,this.arotation=90-Math.atan2(p,u)*N.radDeg}worldToLocal(t){const e=this.matrix,i=e.a,s=e.c,n=e.b,a=e.d,o=1/(i*a-s*n),h=t.x-e.tx,l=t.y-e.ty;return t.x=h*a*o-l*s*o,t.y=l*i*o-h*n*o,t}localToWorld(t){const e=this.matrix,i=t.x,s=t.y;return t.x=i*e.a+s*e.c+e.tx,t.y=i*e.b+s*e.d+e.ty,t}worldToLocalRotation(t){const e=N.sinDeg(t),i=N.cosDeg(t),s=this.matrix;return Math.atan2(s.a*e-s.b*i,s.d*i-s.c*e)*N.radDeg}localToWorldRotation(t){const e=N.sinDeg(t),i=N.cosDeg(t),s=this.matrix;return Math.atan2(i*s.b+e*s.d,i*s.a+e*s.c)*N.radDeg}rotateWorld(t){const e=this.matrix,i=e.a,s=e.c,n=e.b,a=e.d,o=N.cosDeg(t),h=N.sinDeg(t);e.a=o*i-h*n,e.c=o*s-h*a,e.b=h*i+o*n,e.d=h*s+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,s,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 ee.OnlyTranslation:p=e-t.worldX,m=i-t.worldY;break;case ee.NoRotationOrReflection:const v=Math.abs(l*u-c*d)/(l*l+d*d),_=l/t.skeleton.scaleX,x=d/t.skeleton.scaleY;c=-x*v*t.skeleton.scaleX,u=_*v*t.skeleton.scaleY,f+=Math.atan2(x,_)*N.radDeg;default:const b=e-h.tx,E=i-h.ty,T=l*u-c*d;p=(b*u-E*c)/T-t.ax,m=(E*l-b*d)/T-t.ay}f+=Math.atan2(m,p)*N.radDeg,t.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let g=t.ascaleX,y=t.ascaleY;if(s||n){switch(t.data.transformMode){case ee.NoScale:case ee.NoScaleOrReflection:p=e-t.worldX,m=i-t.worldY}const v=t.data.length*g,_=Math.sqrt(p*p+m*m);if(s&&_<v||n&&_>v&&v>1e-4){const x=(_/v-1)*o+1;g*=x,a&&(y*=x)}}t.updateWorldTransformWith(t.ax,t.ay,t.arotation+f*o,g,y,t.ashearX,t.ashearY)}apply2(t,e,i,s,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 g=0,y=0,v=0;d<0?(d=-d,g=180,v=-1):(g=0,v=1),f<0&&(f=-f,v=-v),p<0?(p=-p,y=180):y=0;const _=e.ax;let x=0,b=0,E=0,T=m.a,w=m.c,A=m.b,P=m.d;const L=Math.abs(d-f)<=1e-4;L?(x=e.ay,b=T*_+w*x+m.tx,E=A*_+P*x+m.ty):(x=0,b=T*_+m.tx,E=A*_+m.ty);const M=t.parent.matrix;T=M.a,w=M.c,A=M.b,P=M.d;const S=1/(T*P-w*A);let C=b-M.tx,R=E-M.ty;const k=(C*P-R*w)*S-l,F=(R*T-C*A)*S-c,B=Math.sqrt(k*k+F*F);let X=e.data.length*p,I,D;if(B<1e-4){this.apply1(t,i,s,!1,a,!1,h),e.updateWorldTransformWith(_,x,0,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY);return}C=i-M.tx,R=s-M.ty;let $=(C*P-R*w)*S-l,z=(R*T-C*A)*S-c,U=$*$+z*z;if(o!=0){o*=d*(p+1)/2;const lt=Math.sqrt(U),yt=lt-B-X*d+o;if(yt>0){let Rt=Math.min(1,yt/(o*2))-1;Rt=(yt-o*(1-Rt*Rt))/lt,$-=Rt*$,z-=Rt*z,U=$*$+z*z}}t:if(L){X*=d;let lt=(U-B*B-X*X)/(2*B*X);lt<-1?lt=-1:lt>1&&(lt=1,a&&(u*=(Math.sqrt(U)/(B+X)-1)*h+1)),D=Math.acos(lt)*n,T=B+X*lt,w=X*Math.sin(D),I=Math.atan2(z*T-$*w,$*T+z*w)}else{T=d*X,w=f*X;const lt=T*T,yt=w*w,Rt=Math.atan2(z,$);A=yt*B*B+lt*U-lt*yt;const Bt=-2*yt*B,pt=yt-lt;if(P=Bt*Bt-4*pt*A,P>=0){let As=Math.sqrt(P);Bt<0&&(As=-As),As=-(Bt+As)/2;const Ym=As/pt,jm=A/As,Ss=Math.abs(Ym)<Math.abs(jm)?Ym:jm;if(Ss*Ss<=U){R=Math.sqrt(U-Ss*Ss)*n,I=Rt-Math.atan2(R,Ss),D=Math.atan2(R/f,(Ss-B)/d);break t}}let It=N.PI,vt=B-T,pe=vt*vt,Ee=0,nr=0,ws=B+T,ar=ws*ws,zm=0;A=-T*B/(lt-yt),A>=-1&&A<=1&&(A=Math.acos(A),C=T*Math.cos(A)+B,R=w*Math.sin(A),P=C*C+R*R,P<pe&&(It=A,pe=P,vt=C,Ee=R),P>ar&&(nr=A,ar=P,ws=C,zm=R)),U<=(pe+ar)/2?(I=Rt-Math.atan2(Ee*n,vt),D=It*n):(I=Rt-Math.atan2(zm*n,ws),D=nr*n)}const rt=Math.atan2(x,_)*v;let ut=t.arotation;I=(I-rt)*N.radDeg+g-ut,I>180?I-=360:I<-180&&(I+=360),t.updateWorldTransformWith(l,c,ut+I*h,u,t.ascaleY,0,0),ut=e.arotation,D=((D+rt)*N.radDeg-e.ashearX)*v+y-ut,D>180?D-=360:D<-180&&(D+=360),e.updateWorldTransformWith(_,x,ut+D*h,e.ascaleX,e.ascaleY,e.ashearX,e.ashearY)}}var Es=(r=>(r[r.Length=0]="Length",r[r.Fixed=1]="Fixed",r[r.Percent=2]="Percent",r))(Es||{});const Nr=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,i=r.bones.length;e<i;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 xn))return;const t=this.rotateMix,e=this.translateMix,i=e>0,s=t>0;if(!i&&!s)return;const n=this.data,a=n.spacingMode,o=a==Es.Length,h=n.rotateMode,l=h==Fr.Tangent,c=h==Fr.ChainScale,d=this.bones.length,u=l?d:d+1,f=this.bones,p=Q.setArraySize(this.spaces,u);let m=null;const g=this.spacing;if(c||o){c&&(m=Q.setArraySize(this.lengths,d));for(let E=0,T=u-1;E<T;){const w=f[E],A=w.data.length;if(A<Nr.epsilon)c&&(m[E]=0),p[++E]=0;else{const P=A*w.matrix.a,L=A*w.matrix.b,M=Math.sqrt(P*P+L*L);c&&(m[E]=M),p[++E]=(o?A+g:g)*M/A}}}else for(let E=1;E<u;E++)p[E]=g;const y=this.computeWorldPositions(r,u,l,n.positionMode==eo.Percent,a==Es.Percent);let v=y[0],_=y[1],x=n.offsetRotation,b=!1;if(x==0)b=h==Fr.Chain;else{b=!1;const E=this.target.bone.matrix;x*=E.a*E.d-E.b*E.c>0?N.degRad:-N.degRad}for(let E=0,T=3;E<d;E++,T+=3){const w=f[E],A=w.matrix;A.tx+=(v-A.tx)*e,A.ty+=(_-A.ty)*e;const P=y[T],L=y[T+1],M=P-v,S=L-_;if(c){const C=m[E];if(C!=0){const R=(Math.sqrt(M*M+S*S)/C-1)*t+1;A.a*=R,A.b*=R}}if(v=P,_=L,s){const C=A.a,R=A.c,k=A.b,F=A.d;let B=0,X=0,I=0;if(l&&(l?B=y[T-1]:p[E+1]==0?B=y[T+2]:B=Math.atan2(S,M)),B-=Math.atan2(k,C),b){X=Math.cos(B),I=Math.sin(B);const D=w.data.length;v+=(D*(X*C-I*k)-M)*t,_+=(D*(I*C+X*k)-S)*t}else B+=x;B>N.PI?B-=N.PI2:B<-N.PI&&(B+=N.PI2),B*=t,X=Math.cos(B),I=Math.sin(B),A.a=X*C-I*k,A.c=X*R-I*F,A.b=I*C+X*k,A.d=I*R+X*F}w.appliedValid=!1}}computeWorldPositions(r,t,e,i,s){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=r.closed;let d=r.worldVerticesLength,u=d/6,f=Nr.NONE;if(!r.constantSpeed){const B=r.lengths;u-=c?1:2;const X=B[u];if(i&&(a*=X),s)for(let I=0;I<t;I++)o[I]*=X;l=Q.setArraySize(this.world,8);for(let I=0,D=0,$=0;I<t;I++,D+=3){const z=o[I];a+=z;let U=a;if(c)U%=X,U<0&&(U+=X),$=0;else if(U<0){f!=Nr.BEFORE&&(f=Nr.BEFORE,r.computeWorldVertices(n,2,4,l,0,2)),this.addBeforePosition(U,l,0,h,D);continue}else if(U>X){f!=Nr.AFTER&&(f=Nr.AFTER,r.computeWorldVertices(n,d-6,4,l,0,2)),this.addAfterPosition(U-X,l,0,h,D);continue}for(;;$++){const rt=B[$];if(!(U>rt)){if($==0)U/=rt;else{const ut=B[$-1];U=(U-ut)/(rt-ut)}break}}$!=f&&(f=$,c&&$==u?(r.computeWorldVertices(n,d-4,4,l,0,2),r.computeWorldVertices(n,0,4,l,4,2)):r.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&&z==0)}return h}c?(d+=2,l=Q.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=Q.setArraySize(this.world,d),r.computeWorldVertices(n,2,d,l,0,2));const p=Q.setArraySize(this.curves,u);let m=0,g=l[0],y=l[1],v=0,_=0,x=0,b=0,E=0,T=0,w=0,A=0,P=0,L=0,M=0,S=0,C=0,R=0;for(let B=0,X=2;B<u;B++,X+=6)v=l[X],_=l[X+1],x=l[X+2],b=l[X+3],E=l[X+4],T=l[X+5],w=(g-v*2+x)*.1875,A=(y-_*2+b)*.1875,P=((v-x)*3-g+E)*.09375,L=((_-b)*3-y+T)*.09375,M=w*2+P,S=A*2+L,C=(v-g)*.75+w+P*.16666667,R=(_-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,g=E,y=T;if(i&&(a*=m),s)for(let B=0;B<t;B++)o[B]*=m;const k=this.segments;let F=0;for(let B=0,X=0,I=0,D=0;B<t;B++,X+=3){const $=o[B];a+=$;let z=a;if(c)z%=m,z<0&&(z+=m),I=0;else if(z<0){this.addBeforePosition(z,l,0,h,X);continue}else if(z>m){this.addAfterPosition(z-m,l,d-4,h,X);continue}for(;;I++){const U=p[I];if(!(z>U)){if(I==0)z/=U;else{const rt=p[I-1];z=(z-rt)/(U-rt)}break}}if(I!=f){f=I;let U=I*6;for(g=l[U],y=l[U+1],v=l[U+2],_=l[U+3],x=l[U+4],b=l[U+5],E=l[U+6],T=l[U+7],w=(g-v*2+x)*.03,A=(y-_*2+b)*.03,P=((v-x)*3-g+E)*.006,L=((_-b)*3-y+T)*.006,M=w*2+P,S=A*2+L,C=(v-g)*.3+w+P*.16666667,R=(_-y)*.3+A+L*.16666667,F=Math.sqrt(C*C+R*R),k[0]=F,U=1;U<8;U++)C+=M,R+=S,M+=P,S+=L,F+=Math.sqrt(C*C+R*R),k[U]=F;C+=M,R+=S,F+=Math.sqrt(C*C+R*R),k[8]=F,C+=M+P,R+=S+L,F+=Math.sqrt(C*C+R*R),k[9]=F,D=0}for(z*=F;;D++){const U=k[D];if(!(z>U)){if(D==0)z/=U;else{const rt=k[D-1];z=D+(z-rt)/(U-rt)}break}}this.addCurvePosition(z*.1,g,y,v,_,x,b,E,T,h,X,e||B>0&&$==0)}return h}addBeforePosition(r,t,e,i,s){const n=t[e],a=t[e+1],o=t[e+2]-n,h=t[e+3]-a,l=Math.atan2(h,o);i[s]=n+r*Math.cos(l),i[s+1]=a+r*Math.sin(l),i[s+2]=l}addAfterPosition(r,t,e,i,s){const n=t[e+2],a=t[e+3],o=n-t[e],h=a-t[e+1],l=Math.atan2(h,o);i[s]=n+r*Math.cos(l),i[s+1]=a+r*Math.sin(l),i[s+2]=l}addCurvePosition(r,t,e,i,s,n,a,o,h,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,v=y*3,_=p*v,x=v*r,b=t*g+i*_+n*x+o*f,E=e*g+s*_+a*x+h*f;l[c]=b,l[c+1]=E,d&&(l[c+2]=Math.atan2(E-(e*m+s*y*2+a*u),b-(t*m+i*y*2+n*u)))}};let vn=Nr;vn.NONE=-1,vn.BEFORE=-2,vn.AFTER=-3,vn.epsilon=1e-5;class FE{constructor(t,e){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new RE,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,s=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?N.degRad:-N.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 v=!1;const _=y.matrix;if(t!=0){const x=_.a,b=_.c,E=_.b,T=_.d;let w=Math.atan2(l,o)-Math.atan2(E,x)+u;w>N.PI?w-=N.PI2:w<-N.PI&&(w+=N.PI2),w*=t;const A=Math.cos(w),P=Math.sin(w);_.a=A*x-P*E,_.c=A*b-P*T,_.b=P*x+A*E,_.d=P*b+A*T,v=!0}if(e!=0){const x=this.temp;n.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),_.tx+=(x.x-_.tx)*e,_.ty+=(x.y-_.ty)*e,v=!0}if(i>0){let x=Math.sqrt(_.a*_.a+_.b*_.b),b=Math.sqrt(o*o+l*l);x>1e-5&&(x=(x+(b-x+this.data.offsetScaleX)*i)/x),_.a*=x,_.b*=x,x=Math.sqrt(_.c*_.c+_.d*_.d),b=Math.sqrt(h*h+c*c),x>1e-5&&(x=(x+(b-x+this.data.offsetScaleY)*i)/x),_.c*=x,_.d*=x,v=!0}if(s>0){const x=_.c,b=_.d,E=Math.atan2(b,x);let T=Math.atan2(c,h)-Math.atan2(l,o)-(E-Math.atan2(_.b,_.a));T>N.PI?T-=N.PI2:T<-N.PI&&(T+=N.PI2),T=E+(T+f)*s;const w=Math.sqrt(x*x+b*b);_.c=Math.cos(T)*w,_.d=Math.sin(T)*w,v=!0}v&&(y.appliedValid=!1)}}applyRelativeWorld(){const t=this.rotateMix,e=this.translateMix,i=this.scaleMix,s=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?N.degRad:-N.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 v=!1;const _=y.matrix;if(t!=0){const x=_.a,b=_.c,E=_.b,T=_.d;let w=Math.atan2(l,o)+u;w>N.PI?w-=N.PI2:w<-N.PI&&(w+=N.PI2),w*=t;const A=Math.cos(w),P=Math.sin(w);_.a=A*x-P*E,_.c=A*b-P*T,_.b=P*x+A*E,_.d=P*b+A*T,v=!0}if(e!=0){const x=this.temp;n.localToWorld(x.set(this.data.offsetX,this.data.offsetY)),_.tx+=x.x*e,_.ty+=x.y*e,v=!0}if(i>0){let x=(Math.sqrt(o*o+l*l)-1+this.data.offsetScaleX)*i+1;_.a*=x,_.b*=x,x=(Math.sqrt(h*h+c*c)-1+this.data.offsetScaleY)*i+1,_.c*=x,_.d*=x,v=!0}if(s>0){let x=Math.atan2(c,h)-Math.atan2(l,o);x>N.PI?x-=N.PI2:x<-N.PI&&(x+=N.PI2);const b=_.c,E=_.d;x=Math.atan2(E,b)+(x-N.PI/2+f)*s;const T=Math.sqrt(b*b+E*E);_.c=Math.cos(x)*T,_.d=Math.sin(x)*T,v=!0}v&&(y.appliedValid=!1)}}applyAbsoluteLocal(){const t=this.rotateMix,e=this.translateMix,i=this.scaleMix,s=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 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;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(s>0){let g=n.ashearY-m+this.data.offsetShearY;g-=(16384-(16384.499999999996-g/360|0))*360,l.shearY+=g*s}l.updateWorldTransformWith(d,u,c,f,p,l.ashearX,m)}}applyRelativeLocal(){const t=this.rotateMix,e=this.translateMix,i=this.scaleMix,s=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;s>0&&(m+=(n.ashearY+this.data.offsetShearY)*s),l.updateWorldTransformWith(d,u,c,f,p,l.ashearX,m)}}}const bn=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 i;if(e.parent==null)i=new Wm(e,this,null);else{const s=this.bones[e.parent.index];i=new Wm(e,this,s),s.children.push(i)}this.bones.push(i)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<r.slots.length;t++){const e=r.slots[t],i=this.bones[e.boneData.index],s=new Vm(e,i);this.slots.push(s),this.drawOrder.push(s)}this.ikConstraints=new Array;for(let t=0;t<r.ikConstraints.length;t++){const e=r.ikConstraints[t];this.ikConstraints.push(new OE(e,this))}this.transformConstraints=new Array;for(let t=0;t<r.transformConstraints.length;t++){const e=r.transformConstraints[t];this.transformConstraints.push(new FE(e,this))}this.pathConstraints=new Array;for(let t=0;t<r.pathConstraints.length;t++){const e=r.pathConstraints[t];this.pathConstraints.push(new vn(e,this))}this.color=new be(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,i=this.transformConstraints,s=this.pathConstraints,n=e.length,a=i.length,o=s.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=s[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&&Q.contains(this.skin.constraints,r.data,!0)),!r.active)return;const t=r.target;this.sortBone(t);const e=r.bones,i=e[0];if(this.sortBone(i),e.length>1){const s=e[e.length-1];this._updateCache.indexOf(s)>-1||this.updateCacheReset.push(s)}this._updateCache.push(r),this.sortReset(i.children),e[e.length-1].sorted=!0}sortPathConstraint(r){if(r.active=r.target.bone.isActive()&&(!r.data.skinRequired||this.skin!=null&&Q.contains(this.skin.constraints,r.data,!0)),!r.active)return;const t=r.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 s=t.getAttachment();s instanceof xn&&this.sortPathConstraintAttachmentWith(s,i);const n=r.bones,a=n.length;for(let o=0;o<a;o++)this.sortBone(n[o]);this._updateCache.push(r);for(let o=0;o<a;o++)this.sortReset(n[o].children);for(let o=0;o<a;o++)n[o].sorted=!0}sortTransformConstraint(r){if(r.active=r.target.isActive()&&(!r.data.skinRequired||this.skin!=null&&Q.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 i=0;i<e;i++){const s=t[i];this.sortBone(s.parent),this._updateCache.indexOf(s)>-1||this.updateCacheReset.push(s)}else for(let i=0;i<e;i++)this.sortBone(t[i]);this._updateCache.push(r);for(let i=0;i<e;i++)this.sortReset(t[i].children);for(let i=0;i<e;i++)t[i].sorted=!0}sortPathConstraintAttachment(r,t,e){const i=r.attachments[t];if(i)for(const s in i)this.sortPathConstraintAttachmentWith(i[s],e)}sortPathConstraintAttachmentWith(r,t){if(!(r instanceof xn))return;const e=r.bones;if(e==null)this.sortBone(t);else{const i=this.bones;let s=0;for(;s<e.length;){const n=e[s++];for(let a=s+n;s<a;s++){const o=e[s];this.sortBone(i[o])}}}}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 i=r[t];i.active&&(i.sorted&&this.sortReset(i.children),i.sorted=!1)}}updateWorldTransform(){const r=this.updateCacheReset;for(let e=0,i=r.length;e<i;e++){const s=r[e];s.ax=s.x,s.ay=s.y,s.arotation=s.rotation,s.ascaleX=s.scaleX,s.ascaleY=s.scaleY,s.ashearX=s.shearX,s.ashearY=s.shearY,s.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 r=this.bones;for(let s=0,n=r.length;s<n;s++)r[s].setToSetupPose();const t=this.ikConstraints;for(let s=0,n=t.length;s<n;s++){const a=t[s];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 s=0,n=e.length;s<n;s++){const a=e[s],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 s=0,n=i.length;s<n;s++){const a=i[s],o=a.data;a.position=o.position,a.spacing=o.spacing,a.rotateMix=o.rotateMix,a.translateMix=o.translateMix}}setSlotsToSetupPose(){const r=this.slots;Q.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,i=t.length;e<i;e++){const s=t[e];if(s.data.name==r)return s}return null}findBoneIndex(r){if(r==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==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,i=t.length;e<i;e++){const s=t[e];if(s.data.name==r)return s}return null}findSlotIndex(r){if(r==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==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,i=t.length;e<i;e++){const s=t[e],n=s.data.attachmentName;if(n!=null){const a=r.getAttachment(e,n);a!=null&&s.setAttachment(a)}}}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 i=0,s=e.length;i<s;i++){const n=e[i];if(n.data.name==r){let a=null;if(t!=null&&(a=this.getAttachment(i,t),a==null))throw new Error(`Attachment not found: ${t}, for slot: ${r}`);n.setAttachment(a);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,i=t.length;e<i;e++){const s=t[e];if(s.data.name==r)return s}return null}findTransformConstraint(r){if(r==null)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let e=0,i=t.length;e<i;e++){const s=t[e];if(s.data.name==r)return s}return null}findPathConstraint(r){if(r==null)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let e=0,i=t.length;e<i;e++){const s=t[e];if(s.data.name==r)return s}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 i=this.drawOrder;let s=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 io){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 g=u[p],y=u[p+1];s=Math.min(s,g),n=Math.min(n,y),a=Math.max(a,g),o=Math.max(o,y)}}r.set(s,n),t.set(a-s,o-n)}update(r){this.time+=r}get flipX(){return this.scaleX==-1}set flipX(r){bn.deprecatedWarning1||(bn.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){bn.deprecatedWarning1||(bn.deprecatedWarning1=!0,console.warn("Spine Deprecation Warning: `Skeleton.flipX/flipY` was deprecated, please use scaleX/scaleY")),this.scaleY=r?1:-1}};let $m=bn;$m.deprecatedWarning1=!1,ee.Normal,ee.OnlyTranslation,ee.NoRotationOrReflection,ee.NoScale,ee.NoScaleOrReflection,eo.Fixed,eo.Percent,Es.Length,Es.Fixed,Es.Percent,Fr.Tangent,Fr.Chain,Fr.ChainScale,K.NORMAL,K.ADD,K.MULTIPLY,K.SCREEN;class LE extends wc{createSkeleton(t){this.skeleton=new $m(t),this.skeleton.updateWorldTransform(),this.stateData=new Xm(t),this.state=new Fe(this.stateData)}}class NE extends LE{constructor(t,e){const{followPointList:i,visible:s=!1}=e||{};super(t.spineData),this._followDots=[],this._isStart=!1,this.visible=s,this.autoUpdate=!1,i!=null&&i.length&&(i==null||i.forEach(n=>{n.follow.alpha=0,this._followDots.push({point:this.skeleton.findBone(n.boneName),follow:n.follow,onUpdate:n.onUpdate,angleFollow:n.angleFollow||!1,scaleFollow:n.scaleFollow||!0})})),this._loopFn=this._loop.bind(this),Wt.system.add(this._loopFn)}setAnimation(t="Animation",e=!1,i=!0){return new Promise(s=>{this.visible=!0,this.state.setAnimation(0,t,e).listener={complete:()=>{i?requestAnimationFrame(()=>{s()}):s()}}})}addAnimation(t="Animation",e=!1,i=0){return new Promise(s=>{this.state.addAnimation(0,t,e,i).listener={complete:()=>{requestAnimationFrame(()=>{s()})}}})}setSkin(t){this.skeleton.setSkinByName(t)}destroyAll(){Wt.system.remove(this._loopFn),this.destroy(),this.removeFromParent()}_loop(){this.update(Wt.system.deltaMS/1e3),this._updateFollowPoint()}_updateFollowPoint(){this._followDots.length!==0&&(this._followDots.forEach(t=>{const{worldX:e,worldY:i}=t.point,s=t.point.getWorldRotationX()*(Math.PI/180),n=t.point.getWorldScaleX(),a=t.point.getWorldScaleY();t.onUpdate?t.onUpdate({x:e,y:i,rotate:s,scaleX:n,scaleY:a}):(t.angleFollow&&(t.follow.rotation=s),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=>{gn.to(t.follow,{alpha:1,duration:.25,delay:.15})})))}}const kE=Object.freeze(Object.defineProperty({__proto__:null,Base:{LibBitText:Zb,LibContainer:dE,LibParticleMove:EE,LibRectBgColor:Ql,LibSpine:NE,LibText:Lm}},Symbol.toStringTag,{value:"Module"}));window.LibPixiJs=kE});
|